wlan: Create parameters controlling scan timing during concurrent operation

Create parameters controlling scan timing during concurrent operation.
New parameters:
gPassiveMaxChannelTimeConc (default=110ms)
gPassiveMinChannelTimeConc (default=60ms)
gActiveMaxChannelTimeConc (default=27ms)
gActiveMinChannelTimeConc (default=20ms)
gRestTimeConc (default=20ms)

Change-Id: Idd6065f1f8e480d80c84e2814a0fa283d11c37bb
CR-Fixed: 406360
diff --git a/CORE/HDD/inc/wlan_hdd_cfg.h b/CORE/HDD/inc/wlan_hdd_cfg.h
index 39116d3..43727d9 100644
--- a/CORE/HDD/inc/wlan_hdd_cfg.h
+++ b/CORE/HDD/inc/wlan_hdd_cfg.h
@@ -527,6 +527,35 @@
 #define CFG_ACTIVE_MIN_CHANNEL_TIME_MAX        ( 10000 )
 #define CFG_ACTIVE_MIN_CHANNEL_TIME_DEFAULT    ( 20 )
 
+#ifdef WLAN_AP_STA_CONCURRENCY
+
+#define CFG_PASSIVE_MAX_CHANNEL_TIME_CONC_NAME      "gPassiveMaxChannelTimeConc"
+#define CFG_PASSIVE_MAX_CHANNEL_TIME_CONC_MIN       ( 0 )
+#define CFG_PASSIVE_MAX_CHANNEL_TIME_CONC_MAX       ( 10000 )
+#define CFG_PASSIVE_MAX_CHANNEL_TIME_CONC_DEFAULT   ( 110 )
+
+#define CFG_PASSIVE_MIN_CHANNEL_TIME_CONC_NAME      "gPassiveMinChannelTimeConc"
+#define CFG_PASSIVE_MIN_CHANNEL_TIME_CONC_MIN       ( 0 )
+#define CFG_PASSIVE_MIN_CHANNEL_TIME_CONC_MAX       ( 10000 )
+#define CFG_PASSIVE_MIN_CHANNEL_TIME_CONC_DEFAULT   ( 60 )
+
+#define CFG_ACTIVE_MAX_CHANNEL_TIME_CONC_NAME       "gActiveMaxChannelTimeConc"
+#define CFG_ACTIVE_MAX_CHANNEL_TIME_CONC_MIN        ( 0 )
+#define CFG_ACTIVE_MAX_CHANNEL_TIME_CONC_MAX        ( 10000 )
+#define CFG_ACTIVE_MAX_CHANNEL_TIME_CONC_DEFAULT    ( 27 )
+
+#define CFG_ACTIVE_MIN_CHANNEL_TIME_CONC_NAME       "gActiveMinChannelTimeConc"
+#define CFG_ACTIVE_MIN_CHANNEL_TIME_CONC_MIN        ( 0 )
+#define CFG_ACTIVE_MIN_CHANNEL_TIME_CONC_MAX        ( 10000 )
+#define CFG_ACTIVE_MIN_CHANNEL_TIME_CONC_DEFAULT    ( 20 )
+
+#define CFG_REST_TIME_CONC_NAME                     "gRestTimeConc"
+#define CFG_REST_TIME_CONC_MIN                      ( 0 )
+#define CFG_REST_TIME_CONC_MAX                      ( 10000 )
+#define CFG_REST_TIME_CONC_DEFAULT                  ( 20 )
+
+#endif
+
 #define CFG_MAX_PS_POLL_NAME                   "gMaxPsPoll"
 #define CFG_MAX_PS_POLL_MIN                    WNI_CFG_MAX_PS_POLL_STAMIN
 #define CFG_MAX_PS_POLL_MAX                    WNI_CFG_MAX_PS_POLL_STAMAX
@@ -1485,6 +1514,14 @@
    v_U32_t        nActiveMinChnTime;     //in units of milliseconds
    v_U32_t        nActiveMaxChnTime;     //in units of milliseconds
 
+#ifdef WLAN_AP_STA_CONCURRENCY
+   v_U32_t        nPassiveMinChnTimeConc;    //in units of milliseconds
+   v_U32_t        nPassiveMaxChnTimeConc;    //in units of milliseconds
+   v_U32_t        nActiveMinChnTimeConc;     //in units of milliseconds
+   v_U32_t        nActiveMaxChnTimeConc;     //in units of milliseconds
+   v_U32_t        nRestTimeConc;             //in units of milliseconds
+#endif
+
    v_U8_t         nMaxPsPoll;
 
    v_U8_t         nRssiFilterPeriod;
diff --git a/CORE/HDD/src/wlan_hdd_cfg.c b/CORE/HDD/src/wlan_hdd_cfg.c
index c7c69cf..656506b 100644
--- a/CORE/HDD/src/wlan_hdd_cfg.c
+++ b/CORE/HDD/src/wlan_hdd_cfg.c
@@ -631,6 +631,43 @@
                  CFG_ACTIVE_MIN_CHANNEL_TIME_DEFAULT, 
                  CFG_ACTIVE_MIN_CHANNEL_TIME_MIN, 
                  CFG_ACTIVE_MIN_CHANNEL_TIME_MAX ),
+
+#ifdef WLAN_AP_STA_CONCURRENCY
+   REG_VARIABLE( CFG_PASSIVE_MAX_CHANNEL_TIME_CONC_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nPassiveMaxChnTimeConc, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_PASSIVE_MAX_CHANNEL_TIME_CONC_DEFAULT, 
+                 CFG_PASSIVE_MAX_CHANNEL_TIME_CONC_MIN, 
+                 CFG_PASSIVE_MAX_CHANNEL_TIME_CONC_MAX ),
+
+   REG_VARIABLE( CFG_PASSIVE_MIN_CHANNEL_TIME_CONC_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nPassiveMinChnTimeConc, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_PASSIVE_MIN_CHANNEL_TIME_CONC_DEFAULT, 
+                 CFG_PASSIVE_MIN_CHANNEL_TIME_CONC_MIN, 
+                 CFG_PASSIVE_MIN_CHANNEL_TIME_CONC_MAX ),
+
+   REG_VARIABLE( CFG_ACTIVE_MAX_CHANNEL_TIME_CONC_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nActiveMaxChnTimeConc, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_ACTIVE_MAX_CHANNEL_TIME_CONC_DEFAULT, 
+                 CFG_ACTIVE_MAX_CHANNEL_TIME_CONC_MIN, 
+                 CFG_ACTIVE_MAX_CHANNEL_TIME_CONC_MAX ),
+
+   REG_VARIABLE( CFG_ACTIVE_MIN_CHANNEL_TIME_CONC_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nActiveMinChnTimeConc, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_ACTIVE_MIN_CHANNEL_TIME_CONC_DEFAULT, 
+                 CFG_ACTIVE_MIN_CHANNEL_TIME_CONC_MIN, 
+                 CFG_ACTIVE_MIN_CHANNEL_TIME_CONC_MAX ),
+
+   REG_VARIABLE( CFG_REST_TIME_CONC_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, nRestTimeConc, 
+                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+                 CFG_REST_TIME_CONC_DEFAULT, 
+                 CFG_REST_TIME_CONC_MIN, 
+                 CFG_REST_TIME_CONC_MAX ),
+#endif
    
    REG_VARIABLE( CFG_MAX_PS_POLL_NAME, WLAN_PARAM_Integer,
                  hdd_config_t, nMaxPsPoll, 
@@ -3056,6 +3093,13 @@
    smeConfig.csrConfig.nActiveMinChnTime        = pConfig->nActiveMinChnTime;
    smeConfig.csrConfig.nPassiveMaxChnTime       = pConfig->nPassiveMaxChnTime;
    smeConfig.csrConfig.nPassiveMinChnTime       = pConfig->nPassiveMinChnTime;
+#ifdef WLAN_AP_STA_CONCURRENCY
+   smeConfig.csrConfig.nActiveMaxChnTimeConc    = pConfig->nActiveMaxChnTimeConc;
+   smeConfig.csrConfig.nActiveMinChnTimeConc    = pConfig->nActiveMinChnTimeConc;
+   smeConfig.csrConfig.nPassiveMaxChnTimeConc   = pConfig->nPassiveMaxChnTimeConc;
+   smeConfig.csrConfig.nPassiveMinChnTimeConc   = pConfig->nPassiveMinChnTimeConc;
+   smeConfig.csrConfig.nRestTimeConc            = pConfig->nRestTimeConc;
+#endif
    smeConfig.csrConfig.Is11eSupportEnabled      = pConfig->b80211eIsEnabled;
    smeConfig.csrConfig.WMMSupportMode           = pConfig->WmmMode;
 
diff --git a/CORE/SME/inc/csrApi.h b/CORE/SME/inc/csrApi.h
index 01e6faf..a12513b 100644
--- a/CORE/SME/inc/csrApi.h
+++ b/CORE/SME/inc/csrApi.h
@@ -952,6 +952,13 @@
     tANI_U32  nPassiveMaxChnTime;    //in units of milliseconds
     tANI_U32  nActiveMinChnTime;     //in units of milliseconds
     tANI_U32  nActiveMaxChnTime;     //in units of milliseconds
+#ifdef WLAN_AP_STA_CONCURRENCY
+    tANI_U32  nPassiveMinChnTimeConc;    //in units of milliseconds
+    tANI_U32  nPassiveMaxChnTimeConc;    //in units of milliseconds
+    tANI_U32  nActiveMinChnTimeConc;     //in units of milliseconds
+    tANI_U32  nActiveMaxChnTimeConc;     //in units of milliseconds
+    tANI_U32  nRestTimeConc;             //in units of milliseconds
+#endif
 
     tANI_BOOLEAN IsIdleScanEnabled;
     //in dBm, the maximum TX power
diff --git a/CORE/SME/inc/csrInternal.h b/CORE/SME/inc/csrInternal.h
index b70be01..f156f42 100644
--- a/CORE/SME/inc/csrInternal.h
+++ b/CORE/SME/inc/csrInternal.h
@@ -536,6 +536,13 @@
     tANI_U32  nPassiveMaxChnTime;    //in units of milliseconds
     tANI_U32  nActiveMinChnTime;     //in units of milliseconds
     tANI_U32  nActiveMaxChnTime;     //in units of milliseconds
+#ifdef WLAN_AP_STA_CONCURRENCY
+    tANI_U32  nPassiveMinChnTimeConc;    //in units of milliseconds
+    tANI_U32  nPassiveMaxChnTimeConc;    //in units of milliseconds
+    tANI_U32  nActiveMinChnTimeConc;     //in units of milliseconds
+    tANI_U32  nActiveMaxChnTimeConc;     //in units of milliseconds
+    tANI_U32  nRestTimeConc;             //in units of milliseconds
+#endif
 
     tANI_BOOLEAN IsIdleScanEnabled;
     //in dBm, the maximum TX power
diff --git a/CORE/SME/src/csr/csrApiRoam.c b/CORE/SME/src/csr/csrApiRoam.c
index a1bf306..2df7f25 100644
--- a/CORE/SME/src/csr/csrApiRoam.c
+++ b/CORE/SME/src/csr/csrApiRoam.c
@@ -918,6 +918,13 @@
     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;
+#ifdef WLAN_AP_STA_CONCURRENCY
+    pMac->roam.configParam.nActiveMaxChnTimeConc = CSR_ACTIVE_MAX_CHANNEL_TIME_CONC;
+    pMac->roam.configParam.nActiveMinChnTimeConc = CSR_ACTIVE_MIN_CHANNEL_TIME_CONC;
+    pMac->roam.configParam.nPassiveMaxChnTimeConc = CSR_PASSIVE_MAX_CHANNEL_TIME_CONC;
+    pMac->roam.configParam.nPassiveMinChnTimeConc = CSR_PASSIVE_MIN_CHANNEL_TIME_CONC;
+    pMac->roam.configParam.nRestTimeConc = CSR_REST_TIME_CONC;
+#endif
     pMac->roam.configParam.IsIdleScanEnabled = TRUE; //enable the idle scan by default
     pMac->roam.configParam.nTxPowerCap = CSR_MAX_TX_POWER;
     pMac->roam.configParam.statsReqPeriodicity = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD;
@@ -1163,6 +1170,28 @@
         {
             pMac->roam.configParam.nPassiveMinChnTime = pParam->nPassiveMinChnTime;
         }
+#ifdef WLAN_AP_STA_CONCURRENCY
+        if(pParam->nActiveMaxChnTimeConc)
+        {
+            pMac->roam.configParam.nActiveMaxChnTimeConc = pParam->nActiveMaxChnTimeConc;
+        }
+        if(pParam->nActiveMinChnTimeConc)
+        {
+            pMac->roam.configParam.nActiveMinChnTimeConc = pParam->nActiveMinChnTimeConc;
+        }
+        if(pParam->nPassiveMaxChnTimeConc)
+        {
+            pMac->roam.configParam.nPassiveMaxChnTimeConc = pParam->nPassiveMaxChnTimeConc;
+        }
+        if(pParam->nPassiveMinChnTimeConc)
+        {
+            pMac->roam.configParam.nPassiveMinChnTimeConc = pParam->nPassiveMinChnTimeConc;
+        }
+        if(pParam->nRestTimeConc)
+        {
+            pMac->roam.configParam.nRestTimeConc = pParam->nRestTimeConc;
+        }
+#endif
         //if upper layer wants to disable idle scan altogether set it to 0
         if(pParam->impsSleepTime)
         {
@@ -1329,6 +1358,13 @@
         pParam->nActiveMinChnTime = pMac->roam.configParam.nActiveMinChnTime;
         pParam->nPassiveMaxChnTime = pMac->roam.configParam.nPassiveMaxChnTime;
         pParam->nPassiveMinChnTime = pMac->roam.configParam.nPassiveMinChnTime;
+#ifdef WLAN_AP_STA_CONCURRENCY
+        pParam->nActiveMaxChnTimeConc = pMac->roam.configParam.nActiveMaxChnTimeConc;
+        pParam->nActiveMinChnTimeConc = pMac->roam.configParam.nActiveMinChnTimeConc;
+        pParam->nPassiveMaxChnTimeConc = pMac->roam.configParam.nPassiveMaxChnTimeConc;
+        pParam->nPassiveMinChnTimeConc = pMac->roam.configParam.nPassiveMinChnTimeConc;
+        pParam->nRestTimeConc = pMac->roam.configParam.nRestTimeConc;
+#endif
         //Change the unit from microsecond to second
         pParam->impsSleepTime = pMac->roam.configParam.impsSleepTime / PAL_TIMER_TO_SEC_UNIT;
         pParam->eBand = pMac->roam.configParam.eBand;
@@ -3140,7 +3176,7 @@
         case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
             return PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
         case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
-        default :
+	    default :
             return PHY_SINGLE_CHANNEL_CENTERED;
     }
 }
@@ -3220,13 +3256,13 @@
 #ifdef WLAN_FEATURE_11AC
     if(cfgCb > 2 )
     {
-        if(!WDA_getFwWlanFeatCaps(DOT11AC)) {
+	if(!WDA_getFwWlanFeatCaps(DOT11AC)) {
             cfgCb = csrGetHTCBStateFromVHTCBState(cfgCb);
-        }
-        else 
-        {
+	}
+	else 
+	{
             ccmCfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,  pMac->roam.configParam.nVhtChannelWidth, NULL, eANI_BOOLEAN_FALSE);
-        }
+	}
     }
     else
 #endif
@@ -9427,7 +9463,7 @@
                                             pMac->roam.configParam.ProprietaryRatesEnabled);
 #endif
     eCsrBand eBand;
- 
+    
     //If the global setting for dot11Mode is set to auto/abg, we overwrite the setting in the profile.
 #ifdef WLAN_SOFTAP_FEATURE
     if( ((!CSR_IS_INFRA_AP(pProfile )&& !CSR_IS_WDS(pProfile )) && 
diff --git a/CORE/SME/src/csr/csrApiScan.c b/CORE/SME/src/csr/csrApiScan.c
index 7695e02..9772b8c 100644
--- a/CORE/SME/src/csr/csrApiScan.c
+++ b/CORE/SME/src/csr/csrApiScan.c
@@ -101,6 +101,7 @@
 void csrScanGetResultTimerHandler(void *);
 void csrScanResultAgingTimerHandler(void *pv);
 void csrScanIdleScanTimerHandler(void *);
+static void csrSetDefaultScanTiming( tpAniSirGlobal pMac, tSirScanType scanType, tCsrScanRequest *pScanRequest);
 #ifdef WLAN_AP_STA_CONCURRENCY
 static void csrStaApConcTimerHandler(void *);
 #endif
@@ -376,6 +377,52 @@
 }
 
 
+//Set scan timing parameters according to state of other driver sessions 
+//No validation of the parameters is performed. 
+static void csrSetDefaultScanTiming( tpAniSirGlobal pMac, tSirScanType scanType, tCsrScanRequest *pScanRequest)
+{
+#ifdef WLAN_AP_STA_CONCURRENCY
+    if(csrIsAnySessionConnected(pMac))
+    {
+        //If multi-session, use the appropriate default scan times 
+        if(scanType == eSIR_ACTIVE_SCAN)
+        {
+            pScanRequest->maxChnTime = pMac->roam.configParam.nActiveMaxChnTimeConc;
+            pScanRequest->minChnTime = pMac->roam.configParam.nActiveMinChnTimeConc;
+        }
+        else
+        {
+            pScanRequest->maxChnTime = pMac->roam.configParam.nPassiveMaxChnTimeConc;
+            pScanRequest->minChnTime = pMac->roam.configParam.nPassiveMinChnTimeConc;
+        }
+
+        pScanRequest->restTime = pMac->roam.configParam.nRestTimeConc;
+        
+        //Return so that fields set above will not be overwritten.
+        return;
+    }
+#endif
+
+    //This portion of the code executed if multi-session not supported
+    //(WLAN_AP_STA_CONCURRENCY not defined) or no multi-session.
+    //Use the "regular" (non-concurrency) default scan timing.
+    if(pScanRequest->scanType == eSIR_ACTIVE_SCAN)
+    {
+        pScanRequest->maxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
+        pScanRequest->minChnTime = pMac->roam.configParam.nActiveMinChnTime;
+    }
+    else
+    {
+        pScanRequest->maxChnTime = pMac->roam.configParam.nPassiveMaxChnTime;
+        pScanRequest->minChnTime = pMac->roam.configParam.nPassiveMinChnTime;
+    }
+
+#ifdef WLAN_AP_STA_CONCURRENCY
+    //No rest time if no sessions are connected.
+    pScanRequest->restTime = 0;
+#endif
+}
+
 #ifdef WLAN_AP_STA_CONCURRENCY
 //Return SUCCESS is the command is queued, else returns eHAL_STATUS_FAILURE 
 eHalStatus csrQueueScanRequest( tpAniSirGlobal pMac, tSmeCmd *pScanCmd )
@@ -432,11 +479,9 @@
             {
                 pSendScanCmd = pScanCmd;
                 pSendScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels = 1;
-                pSendScanCmd->u.scanCmd.u.scanRequest.scanType = eSIR_ACTIVE_SCAN;
-                pSendScanCmd->u.scanCmd.u.scanRequest.maxChnTime = 
-                    CSR_MIN(pSendScanCmd->u.scanCmd.u.scanRequest.maxChnTime,CSR_ACTIVE_MAX_CHANNEL_TIME_CONC);
-                pSendScanCmd->u.scanCmd.u.scanRequest.minChnTime = 
-                    CSR_MIN(pSendScanCmd->u.scanCmd.u.scanRequest.minChnTime, CSR_ACTIVE_MIN_CHANNEL_TIME_CONC);
+                //Use concurrency values for min/maxChnTime. 
+                //We know csrIsAnySessionConnected(pMac) returns TRUE here
+                csrSetDefaultScanTiming(pMac, pSendScanCmd->u.scanCmd.u.scanRequest.scanType, &pSendScanCmd->u.scanCmd.u.scanRequest);
                 if (i != 0)
                 { //Callback should be NULL for all except last channel So hdd_callback will be called only after last command
                   //i!=0 then we came here in second iteration 
@@ -483,14 +528,15 @@
 
                 pChnInfo->ChannelList = &channelToScan[0];
               
-
                 scanReq.BSSType = eCSR_BSS_TYPE_ANY;
                 //Modify callers parameters in case of concurrency
                 scanReq.scanType = eSIR_ACTIVE_SCAN;
-                scanReq.maxChnTime = CSR_ACTIVE_MAX_CHANNEL_TIME_CONC;
-                scanReq.minChnTime = CSR_ACTIVE_MIN_CHANNEL_TIME_CONC;
+                //Use concurrency values for min/maxChnTime. 
+                //We know csrIsAnySessionConnected(pMac) returns TRUE here
+                csrSetDefaultScanTiming(pMac, scanReq.scanType, &scanReq);
 
                 status = csrScanCopyRequest(pMac, &pQueueScanCmd->u.scanCmd.u.scanRequest, &scanReq);
+
                 if(!HAL_STATUS_SUCCESS(status))
                 {
                     if (bMemAlloc)
@@ -598,8 +644,10 @@
 {
     eHalStatus status = eHAL_STATUS_FAILURE;
     tSmeCmd *pScanCmd = NULL;
-    eCsrConnectState ConnectState;
+	eCsrConnectState ConnectState;
     
+    VOS_ASSERT(pScanRequest != NULL);
+
     do
     {
         if(pMac->scan.fScanEnable)
@@ -646,17 +694,18 @@
                 if(pScanRequest->minChnTime == 0 && pScanRequest->maxChnTime == 0)
                 {
                     //The caller doesn't set the time correctly. Set it here
-                    if(pScanRequest->scanType == eSIR_ACTIVE_SCAN)
+                    csrSetDefaultScanTiming(pMac, pScanRequest->scanType, pScanRequest);
+                }
+#ifdef WLAN_AP_STA_CONCURRENCY
+                if(pScanRequest->restTime == 0)
                     {
-                        pScanRequest->maxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
-                        pScanRequest->minChnTime = pMac->roam.configParam.nActiveMinChnTime;
-                    }
-                    else
+                    //Need to set restTime only if at least one session is connected
+                    if(csrIsAnySessionConnected(pMac))
                     {
-                        pScanRequest->maxChnTime = pMac->roam.configParam.nPassiveMaxChnTime;
-                        pScanRequest->minChnTime = pMac->roam.configParam.nPassiveMinChnTime;
+                        pScanRequest->restTime = pMac->roam.configParam.nRestTimeConc;
                     }
                 }
+#endif
                  /*For Standalone wlan : channel time will remain the same.
                                   For BTC with A2DP up: Channel time = Channel time * 2 , if station is not already associated.
                                   This has been done to provide a larger scan window for faster connection during btc.Else Scan is seen
@@ -4353,8 +4402,9 @@
 #ifdef WLAN_AP_STA_CONCURRENCY
     if (!csrLLIsListEmpty( &pMac->scan.scanCmdPendingList, LL_ACCESS_LOCK ))
     {
+         VOS_ASSERT(pCommand->u.scanCmd.u.scanRequest.restTime != 0);
          palTimerStart(pMac->hHdd, pMac->scan.hTimerStaApConcTimer, 
-                 CSR_SCAN_STAAP_CONC_INTERVAL, eANI_BOOLEAN_FALSE);
+                 pCommand->u.scanCmd.u.scanRequest.restTime * PAL_TIMER_TO_MS_UNIT, eANI_BOOLEAN_FALSE);
     }
 #endif
     return (fRet);
@@ -5411,7 +5461,6 @@
         tANI_U8    channelToScan[WNI_CFG_VALID_CHANNEL_LIST_LEN];
         eHalStatus status;
        
-
         pScanCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
         numChn = pScanCmd->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels;
         if (numChn > 1)
@@ -5452,8 +5501,9 @@
              scanReq.BSSType = eCSR_BSS_TYPE_ANY;
              //Modify callers parameters in case of concurrency
              scanReq.scanType = eSIR_ACTIVE_SCAN;
-             scanReq.maxChnTime = CSR_MIN(pScanCmd->u.scanCmd.u.scanRequest.maxChnTime,CSR_ACTIVE_MAX_CHANNEL_TIME_CONC);
-             scanReq.minChnTime =  CSR_MIN(pScanCmd->u.scanCmd.u.scanRequest.minChnTime,CSR_ACTIVE_MIN_CHANNEL_TIME_CONC);
+             //Use concurrency values for min/maxChnTime. 
+             //We know csrIsAnySessionConnected(pMac) returns TRUE here
+             csrSetDefaultScanTiming(pMac, scanReq.scanType, &scanReq);
 
              status = csrScanCopyRequest(pMac, &pSendScanCmd->u.scanCmd.u.scanRequest, &scanReq);
              if(!HAL_STATUS_SUCCESS(status))
diff --git a/CORE/SME/src/csr/csrInsideApi.h b/CORE/SME/src/csr/csrInsideApi.h
index 12e0ea1..3ff8da7 100644
--- a/CORE/SME/src/csr/csrInsideApi.h
+++ b/CORE/SME/src/csr/csrInsideApi.h
@@ -45,8 +45,13 @@
 #define CSR_ACTIVE_MIN_CHANNEL_TIME    20
 
 #ifdef WLAN_AP_STA_CONCURRENCY
+#define CSR_PASSIVE_MAX_CHANNEL_TIME_CONC   110
+#define CSR_PASSIVE_MIN_CHANNEL_TIME_CONC   60 
+
 #define CSR_ACTIVE_MAX_CHANNEL_TIME_CONC    27
 #define CSR_ACTIVE_MIN_CHANNEL_TIME_CONC    20
+
+#define CSR_REST_TIME_CONC                  20
 #endif
 
 #define CSR_MAX_NUM_SUPPORTED_CHANNELS 55
@@ -66,9 +71,6 @@
 #define CSR_IDLE_SCAN_NO_PS_INTERVAL     (10 * PAL_TIMER_TO_SEC_UNIT)     //10 second 
 #define CSR_IDLE_SCAN_NO_PS_INTERVAL_MIN (5 * PAL_TIMER_TO_SEC_UNIT)
 #define CSR_SCAN_GET_RESULT_INTERVAL    (5 * PAL_TIMER_TO_SEC_UNIT)     //5 seconds
-#ifdef WLAN_AP_STA_CONCURRENCY
-#define CSR_SCAN_STAAP_CONC_INTERVAL    (20 * PAL_TIMER_TO_MS_UNIT)     //20 milliseconds
-#endif
 #define CSR_MIC_ERROR_TIMEOUT  (60 * PAL_TIMER_TO_SEC_UNIT)     //60 seconds
 #define CSR_TKIP_COUNTER_MEASURE_TIMEOUT  (60 * PAL_TIMER_TO_SEC_UNIT)     //60 seconds
 #define CSR_SCAN_RESULT_AGING_INTERVAL    (5 * PAL_TIMER_TO_SEC_UNIT)     //5 seconds
diff --git a/CORE/SME/src/csr/csrLogDump.c b/CORE/SME/src/csr/csrLogDump.c
index 7bdc754..8e64cb5 100644
--- a/CORE/SME/src/csr/csrLogDump.c
+++ b/CORE/SME/src/csr/csrLogDump.c
@@ -96,11 +96,32 @@
     }
     return p;
 }
+static char* dump_csrApConcScanParams( tpAniSirGlobal pMac, tANI_U32 arg1, 
+                               tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p )
+{
+    if( arg1 )
+    {
+        pMac->roam.configParam.nRestTimeConc = arg1;
+    }
+    if( arg2 )
+    {
+        pMac->roam.configParam.nActiveMinChnTimeConc = arg2;
+    }
+    if( arg3 )
+    {
+        pMac->roam.configParam.nActiveMaxChnTimeConc = arg3;
+    }
+
+    smsLog(pMac, LOGE, FL(" Working %d %d %d\n"), (int) pMac->roam.configParam.nRestTimeConc,
+        (int)pMac->roam.configParam.nActiveMinChnTimeConc, (int) pMac->roam.configParam.nActiveMaxChnTimeConc);
+    return p;
+}
 
 static tDumpFuncEntry csrMenuDumpTable[] = {
     {0,     "CSR (850-860)",                                    NULL},
     {851,   "CSR: CSR testing connection to AniNet",            dump_csr},
     {852,   "BTC: Fake BT events (event, handle)",              dump_btcSetEvent},
+    {853,   "CSR: Split Scan related params",                   dump_csrApConcScanParams},
 };
 
 void csrDumpInit(tHalHandle hHal)
diff --git a/firmware_bin/WCNSS_qcom_cfg.ini b/firmware_bin/WCNSS_qcom_cfg.ini
index 96f19c5..8050869 100644
--- a/firmware_bin/WCNSS_qcom_cfg.ini
+++ b/firmware_bin/WCNSS_qcom_cfg.ini
@@ -336,6 +336,17 @@
 # Enable CRDA regulatory support by settings default country code
 #gCrdaDefaultCountryCode=TW
 
+# Scan Timing Parameters
+# gPassiveMaxChannelTime=110
+# gPassiveMinChannelTime=60
+# gActiveMaxChannelTime=40
+# gActiveMinChannelTime=20
+gPassiveMaxChannelTimeConc=110
+gPassiveMinChannelTimeConc=60
+gActiveMaxChannelTimeConc=27
+gActiveMinChannelTimeConc=20
+gRestTimeConc=20
+
 END
 
 # Note: Configuration parser would not read anything past the END marker