diff options
| author | Rajeev Kumar <rajekuma@qca.qualcomm.com> | 2014-02-05 20:37:49 -0800 |
|---|---|---|
| committer | Akash Patel <c_akashp@qca.qualcomm.com> | 2014-02-07 17:38:21 -0800 |
| commit | 84681c9150f591bdfda1f5ce7348b1cea5a29966 (patch) | |
| tree | adff524401694e18f4680736899b6e940b1cca1c | |
| parent | a10789eb9eea428842b95ffeeb444813d12682db (diff) | |
qcacld: Integrating batch scan fixes from pronto
Integrating batch scan fixes from pronto to QCACLD_NEW
Change-Id: I7b1a1fda2b54907a2ff182cb57ea87f75cc05139
CRs-Fixed: 611028
| -rw-r--r-- | CORE/HDD/inc/wlan_hdd_main.h | 41 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_hostapd.c | 7 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_main.c | 553 | ||||
| -rw-r--r-- | CORE/SERVICES/WMA/wma.c | 22 |
4 files changed, 382 insertions, 241 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h index 4ae0aa107893..7213c73da511 100644 --- a/CORE/HDD/inc/wlan_hdd_main.h +++ b/CORE/HDD/inc/wlan_hdd_main.h @@ -1379,4 +1379,45 @@ void hdd_checkandupdate_phymode( hdd_context_t *pHddCtx); #endif int hdd_wmmps_helper(hdd_adapter_t *pAdapter, tANI_U8 *ptr); + +#ifdef FEATURE_WLAN_BATCH_SCAN +/**--------------------------------------------------------------------------- + + \brief hdd_handle_batch_scan_ioctl () - This function handles WLS_BATCHING + IOCTLs from user space. Following BATCH SCAN DEV IOCTs are handled: + WLS_BATCHING VERSION + WLS_BATCHING SET + WLS_BATCHING GET + WLS_BATCHING STOP + + \param - pAdapter Pointer to HDD adapter + \param - pPrivdata Pointer to priv_data + \param - command Pointer to command + + \return - 0 for success -EFAULT for failure + + --------------------------------------------------------------------------*/ + +int hdd_handle_batch_scan_ioctl +( + hdd_adapter_t *pAdapter, + hdd_priv_data_t *pPrivdata, + tANI_U8 *command +); + +/**--------------------------------------------------------------------------- + + \brief hdd_deinit_batch_scan () - This function cleans up batch scan data + structures + + \param - pAdapter Pointer to HDD adapter + + \return - None + + --------------------------------------------------------------------------*/ + +void hdd_deinit_batch_scan(hdd_adapter_t *pAdapter); + +#endif /*End of FEATURE_WLAN_BATCH_SCAN*/ + #endif // end #if !defined( WLAN_HDD_MAIN_H ) diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c index 1037154ac026..5dafbabe316f 100644 --- a/CORE/HDD/src/wlan_hdd_hostapd.c +++ b/CORE/HDD/src/wlan_hdd_hostapd.c @@ -271,6 +271,12 @@ int hdd_hostapd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { hdd_setP2pOpps(dev, command); } +#ifdef FEATURE_WLAN_BATCH_SCAN + else if( strncmp(command, "WLS_BATCHING", 12) == 0 ) + { + ret = hdd_handle_batch_scan_ioctl(pAdapter, &priv_data, command); + } +#endif /* command should be a string having format @@ -283,6 +289,7 @@ int hdd_hostapd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ret = sapSetPreferredChannel(command); } + } exit: if (command) diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c index 8ed80d01c045..b050ec8bc3b2 100644 --- a/CORE/HDD/src/wlan_hdd_main.c +++ b/CORE/HDD/src/wlan_hdd_main.c @@ -677,6 +677,7 @@ void hdd_checkandupdate_dfssetting( hdd_adapter_t *pAdapter, char *country_code) } + #ifdef FEATURE_WLAN_BATCH_SCAN /**--------------------------------------------------------------------------- @@ -733,7 +734,6 @@ hdd_extract_assigned_int_from_str { return NULL; } - if (tempInt < 0) { tempInt = 0; @@ -1142,6 +1142,7 @@ static void hdd_batch_scan_result_ind_callback { v_BOOL_t isLastAp; tANI_U32 numApMetaInfo; + tANI_U32 numNetworkInScanList; tANI_U32 numberScanList; tANI_U32 nextScanListOffset; tANI_U32 nextApMetaInfoOffset; @@ -1166,6 +1167,7 @@ static void hdd_batch_scan_result_ind_callback pBatchScanRsp = (tpSirBatchScanResultIndParam)pRsp; isLastAp = FALSE; numApMetaInfo = 0; + numNetworkInScanList = 0; numberScanList = 0; nextScanListOffset = 0; nextApMetaInfoOffset = 0; @@ -1195,7 +1197,7 @@ static void hdd_batch_scan_result_ind_callback while (numberScanList) { - pScanList = (tpSirBatchScanList)(pBatchScanRsp->scanResults + + pScanList = (tpSirBatchScanList)((tANI_U8 *)pBatchScanRsp->scanResults + nextScanListOffset); if (NULL == pScanList) { @@ -1204,9 +1206,10 @@ static void hdd_batch_scan_result_ind_callback isLastAp = TRUE; goto done; } - numApMetaInfo = pScanList->numNetworksInScanList; + numNetworkInScanList = numApMetaInfo = pScanList->numNetworksInScanList; VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "Batch scan rsp: numApMetaInfo %d", numApMetaInfo); + "Batch scan rsp: numApMetaInfo %d scanId %d", + numApMetaInfo, pScanList->scanId); if ((!numApMetaInfo) || (numApMetaInfo > pReq->bestNetwork)) { @@ -1216,6 +1219,9 @@ static void hdd_batch_scan_result_ind_callback goto done; } + /*Initialize next AP meta info offset for next scan list*/ + nextApMetaInfoOffset = 0; + while (numApMetaInfo) { pApMetaInfo = (tpSirBatchScanNetworkInfo)(pScanList->scanList + @@ -1232,13 +1238,11 @@ static void hdd_batch_scan_result_ind_callback pBatchScanRsp->timestamp - pApMetaInfo->timestamp; VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, - "%s: bssId 0x%x:0x%x:0x%x:0x%x:0x%x:0x%x " - "ch %d rssi %d timestamp %d", __func__, - pApMetaInfo->bssid[0],pApMetaInfo->bssid[1], - pApMetaInfo->bssid[2],pApMetaInfo->bssid[3], - pApMetaInfo->bssid[4],pApMetaInfo->bssid[5], - pApMetaInfo->ch, pApMetaInfo->rssi, - pApMetaInfo->timestamp); + "%s: bssId "MAC_ADDRESS_STR + " ch %d rssi %d timestamp %d", __func__, + MAC_ADDR_ARRAY(pApMetaInfo->bssid), + pApMetaInfo->ch, pApMetaInfo->rssi, + pApMetaInfo->timestamp); /*mark last AP in batch scan response*/ if ((TRUE == pBatchScanRsp->isLastResult) && @@ -1257,7 +1261,9 @@ static void hdd_batch_scan_result_ind_callback numApMetaInfo--; } - nextScanListOffset += (sizeof(tSirBatchScanList) - (sizeof(tANI_U8))); + nextScanListOffset += ((sizeof(tSirBatchScanList) - sizeof(tANI_U8)) + + (sizeof(tSirBatchScanNetworkInfo) + * numNetworkInScanList)); numberScanList--; } @@ -1490,6 +1496,7 @@ tANI_U32 hdd_populate_user_batch_scan_rsp pAdapter->prev_batch_id = pPrev->ApInfo.batchId; } vos_mem_free(pPrev); + pPrev = NULL; } return cur_len; @@ -1572,11 +1579,11 @@ int hdd_return_batch_scan_rsp_to_user rc = wait_for_completion_timeout( &pAdapter->hdd_get_batch_scan_req_var, msecs_to_jiffies(HDD_GET_BATCH_SCAN_RSP_TIME_OUT)); - if (0 == rc) + if (0 >= rc) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "%s: Timeout waiting to fetch batch scan rsp from fw", - __func__); + "%s: wait on hdd_get_batch_scan_req_var failed %ld", + __func__, rc); return -EFAULT; } } @@ -1643,6 +1650,242 @@ int hdd_return_batch_scan_rsp_to_user return 0; } /*End of hdd_return_batch_scan_rsp_to_user*/ +/**--------------------------------------------------------------------------- + + \brief hdd_handle_batch_scan_ioctl () - This function handles WLS_BATCHING + IOCTLs from user space. Following BATCH SCAN DEV IOCTs are handled: + WLS_BATCHING VERSION + WLS_BATCHING SET + WLS_BATCHING GET + WLS_BATCHING STOP + + \param - pAdapter Pointer to HDD adapter + \param - pPrivdata Pointer to priv_data + \param - command Pointer to command + + \return - 0 for success -EFAULT for failure + + --------------------------------------------------------------------------*/ + +int hdd_handle_batch_scan_ioctl +( + hdd_adapter_t *pAdapter, + hdd_priv_data_t *pPrivdata, + tANI_U8 *command +) +{ + int ret = 0; + + if (strncmp(command, "WLS_BATCHING VERSION", 20) == 0) + { + char extra[32]; + tANI_U8 len = 0; + tANI_U8 version = HDD_BATCH_SCAN_VERSION; + + if (FALSE == sme_IsFeatureSupportedByFW(BATCH_SCAN)) + { + VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "%s: Batch scan feature is not supported by FW", __func__); + ret = -EINVAL; + goto exit; + } + + len = scnprintf(extra, sizeof(extra), "WLS_BATCHING_VERSION %d", + version); + if (copy_to_user(pPrivdata->buf, &extra, len + 1)) + { + VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "%s: failed to copy data to user buffer", __func__); + ret = -EFAULT; + goto exit; + } + ret = HDD_BATCH_SCAN_VERSION; + } + else if (strncmp(command, "WLS_BATCHING SET", 16) == 0) + { + int status; + tANI_U8 *value = (command + 16); + eHalStatus halStatus; + unsigned long rc; + tSirSetBatchScanReq *pReq = &pAdapter->hddSetBatchScanReq; + tSirSetBatchScanRsp *pRsp = &pAdapter->hddSetBatchScanRsp; + + if (FALSE == sme_IsFeatureSupportedByFW(BATCH_SCAN)) + { + VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "%s: Batch scan feature is not supported by FW", __func__); + ret = -EINVAL; + goto exit; + } + + if ((WLAN_HDD_INFRA_STATION != pAdapter->device_mode) && + (WLAN_HDD_P2P_CLIENT != pAdapter->device_mode) && + (WLAN_HDD_P2P_GO != pAdapter->device_mode) && + (WLAN_HDD_P2P_DEVICE != pAdapter->device_mode)) + { + VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "Received WLS_BATCHING SET command in invalid mode %d " + "WLS_BATCHING_SET is only allowed in infra STA/P2P client mode", + pAdapter->device_mode); + ret = -EINVAL; + goto exit; + } + + status = hdd_parse_set_batchscan_command(value, pReq); + if (status) + { + VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "Invalid WLS_BATCHING SET command"); + ret = -EINVAL; + goto exit; + } + + + pAdapter->hdd_wait_for_set_batch_scan_rsp = TRUE; + halStatus = sme_SetBatchScanReq(WLAN_HDD_GET_HAL_CTX(pAdapter), pReq, + pAdapter->sessionId, hdd_set_batch_scan_req_callback, + pAdapter); + + if ( eHAL_STATUS_SUCCESS == halStatus ) + { + VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, + "sme_SetBatchScanReq returned success halStatus %d", + halStatus); + if (TRUE == pAdapter->hdd_wait_for_set_batch_scan_rsp) + { + INIT_COMPLETION(pAdapter->hdd_set_batch_scan_req_var); + rc = wait_for_completion_timeout( + &pAdapter->hdd_set_batch_scan_req_var, + msecs_to_jiffies(HDD_SET_BATCH_SCAN_REQ_TIME_OUT)); + if (0 == rc) + { + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "%s: Timeout waiting for set batch scan to complete", + __func__); + ret = -EINVAL; + goto exit; + } + } + if ( !pRsp->nScansToBatch ) + { + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "%s: Received set batch scan failure response from FW", + __func__); + ret = -EINVAL; + goto exit; + } + /*As per the Batch Scan Framework API we should return the MIN of + either MSCAN or the max # of scans firmware can cache*/ + ret = MIN(pReq->numberOfScansToBatch , pRsp->nScansToBatch); + + pAdapter->batchScanState = eHDD_BATCH_SCAN_STATE_STARTED; + + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "%s: request MSCAN %d response MSCAN %d ret %d", + __func__, pReq->numberOfScansToBatch, pRsp->nScansToBatch, ret); + } + else + { + VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "sme_SetBatchScanReq returned failure halStatus %d", + halStatus); + ret = -EINVAL; + goto exit; + } + } + else if (strncmp(command, "WLS_BATCHING STOP", 17) == 0) + { + eHalStatus halStatus; + tSirStopBatchScanInd *pInd = &pAdapter->hddStopBatchScanInd; + pInd->param = 0; + + if (FALSE == sme_IsFeatureSupportedByFW(BATCH_SCAN)) + { + VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "%s: Batch scan feature is not supported by FW", __func__); + ret = -EINVAL; + goto exit; + } + + if (eHDD_BATCH_SCAN_STATE_STARTED != pAdapter->batchScanState) + { + VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "Batch scan is not yet enabled batch scan state %d", + pAdapter->batchScanState); + ret = -EINVAL; + goto exit; + } + + mutex_lock(&pAdapter->hdd_batch_scan_lock); + hdd_deinit_batch_scan(pAdapter); + mutex_unlock(&pAdapter->hdd_batch_scan_lock); + + pAdapter->batchScanState = eHDD_BATCH_SCAN_STATE_STOPPED; + + halStatus = sme_StopBatchScanInd(WLAN_HDD_GET_HAL_CTX(pAdapter), pInd, + pAdapter->sessionId); + if ( eHAL_STATUS_SUCCESS == halStatus ) + { + ret = 0; + VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, + "sme_StopBatchScanInd returned success halStatus %d", + halStatus); + } + else + { + VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "sme_StopBatchScanInd returned failure halStatus %d", + halStatus); + ret = -EINVAL; + goto exit; + } + } + else if (strncmp(command, "WLS_BATCHING GET", 16) == 0) + { + tANI_U32 remain_len; + + if (FALSE == sme_IsFeatureSupportedByFW(BATCH_SCAN)) + { + VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "%s: Batch scan feature is not supported by FW", __func__); + ret = -EINVAL; + goto exit; + } + + if (eHDD_BATCH_SCAN_STATE_STARTED != pAdapter->batchScanState) + { + VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "Batch scan is not yet enabled could not return results" + "Batch Scan state %d", + pAdapter->batchScanState); + ret = -EINVAL; + goto exit; + } + + pPrivdata->used_len = 16; + remain_len = pPrivdata->total_len - pPrivdata->used_len; + if (remain_len < pPrivdata->total_len) + { + /*Clear previous batch scan response data if any*/ + vos_mem_zero((tANI_U8 *)(command + pPrivdata->used_len), remain_len); + } + else + { + VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "Invalid total length from user space can't fetch batch" + " scan response total_len %d used_len %d remain len %d", + pPrivdata->total_len, pPrivdata->used_len, remain_len); + ret = -EINVAL; + goto exit; + } + ret = hdd_return_batch_scan_rsp_to_user(pAdapter, pPrivdata, command); + } + +exit: + + return ret; +} + #endif/*End of FEATURE_WLAN_BATCH_SCAN*/ /**--------------------------------------------------------------------------- @@ -3801,218 +4044,14 @@ int hdd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) status = sme_SendRateUpdateInd((tHalHandle)(pHddCtx->hHal), rateUpdateParams); } -#ifdef FEATURE_WLAN_BATCH_SCAN - else if (strncmp(command, "WLS_BATCHING VERSION", 20) == 0) - { - char extra[32]; - tANI_U8 len = 0; - tANI_U8 version = HDD_BATCH_SCAN_VERSION; - - if (FALSE == sme_IsFeatureSupportedByFW(BATCH_SCAN)) - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "%s: Batch scan feature is not supported by FW", __func__); - ret = -EINVAL; - goto exit; - } - - if ((WLAN_HDD_INFRA_STATION != pAdapter->device_mode) && - (WLAN_HDD_P2P_CLIENT != pAdapter->device_mode) && - (WLAN_HDD_P2P_DEVICE != pAdapter->device_mode)) - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "Received WLS_BATCHING_VERSION command in invalid mode %d " - "WLS_BATCHING_VERSION is only allowed in infra STA/P2P client" - " mode", - pAdapter->device_mode); - ret = -EINVAL; - goto exit; - } - - len = scnprintf(extra, sizeof(extra), "WLS_BATCHING_VERSION %d", - version); - if (copy_to_user(priv_data.buf, &extra, len + 1)) - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "%s: failed to copy data to user buffer", __func__); - ret = -EFAULT; - goto exit; - } - ret = HDD_BATCH_SCAN_VERSION; - } - else if (strncmp(command, "WLS_BATCHING SET", 16) == 0) - { - int status; - tANI_U8 *value = (command + 16); - eHalStatus halStatus; - unsigned long rc; - tSirSetBatchScanReq *pReq = &pAdapter->hddSetBatchScanReq; - tSirSetBatchScanRsp *pRsp = &pAdapter->hddSetBatchScanRsp; - - if (FALSE == sme_IsFeatureSupportedByFW(BATCH_SCAN)) - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "%s: Batch scan feature is not supported by FW", __func__); - ret = -EINVAL; - goto exit; - } - - if ((WLAN_HDD_INFRA_STATION != pAdapter->device_mode) && - (WLAN_HDD_P2P_CLIENT != pAdapter->device_mode) && - (WLAN_HDD_P2P_DEVICE != pAdapter->device_mode)) - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "Received WLS_BATCHING SET command in invalid mode %d " - "WLS_BATCHING_SET is only allowed in infra STA/P2P client mode", - pAdapter->device_mode); - ret = -EINVAL; - goto exit; - } - - status = hdd_parse_set_batchscan_command(value, pReq); - if (status) - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "Invalid WLS_BATCHING SET command"); - ret = -EINVAL; - goto exit; - } - pAdapter->hdd_wait_for_set_batch_scan_rsp = TRUE; - halStatus = sme_SetBatchScanReq(WLAN_HDD_GET_HAL_CTX(pAdapter), pReq, - pAdapter->sessionId, hdd_set_batch_scan_req_callback, - pAdapter); - - if ( eHAL_STATUS_SUCCESS == halStatus ) - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, - "sme_SetBatchScanReq returned success halStatus %d", - halStatus); - if (TRUE == pAdapter->hdd_wait_for_set_batch_scan_rsp) - { - INIT_COMPLETION(pAdapter->hdd_set_batch_scan_req_var); - rc = wait_for_completion_timeout( - &pAdapter->hdd_set_batch_scan_req_var, - msecs_to_jiffies(HDD_SET_BATCH_SCAN_REQ_TIME_OUT)); - if (0 == rc) - { - VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "%s: Timeout waiting for set batch scan to complete", - __func__); - ret = -EINVAL; - goto exit; - } - } - if ( !pRsp->nScansToBatch ) - { - VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "%s: Received set batch scan failure response from FW", - __func__); - ret = -EINVAL; - goto exit; - } - /*As per the Batch Scan Framework API we should return the MIN of - either MSCAN or the max # of scans firmware can cache*/ - ret = MIN(pReq->numberOfScansToBatch , pRsp->nScansToBatch); - - pAdapter->batchScanState = eHDD_BATCH_SCAN_STATE_STARTED; - - VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "%s: request MSCAN %d response MSCAN %d ret %d", - __func__, pReq->numberOfScansToBatch, pRsp->nScansToBatch, ret); - } - else - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "sme_SetBatchScanReq returned failure halStatus %d", - halStatus); - ret = -EINVAL; - goto exit; - } - } - else if (strncmp(command, "WLS_BATCHING STOP", 17) == 0) - { - eHalStatus halStatus; - tSirStopBatchScanInd *pInd = &pAdapter->hddStopBatchScanInd; - pInd->param = 0; - - if (FALSE == sme_IsFeatureSupportedByFW(BATCH_SCAN)) - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "%s: Batch scan feature is not supported by FW", __func__); - ret = -EINVAL; - goto exit; - } - - if (eHDD_BATCH_SCAN_STATE_STARTED != pAdapter->batchScanState) - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "Batch scan is not yet enabled batch scan state %d", - pAdapter->batchScanState); - ret = -EINVAL; - goto exit; - } - pAdapter->batchScanState = eHDD_BATCH_SCAN_STATE_STOPPED; - - halStatus = sme_StopBatchScanInd(WLAN_HDD_GET_HAL_CTX(pAdapter), pInd, - pAdapter->sessionId); - if ( eHAL_STATUS_SUCCESS == halStatus ) - { - ret = 0; - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, - "sme_StopBatchScanInd returned success halStatus %d", - halStatus); - } - else - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "sme_StopBatchScanInd returned failure halStatus %d", - halStatus); - ret = -EINVAL; - goto exit; - } - } - else if (strncmp(command, "WLS_BATCHING GET", 16) == 0) +#ifdef FEATURE_WLAN_BATCH_SCAN + else if (strncmp(command, "WLS_BATCHING", 12) == 0) { - tANI_U32 remain_len; - - if (FALSE == sme_IsFeatureSupportedByFW(BATCH_SCAN)) - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "%s: Batch scan feature is not supported by FW", __func__); - ret = -EINVAL; - goto exit; - } - - if (eHDD_BATCH_SCAN_STATE_STARTED != pAdapter->batchScanState) - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "Batch scan is not yet enabled could not return results" - "Batch Scan state %d", - pAdapter->batchScanState); - ret = -EINVAL; - goto exit; - } - - priv_data.used_len = 16; - remain_len = priv_data.total_len - priv_data.used_len; - if (remain_len < priv_data.total_len) - { - /*Clear previous batch scan response data if any*/ - vos_mem_zero((tANI_U8 *)(command + priv_data.used_len), remain_len); - } - else - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "Invalid total length from user space can't fetch batch" - " scan response total_len %d used_len %d remain len %d", - priv_data.total_len, priv_data.used_len, remain_len); - ret = -EINVAL; - goto exit; - } - ret = hdd_return_batch_scan_rsp_to_user(pAdapter, &priv_data, command); + ret = hdd_handle_batch_scan_ioctl(pAdapter, &priv_data, command); } #endif + #if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD) else if (strncmp(command, "SETCCXROAMSCANCHANNELS", 22) == 0) { @@ -6690,11 +6729,6 @@ void hdd_cleanup_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter, tANI_ { struct net_device *pWlanDev = NULL; -#ifdef FEATURE_WLAN_BATCH_SCAN - tHddBatchScanRsp *pNode; - tHddBatchScanRsp *pPrev; -#endif - if (pAdapter) pWlanDev = pAdapter->dev; else { @@ -6704,14 +6738,20 @@ void hdd_cleanup_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter, tANI_ } #ifdef FEATURE_WLAN_BATCH_SCAN - pNode = pAdapter->pBatchScanRsp; - while (pNode) + if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) + || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) + || (pAdapter->device_mode == WLAN_HDD_P2P_GO) + || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) + ) + { + if (pAdapter) { - pPrev = pNode; - pNode = pNode->pNext; - vos_mem_free((v_VOID_t * )pPrev); + if (eHDD_BATCH_SCAN_STATE_STARTED == pAdapter->batchScanState) + { + hdd_deinit_batch_scan(pAdapter); + } } - pAdapter->pBatchScanRsp = NULL; + } #endif if(test_bit(NET_DEVICE_REGISTERED, &pAdapter->event_flags)) { @@ -7473,6 +7513,44 @@ VOS_STATUS hdd_stop_all_adapters( hdd_context_t *pHddCtx ) return VOS_STATUS_SUCCESS; } +#ifdef FEATURE_WLAN_BATCH_SCAN +/**--------------------------------------------------------------------------- + + \brief hdd_deinit_batch_scan () - This function cleans up batch scan data + structures + + \param - pAdapter Pointer to HDD adapter + + \return - None + + --------------------------------------------------------------------------*/ +void hdd_deinit_batch_scan(hdd_adapter_t *pAdapter) +{ + tHddBatchScanRsp *pNode; + tHddBatchScanRsp *pPrev; + + if (pAdapter) + { + pNode = pAdapter->pBatchScanRsp; + while (pNode) + { + pPrev = pNode; + pNode = pNode->pNext; + vos_mem_free((v_VOID_t * )pPrev); + } + pAdapter->pBatchScanRsp = NULL; + } + + pAdapter->pBatchScanRsp = NULL; + pAdapter->numScanList = 0; + pAdapter->batchScanState = eHDD_BATCH_SCAN_STATE_STOPPED; + pAdapter->prev_batch_id = 0; + + return; +} +#endif + + VOS_STATUS hdd_reset_all_adapters( hdd_context_t *pHddCtx ) { hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; @@ -7498,6 +7576,13 @@ VOS_STATUS hdd_reset_all_adapters( hdd_context_t *pHddCtx ) clear_bit(WMM_INIT_DONE, &pAdapter->event_flags); } +#ifdef FEATURE_WLAN_BATCH_SCAN + if (eHDD_BATCH_SCAN_STATE_STARTED == pAdapter->batchScanState) + { + hdd_deinit_batch_scan(pAdapter); + } +#endif + status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); pAdapterNode = pNext; } diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c index 2e04c299a9fb..765254829b51 100644 --- a/CORE/SERVICES/WMA/wma.c +++ b/CORE/SERVICES/WMA/wma.c @@ -15114,13 +15114,13 @@ wma_batch_scan_result_event_handler tSirBatchScanResultIndParam *pHddResult; tSirBatchScanNetworkInfo *pHddApMetaInfo; tp_wma_handle wma = (tp_wma_handle) handle; - u_int32_t nextScanListOffset, nextApMetaInfoOffset; - u_int8_t bssid[IEEE80211_ADDR_LEN], ssid[33], *ssid_temp; - u_int32_t temp, count1, count2, scan_num, netinfo_num, total_size; - WMI_BATCH_SCAN_RESULT_EVENTID_param_tlvs *param_tlvs; - wmi_batch_scan_result_event_fixed_param *fix_param; wmi_batch_scan_result_scan_list *scan_list; wmi_batch_scan_result_network_info *network_info; + wmi_batch_scan_result_event_fixed_param *fix_param; + WMI_BATCH_SCAN_RESULT_EVENTID_param_tlvs *param_tlvs; + u_int8_t bssid[IEEE80211_ADDR_LEN], ssid[33], *ssid_temp; + u_int32_t temp, count1, count2, scan_num, netinfo_num, total_size; + u_int32_t nextScanListOffset, nextApMetaInfoOffset, numNetworkInScanList; tpAniSirGlobal pMac = (tpAniSirGlobal )vos_get_context(VOS_MODULE_ID_PE, wma->vos_context); @@ -15192,12 +15192,18 @@ wma_batch_scan_result_event_handler network_info = param_tlvs->network_list; nextScanListOffset = 0; nextApMetaInfoOffset = 0; + numNetworkInScanList = 0; + for(count1 = 0; count1 < scan_num; count1++) { - pHddScanList = (tSirBatchScanList *)(pHddResult->scanResults + + pHddScanList = (tSirBatchScanList *)((tANI_U8 *)pHddResult->scanResults + nextScanListOffset); pHddScanList->scanId = scan_list->scanId; pHddScanList->numNetworksInScanList = scan_list->numNetworksInScanList; + numNetworkInScanList = pHddScanList->numNetworksInScanList; + + /*Initialize next AP meta info offset for next scan list*/ + nextApMetaInfoOffset = 0; for (count2 = 0; count2 < scan_list->numNetworksInScanList; count2++) { @@ -15242,7 +15248,9 @@ wma_batch_scan_result_event_handler network_info++; } - nextScanListOffset += (sizeof(tSirBatchScanList) - (sizeof(tANI_U8))); + nextScanListOffset += ((sizeof(tSirBatchScanList) - sizeof(tANI_U8)) + + (sizeof(tSirBatchScanNetworkInfo) + * numNetworkInScanList)); scan_list++; } |
