|
@@ -654,230 +654,11 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
|
|
|
!qdf_mem_cmp(&request->ssids[0], "DIRECT-", 7))
|
|
|
ucfg_p2p_status_scan(adapter->hdd_vdev);
|
|
|
|
|
|
-#ifdef NAPIER_SCAN
|
|
|
status = wlan_cfg80211_scan(hdd_ctx->hdd_pdev, request, ¶ms);
|
|
|
if (params.default_ie.ptr)
|
|
|
qdf_mem_free(params.default_ie.ptr);
|
|
|
- return status;
|
|
|
-#else
|
|
|
- /* Below code will be removed once common scan module is available.*/
|
|
|
- qdf_mem_zero(&scan_req, sizeof(scan_req));
|
|
|
-
|
|
|
- scan_req.timestamp = qdf_mc_timer_get_system_time();
|
|
|
-
|
|
|
- /* Even though supplicant doesn't provide any SSIDs, n_ssids is
|
|
|
- * set to 1. Because of this, driver is assuming that this is not
|
|
|
- * wildcard scan and so is not aging out the scan results.
|
|
|
- */
|
|
|
- if ((request->ssids) && (request->n_ssids == 1) &&
|
|
|
- ('\0' == request->ssids->ssid[0])) {
|
|
|
- request->n_ssids = 0;
|
|
|
- }
|
|
|
-
|
|
|
- if ((request->ssids) && (0 < request->n_ssids)) {
|
|
|
- tCsrSSIDInfo *SsidInfo;
|
|
|
- int j;
|
|
|
-
|
|
|
- scan_req.SSIDs.numOfSSIDs = request->n_ssids;
|
|
|
- /* Allocate num_ssid tCsrSSIDInfo structure */
|
|
|
- SsidInfo = scan_req.SSIDs.SSIDList =
|
|
|
- qdf_mem_malloc(request->n_ssids * sizeof(tCsrSSIDInfo));
|
|
|
-
|
|
|
- if (NULL == scan_req.SSIDs.SSIDList) {
|
|
|
- hdd_err("memory alloc failed SSIDInfo buffer");
|
|
|
- return -ENOMEM;
|
|
|
- }
|
|
|
-
|
|
|
- /* copy all the ssid's and their length */
|
|
|
- for (j = 0; j < request->n_ssids; j++, SsidInfo++) {
|
|
|
- /* get the ssid length */
|
|
|
- SsidInfo->SSID.length = request->ssids[j].ssid_len;
|
|
|
- qdf_mem_copy(SsidInfo->SSID.ssId,
|
|
|
- &request->ssids[j].ssid[0],
|
|
|
- SsidInfo->SSID.length);
|
|
|
- SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0';
|
|
|
- hdd_debug("SSID number %d: %s", j,
|
|
|
- SsidInfo->SSID.ssId);
|
|
|
- }
|
|
|
- /* set the scan type to active */
|
|
|
- scan_req.scanType = eSIR_ACTIVE_SCAN;
|
|
|
- } else if (QDF_P2P_GO_MODE == adapter->device_mode) {
|
|
|
- /* set the scan type to active */
|
|
|
- scan_req.scanType = eSIR_ACTIVE_SCAN;
|
|
|
- } else {
|
|
|
- /*
|
|
|
- * Set the scan type to passive if there is no ssid list
|
|
|
- * provided else set default type configured in the driver.
|
|
|
- */
|
|
|
- if (!request->ssids)
|
|
|
- scan_req.scanType = eSIR_PASSIVE_SCAN;
|
|
|
- else
|
|
|
- scan_req.scanType = hdd_ctx->ioctl_scan_mode;
|
|
|
- }
|
|
|
- if (scan_req.scanType == eSIR_PASSIVE_SCAN) {
|
|
|
- scan_req.minChnTime = cfg_param->nPassiveMinChnTime;
|
|
|
- scan_req.maxChnTime = cfg_param->nPassiveMaxChnTime;
|
|
|
- } else {
|
|
|
- scan_req.minChnTime = cfg_param->nActiveMinChnTime;
|
|
|
- scan_req.maxChnTime = cfg_param->nActiveMaxChnTime;
|
|
|
- }
|
|
|
-
|
|
|
- wlan_hdd_copy_bssid_scan_request(&scan_req, request);
|
|
|
-
|
|
|
- /* set BSSType to default type */
|
|
|
- scan_req.BSSType = eCSR_BSS_TYPE_ANY;
|
|
|
-
|
|
|
- if (MAX_CHANNEL < request->n_channels) {
|
|
|
- hdd_warn("No of Scan Channels exceeded limit: %d",
|
|
|
- request->n_channels);
|
|
|
- request->n_channels = MAX_CHANNEL;
|
|
|
- }
|
|
|
-
|
|
|
- if (request->n_channels) {
|
|
|
- char chList[(request->n_channels * 5) + 1];
|
|
|
- int len;
|
|
|
-
|
|
|
- channelList = qdf_mem_malloc(request->n_channels);
|
|
|
- if (NULL == channelList) {
|
|
|
- hdd_err("channelList malloc failed channelList");
|
|
|
- status = -ENOMEM;
|
|
|
- goto free_mem;
|
|
|
- }
|
|
|
- for (i = 0, len = 0; i < request->n_channels; i++) {
|
|
|
- if (WLAN_REG_IS_11P_CH(
|
|
|
- pHddCrequest->channels[i]->hw_value))
|
|
|
- continue;
|
|
|
-
|
|
|
- channelList[num_chan] = request->channels[i]->hw_value;
|
|
|
- len += snprintf(chList + len, 5, "%d ", channelList[i]);
|
|
|
- num_chan++;
|
|
|
- }
|
|
|
- hdd_debug("Channel-List: %s", chList);
|
|
|
- hdd_debug("No. of Scan Channels: %d", num_chan);
|
|
|
- }
|
|
|
- if (!num_chan) {
|
|
|
- hdd_err("Received zero non-dsrc channels");
|
|
|
- status = -EINVAL;
|
|
|
- goto free_mem;
|
|
|
- }
|
|
|
-
|
|
|
- scan_req.ChannelInfo.numOfChannels = num_chan;
|
|
|
- scan_req.ChannelInfo.ChannelList = channelList;
|
|
|
-
|
|
|
- /* set requestType to full scan */
|
|
|
- scan_req.requestType = eCSR_SCAN_REQUEST_FULL_SCAN;
|
|
|
-
|
|
|
- /* Flush the scan results(only p2p beacons) for STA scan and P2P
|
|
|
- * search (Flush on both full scan and social scan but not on single
|
|
|
- * channel scan).P2P search happens on 3 social channels (1, 6, 11)
|
|
|
- */
|
|
|
-
|
|
|
- /* Supplicant does single channel scan after 8-way handshake
|
|
|
- * and in that case driver shoudnt flush scan results. If
|
|
|
- * driver flushes the scan results here and unfortunately if
|
|
|
- * the AP doesnt respond to our probe req then association
|
|
|
- * fails which is not desired
|
|
|
- */
|
|
|
-
|
|
|
- if ((request->n_ssids == 1) &&
|
|
|
- (request->ssids != NULL) &&
|
|
|
- qdf_mem_cmp(&request->ssids[0], "DIRECT-", 7))
|
|
|
- is_p2p_scan = true;
|
|
|
-
|
|
|
- if (is_p2p_scan ||
|
|
|
- (request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN)) {
|
|
|
- hdd_debug("Flushing P2P Results");
|
|
|
- sme_scan_flush_p2p_result(WLAN_HDD_GET_HAL_CTX(adapter),
|
|
|
- adapter->session_id);
|
|
|
- }
|
|
|
- if (request->ie_len) {
|
|
|
- pP2pIe = wlan_hdd_get_p2p_ie_ptr((uint8_t *) request->ie,
|
|
|
- request->ie_len);
|
|
|
- if (pP2pIe != NULL) {
|
|
|
- /* no_cck will be set during p2p find to
|
|
|
- * disable 11b rates
|
|
|
- */
|
|
|
- if (request->no_cck) {
|
|
|
- hdd_debug("This is a P2P Search");
|
|
|
- scan_req.p2pSearch = 1;
|
|
|
-
|
|
|
- if (request->n_channels ==
|
|
|
- WLAN_HDD_P2P_SOCIAL_CHANNELS) {
|
|
|
- /* set requestType to P2P Discovery */
|
|
|
- scan_req.requestType =
|
|
|
- eCSR_SCAN_P2P_DISCOVERY;
|
|
|
- }
|
|
|
-
|
|
|
- /*
|
|
|
- * Skip Dfs Channel in case of P2P Search if
|
|
|
- * it is set in ini file
|
|
|
- */
|
|
|
- if (cfg_param->skipDfsChnlInP2pSearch)
|
|
|
- scan_req.skipDfsChnlInP2pSearch = 1;
|
|
|
- else
|
|
|
- scan_req.skipDfsChnlInP2pSearch = 0;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- scan_req.uIEFieldLen = scan_info->scan_add_ie.length;
|
|
|
- scan_req.pIEField = scan_info->scan_add_ie.addIEdata;
|
|
|
-
|
|
|
- /* acquire the wakelock to avoid the apps suspend during the scan. To
|
|
|
- * address the following issues.
|
|
|
- * 1) Disconnected scenario: we are not allowing the suspend as WLAN
|
|
|
- * is not in BMPS/IMPS this result in android trying to suspend
|
|
|
- * aggressively and backing off for long time, this result in apps
|
|
|
- * running at full power for long time.
|
|
|
- * 2) Connected scenario: If we allow the suspend during the scan,
|
|
|
- * RIVA will be stuck in full power because of resume BMPS
|
|
|
- */
|
|
|
- hdd_prevent_suspend_timeout(HDD_WAKE_LOCK_SCAN_DURATION,
|
|
|
- WIFI_POWER_EVENT_WAKELOCK_SCAN);
|
|
|
-
|
|
|
- hdd_debug("requestType %d, scanType %d, minChnTime %d, maxChnTime %d,p2pSearch %d, skipDfsChnlIn P2pSearch %d",
|
|
|
- scan_req.requestType, scan_req.scanType,
|
|
|
- scan_req.minChnTime, scan_req.maxChnTime,
|
|
|
- scan_req.p2pSearch, scan_req.skipDfsChnlInP2pSearch);
|
|
|
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 7, 0))
|
|
|
- if (request->flags & NL80211_SCAN_FLAG_FLUSH)
|
|
|
- sme_scan_flush_result(WLAN_HDD_GET_HAL_CTX(adapter));
|
|
|
-#endif
|
|
|
- status = sme_scan_request(WLAN_HDD_GET_HAL_CTX(adapter),
|
|
|
- adapter->session_id, &scan_req,
|
|
|
- &hdd_cfg80211_scan_done_callback, dev);
|
|
|
-
|
|
|
- if (QDF_STATUS_SUCCESS != status) {
|
|
|
- hdd_err("sme_scan_request returned error %d", status);
|
|
|
- if (QDF_STATUS_E_RESOURCES == status) {
|
|
|
- scan_ebusy_cnt++;
|
|
|
- hdd_err("HO is in progress. Defer scan scan_ebusy_cnt: %d",
|
|
|
- scan_ebusy_cnt);
|
|
|
- status = -EBUSY;
|
|
|
- } else {
|
|
|
- status = -EIO;
|
|
|
- }
|
|
|
- hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN);
|
|
|
- goto free_mem;
|
|
|
- }
|
|
|
- wlan_hdd_scan_request_enqueue(adapter, request, source,
|
|
|
- scan_req.scan_id, scan_req.timestamp);
|
|
|
- adapter->scan_info.mScanPending = true;
|
|
|
- hdd_ctx->beacon_probe_rsp_cnt_per_scan = 0;
|
|
|
-free_mem:
|
|
|
- if (scan_req.SSIDs.SSIDList)
|
|
|
- qdf_mem_free(scan_req.SSIDs.SSIDList);
|
|
|
-
|
|
|
- if (channelList)
|
|
|
- qdf_mem_free(channelList);
|
|
|
-
|
|
|
- if (status == 0)
|
|
|
- scan_ebusy_cnt = 0;
|
|
|
-
|
|
|
EXIT();
|
|
|
return status;
|
|
|
-#endif
|
|
|
-
|
|
|
}
|
|
|
|
|
|
#undef SCAN_FAILURE
|