wlan: At very low RSSI increase throttle down of TX traffic

Currently as part of SAP TX flow control when the bad peer goes to
very low RSSI around -90dbm it results in high PER rate and leads to
piling up of high number of packets in the bad peer station's BTQM
queue. This impacts the throughput of the good link.

In this change increase throttle down of bad peer TX traffic when the
bad peer to good peer RA rate ratio crosses the threshold and the bad
peer queue length crosses the threshold.

Change-Id: I41a3866aa4a6d5302a825df1f1e1b943c4074841
CRs-Fixed: 2004575
diff --git a/CORE/TL/src/wlan_qct_tl.c b/CORE/TL/src/wlan_qct_tl.c
index 014927b..eebc2d3 100755
--- a/CORE/TL/src/wlan_qct_tl.c
+++ b/CORE/TL/src/wlan_qct_tl.c
@@ -247,6 +247,7 @@
 #define WLANTL_PER_THRESHOLD 5
 #define WLANTL_QUEUE_THRESHOLD 60
 #define WLANTL_GOOD_STA_WEIGHT 1
+#define WLANTL_WEIGHT_THRESHOLD 50
 
 /*----------------------------------------------------------------------------
  * Type Declarations
@@ -6056,14 +6057,27 @@
    for (i = 0; i < num_stas; i++) {
       pTLCb->atlSTAClients[staid[i]]->weight =
                              max_rate/pTLCb->atlSTAClients[staid[i]]->trate;
-      if (pTLCb->atlSTAClients[staid[i]]->weight >= WLANTL_RATE_RATIO_THRESHOLD
-          && !pTLCb->atlSTAClients[staid[i]]->set_flag) {
+      if (pTLCb->atlSTAClients[staid[i]]->weight >=
+          WLANTL_RATE_RATIO_THRESHOLD) {
+         if (!pTLCb->atlSTAClients[staid[i]]->set_flag) {
             vos_set_hdd_bad_sta(staid[i]);
             pTLCb->atlSTAClients[staid[i]]->set_flag = true;
+         }
+         /**
+          * If station's link becomes very bad rssi below -90dbm then because
+          * of high PER rate high number of packets are stuck in BTQM which is
+          * affecting the good peers throughput. So throttle further the bad
+          * link traffic.
+          */
+         if ((pTLCb->atlSTAClients[staid[i]]->weight >
+              WLANTL_WEIGHT_THRESHOLD) &&
+             (pTLCb->atlSTAClients[staid[i]]->queue >
+              WLANTL_QUEUE_THRESHOLD))
+            pTLCb->atlSTAClients[staid[i]]->weight *= 2;
       }
       if (pTLCb->atlSTAClients[staid[i]]->weight <
           WLANTL_RATE_RATIO_THRESHOLD) {
-         if (pTLCb->atlSTAClients[staid[i]]->per > WLANTL_PER_THRESHOLD &&
+         if (pTLCb->atlSTAClients[staid[i]]->per >= WLANTL_PER_THRESHOLD &&
              pTLCb->atlSTAClients[staid[i]]->queue > WLANTL_QUEUE_THRESHOLD) {
              vos_set_hdd_bad_sta(staid[i]);
              pTLCb->atlSTAClients[staid[i]]->set_flag = true;