wlan: Handle slow RA rate ramp down when link goes bad rapidly

Currently when link quality deteriorate rapidly then station's RA
rate does get ramp down quickly resulting in pile up of stations in
its BTQM and also high PER.

In this change indicate to HDD as bad station when it's PER and BTQM
queue length reaches threshold.

Change-Id: I3a2c281fe19d150ca3843019cdb9f26498c6b9ce
CRs-Fixed: 1106748
diff --git a/CORE/TL/src/wlan_qct_tl.c b/CORE/TL/src/wlan_qct_tl.c
index 21a6232..0933b44 100644
--- a/CORE/TL/src/wlan_qct_tl.c
+++ b/CORE/TL/src/wlan_qct_tl.c
@@ -244,6 +244,8 @@
 #define SEND_ARP_ON_WQ5    2
 
 #define WLANTL_RATE_RATIO_THRESHOLD 2
+#define WLANTL_PER_THRESHOLD 5
+#define WLANTL_QUEUE_THRESHOLD 60
 #define WLANTL_GOOD_STA_WEIGHT 1
 
 /*----------------------------------------------------------------------------
@@ -6061,7 +6063,12 @@
       }
       if (pTLCb->atlSTAClients[staid[i]]->weight <
           WLANTL_RATE_RATIO_THRESHOLD) {
-         if (pTLCb->atlSTAClients[staid[i]]->set_flag) {
+         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;
+         }
+         else if (pTLCb->atlSTAClients[staid[i]]->set_flag) {
             vos_reset_hdd_bad_sta(staid[i]);
             pTLCb->atlSTAClients[staid[i]]->set_flag = false;
          }