Wlan: Add ini params for scan dwell time during BTC SCO call

Add gActiveMaxChannelTimeBtcSCO and gActiveMinChannelTimeBtcSCO
params in INI file to control the scan dwell time during BTC SCO
call.

These params will be used when scan is compromised due to SCO call.

Change-Id: Iaf203489ae7984008779e4d32aa2d0ea9a217513
CRs-Fixed: 1073668
diff --git a/CORE/SME/inc/btcApi.h b/CORE/SME/inc/btcApi.h
index bab11f4..c6da770 100644
--- a/CORE/SME/inc/btcApi.h
+++ b/CORE/SME/inc/btcApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -366,7 +366,10 @@
    v_BOOL_t      fA2DPTrafStop;/*flag to check A2DP_STOP event has come before MODE_CHANGED*/
    v_U16_t       btcScoHandles[BT_MAX_SCO_SUPPORT];  /* Handles for SCO, if any*/
    v_BOOL_t      fA2DPUp;        /*remember whether A2DP is in session*/
-   v_BOOL_t      btcScanCompromise;
+   /* Scan compromise due to eSCO */
+   bool          btc_scan_compromise_esco;
+   /* Scan compromise due to SCO */
+   bool          btc_scan_compromise_sco;
    v_U8_t        btcBssfordisableaggr[VOS_MAC_ADDRESS_LEN];
    vos_timer_t   enableUapsdTimer;
 } tSmeBtcInfo, *tpSmeBtcInfo;
diff --git a/CORE/SME/inc/csrApi.h b/CORE/SME/inc/csrApi.h
index e0ce245..ef7f97d 100644
--- a/CORE/SME/inc/csrApi.h
+++ b/CORE/SME/inc/csrApi.h
@@ -291,8 +291,8 @@
     tCsrChannelInfo ChannelInfo;
     tANI_U32 minChnTime;    //in units of milliseconds
     tANI_U32 maxChnTime;    //in units of milliseconds
-    tANI_U32 minChnTimeBtc;    //in units of milliseconds
-    tANI_U32 maxChnTimeBtc;    //in units of milliseconds
+    tANI_U32 min_chntime_btc_esco;    //in units of milliseconds
+    tANI_U32 max_chntime_btc_esco;    //in units of milliseconds
     tANI_U32 restTime;      //in units of milliseconds  //ignored when not connected
     tANI_U32 uIEFieldLen;
     tANI_U8 *pIEField;
@@ -309,8 +309,8 @@
     tANI_U32 scanInterval;  //in units of milliseconds
     tANI_U32 minChnTime;    //in units of milliseconds
     tANI_U32 maxChnTime;    //in units of milliseconds
-    tANI_U32 minChnTimeBtc;    //in units of milliseconds
-    tANI_U32 maxChnTimeBtc;    //in units of milliseconds
+    tANI_U32 min_chntime_btc_esco;    //in units of milliseconds
+    tANI_U32 max_chntime_btc_esco;    //in units of milliseconds
     tANI_U32 restTime;      //in units of milliseconds  //ignored when not connected
     tANI_U32 throughputImpact;      //specify whether BG scan cares about impacting throughput  //ignored when not connected
     tCsrBssid bssid;    //how to use it?? Apple
@@ -1097,8 +1097,10 @@
 
     tANI_U32  nInitialDwellTime;      //in units of milliseconds
 
-    tANI_U32  nActiveMinChnTimeBtc;     //in units of milliseconds
-    tANI_U32  nActiveMaxChnTimeBtc;     //in units of milliseconds
+    uint32_t  min_chntime_btc_esco;     //in units of milliseconds
+    uint32_t  max_chntime_btc_esco;     //in units of milliseconds
+    uint32_t  min_chntime_btc_sco;
+    uint32_t  max_chntime_btc_sco;
     tANI_U32  disableAggWithBtc;
 #ifdef WLAN_AP_STA_CONCURRENCY
     tANI_U32  nPassiveMinChnTimeConc;    //in units of milliseconds
diff --git a/CORE/SME/inc/csrInternal.h b/CORE/SME/inc/csrInternal.h
index 5fab7b8..318c255 100644
--- a/CORE/SME/inc/csrInternal.h
+++ b/CORE/SME/inc/csrInternal.h
@@ -587,8 +587,10 @@
 
     tANI_U32  nInitialDwellTime;     //in units of milliseconds
 
-    tANI_U32  nActiveMinChnTimeBtc;     //in units of milliseconds
-    tANI_U32  nActiveMaxChnTimeBtc;     //in units of milliseconds
+    uint32_t  min_chntime_btc_esco;     //in units of milliseconds
+    uint32_t  max_chntime_btc_esco;     //in units of milliseconds
+    uint32_t  min_chntime_btc_sco;
+    uint32_t  max_chntime_btc_sco;
     tANI_U8   disableAggWithBtc;
 #ifdef WLAN_AP_STA_CONCURRENCY
     tANI_U32  nPassiveMinChnTimeConc;    //in units of milliseconds
diff --git a/CORE/SME/src/btc/btcApi.c b/CORE/SME/src/btc/btcApi.c
index 4e1e9ea..cc52917 100644
--- a/CORE/SME/src/btc/btcApi.c
+++ b/CORE/SME/src/btc/btcApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -96,7 +96,8 @@
    pMac->btc.btcReady = VOS_FALSE;
    pMac->btc.btcEventState = 0;
    pMac->btc.btcHBActive = VOS_TRUE;
-   pMac->btc.btcScanCompromise = VOS_FALSE;
+   pMac->btc.btc_scan_compromise_esco = false;
+   pMac->btc.btc_scan_compromise_sco = false;
 
    for (i = 0; i < MWS_COEX_MAX_VICTIM_TABLE; i++)
    {
@@ -1988,13 +1989,21 @@
      }
      else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_SCAN_COMPROMISED)
      {
-         pMac->btc.btcScanCompromise = VOS_TRUE;
-         smsLog(pMac, LOGW, "Coex indication in %s(), type - SIR_COEX_IND_TYPE_SCAN_COMPROMISED",
-             __func__);
+         smsLog(pMac, LOGW,
+            FL("Coex indication SIR_COEX_IND_TYPE_SCAN_COMPROMISED data[0] %d"),
+            pSmeCoexInd->coexIndData[0]);
+
+         /* coexIndData[0] will be 1 for SCO call and 0 for eSCO call */
+         if (pSmeCoexInd->coexIndData[0])
+            pMac->btc.btc_scan_compromise_sco = true;
+         else
+            pMac->btc.btc_scan_compromise_esco = true;
+
      }
      else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_SCAN_NOT_COMPROMISED)
      {
-         pMac->btc.btcScanCompromise = VOS_FALSE;
+         pMac->btc.btc_scan_compromise_esco = false;
+         pMac->btc.btc_scan_compromise_sco = false;
          smsLog(pMac, LOGW, "Coex indication in %s(), type - SIR_COEX_IND_TYPE_SCAN_NOT_COMPROMISED",
              __func__);
      }
diff --git a/CORE/SME/src/csr/csrApiRoam.c b/CORE/SME/src/csr/csrApiRoam.c
index 46bb235..6b36c8a 100644
--- a/CORE/SME/src/csr/csrApiRoam.c
+++ b/CORE/SME/src/csr/csrApiRoam.c
@@ -1230,8 +1230,14 @@
     pMac->roam.configParam.nActiveMinChnTime = CSR_ACTIVE_MIN_CHANNEL_TIME;
     pMac->roam.configParam.nPassiveMaxChnTime = CSR_PASSIVE_MAX_CHANNEL_TIME;
     pMac->roam.configParam.nPassiveMinChnTime = CSR_PASSIVE_MIN_CHANNEL_TIME;
-    pMac->roam.configParam.nActiveMaxChnTimeBtc = CSR_ACTIVE_MAX_CHANNEL_TIME_BTC;
-    pMac->roam.configParam.nActiveMinChnTimeBtc = CSR_ACTIVE_MIN_CHANNEL_TIME_BTC;
+    pMac->roam.configParam.max_chntime_btc_esco =
+          CSR_ACTIVE_MAX_CHANNEL_TIME_ESCO_BTC;
+    pMac->roam.configParam.min_chntime_btc_esco =
+          CSR_ACTIVE_MIN_CHANNEL_TIME_ESCO_BTC;
+    pMac->roam.configParam.min_chntime_btc_sco =
+          CSR_ACTIVE_MIN_CHANNEL_TIME_SCO_BTC;
+    pMac->roam.configParam.max_chntime_btc_sco=
+          CSR_ACTIVE_MAX_CHANNEL_TIME_SCO_BTC;
     pMac->roam.configParam.disableAggWithBtc = eANI_BOOLEAN_TRUE;
 #ifdef WLAN_AP_STA_CONCURRENCY
     pMac->roam.configParam.nActiveMaxChnTimeConc = CSR_ACTIVE_MAX_CHANNEL_TIME_CONC;
@@ -1799,14 +1805,22 @@
             cfgSetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
                       pParam->nOBSSScanWidthTriggerInterval);
         }
-        if (pParam->nActiveMaxChnTimeBtc)
+        if (pParam->max_chntime_btc_esco)
         {
-            pMac->roam.configParam.nActiveMaxChnTimeBtc = pParam->nActiveMaxChnTimeBtc;
+            pMac->roam.configParam.max_chntime_btc_esco =
+                             pParam->max_chntime_btc_esco;
         }
-        if (pParam->nActiveMinChnTimeBtc)
+        if (pParam->min_chntime_btc_esco)
         {
-            pMac->roam.configParam.nActiveMinChnTimeBtc = pParam->nActiveMinChnTimeBtc;
+            pMac->roam.configParam.min_chntime_btc_esco =
+                             pParam->min_chntime_btc_esco;
         }
+        if (pParam->min_chntime_btc_sco)
+            pMac->roam.configParam.min_chntime_btc_sco =
+                   pParam->min_chntime_btc_sco;
+        if (pParam->max_chntime_btc_sco)
+            pMac->roam.configParam.max_chntime_btc_sco =
+                   pParam->max_chntime_btc_sco;
 #ifdef WLAN_AP_STA_CONCURRENCY
         if (pParam->nActiveMaxChnTimeConc)
         {
@@ -2083,8 +2097,14 @@
         pParam->nActiveMinChnTime = pMac->roam.configParam.nActiveMinChnTime;
         pParam->nPassiveMaxChnTime = pMac->roam.configParam.nPassiveMaxChnTime;
         pParam->nPassiveMinChnTime = pMac->roam.configParam.nPassiveMinChnTime;
-        pParam->nActiveMaxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc;
-        pParam->nActiveMinChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc;
+        pParam->max_chntime_btc_esco =
+                 pMac->roam.configParam.max_chntime_btc_esco;
+        pParam->min_chntime_btc_esco =
+                 pMac->roam.configParam.min_chntime_btc_esco;
+        pParam->min_chntime_btc_sco =
+                 pMac->roam.configParam.min_chntime_btc_sco;
+        pParam->max_chntime_btc_sco =
+                 pMac->roam.configParam.max_chntime_btc_sco;
         pParam->disableAggWithBtc = pMac->roam.configParam.disableAggWithBtc;
 #ifdef WLAN_AP_STA_CONCURRENCY
         pParam->nActiveMaxChnTimeConc = pMac->roam.configParam.nActiveMaxChnTimeConc;
diff --git a/CORE/SME/src/csr/csrApiScan.c b/CORE/SME/src/csr/csrApiScan.c
index 843113e..7ae5f94 100644
--- a/CORE/SME/src/csr/csrApiScan.c
+++ b/CORE/SME/src/csr/csrApiScan.c
@@ -310,8 +310,10 @@
             pScanRequest->maxChnTime = pMac->roam.configParam.nPassiveMaxChnTimeConc;
             pScanRequest->minChnTime = pMac->roam.configParam.nPassiveMinChnTimeConc;
         }
-        pScanRequest->maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc;
-        pScanRequest->minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc;
+        pScanRequest->max_chntime_btc_esco =
+            pMac->roam.configParam.max_chntime_btc_esco;
+        pScanRequest->min_chntime_btc_esco =
+            pMac->roam.configParam.min_chntime_btc_esco;
 
         pScanRequest->restTime = pMac->roam.configParam.nRestTimeConc;
         
@@ -336,8 +338,10 @@
         pScanRequest->maxChnTime = pMac->roam.configParam.nPassiveMaxChnTime;
         pScanRequest->minChnTime = pMac->roam.configParam.nPassiveMinChnTime;
     }
-        pScanRequest->maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc;
-        pScanRequest->minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc;
+        pScanRequest->max_chntime_btc_esco =
+              pMac->roam.configParam.max_chntime_btc_esco;
+        pScanRequest->min_chntime_btc_esco =
+              pMac->roam.configParam.min_chntime_btc_esco;
 
 #ifdef WLAN_AP_STA_CONCURRENCY
     //No rest time if no sessions are connected.
@@ -724,8 +728,10 @@
                             pScanRequest->minChnTime);
                 }  
 
-                pScanRequest->maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc;
-                pScanRequest->minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc;
+                pScanRequest->max_chntime_btc_esco =
+                    pMac->roam.configParam.max_chntime_btc_esco;
+                pScanRequest->min_chntime_btc_esco =
+                    pMac->roam.configParam.min_chntime_btc_esco;
                 //Need to make the following atomic
                 pScanCmd->u.scanCmd.scanID = pMac->scan.nextScanID++; //let it wrap around
                 
@@ -791,8 +797,10 @@
                             scanReq.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
                             scanReq.minChnTime = pMac->roam.configParam.nActiveMinChnTime;
 
-                            scanReq.maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc;
-                            scanReq.minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc;
+                            scanReq.max_chntime_btc_esco =
+                                 pMac->roam.configParam.max_chntime_btc_esco;
+                            scanReq.min_chntime_btc_esco =
+                                 pMac->roam.configParam.min_chntime_btc_esco;
                         }
                         if (pMac->roam.configParam.nInitialDwellTime)
                         {
@@ -913,8 +921,8 @@
                              pTempScanReq->p2pSearch,
                              pTempScanReq->minChnTime,
                              pTempScanReq->maxChnTime,
-                             pTempScanReq->minChnTimeBtc,
-                             pTempScanReq->maxChnTimeBtc );
+                             pTempScanReq->min_chntime_btc_esco,
+                             pTempScanReq->max_chntime_btc_esco);
                     //Start process the command
 #ifdef WLAN_AP_STA_CONCURRENCY
                     if (!pMac->fScanOffload)
@@ -1061,8 +1069,10 @@
     scanReq.requestType = reqType;
     scanReq.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
     scanReq.minChnTime = pMac->roam.configParam.nActiveMinChnTime;
-    scanReq.maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc;
-    scanReq.minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc;
+    scanReq.max_chntime_btc_esco =
+           pMac->roam.configParam.max_chntime_btc_esco;
+    scanReq.min_chntime_btc_esco =
+           pMac->roam.configParam.min_chntime_btc_esco;
     //Scan with invalid sessionId. 
     //This results in SME using the first available session to scan.
     status = csrScanRequest(pMac, CSR_SESSION_ID_INVALID, &scanReq, 
@@ -1349,8 +1359,10 @@
         pCommand->u.scanCmd.pContext = NULL;
         pCommand->u.scanCmd.u.scanRequest.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
         pCommand->u.scanCmd.u.scanRequest.minChnTime = pMac->roam.configParam.nActiveMinChnTime;
-        pCommand->u.scanCmd.u.scanRequest.maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc;
-        pCommand->u.scanCmd.u.scanRequest.minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc;
+        pCommand->u.scanCmd.u.scanRequest.max_chntime_btc_esco =
+               pMac->roam.configParam.max_chntime_btc_esco;
+        pCommand->u.scanCmd.u.scanRequest.min_chntime_btc_esco =
+               pMac->roam.configParam.min_chntime_btc_esco;
         pCommand->u.scanCmd.u.scanRequest.scanType = eSIR_ACTIVE_SCAN;
         if(pSession->connectedProfile.SSID.length)
         {
@@ -1526,8 +1538,10 @@
         pCommand->u.scanCmd.pContext = NULL;
         pCommand->u.scanCmd.u.scanRequest.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
         pCommand->u.scanCmd.u.scanRequest.minChnTime = pMac->roam.configParam.nActiveMinChnTime;
-        pCommand->u.scanCmd.u.scanRequest.maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc;
-        pCommand->u.scanCmd.u.scanRequest.minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc;
+        pCommand->u.scanCmd.u.scanRequest.max_chntime_btc_esco =
+                  pMac->roam.configParam.max_chntime_btc_esco;
+        pCommand->u.scanCmd.u.scanRequest.min_chntime_btc_esco =
+                  pMac->roam.configParam.min_chntime_btc_esco;
         pCommand->u.scanCmd.u.scanRequest.scanType = eSIR_ACTIVE_SCAN;
         if(pSession->pCurRoamProfile)
         {
@@ -1640,8 +1654,10 @@
         pCommand->u.scanCmd.pContext = NULL;
         pCommand->u.scanCmd.u.scanRequest.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
         pCommand->u.scanCmd.u.scanRequest.minChnTime = pMac->roam.configParam.nActiveMinChnTime;
-        pCommand->u.scanCmd.u.scanRequest.maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc;
-        pCommand->u.scanCmd.u.scanRequest.minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc;
+        pCommand->u.scanCmd.u.scanRequest.max_chntime_btc_esco =
+               pMac->roam.configParam.max_chntime_btc_esco;
+        pCommand->u.scanCmd.u.scanRequest.min_chntime_btc_esco =
+               pMac->roam.configParam.min_chntime_btc_esco;
         pCommand->u.scanCmd.u.scanRequest.scanType = eSIR_ACTIVE_SCAN;
         vos_mem_copy(&pCommand->u.scanCmd.u.scanRequest.bssid, bAddr, sizeof(tCsrBssid));
         //Put to the head of pending queue
@@ -6193,8 +6209,10 @@
 
             pMsg->minChannelTime = pal_cpu_to_be32(minChnTime);
             pMsg->maxChannelTime = pal_cpu_to_be32(maxChnTime);
-            pMsg->minChannelTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc;
-            pMsg->maxChannelTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc;
+            pMsg->min_chntime_btc_esco =
+                pMac->roam.configParam.min_chntime_btc_esco;
+            pMsg->max_chntime_btc_esco =
+                pMac->roam.configParam.max_chntime_btc_esco;
             //hidden SSID option
             pMsg->hiddenSsid = pScanReqParam->hiddenSsid;
             //rest time
@@ -7983,10 +8001,10 @@
                  pScanCmd->u.scanCmd.u.scanRequest.minChnTime =
                                    pMac->roam.configParam.nActiveMinChnTime;
             }
-            pScanCmd->u.scanCmd.u.scanRequest.maxChnTimeBtc =
-                                   pMac->roam.configParam.nActiveMaxChnTimeBtc;
-            pScanCmd->u.scanCmd.u.scanRequest.minChnTimeBtc =
-                                   pMac->roam.configParam.nActiveMinChnTimeBtc;
+            pScanCmd->u.scanCmd.u.scanRequest.max_chntime_btc_esco =
+                                   pMac->roam.configParam.max_chntime_btc_esco;
+            pScanCmd->u.scanCmd.u.scanRequest.min_chntime_btc_esco =
+                                   pMac->roam.configParam.min_chntime_btc_esco;
             if(pProfile->BSSIDs.numOfBSSIDs == 1)
             {
                 vos_mem_copy(pScanCmd->u.scanCmd.u.scanRequest.bssid,
diff --git a/CORE/SME/src/csr/csrInsideApi.h b/CORE/SME/src/csr/csrInsideApi.h
index f61c923..b297d3d 100644
--- a/CORE/SME/src/csr/csrInsideApi.h
+++ b/CORE/SME/src/csr/csrInsideApi.h
@@ -48,8 +48,11 @@
 #define CSR_ACTIVE_MAX_CHANNEL_TIME    40
 #define CSR_ACTIVE_MIN_CHANNEL_TIME    20
 
-#define CSR_ACTIVE_MAX_CHANNEL_TIME_BTC    120
-#define CSR_ACTIVE_MIN_CHANNEL_TIME_BTC    60
+#define CSR_ACTIVE_MAX_CHANNEL_TIME_ESCO_BTC    120
+#define CSR_ACTIVE_MIN_CHANNEL_TIME_ESCO_BTC    60
+
+#define CSR_ACTIVE_MIN_CHANNEL_TIME_SCO_BTC    20
+#define CSR_ACTIVE_MAX_CHANNEL_TIME_SCO_BTC    40
 
 #ifdef WLAN_AP_STA_CONCURRENCY
 #define CSR_PASSIVE_MAX_CHANNEL_TIME_CONC   110