[9610] wlbt: traffic monitor - update hysteresis
authorDebabrata Purohit <d.purohit@samsung.com>
Mon, 18 Jun 2018 16:23:07 +0000 (17:23 +0100)
committerIvan Priest <i.priest@samsung.com>
Wed, 11 Jul 2018 17:43:18 +0000 (18:43 +0100)
The transitions from high throughput to mid
throughput and vice versa are too frequent.

Add more hysteresis to transition from High to mid.

Change-Id: I8662eaf21d52073acb34ec229933e649be73bcf6
SCSC-Bug-Id: SSB-41039
Signed-off-by: Debabrata Purohit <d.purohit@samsung.com>
drivers/net/wireless/scsc/traffic_monitor.c

index 7476ea9ff2e18ba1f1b9b798811a2ebce4a37d99..4648c453d9fbc42a2c87e1af6ff846330a8802ee 100644 (file)
@@ -43,13 +43,15 @@ static inline void traffic_mon_invoke_client_callback(struct slsi_dev *sdev, u32
                                                traffic_client->traffic_mon_client_cb(traffic_client->client_ctx, TRAFFIC_MON_CLIENT_STATE_HIGH, tput_tx, tput_rx);
                                        }
                        } else if ((traffic_client->mid_tput) && ((tput_tx + tput_rx) > traffic_client->mid_tput)) {
-                               if (traffic_client->state != TRAFFIC_MON_CLIENT_STATE_MID &&
-                                  (traffic_client->hysteresis++ > SLSI_TRAFFIC_MON_HYSTERESIS_HIGH)) {
-                                       SLSI_DBG1(sdev, SLSI_HIP, "notify traffic event (tput:%u, state:%u --> MID)\n", (tput_tx + tput_rx), traffic_client->state);
-                                       traffic_client->hysteresis = 0;
-                                       traffic_client->state = TRAFFIC_MON_CLIENT_STATE_MID;
-                                       if (traffic_client->traffic_mon_client_cb)
-                                               traffic_client->traffic_mon_client_cb(traffic_client->client_ctx, TRAFFIC_MON_CLIENT_STATE_MID, tput_tx, tput_rx);
+                               if (traffic_client->state != TRAFFIC_MON_CLIENT_STATE_MID) {
+                                       if ((traffic_client->state == TRAFFIC_MON_CLIENT_STATE_LOW && (traffic_client->hysteresis++ > SLSI_TRAFFIC_MON_HYSTERESIS_HIGH)) ||
+                                               (traffic_client->state == TRAFFIC_MON_CLIENT_STATE_HIGH && (traffic_client->hysteresis++ > SLSI_TRAFFIC_MON_HYSTERESIS_LOW))) {
+                                               SLSI_DBG1(sdev, SLSI_HIP, "notify traffic event (tput:%u, state:%u --> MID)\n", (tput_tx + tput_rx), traffic_client->state);
+                                               traffic_client->hysteresis = 0;
+                                               traffic_client->state = TRAFFIC_MON_CLIENT_STATE_MID;
+                                               if (traffic_client->traffic_mon_client_cb)
+                                                       traffic_client->traffic_mon_client_cb(traffic_client->client_ctx, TRAFFIC_MON_CLIENT_STATE_MID, tput_tx, tput_rx);
+                                       }
                                }
                        } else if (traffic_client->state != TRAFFIC_MON_CLIENT_STATE_LOW &&
                                        (traffic_client->hysteresis++ > SLSI_TRAFFIC_MON_HYSTERESIS_LOW)) {