wlan: Dynamically change tcp delay ack using hdd stats

We start a periodic timer in which we monitor number of rx
packets received. Using this count we decide bus width/rx_level.
We send this throughput level to cnss-daemon so that daemon can
dynamically set tcp delay ack value based on current receive
traffic situation to improve tcp performace. Added ini item to
enable this feature.

CRs-Fixed: 763246
Change-Id: I61f8a55ec9215a8fe86433d9f34a8ee7082a04bb
diff --git a/CORE/HDD/src/wlan_hdd_tdls.c b/CORE/HDD/src/wlan_hdd_tdls.c
index 0b0f418..e548cf9 100644
--- a/CORE/HDD/src/wlan_hdd_tdls.c
+++ b/CORE/HDD/src/wlan_hdd_tdls.c
@@ -802,6 +802,7 @@
     hdd_context_t *pHddCtx;
     u16 connectedTdlsPeers;
     hddTdlsPeer_t *currPeer;
+    tANI_U16 numCurrTdlsPeers = 0;
 
     ENTER();
     if ((NULL == data) || (indType < 0))
@@ -887,6 +888,9 @@
                }
             }
         }
+        /* stop TCP delack timer if BtCoex is enable  */
+        set_bit(WLAN_BTCOEX_MODE, &pHddCtx->mode);
+        hdd_manage_delack_timer(pHddCtx);
    }
    /* BtCoex notification type enabled, Enable TDLS */
    else if (indType == SIR_COEX_IND_TYPE_TDLS_ENABLE)
@@ -903,7 +907,15 @@
             pHddCtx->is_tdls_btc_enabled = TRUE;
             wlan_hdd_tdls_set_mode(pHddCtx, pHddCtx->tdls_mode_last, FALSE);
         }
-   }
+
+        clear_bit(WLAN_BTCOEX_MODE, &pHddCtx->mode);
+        numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter);
+        if(numCurrTdlsPeers == 0) {
+             /* start delack timer if BtCoex is disable and tdls is not present */
+             hdd_manage_delack_timer(pHddCtx);
+        }
+  }
+
    EXIT();
    return;
 }