qcacld-3.0: Remove unused SCAN code under NAPIER_SCAN define

Clean up unused legacy scan code under NAPIER_SCAN define.

Change-Id: I7e04b4488b10021d6815e76d0a55e040756b1794
CRs-Fixed: 2253647
This commit is contained in:
Vignesh Viswanathan 2018-06-05 12:19:47 +05:30 committed by nshrivas
parent b3bceade65
commit 9eab59313b
4 changed files with 0 additions and 784 deletions

1
Kbuild
View File

@ -1489,7 +1489,6 @@ cppflags-$(CONFIG_160MHZ_SUPPORT) += -DCONFIG_160MHZ_SUPPORT
cppflags-$(CONFIG_MCL) += -DCONFIG_MCL
cppflags-$(CONFIG_MCL_REGDB) += -DCONFIG_MCL_REGDB
cppflags-$(CONFIG_LEGACY_CHAN_ENUM) += -DCONFIG_LEGACY_CHAN_ENUM
cppflags-$(CONFIG_NAPIER_SCAN) += -DNAPIER_SCAN
cppflags-$(CONFIG_WLAN_PMO_ENABLE) += -DWLAN_PMO_ENABLE
cppflags-$(CONFIG_CONVERGED_P2P_ENABLE) += -DCONVERGED_P2P_ENABLE
cppflags-$(CONFIG_WLAN_POLICY_MGR_ENABLE) += -DWLAN_POLICY_MGR_ENABLE

View File

@ -501,7 +501,6 @@ CONFIG_160MHZ_SUPPORT := y
CONFIG_MCL := y
CONFIG_MCL_REGDB := y
CONFIG_LEGACY_CHAN_ENUM := y
CONFIG_NAPIER_SCAN := y
CONFIG_WLAN_PMO_ENABLE := y
CONFIG_CONVERGED_P2P_ENABLE := y
CONFIG_WLAN_POLICY_MGR_ENABLE := y

View File

@ -24,7 +24,6 @@ CONFIG_WIFI_POS_LEGACY := n
CONFIG_FEATURE_WLAN_WAPI := y
CONFIG_AGEIE_ON_SCAN_RESULTS := y
CONFIG_LEGACY_CHAN_ENUM := y
CONFIG_NAPIER_SCAN := y
CONFIG_WLAN_PMO_ENABLE := y
CONFIG_CONVERGED_P2P_ENABLE := y
CONFIG_WLAN_POLICY_MGR_ENABLE := y

View File

@ -86,787 +86,6 @@ static bool csr_roam_is_valid_channel(tpAniSirGlobal pMac, uint8_t channel);
#define CSR_IS_SOCIAL_CHANNEL(channel) \
(((channel) == 1) || ((channel) == 6) || ((channel) == 11))
#ifndef NAPIER_SCAN
#define MIN_CHN_TIME_TO_FIND_GO 100
#define MAX_CHN_TIME_TO_FIND_GO 100
#define DIRECT_SSID_LEN 7
/* Increase dwell time for P2P search in ms */
#define P2P_SEARCH_DWELL_TIME_INCREASE 20
#define P2P_SOCIAL_CHANNELS 3
/**
* csr_scan_filter_given_chnl_band() - filter all channels which matches given
* channel's band
* @mac_ctx: pointer to mac context
* @channel: Given channel
* @dst_req: destination scan request
*
* when ever particular connection already exist, STA should not scan the
* channels which fall under same band as given channel's band.
* this routine will filter out those channels
*
* Return: true if success otherwise false for any failure
*/
static bool csr_scan_filter_given_chnl_band(tpAniSirGlobal mac_ctx,
uint8_t channel, tCsrScanRequest *dst_req) {
uint8_t valid_chnl_list[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
uint32_t filter_chnl_len = 0, i = 0;
uint32_t valid_chnl_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
if (!channel) {
sme_debug("Nothing to filter as no IBSS session");
return true;
}
if (!dst_req) {
sme_err("No valid scan requests");
return false;
}
/*
* In case of concurrent IBSS session exist, scan only
* those channels which are not in IBSS channel's band.
* In case if no-concurrent IBSS session exist then scan
* full band
*/
if (dst_req->ChannelInfo.numOfChannels == 0) {
csr_get_cfg_valid_channels(mac_ctx, valid_chnl_list,
&valid_chnl_len);
} else {
valid_chnl_len = (WNI_CFG_VALID_CHANNEL_LIST_LEN >
dst_req->ChannelInfo.numOfChannels) ?
dst_req->ChannelInfo.numOfChannels :
WNI_CFG_VALID_CHANNEL_LIST_LEN;
qdf_mem_copy(valid_chnl_list, dst_req->ChannelInfo.ChannelList,
valid_chnl_len);
}
for (i = 0; i < valid_chnl_len; i++) {
if (valid_chnl_list[i] >= WLAN_REG_MIN_11P_CH_NUM)
continue;
if (WLAN_REG_IS_5GHZ_CH(channel) &&
WLAN_REG_IS_24GHZ_CH(valid_chnl_list[i])) {
valid_chnl_list[filter_chnl_len] =
valid_chnl_list[i];
filter_chnl_len++;
} else if (WLAN_REG_IS_24GHZ_CH(channel) &&
WLAN_REG_IS_5GHZ_CH(valid_chnl_list[i])) {
valid_chnl_list[filter_chnl_len] =
valid_chnl_list[i];
filter_chnl_len++;
}
}
if (filter_chnl_len == 0) {
sme_err("there no channels to scan due to IBSS session");
return false;
}
if (dst_req->ChannelInfo.ChannelList) {
qdf_mem_free(dst_req->ChannelInfo.ChannelList);
dst_req->ChannelInfo.ChannelList = NULL;
dst_req->ChannelInfo.numOfChannels = 0;
}
dst_req->ChannelInfo.ChannelList =
qdf_mem_malloc(filter_chnl_len *
sizeof(*dst_req->ChannelInfo.ChannelList));
dst_req->ChannelInfo.numOfChannels = filter_chnl_len;
if (NULL == dst_req->ChannelInfo.ChannelList) {
sme_err("Memory allocation failed");
return false;
}
qdf_mem_copy(dst_req->ChannelInfo.ChannelList, valid_chnl_list,
filter_chnl_len);
return true;
}
/**
* csr_scan_copy_request_valid_channels_only() - scan request of valid channels
* @mac_ctx : pointer to Global Mac Structure
* @dst_req: pointer to tCsrScanRequest
* @skip_dfs_chnl: 1 - skip dfs channel, 0 - don't skip dfs channel
* @src_req: pointer to tCsrScanRequest
*
* This function makes a copy of scan request with valid channels
*
* Return: none
*/
static void csr_scan_copy_request_valid_channels_only(tpAniSirGlobal mac_ctx,
tCsrScanRequest *dst_req, uint8_t skip_dfs_chnl,
tCsrScanRequest *src_req)
{
uint32_t index = 0;
uint32_t new_index = 0;
uint16_t unsafe_chan[NUM_CHANNELS];
uint16_t unsafe_chan_cnt = 0;
uint16_t cnt = 0;
bool is_unsafe_chan;
qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
if (!qdf_ctx) {
cds_err("qdf_ctx is NULL");
return;
}
pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan,
&unsafe_chan_cnt,
sizeof(unsafe_chan));
if (mac_ctx->roam.configParam.sta_roam_policy.dfs_mode ==
CSR_STA_ROAM_POLICY_DFS_DISABLED)
skip_dfs_chnl = true;
for (index = 0; index < src_req->ChannelInfo.numOfChannels; index++) {
/* Allow scan on valid channels only.
* If it is p2p scan and valid channel list doesn't contain
* social channels, enforce scan on social channels because
* that is the only way to find p2p peers.
* This can happen only if band is set to 5Ghz mode.
*/
if (src_req->ChannelInfo.ChannelList[index] <
WLAN_REG_MIN_11P_CH_NUM &&
((csr_roam_is_valid_channel(mac_ctx,
src_req->ChannelInfo.ChannelList[index])) ||
((eCSR_SCAN_P2P_DISCOVERY == src_req->requestType) &&
CSR_IS_SOCIAL_CHANNEL(
src_req->ChannelInfo.ChannelList[index])))) {
if (((src_req->skipDfsChnlInP2pSearch ||
skip_dfs_chnl) && (CHANNEL_STATE_DFS ==
wlan_reg_get_channel_state(mac_ctx->pdev,
src_req->ChannelInfo.ChannelList[index]))) &&
(src_req->ChannelInfo.numOfChannels > 1)) {
sme_debug(
"reqType= %d, numOfChannels=%d, ignoring DFS channel %d",
src_req->requestType,
src_req->ChannelInfo.numOfChannels,
src_req->ChannelInfo.ChannelList
[index]);
continue;
}
if (mac_ctx->roam.configParam.
sta_roam_policy.skip_unsafe_channels &&
unsafe_chan_cnt) {
is_unsafe_chan = false;
for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) {
if (unsafe_chan[cnt] ==
src_req->ChannelInfo.
ChannelList[index]) {
is_unsafe_chan = true;
break;
}
}
if (is_unsafe_chan &&
((CSR_IS_CHANNEL_24GHZ(
src_req->ChannelInfo.
ChannelList[index]) &&
mac_ctx->roam.configParam.
sta_roam_policy.sap_operating_band ==
BAND_2G) ||
(WLAN_REG_IS_5GHZ_CH(
src_req->ChannelInfo.
ChannelList[index]) &&
mac_ctx->roam.configParam.
sta_roam_policy.sap_operating_band ==
BAND_5G))) {
QDF_TRACE(QDF_MODULE_ID_SME,
QDF_TRACE_LEVEL_DEBUG,
FL("ignoring unsafe channel %d"),
src_req->ChannelInfo.
ChannelList[index]);
continue;
}
}
dst_req->ChannelInfo.ChannelList[new_index] =
src_req->ChannelInfo.ChannelList[index];
new_index++;
}
}
dst_req->ChannelInfo.numOfChannels = new_index;
}
/**
* csr_scan_copy_request() - Function to copy scan request
* @mac_ctx : pointer to Global Mac Structure
* @dst_req: pointer to tCsrScanRequest
* @src_req: pointer to tCsrScanRequest
*
* This function makes a copy of scan request
*
* Return: 0 - Success, Error number - Failure
*/
QDF_STATUS csr_scan_copy_request(tpAniSirGlobal mac_ctx,
tCsrScanRequest *dst_req,
tCsrScanRequest *src_req)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
uint32_t len = sizeof(mac_ctx->roam.validChannelList);
uint32_t index = 0;
uint32_t new_index = 0;
enum channel_state channel_state;
uint8_t channel = 0;
bool skip_dfs_chnl =
mac_ctx->roam.configParam.initial_scan_no_dfs_chnl ||
!mac_ctx->scan.fEnableDFSChnlScan;
status = csr_scan_free_request(mac_ctx, dst_req);
if (!QDF_IS_STATUS_SUCCESS(status))
goto complete;
qdf_mem_copy(dst_req, src_req, sizeof(tCsrScanRequest));
/* Re-initialize the pointers to NULL since we did a copy */
dst_req->pIEField = NULL;
dst_req->ChannelInfo.ChannelList = NULL;
dst_req->SSIDs.SSIDList = NULL;
if (src_req->uIEFieldLen) {
dst_req->pIEField =
qdf_mem_malloc(src_req->uIEFieldLen);
if (NULL == dst_req->pIEField) {
status = QDF_STATUS_E_NOMEM;
sme_err("No memory for scanning IE fields");
goto complete;
} else {
status = QDF_STATUS_SUCCESS;
qdf_mem_copy(dst_req->pIEField, src_req->pIEField,
src_req->uIEFieldLen);
dst_req->uIEFieldLen = src_req->uIEFieldLen;
}
}
/* Allocate memory for IE field */
if (src_req->ChannelInfo.numOfChannels == 0) {
dst_req->ChannelInfo.ChannelList = NULL;
dst_req->ChannelInfo.numOfChannels = 0;
} else {
dst_req->ChannelInfo.ChannelList =
qdf_mem_malloc(src_req->ChannelInfo.numOfChannels *
sizeof(*dst_req->ChannelInfo.ChannelList));
if (NULL == dst_req->ChannelInfo.ChannelList) {
status = QDF_STATUS_E_NOMEM;
dst_req->ChannelInfo.numOfChannels = 0;
sme_err("No memory for scanning Channel List");
goto complete;
}
if ((src_req->scanType == eSIR_PASSIVE_SCAN) &&
(src_req->requestType == eCSR_SCAN_REQUEST_11D_SCAN)) {
for (index = 0; index < src_req->ChannelInfo.
numOfChannels; index++) {
channel_state = wlan_reg_get_channel_state(
mac_ctx->pdev,
src_req->ChannelInfo.
ChannelList[index]);
if (src_req->ChannelInfo.ChannelList[index] <
WLAN_REG_MIN_11P_CH_NUM &&
((CHANNEL_STATE_ENABLE ==
channel_state) ||
((CHANNEL_STATE_DFS == channel_state) &&
!skip_dfs_chnl))) {
dst_req->ChannelInfo.ChannelList
[new_index] =
src_req->
ChannelInfo.
ChannelList
[index];
new_index++;
}
}
dst_req->ChannelInfo.numOfChannels = new_index;
} else if (QDF_IS_STATUS_SUCCESS(
csr_get_cfg_valid_channels(mac_ctx,
mac_ctx->roam.validChannelList,
&len))) {
new_index = 0;
mac_ctx->roam.numValidChannels = len;
csr_scan_copy_request_valid_channels_only(mac_ctx,
dst_req, skip_dfs_chnl,
src_req);
} else {
sme_err(
"Couldn't get the valid Channel List, keeping requester's list");
new_index = 0;
for (index = 0; index < src_req->ChannelInfo.
numOfChannels; index++) {
if (src_req->ChannelInfo.ChannelList[index] <
WLAN_REG_MIN_11P_CH_NUM) {
dst_req->ChannelInfo.
ChannelList[new_index] =
src_req->ChannelInfo.
ChannelList[index];
new_index++;
}
}
dst_req->ChannelInfo.numOfChannels =
new_index;
}
} /* Allocate memory for Channel List */
/*
* If IBSS concurrent connection exist, and if the scan
* request comes from STA adapter then we need to filter
* out IBSS channel's band otherwise it will cause issue
* in IBSS+STA concurrency
*
* If DFS SAP/GO concurrent connection exist, and if the scan
* request comes from STA adapter then we need to filter
* out SAP/GO channel's band otherwise it will cause issue in
* SAP+STA concurrency
*/
if (policy_mgr_is_ibss_conn_exist(mac_ctx->psoc, &channel)) {
sme_debug("Conc IBSS exist, channel list will be modified");
} else if (policy_mgr_is_any_dfs_beaconing_session_present(
mac_ctx->psoc, &channel)) {
/*
* 1) if agile & DFS scans are supported
* 2) if hardware is DBS capable
* 3) if current hw mode is non-dbs
* if all above 3 conditions are true then don't skip any
* channel from scan list
*/
if (true != policy_mgr_is_current_hwmode_dbs(mac_ctx->psoc) &&
policy_mgr_get_dbs_plus_agile_scan_config(mac_ctx->psoc) &&
policy_mgr_get_single_mac_scan_with_dfs_config(
mac_ctx->psoc))
channel = 0;
else
sme_debug(
"Conc DFS SAP/GO exist, channel list will be modified");
}
if ((channel > 0) &&
(!csr_scan_filter_given_chnl_band(mac_ctx, channel, dst_req))) {
sme_err("Can't filter channels due to IBSS/SAP DFS");
goto complete;
}
if (src_req->SSIDs.numOfSSIDs == 0) {
dst_req->SSIDs.numOfSSIDs = 0;
dst_req->SSIDs.SSIDList = NULL;
} else {
dst_req->SSIDs.SSIDList =
qdf_mem_malloc(src_req->SSIDs.numOfSSIDs *
sizeof(*dst_req->SSIDs.SSIDList));
if (NULL == dst_req->SSIDs.SSIDList)
status = QDF_STATUS_E_NOMEM;
else
status = QDF_STATUS_SUCCESS;
if (QDF_IS_STATUS_SUCCESS(status)) {
dst_req->SSIDs.numOfSSIDs =
src_req->SSIDs.numOfSSIDs;
qdf_mem_copy(dst_req->SSIDs.SSIDList,
src_req->SSIDs.SSIDList,
src_req->SSIDs.numOfSSIDs *
sizeof(*dst_req->SSIDs.SSIDList));
} else {
dst_req->SSIDs.numOfSSIDs = 0;
sme_err("No memory for scanning SSID List");
goto complete;
}
} /* Allocate memory for SSID List */
qdf_mem_copy(&dst_req->bssid, &src_req->bssid,
sizeof(struct qdf_mac_addr));
dst_req->p2pSearch = src_req->p2pSearch;
dst_req->skipDfsChnlInP2pSearch =
src_req->skipDfsChnlInP2pSearch;
dst_req->scan_id = src_req->scan_id;
dst_req->timestamp = src_req->timestamp;
complete:
if (!QDF_IS_STATUS_SUCCESS(status))
csr_scan_free_request(mac_ctx, dst_req);
return status;
}
/**
* csr_scan_2g_only_request() - This function will update the scan request with
* only 2.4GHz valid channel list.
* @mac_ctx: Pointer to Global MAC structure
* @scan_cmd scan cmd
* @scan_req scan req
*
* This function will update the scan request with only 2.4GHz valid channel
* list.
*
* @Return: status of operation
*/
static QDF_STATUS
csr_scan_2g_only_request(tpAniSirGlobal mac_ctx,
tSmeCmd *scan_cmd,
tCsrScanRequest *scan_req)
{
uint8_t idx, lst_sz = 0;
QDF_ASSERT(scan_cmd && scan_req);
/* To silence the KW tool null check is added */
if ((scan_cmd == NULL) || (scan_req == NULL)) {
sme_err("Scan Cmd or Scan Request is NULL");
return QDF_STATUS_E_INVAL;
}
if (eCSR_SCAN_REQUEST_FULL_SCAN != scan_req->requestType)
return QDF_STATUS_SUCCESS;
sme_debug("Scanning only 2G Channels during first scan");
/* Contsruct valid Supported 2.4 GHz Channel List */
if (NULL == scan_req->ChannelInfo.ChannelList) {
scan_req->ChannelInfo.ChannelList =
qdf_mem_malloc(NUM_24GHZ_CHANNELS);
if (NULL == scan_req->ChannelInfo.ChannelList) {
sme_err("Memory allocation failed");
return QDF_STATUS_E_NOMEM;
}
for (idx = 1; idx <= NUM_24GHZ_CHANNELS; idx++) {
if (csr_is_supported_channel(mac_ctx, idx)) {
scan_req->ChannelInfo.ChannelList[lst_sz] = idx;
lst_sz++;
}
}
} else {
for (idx = 0;
idx < scan_req->ChannelInfo.numOfChannels;
idx++) {
if (scan_req->ChannelInfo.ChannelList[idx] <=
CDS_24_GHZ_CHANNEL_14
&& csr_is_supported_channel(mac_ctx,
scan_req->ChannelInfo.ChannelList[idx])) {
scan_req->ChannelInfo.ChannelList[lst_sz] =
scan_req->ChannelInfo.ChannelList[idx];
lst_sz++;
}
}
}
scan_req->ChannelInfo.numOfChannels = lst_sz;
return QDF_STATUS_SUCCESS;
}
/* Set scan timing parameters according to state of other driver sessions */
/* No validation of the parameters is performed. */
static void csr_set_default_scan_timing(tpAniSirGlobal pMac,
tSirScanType scanType,
tCsrScanRequest *pScanRequest)
{
if (csr_is_any_session_connected(pMac)) {
/* Reset passive scan time as per ini parameter. */
cfg_set_int(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME,
pMac->roam.configParam.nPassiveMaxChnTimeConc);
/* 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;
pScanRequest->min_rest_time =
pMac->roam.configParam.min_rest_time_conc;
pScanRequest->idle_time =
pMac->roam.configParam.idle_time_conc;
/* Return so that fields set above will not be overwritten. */
return;
}
/*
* This portion of the code is executed if no multi-session.
* Use the "regular" (non-concurrency) default scan timing if
* no multi session.
*/
cfg_set_int(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME,
pMac->roam.configParam.nPassiveMaxChnTime);
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;
}
/* No rest time/Idle time if no sessions are connected. */
pScanRequest->restTime = 0;
pScanRequest->min_rest_time = 0;
pScanRequest->idle_time = 0;
}
static QDF_STATUS
csr_issue_11d_scan(tpAniSirGlobal mac_ctx, tSmeCmd *scan_cmd,
tCsrScanRequest *scan_req, uint16_t session_id)
{
QDF_STATUS status;
tSmeCmd *scan_11d_cmd = NULL;
tCsrScanRequest tmp_rq;
tCsrChannelInfo *chn_info = &tmp_rq.ChannelInfo;
uint32_t num_chn = mac_ctx->scan.base_channels.numChannels;
struct csr_roam_session *csr_session = CSR_GET_SESSION(mac_ctx,
session_id);
if (csr_session == NULL) {
sme_err("session %d not found", session_id);
QDF_ASSERT(0);
return QDF_STATUS_E_FAILURE;
}
if (num_chn > WNI_CFG_VALID_CHANNEL_LIST_LEN) {
sme_err("invalid number of channels: %d", num_chn);
return QDF_STATUS_E_FAILURE;
}
if (!(((false == mac_ctx->first_scan_done)
&& (eCSR_SCAN_REQUEST_11D_SCAN != scan_req->requestType))
#ifdef SOFTAP_CHANNEL_RANGE
&& (eCSR_SCAN_SOFTAP_CHANNEL_RANGE != scan_req->requestType)
#endif
&& (false == mac_ctx->scan.fEnableBypass11d)))
return QDF_STATUS_SUCCESS;
qdf_mem_set(&tmp_rq, sizeof(tCsrScanRequest), 0);
scan_11d_cmd = csr_get_command_buffer(mac_ctx);
if (!scan_11d_cmd) {
sme_err("scan_11d_cmd failed");
return QDF_STATUS_E_FAILURE;
}
qdf_mem_set(&scan_11d_cmd->u.scanCmd, sizeof(struct scan_cmd), 0);
chn_info->ChannelList = qdf_mem_malloc(num_chn);
if (NULL == chn_info->ChannelList) {
sme_err("Failed to allocate memory");
return QDF_STATUS_E_NOMEM;
}
qdf_mem_copy(chn_info->ChannelList,
mac_ctx->scan.base_channels.channelList, num_chn);
chn_info->numOfChannels = (uint8_t) num_chn;
scan_11d_cmd->command = eSmeCommandScan;
scan_11d_cmd->u.scanCmd.callback = mac_ctx->scan.callback11dScanDone;
scan_11d_cmd->u.scanCmd.pContext = NULL;
tmp_rq.BSSType = eCSR_BSS_TYPE_ANY;
tmp_rq.scan_id = scan_11d_cmd->u.scanCmd.scanID;
status = qdf_mc_timer_init(&scan_11d_cmd->u.scanCmd.csr_scan_timer,
QDF_TIMER_TYPE_SW,
csr_scan_active_list_timeout_handle, scan_11d_cmd);
if (wlan_reg_11d_enabled_on_host(mac_ctx->psoc)) {
tmp_rq.bcnRptReqScan = scan_req->bcnRptReqScan;
if (scan_req->bcnRptReqScan)
tmp_rq.scanType = scan_req->scanType ?
eSIR_PASSIVE_SCAN : scan_req->scanType;
else
tmp_rq.scanType = eSIR_PASSIVE_SCAN;
tmp_rq.requestType = eCSR_SCAN_REQUEST_11D_SCAN;
tmp_rq.maxChnTime =
mac_ctx->roam.configParam.nPassiveMaxChnTime;
tmp_rq.minChnTime =
mac_ctx->roam.configParam.nPassiveMinChnTime;
} else {
tmp_rq.bcnRptReqScan = scan_req->bcnRptReqScan;
if (scan_req->bcnRptReqScan)
tmp_rq.scanType = scan_req->scanType;
else
tmp_rq.scanType = eSIR_ACTIVE_SCAN;
tmp_rq.requestType = scan_req->requestType;
tmp_rq.maxChnTime = mac_ctx->roam.configParam.nActiveMaxChnTime;
tmp_rq.minChnTime = mac_ctx->roam.configParam.nActiveMinChnTime;
}
if (mac_ctx->roam.configParam.nInitialDwellTime) {
tmp_rq.maxChnTime = mac_ctx->roam.configParam.nInitialDwellTime;
sme_debug("11d scan, updating dwell time for first scan %u",
tmp_rq.maxChnTime);
}
status = csr_scan_copy_request(mac_ctx,
&scan_11d_cmd->u.scanCmd.u.scanRequest, &tmp_rq);
/* Free the channel list */
qdf_mem_free(chn_info->ChannelList);
chn_info->ChannelList = NULL;
if (!QDF_IS_STATUS_SUCCESS(status)) {
sme_err("csr_scan_copy_request failed");
return QDF_STATUS_E_FAILURE;
}
mac_ctx->scan.scanProfile.numOfChannels =
scan_11d_cmd->u.scanCmd.u.scanRequest.ChannelInfo.numOfChannels;
status = csr_queue_sme_command(mac_ctx, scan_11d_cmd, false);
if (!QDF_IS_STATUS_SUCCESS(status)) {
sme_err("Failed to send message status = %d",
status);
return QDF_STATUS_E_FAILURE;
}
return QDF_STATUS_SUCCESS;
}
QDF_STATUS csr_scan_request(tpAniSirGlobal pMac, uint16_t sessionId,
tCsrScanRequest *scan_req,
csr_scan_completeCallback callback, void *pContext)
{
QDF_STATUS status = QDF_STATUS_E_FAILURE;
tSmeCmd *scan_cmd = NULL;
tCsrScanRequest *pTempScanReq = NULL;
struct csr_config *cfg_prm = &pMac->roam.configParam;
if (scan_req == NULL) {
sme_err("scan_req is NULL");
QDF_ASSERT(0);
return status;
}
/*
* During group formation, the P2P client scans for GO with the specific
* SSID. There will be chances of GO switching to other channels because
* of scan or to STA channel in case of STA+GO MCC scenario. So to
* increase the possibility of client to find the GO, the dwell time of
* scan is increased to 100ms.
* If the scan request is for specific SSId the length of SSID will be
* greater than 7 as SSID for p2p search contains "DIRECT-")
*/
if (scan_req->p2pSearch
&& scan_req->SSIDs.numOfSSIDs
&& (NULL != scan_req->SSIDs.SSIDList)
&& (scan_req->SSIDs.SSIDList->SSID.length > DIRECT_SSID_LEN)) {
sme_debug("P2P: Increasing the min and max Dwell time to %d for specific SSID scan %.*s",
MAX_CHN_TIME_TO_FIND_GO,
scan_req->SSIDs.SSIDList->SSID.length,
scan_req->SSIDs.SSIDList->SSID.ssId);
scan_req->maxChnTime = MAX_CHN_TIME_TO_FIND_GO;
scan_req->minChnTime = MIN_CHN_TIME_TO_FIND_GO;
}
scan_cmd = csr_get_command_buffer(pMac);
if (!scan_cmd) {
sme_err("scan_cmd is NULL");
goto release_cmd;
}
qdf_mem_set(&scan_cmd->u.scanCmd, sizeof(struct scan_cmd), 0);
scan_cmd->command = eSmeCommandScan;
scan_cmd->sessionId = sessionId;
if (scan_cmd->sessionId >= CSR_ROAM_SESSION_MAX)
sme_err("Invalid Sme SessionID: %d", sessionId);
scan_cmd->u.scanCmd.callback = callback;
scan_cmd->u.scanCmd.pContext = pContext;
if (scan_req->minChnTime == 0 && scan_req->maxChnTime == 0) {
/* The caller doesn't set the time correctly. Set it here */
csr_set_default_scan_timing(pMac, scan_req->scanType, scan_req);
sme_debug("Setting default min %d and max %d ChnTime",
scan_req->minChnTime, scan_req->maxChnTime);
}
/*
* Need to set restTime/min_Ret_time/idle_time
* only if at least one session is connected
*/
if (scan_req->restTime == 0 && csr_is_any_session_connected(pMac)) {
scan_req->restTime = cfg_prm->nRestTimeConc;
scan_req->min_rest_time = cfg_prm->min_rest_time_conc;
scan_req->idle_time = cfg_prm->idle_time_conc;
if (scan_req->scanType == eSIR_ACTIVE_SCAN) {
scan_req->maxChnTime = cfg_prm->nActiveMaxChnTimeConc;
scan_req->minChnTime = cfg_prm->nActiveMinChnTimeConc;
} else {
scan_req->maxChnTime = cfg_prm->nPassiveMaxChnTimeConc;
scan_req->minChnTime = cfg_prm->nPassiveMinChnTimeConc;
}
}
/* Increase dwell time in case P2P Search and Miracast is not present */
if (scan_req->p2pSearch && scan_req->ChannelInfo.numOfChannels
== P2P_SOCIAL_CHANNELS && (!(pMac->sme.miracast_value))) {
scan_req->maxChnTime += P2P_SEARCH_DWELL_TIME_INCREASE;
}
scan_cmd->u.scanCmd.scanID = scan_req->scan_id;
/*
* If it is the first scan request from HDD, CSR checks if it is for 11d
* If it is not, CSR will save the scan request in the pending cmd queue
* & issue an 11d scan request to PE.
*/
status = csr_issue_11d_scan(pMac, scan_cmd, scan_req, sessionId);
if (status != QDF_STATUS_SUCCESS)
goto release_cmd;
/*
* Scan only 2G Channels if set in ini file. This is mainly to reduce
* the First Scan duration once we turn on Wifi
*/
if (pMac->scan.fFirstScanOnly2GChnl
&& false == pMac->first_scan_done) {
csr_scan_2g_only_request(pMac, scan_cmd, scan_req);
pMac->first_scan_done = true;
}
if (cfg_prm->nInitialDwellTime) {
scan_req->maxChnTime = cfg_prm->nInitialDwellTime;
cfg_prm->nInitialDwellTime = 0;
sme_debug("updating dwell time for first scan %u",
scan_req->maxChnTime);
}
if (csr_is_conn_state_disconnected(pMac, sessionId))
scan_req->scan_adaptive_dwell_mode =
cfg_prm->scan_adaptive_dwell_mode_nc;
else
scan_req->scan_adaptive_dwell_mode =
cfg_prm->scan_adaptive_dwell_mode;
status = csr_scan_copy_request(pMac, &scan_cmd->u.scanCmd.u.scanRequest,
scan_req);
/*
* Reset the variable after the first scan is queued after loading the
* driver. The purpose of this parameter is that DFS channels are
* skipped during the first scan after loading the driver. The above API
* builds the target scan request in which this variable is used.
*/
cfg_prm->initial_scan_no_dfs_chnl = 0;
if (!QDF_IS_STATUS_SUCCESS(status)) {
sme_err("fail to copy request status: %d", status);
goto release_cmd;
}
pTempScanReq = &scan_cmd->u.scanCmd.u.scanRequest;
pMac->scan.scanProfile.numOfChannels =
pTempScanReq->ChannelInfo.numOfChannels;
status = qdf_mc_timer_init(&scan_cmd->u.scanCmd.csr_scan_timer,
QDF_TIMER_TYPE_SW,
csr_scan_active_list_timeout_handle, scan_cmd);
sme_debug(
"SId=%d scanId=%d numSSIDs=%d numChan=%d P2P search=%d minCT=%d maxCT=%d uIEFieldLen=%d BSSID: " MAC_ADDRESS_STR,
sessionId, scan_cmd->u.scanCmd.scanID,
pTempScanReq->SSIDs.numOfSSIDs,
pTempScanReq->ChannelInfo.numOfChannels,
pTempScanReq->p2pSearch, pTempScanReq->minChnTime,
pTempScanReq->maxChnTime, pTempScanReq->uIEFieldLen,
MAC_ADDR_ARRAY(scan_cmd->u.scanCmd.u.scanRequest.bssid.bytes));
status = csr_queue_sme_command(pMac, scan_cmd, false);
if (!QDF_IS_STATUS_SUCCESS(status)) {
sme_err("fail to send message status: %d", status);
return status;
}
release_cmd:
if (!QDF_IS_STATUS_SUCCESS(status) && scan_cmd) {
sme_err(" SId: %d Failed with status=%d numOfSSIDs=%d P2P search=%d scanId=%d",
sessionId, status,
scan_req->SSIDs.numOfSSIDs, scan_req->p2pSearch,
scan_cmd->u.scanCmd.scanID);
csr_release_command_buffer(pMac, scan_cmd);
}
return status;
}
#endif
/* pResult is invalid calling this function. */
void csr_free_scan_result_entry(tpAniSirGlobal pMac, struct tag_csrscan_result
*pResult)