TDLS: TDLS Scan Coexistence Implementation

This commit introduces TDLS Link and Scan
Coexistence functionality.
Scan coexistence on the TDLS Link is supported
provided a single TDLS session is present, DUT
is not Buffer STA capable and the TDLS peer is
Buffer Sta capable.
This capability shall be enabled based on the
gEnableTDLSScanCoexistence parameter.

CRs-Fixed: 668619
Change-Id: I6dad95ce4f453d774b4f6bea99cccca46b95aa5f
diff --git a/CORE/HDD/src/wlan_hdd_cfg.c b/CORE/HDD/src/wlan_hdd_cfg.c
index dec97de..c43697f 100644
--- a/CORE/HDD/src/wlan_hdd_cfg.c
+++ b/CORE/HDD/src/wlan_hdd_cfg.c
@@ -2531,6 +2531,13 @@
               CFG_TDLS_WMM_MODE_ENABLE_DEFAULT,
               CFG_TDLS_WMM_MODE_ENABLE_MIN,
               CFG_TDLS_WMM_MODE_ENABLE_MAX ),
+
+REG_VARIABLE( CFG_TDLS_SCAN_COEX_SUPPORT_ENABLE, WLAN_PARAM_Integer,
+              hdd_config_t, fEnableTDLSScanCoexSupport,
+              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+              CFG_TDLS_SCAN_COEX_SUPPORT_ENABLE_DEFAULT,
+              CFG_TDLS_SCAN_COEX_SUPPORT_ENABLE_MIN,
+              CFG_TDLS_SCAN_COEX_SUPPORT_ENABLE_MAX ),
 #endif
 
 #ifdef WLAN_SOFTAP_VSTA_FEATURE
@@ -4591,6 +4598,16 @@
       fStatus = FALSE;
       hddLog(LOGE, "Could not pass on WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK to CCM");
    }
+
+   if (TRUE == pConfig->fEnableTDLSScanCoexSupport)
+   {
+      /* TDLSScanCoexistance feature is supported when the DUT acts as only
+       * the Sleep STA and hence explicitly disable the BufferSta capability
+       * on the DUT. DUT's Buffer STA capability is explicitly disabled to
+       * ensure that the TDLS peer shall not go to TDLS power save mode.
+       */
+      pConfig->fEnableTDLSBufferSta = FALSE;
+   }
    if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_TDLS_BUF_STA_ENABLED,
                     pConfig->fEnableTDLSBufferSta, NULL,
                     eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)