From 221cf99fdf0f339804ea81aec1c8b27a6d71b60e Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Thu, 22 Feb 2018 13:44:53 +0530 Subject: [PATCH] qcacld-3.0: Cleanup unused scan code Cleanup the unused legacy scan code. Change-Id: Ia664f815759142e7f4ad8e648a469c63ddd003f5 CRs-Fixed: 2193917 --- core/hdd/src/wlan_hdd_scan.c | 24 - core/mac/inc/ani_global.h | 5 - core/mac/inc/sir_api.h | 162 --- core/mac/src/pe/include/lim_global.h | 37 - core/mac/src/pe/lim/lim_api.c | 6 - .../src/pe/lim/lim_process_message_queue.c | 1 - .../src/pe/lim/lim_process_mlm_req_messages.c | 68 -- .../src/pe/lim/lim_process_sme_req_messages.c | 2 - .../src/pe/lim/lim_send_management_frames.c | 17 +- core/mac/src/pe/lim/lim_sme_req_utils.c | 73 -- core/mac/src/pe/lim/lim_sme_req_utils.h | 3 +- core/mac/src/pe/lim/lim_timer_utils.c | 40 - core/mac/src/pe/lim/lim_timer_utils.h | 1 - core/mac/src/pe/lim/lim_trace.c | 3 +- core/mac/src/pe/lim/lim_types.h | 28 - core/mac/src/pe/lim/lim_utils.c | 23 - .../src/sys/legacy/src/utils/src/mac_trace.c | 1 - core/sme/inc/csr_api.h | 52 - core/sme/inc/csr_internal.h | 18 - core/sme/inc/sme_api.h | 1 - core/sme/inc/sme_inside.h | 1 - core/sme/inc/sme_internal.h | 2 - core/sme/src/csr/csr_api_roam.c | 24 +- core/sme/src/csr/csr_api_scan.c | 1029 ++++++++--------- core/sme/src/csr/csr_inside_api.h | 18 - core/sme/src/csr/csr_util.c | 17 - core/wma/inc/wma_internal.h | 9 - 27 files changed, 493 insertions(+), 1172 deletions(-) diff --git a/core/hdd/src/wlan_hdd_scan.c b/core/hdd/src/wlan_hdd_scan.c index 8cf88771f9ae..cc2d7095f0e8 100644 --- a/core/hdd/src/wlan_hdd_scan.c +++ b/core/hdd/src/wlan_hdd_scan.c @@ -337,30 +337,6 @@ void wlan_hdd_cfg80211_scan_block_cb(struct work_struct *work) cds_ssr_unprotect(__func__); } -/** - * wlan_hdd_copy_bssid_scan_request() - API to copy the bssid to Scan request - * @scan_req: Pointer to CSR Scan Request - * @request: scan request from Supplicant - * - * This API copies the BSSID in scan request from Supplicant and copies it to - * the CSR Scan request - * - * Return: None - */ -#if defined(CFG80211_SCAN_BSSID) || \ - (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) -static inline void wlan_hdd_copy_bssid_scan_request(tCsrScanRequest *scan_req, - struct cfg80211_scan_request *request) -{ - qdf_mem_copy(scan_req->bssid.bytes, request->bssid, QDF_MAC_ADDR_SIZE); -} -#else -static inline void wlan_hdd_copy_bssid_scan_request(tCsrScanRequest *scan_req, - struct cfg80211_scan_request *request) -{ -} -#endif - /* * wlan_hdd_update_scan_ies() - API to update the scan IEs of scan request * with already stored default scan IEs diff --git a/core/mac/inc/ani_global.h b/core/mac/inc/ani_global.h index dd2010e4acdb..c90b6fd50e84 100644 --- a/core/mac/inc/ani_global.h +++ b/core/mac/inc/ani_global.h @@ -292,8 +292,6 @@ typedef struct sLimTimers { /* Join Failure timeout on STA */ TX_TIMER gLimJoinFailureTimer; - TX_TIMER gLimPeriodicProbeReqTimer; - /* CNF_WAIT timer */ TX_TIMER *gpLimCnfWaitTimer; @@ -384,9 +382,6 @@ typedef struct sAniSirLim { uint16_t gDeferMsgTypeForNOA; uint32_t *gpDefdSmeMsgForNOA; - tLimMlmScanReq *gpLimMlmScanReq; - - /* Used to store the list of legacy bss sta detected during scan on one channel */ uint16_t gLimRestoreCBNumScanInterval; uint16_t gLimRestoreCBCount; diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 6622f1df4a20..c73b071a09e9 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -71,10 +71,6 @@ typedef struct sAniSirGlobal *tpAniSirGlobal; #define SIR_MAX_ELEMENT_ID 255 -/* Increase dwell time for P2P search in ms */ -#define P2P_SEARCH_DWELL_TIME_INCREASE 20 -#define P2P_SOCIAL_CHANNELS 3 - /* Max number of channels are 165, but to access 165th element of array, *array of 166 is required. */ @@ -377,8 +373,6 @@ struct rrm_config_param { #define IERATE_IS_BASICRATE(x) ((x) & IERATE_BASICRATE_MASK) const char *lim_bss_type_to_string(const uint16_t bss_type); -const char *lim_scan_type_to_string(const uint8_t scan_type); - /** * struct sSirSupportedRates - stores rates/MCS supported * @llbRates: 11b rates in unit of 500kbps @@ -870,117 +864,6 @@ typedef enum eSirLinkTrafficCheck { #define SIR_BG_SCAN_RETURN_LFR_CACHED_RESULTS 0x02 #define SIR_BG_SCAN_PURGE_LFR_RESULTS 0x40 -/* / Definition for scan request */ -typedef struct sSirSmeScanReq { - uint16_t messageType; /* eWNI_SME_SCAN_REQ */ - uint16_t length; - uint8_t sessionId; /* Session ID */ - uint16_t transactionId; /* Transaction ID for cmd */ - struct qdf_mac_addr bssId; - tSirMacSSid ssId[SIR_SCAN_MAX_NUM_SSID]; - struct qdf_mac_addr selfMacAddr; /* Added For BT-AMP Support */ - tSirBssType bssType; - uint8_t dot11mode; - tSirScanType scanType; - uint32_t scan_id; - /** - * minChannelTime. Not used if scanType is passive. - * 0x0 - Dont Use min channel timer. Only max channel timeout will used. - * 11k measurements set this to 0 to user only single duration for scan. - * - Timeout value used for min channel timeout. - */ - uint32_t minChannelTime; - /** - * maxChannelTime. - * 0x0 - Invalid. In case of active scan. - * In case of passive scan, MAX( maxChannelTime, - * WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME) is used. - */ - uint32_t maxChannelTime; - enum wmi_dwelltime_adaptive_mode scan_adaptive_dwell_mode; - /** - * returnAfterFirstMatch can take following values: - * 0x00 - Return SCAN_RSP message after complete channel scan - * 0x01 - Return SCAN_RSP message after collecting BSS description - * that matches scan criteria. - * 0xC0 - Return after collecting first 11d IE from 2.4 GHz & - * 5 GHz band channels - * 0x80 - Return after collecting first 11d IE from 5 GHz band - * channels - * 0x40 - Return after collecting first 11d IE from 2.4 GHz - * band channels - * - * Values of 0xC0, 0x80 & 0x40 are to be used by - * Roaming/application when 11d is enabled. - */ - /* in units of milliseconds, ignored when not connected */ - uint32_t restTime; - /*in units of milliseconds, ignored when not connected*/ - uint32_t min_rest_time; - /*in units of milliseconds, ignored when not connected*/ - uint32_t idle_time; - uint8_t returnAfterFirstMatch; - - /** - * returnUniqueResults can take following values: - * 0 - Collect & report all received BSS descriptions from same BSS. - * 1 - Collect & report unique BSS description from same BSS. - */ - uint8_t returnUniqueResults; - - /** - * returnFreshResults can take following values: - * 0x00 - Return background scan results. - * 0x80 - Return & purge background scan results - * 0x01 - Trigger fresh scan instead of returning background scan - * results. - * 0x81 - Trigger fresh scan instead of returning background scan - * results and purge background scan results. - */ - uint8_t returnFreshResults; - - /* backgroundScanMode can take following values: - * 0x0 - agressive scan - * 0x1 - normal scan where HAL will check for link traffic - * prior to proceeding with the scan - */ - tSirBackgroundScanMode backgroundScanMode; - - uint8_t hiddenSsid; - - /* Number of SSIDs to scan */ - uint8_t numSsid; - - /* channelList has to be the last member of this structure. Check - * tSirChannelList for the reason. This MUST be the last field of the - * structure - */ - - bool p2pSearch; - uint16_t uIEFieldLen; - uint16_t uIEFieldOffset; - - /* channelList MUST be the last field of this structure */ - tSirChannelList channelList; - /*----------------------------- - tSirSmeScanReq.... - ----------------------------- - uIEFiledLen - ----------------------------- - uIEFiledOffset ----+ - ----------------------------- | - channelList.numChannels | - ----------------------------- | - ... variable size up to | - channelNumber[numChannels-1] | - This can be zero, if | - numChannel is zero. | - ----------------------------- <--+ - ... variable size uIEFiled - up to uIEFieldLen (can be 0) - -----------------------------*/ -} tSirSmeScanReq, *tpSirSmeScanReq; - typedef struct sSirSmeScanAbortReq { uint16_t type; uint16_t msgLen; @@ -3692,51 +3575,6 @@ typedef struct sAniHandoffReq { uint8_t handoff_src; } tAniHandoffReq, *tpAniHandoffReq; -typedef struct sSirScanOffloadReq { - uint8_t sessionId; - struct qdf_mac_addr bssId; - uint8_t numSsid; - tSirMacSSid ssId[SIR_SCAN_MAX_NUM_SSID]; - uint8_t hiddenSsid; - struct qdf_mac_addr selfMacAddr; - tSirBssType bssType; - uint8_t dot11mode; - tSirScanType scanType; - uint32_t minChannelTime; - uint32_t maxChannelTime; - uint32_t scan_id; - uint32_t scan_requestor_id; - /* in units of milliseconds, ignored when not connected */ - uint32_t restTime; - /*in units of milliseconds, ignored when not connected*/ - uint32_t min_rest_time; - /*in units of milliseconds, ignored when not connected*/ - uint32_t idle_time; - tSirP2pScanType p2pScanType; - enum wmi_dwelltime_adaptive_mode scan_adaptive_dwell_mode; - uint16_t uIEFieldLen; - uint16_t uIEFieldOffset; - uint32_t burst_scan_duration; - tSirChannelList channelList; - /*----------------------------- - sSirScanOffloadReq.... - ----------------------------- - uIEFieldLen - ----------------------------- - uIEFieldOffset ----+ - ----------------------------- | - channelList.numChannels | - ----------------------------- | - ... variable size up to | - channelNumber[numChannels-1] | - This can be zero, if | - numChannel is zero. | - ----------------------------- <--+ - ... variable size uIEField - up to uIEFieldLen (can be 0) - -----------------------------*/ -} tSirScanOffloadReq, *tpSirScanOffloadReq; - /** * sir_scan_event_type - scan event types used in LIM * @SIR_SCAN_EVENT_STARTED - scan command accepted by FW diff --git a/core/mac/src/pe/include/lim_global.h b/core/mac/src/pe/include/lim_global.h index 0d1346aad97c..ec826951150e 100644 --- a/core/mac/src/pe/include/lim_global.h +++ b/core/mac/src/pe/include/lim_global.h @@ -248,43 +248,6 @@ typedef struct sLimMlmJoinReq { */ } tLimMlmJoinReq, *tpLimMlmJoinReq; -typedef struct sLimMlmScanReq { - tSirBssType bssType; - tSirMacAddr bssId; - tSirMacSSid ssId[SIR_SCAN_MAX_NUM_SSID]; - tSirScanType scanType; - uint32_t minChannelTime; - uint32_t maxChannelTime; - uint32_t dot11mode; - /* Number of SSIDs to scan(send Probe request) */ - uint8_t numSsid; - - bool p2pSearch; - uint16_t uIEFieldLen; - uint16_t uIEFieldOffset; - - uint8_t sessionId; - /* channelList MUST be the last field of this structure */ - tSirChannelList channelList; - /*----------------------------- - tLimMlmScanReq.... - ----------------------------- - uIEFiledLen - ----------------------------- - uIEFiledOffset ----+ - ----------------------------- | - channelList.numChannels | - ----------------------------- | - ... variable size up to | - channelNumber[numChannels-1] | - This can be zero, if | - numChannel is zero. | - ----------------------------- <--+ - ... variable size uIEFiled - up to uIEFieldLen (can be 0) - -----------------------------*/ -} tLimMlmScanReq, *tpLimMlmScanReq; - typedef struct tLimScanResultNode tLimScanResultNode; struct tLimScanResultNode { tLimScanResultNode *next; diff --git a/core/mac/src/pe/lim/lim_api.c b/core/mac/src/pe/lim/lim_api.c index 0143c4856086..df2b01d9513f 100644 --- a/core/mac/src/pe/lim/lim_api.c +++ b/core/mac/src/pe/lim/lim_api.c @@ -91,7 +91,6 @@ static void __lim_init_scan_vars(tpAniSirGlobal pMac) pMac->lim.gLimReturnUniqueResults = 0; pMac->lim.gLimCurrentScanChannelId = 0; - pMac->lim.gpLimMlmScanReq = NULL; pMac->lim.gDeferMsgTypeForNOA = 0; pMac->lim.gpDefdSmeMsgForNOA = NULL; @@ -678,11 +677,6 @@ void lim_cleanup(tpAniSirGlobal pMac) pMac->lim.gpDefdSmeMsgForNOA = NULL; } - if (pMac->lim.gpLimMlmScanReq != NULL) { - qdf_mem_free(pMac->lim.gpLimMlmScanReq); - pMac->lim.gpLimMlmScanReq = NULL; - } - if (pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq) { qdf_mem_free(pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq); pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; diff --git a/core/mac/src/pe/lim/lim_process_message_queue.c b/core/mac/src/pe/lim/lim_process_message_queue.c index 0dcf894443e8..24264621cdb7 100644 --- a/core/mac/src/pe/lim/lim_process_message_queue.c +++ b/core/mac/src/pe/lim/lim_process_message_queue.c @@ -1625,7 +1625,6 @@ static void lim_process_messages(tpAniSirGlobal mac_ctx, case SIR_LIM_DELETE_STA_CONTEXT_IND: lim_delete_sta_context(mac_ctx, msg); break; - case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT: case SIR_LIM_JOIN_FAIL_TIMEOUT: case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT: case SIR_LIM_AUTH_FAIL_TIMEOUT: diff --git a/core/mac/src/pe/lim/lim_process_mlm_req_messages.c b/core/mac/src/pe/lim/lim_process_mlm_req_messages.c index 54e025fe886a..a8c26063ae13 100644 --- a/core/mac/src/pe/lim/lim_process_mlm_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_mlm_req_messages.c @@ -58,7 +58,6 @@ static void lim_process_mlm_deauth_req(tpAniSirGlobal, uint32_t *); static void lim_process_mlm_set_keys_req(tpAniSirGlobal, uint32_t *); /* MLM Timeout event handler templates */ -static void lim_process_periodic_probe_req_timer(tpAniSirGlobal mac_ctx); static void lim_process_auth_rsp_timeout(tpAniSirGlobal, uint32_t); static void lim_process_periodic_join_probe_req_timer(tpAniSirGlobal); static void lim_process_auth_retry_timer(tpAniSirGlobal); @@ -151,9 +150,6 @@ void lim_process_mlm_req_messages(tpAniSirGlobal mac_ctx, case LIM_MLM_SETKEYS_REQ: lim_process_mlm_set_keys_req(mac_ctx, msg->bodyptr); break; - case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT: - lim_process_periodic_probe_req_timer(mac_ctx); - break; case SIR_LIM_JOIN_FAIL_TIMEOUT: lim_process_join_failure_timeout(mac_ctx); break; @@ -2246,70 +2242,6 @@ end: mlm_set_keys_cnf.sessionId = mlm_set_keys_req->sessionId; lim_post_sme_set_keys_cnf(mac_ctx, mlm_set_keys_req, &mlm_set_keys_cnf); } - -/** - * lim_process_periodic_probe_req_timer() - This function is called to process - * periodic probe request to send during scan. - * - * @mac_ctx: Pointer to Global MAC structure - * - * This function is called to process periodic probe request to send during scan - * - * @Return None - */ -static void lim_process_periodic_probe_req_timer(tpAniSirGlobal mac_ctx) -{ - uint8_t channel_num; - uint8_t i = 0; - tLimMlmScanReq *mlm_scan_req; - tSirRetStatus status = eSIR_SUCCESS; - TX_TIMER *probe_req_timer = - &mac_ctx->lim.limTimers.gLimPeriodicProbeReqTimer; - - if (qdf_mc_timer_get_current_state(&probe_req_timer->qdf_timer) - != QDF_TIMER_STATE_STOPPED) { - pe_debug("Invalid state of timer"); - return; - } - - if (!((mac_ctx->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) - && (probe_req_timer->sessionId != 0xff) - && (mac_ctx->lim.probeCounter < mac_ctx->lim.maxProbe))) { - pe_debug("received unexpected Periodic scan timeout in state %X", - mac_ctx->lim.gLimMlmState); - return; - } - - mlm_scan_req = mac_ctx->lim.gpLimMlmScanReq; - mac_ctx->lim.probeCounter++; - /* Periodic channel timer timed out to send probe request. */ - channel_num = lim_get_current_scan_channel(mac_ctx); - do { - /* - * Prepare and send Probe Request frame for all the SSIDs - * present in the saved MLM - */ - status = lim_send_probe_req_mgmt_frame(mac_ctx, - &mlm_scan_req->ssId[i], mlm_scan_req->bssId, - channel_num, mac_ctx->lim.gSelfMacAddr, - mlm_scan_req->dot11mode, - mlm_scan_req->uIEFieldLen, - (uint8_t *) (mlm_scan_req) + - mlm_scan_req->uIEFieldOffset); - if (status != eSIR_SUCCESS) { - pe_err("send ProbeReq failed for SSID %s on channel: %d", - mlm_scan_req->ssId[i].ssId, channel_num); - return; - } - i++; - } while (i < mlm_scan_req->numSsid); - /* Activate timer again */ - if (tx_timer_activate(probe_req_timer) != TX_SUCCESS) { - pe_warn("could not start periodic probe req timer"); - return; - } -} - void lim_process_join_failure_timeout(tpAniSirGlobal mac_ctx) { tLimMlmJoinCnf mlm_join_cnf; diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c index 52962afd3eb1..2b895acbda48 100644 --- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c @@ -4517,14 +4517,12 @@ bool lim_process_sme_req_messages(tpAniSirGlobal pMac, { bool bufConsumed = true; /* Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed. */ uint32_t *pMsgBuf = pMsg->bodyptr; - tpSirSmeScanReq pScanReq; pe_debug("LIM Received SME Message %s(%d) Global LimSmeState:%s(%d) Global LimMlmState: %s(%d)", lim_msg_str(pMsg->type), pMsg->type, lim_sme_state_str(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState, lim_mlm_state_str(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState); - pScanReq = (tpSirSmeScanReq) pMsgBuf; /* If no insert NOA required then execute the code below */ switch (pMsg->type) { diff --git a/core/mac/src/pe/lim/lim_send_management_frames.c b/core/mac/src/pe/lim/lim_send_management_frames.c index b57d31244b44..832db87f98c4 100644 --- a/core/mac/src/pe/lim/lim_send_management_frames.c +++ b/core/mac/src/pe/lim/lim_send_management_frames.c @@ -273,12 +273,8 @@ lim_send_probe_req_mgmt_frame(tpAniSirGlobal mac_ctx, * sent by P2P Client */ if ((WNI_CFG_DOT11_MODE_11B != dot11mode) && (p2pie != NULL) && - (((mac_ctx->lim.gpLimMlmScanReq != NULL) && - mac_ctx->lim.gpLimMlmScanReq->p2pSearch) || - ((pesession != NULL) && - (QDF_P2P_CLIENT_MODE == pesession->pePersona)) - ) - ) { + ((pesession != NULL) && + (QDF_P2P_CLIENT_MODE == pesession->pePersona))) { /* * In the below API pass channel number > 14, do that it fills * only 11a rates in supported rates @@ -443,17 +439,14 @@ lim_send_probe_req_mgmt_frame(tpAniSirGlobal mac_ctx, /* If this probe request is sent during P2P Search State, then we need * to send it at OFDM rate. */ - if ((BAND_5G == lim_get_rf_band(channel)) - || ((mac_ctx->lim.gpLimMlmScanReq != NULL) && - mac_ctx->lim.gpLimMlmScanReq->p2pSearch) + if ((BAND_5G == lim_get_rf_band(channel)) || /* * For unicast probe req mgmt from Join function we don't set * above variables. So we need to add one more check whether it * is pePersona is P2P_CLIENT or not */ - || ((pesession != NULL) && - (QDF_P2P_CLIENT_MODE == pesession->pePersona)) - ) { + ((pesession != NULL) && + (QDF_P2P_CLIENT_MODE == pesession->pePersona))) { txflag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; } diff --git a/core/mac/src/pe/lim/lim_sme_req_utils.c b/core/mac/src/pe/lim/lim_sme_req_utils.c index 13db15d4df36..1f44b52cf0fb 100644 --- a/core/mac/src/pe/lim/lim_sme_req_utils.c +++ b/core/mac/src/pe/lim/lim_sme_req_utils.c @@ -639,79 +639,6 @@ lim_is_sme_deauth_req_valid(tpAniSirGlobal pMac, tpSirSmeDeauthReq pDeauthReq, return true; } /*** end lim_is_sme_deauth_req_valid() ***/ -/** - * lim_is_sme_scan_req_valid() - * - ***FUNCTION: - * This function is called by lim_process_sme_req_messages() upon - * receiving SME_SCAN_REQ message from application. - * - ***LOGIC: - * Message validity checks are performed in this function - * - ***ASSUMPTIONS: - * - ***NOTE: - * - * @param pScanReq Pointer to received SME_SCAN_REQ message - * @return true when received SME_SCAN_REQ is formatted correctly - * false otherwise - */ - -uint8_t lim_is_sme_scan_req_valid(tpAniSirGlobal pMac, tpSirSmeScanReq pScanReq) -{ - uint8_t valid = true; - uint8_t i = 0; - - if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID) { - valid = false; - pe_err("Number of SSIDs > SIR_SCAN_MAX_NUM_SSID"); - goto end; - } - - for (i = 0; i < pScanReq->numSsid; i++) { - if (pScanReq->ssId[i].length > SIR_MAC_MAX_SSID_LENGTH) { - pe_err("Requested SSID length > SIR_MAC_MAX_SSID_LENGTH"); - valid = false; - goto end; - } - } - if ((pScanReq->bssType < 0) || (pScanReq->bssType > eSIR_AUTO_MODE)) { - pe_err("Invalid BSS Type"); - valid = false; - } - if (qdf_is_macaddr_group(&pScanReq->bssId) && - !qdf_is_macaddr_broadcast(&pScanReq->bssId)) { - valid = false; - pe_err("BSSID is group addr and is not Broadcast Addr"); - } - if (! - (pScanReq->scanType == eSIR_PASSIVE_SCAN - || pScanReq->scanType == eSIR_ACTIVE_SCAN)) { - valid = false; - pe_err("Invalid Scan Type"); - } - if (pScanReq->channelList.numChannels > SIR_MAX_NUM_CHANNELS) { - valid = false; - pe_err("Number of Channels > SIR_MAX_NUM_CHANNELS"); - } - - /* - ** check min/max channelTime range - **/ - if (valid) { - if ((pScanReq->scanType == eSIR_ACTIVE_SCAN) && - (pScanReq->maxChannelTime < pScanReq->minChannelTime)) { - pe_err("Max Channel Time < Min Channel Time"); - valid = false; - goto end; - } - } - -end: - return valid; -} /*** end lim_is_sme_scan_req_valid() ***/ - /** * lim_is_sme_set_context_req_valid() * diff --git a/core/mac/src/pe/lim/lim_sme_req_utils.h b/core/mac/src/pe/lim/lim_sme_req_utils.h index 7e89373ad2e1..0f2d40f5b9bc 100644 --- a/core/mac/src/pe/lim/lim_sme_req_utils.h +++ b/core/mac/src/pe/lim/lim_sme_req_utils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2012,2014-2015 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2012,2014-2015,2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -45,7 +45,6 @@ uint8_t lim_is_sme_start_bss_req_valid(tpAniSirGlobal, tpSirSmeStartBssReq); uint8_t lim_set_rs_nie_wp_aiefrom_sme_start_bss_req_message(tpAniSirGlobal, tpSirRSNie, tpPESession); -uint8_t lim_is_sme_scan_req_valid(tpAniSirGlobal, tpSirSmeScanReq); uint8_t lim_is_sme_join_req_valid(tpAniSirGlobal, tpSirSmeJoinReq); uint8_t lim_is_sme_disassoc_req_valid(tpAniSirGlobal, tpSirSmeDisassocReq, tpPESession); diff --git a/core/mac/src/pe/lim/lim_timer_utils.c b/core/mac/src/pe/lim/lim_timer_utils.c index 413fb2910110..3226d920c192 100644 --- a/core/mac/src/pe/lim/lim_timer_utils.c +++ b/core/mac/src/pe/lim/lim_timer_utils.c @@ -248,16 +248,6 @@ uint32_t lim_create_timers(tpAniSirGlobal pMac) * timer expires */ cfgValue1 = cfgValue / 2; - /* Create periodic probe request timer and activate them later */ - if (cfgValue1 >= 1 - && (tx_timer_create(pMac, - &pMac->lim.limTimers.gLimPeriodicProbeReqTimer, - "Periodic Probe Request Timer", lim_timer_handler, - SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT, cfgValue1, 0, - TX_NO_ACTIVATE) != TX_SUCCESS)) { - pe_err("could not create periodic probe timer"); - goto err_timer; - } if (wlan_cfg_get_int(pMac, WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME, &cfgValue) != eSIR_SUCCESS) @@ -396,7 +386,6 @@ err_timer: tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer); tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer); tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer); - tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer); tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer); tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer); tx_timer_delete(&pMac->lim.limTimers.sae_auth_timer); @@ -648,35 +637,6 @@ void lim_deactivate_and_change_timer(tpAniSirGlobal pMac, uint32_t timerId) } break; - case eLIM_PERIODIC_PROBE_REQ_TIMER: - if (tx_timer_deactivate - (&pMac->lim.limTimers.gLimPeriodicProbeReqTimer) - != TX_SUCCESS) { - /* Could not deactivate min channel timer. */ - /* Log error */ - pe_err("Unable to deactivate periodic timer"); - } - - val = - SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime) / - 2; - if (val) { - if (tx_timer_change( - &pMac->lim.limTimers.gLimPeriodicProbeReqTimer, - val, 0) != TX_SUCCESS) { - /* Could not change min channel timer. */ - /* Log error */ - pe_err("Unable to change periodic timer"); - } - } else - pe_err("Do not change gLimPeriodicProbeReqTimer values," - "value: %d minchannel time: %d" - "maxchannel time: %d", val, - pMac->lim.gpLimMlmScanReq->minChannelTime, - pMac->lim.gpLimMlmScanReq->maxChannelTime); - - break; - case eLIM_JOIN_FAIL_TIMER: if (tx_timer_deactivate (&pMac->lim.limTimers.gLimJoinFailureTimer) diff --git a/core/mac/src/pe/lim/lim_timer_utils.h b/core/mac/src/pe/lim/lim_timer_utils.h index 2f86f7e000b7..9beb54efbc52 100644 --- a/core/mac/src/pe/lim/lim_timer_utils.h +++ b/core/mac/src/pe/lim/lim_timer_utils.h @@ -62,7 +62,6 @@ enum { eLIM_WPS_OVERLAP_TIMER, eLIM_FT_PREAUTH_RSP_TIMER, eLIM_REMAIN_CHN_TIMER, - eLIM_PERIODIC_PROBE_REQ_TIMER, eLIM_DISASSOC_ACK_TIMER, eLIM_DEAUTH_ACK_TIMER, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER, diff --git a/core/mac/src/pe/lim/lim_trace.c b/core/mac/src/pe/lim/lim_trace.c index e685ca119b07..0cad3932e7ae 100644 --- a/core/mac/src/pe/lim/lim_trace.c +++ b/core/mac/src/pe/lim/lim_trace.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -73,7 +73,6 @@ static uint8_t *__lim_trace_get_timer_string(uint16_t timerId) CASE_RETURN_STRING(eLIM_WPS_OVERLAP_TIMER); CASE_RETURN_STRING(eLIM_FT_PREAUTH_RSP_TIMER); CASE_RETURN_STRING(eLIM_REMAIN_CHN_TIMER); - CASE_RETURN_STRING(eLIM_PERIODIC_PROBE_REQ_TIMER); CASE_RETURN_STRING(eLIM_DISASSOC_ACK_TIMER); CASE_RETURN_STRING(eLIM_DEAUTH_ACK_TIMER); CASE_RETURN_STRING(eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER); diff --git a/core/mac/src/pe/lim/lim_types.h b/core/mac/src/pe/lim/lim_types.h index f04f3963b318..72fa06644fe3 100644 --- a/core/mac/src/pe/lim/lim_types.h +++ b/core/mac/src/pe/lim/lim_types.h @@ -856,34 +856,6 @@ lim_post_mlm_message(tpAniSirGlobal pMac, uint32_t msgType, uint32_t *pMsgBuf) lim_process_mlm_req_messages(pMac, &msg); } /*** end lim_post_mlm_message() ***/ -/** - * lim_get_current_scan_channel() - * - ***FUNCTION: - * This function is called in various places to get current channel - * number being scanned. - * - ***PARAMS: - * - ***LOGIC: - * - ***ASSUMPTIONS: - * NA - * - ***NOTE: - * NA - * - * @param pMac Pointer to Global MAC structure - * @return Channel number - */ -static inline uint8_t lim_get_current_scan_channel(tpAniSirGlobal pMac) -{ - uint8_t *pChanNum = - pMac->lim.gpLimMlmScanReq->channelList.channelNumber; - - return *(pChanNum + pMac->lim.gLimCurrentScanChannelId); -} /*** end lim_get_current_scan_channel() ***/ - /** * lim_get_ielen_from_bss_description() * diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index 0c1792ffae56..b525e11aa36d 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -547,9 +547,6 @@ void lim_deactivate_timers(tpAniSirGlobal mac_ctx) lim_deactivate_timers_host_roam(mac_ctx); - /* Deactivate Periodic Probe channel timers. */ - tx_timer_deactivate(&lim_timer->gLimPeriodicProbeReqTimer); - /* Deactivate channel switch timer. */ tx_timer_deactivate(&lim_timer->gLimChannelSwitchTimer); @@ -643,9 +640,6 @@ void lim_cleanup_mlm(tpAniSirGlobal mac_ctx) lim_deactivate_timers(mac_ctx); lim_delete_timers_host_roam(mac_ctx); - /* Delete Periodic Probe channel timers. */ - tx_timer_delete(&lim_timer->gLimPeriodicProbeReqTimer); - /* Delete channel switch timer. */ tx_timer_delete(&lim_timer->gLimChannelSwitchTimer); @@ -6788,23 +6782,6 @@ lim_get_80Mhz_center_channel(uint8_t primary_channel) return INVALID_CHANNEL_ID; } -/** - * lim_scan_type_to_string(): converts scan type enum to string. - * @scan_type: enum value of scan_type. - * - * Return: Printable string for scan_type - */ -const char *lim_scan_type_to_string(const uint8_t scan_type) -{ - switch (scan_type) { - CASE_RETURN_STRING(eSIR_PASSIVE_SCAN); - CASE_RETURN_STRING(eSIR_ACTIVE_SCAN); - CASE_RETURN_STRING(eSIR_BEACON_TABLE); - default: - return "Unknown scan_type"; - } -} - /** * lim_bss_type_to_string(): converts bss type enum to string. * @bss_type: enum value of bss_type. diff --git a/core/mac/src/sys/legacy/src/utils/src/mac_trace.c b/core/mac/src/sys/legacy/src/utils/src/mac_trace.c index ff9678136c5c..2e698038fee7 100644 --- a/core/mac/src/sys/legacy/src/utils/src/mac_trace.c +++ b/core/mac/src/sys/legacy/src/utils/src/mac_trace.c @@ -714,7 +714,6 @@ uint8_t *mac_trace_get_lim_msg_string(uint16_t lim_msg) CASE_RETURN_STRING(SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT); CASE_RETURN_STRING(SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE); CASE_RETURN_STRING(SIR_LIM_BEACON_GEN_IND); - CASE_RETURN_STRING(SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT); CASE_RETURN_STRING(SIR_LIM_DISASSOC_ACK_TIMEOUT); CASE_RETURN_STRING(SIR_LIM_DEAUTH_ACK_TIMEOUT); CASE_RETURN_STRING(SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT); diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h index 7423ff8a4836..6fd52099e98d 100644 --- a/core/sme/inc/csr_api.h +++ b/core/sme/inc/csr_api.h @@ -164,22 +164,6 @@ typedef enum { eCSR_BSS_TYPE_ANY, } eCsrRoamBssType; -typedef enum { - eCSR_SCAN_REQUEST_11D_SCAN = 1, - eCSR_SCAN_REQUEST_FULL_SCAN, - eCSR_SCAN_IDLE_MODE_SCAN, - eCSR_SCAN_HO_PROBE_SCAN, /* direct probe on entry from candidate list */ - eCSR_SCAN_P2P_DISCOVERY, - - eCSR_SCAN_SOFTAP_CHANNEL_RANGE, - eCSR_SCAN_P2P_FIND_PEER, -} eCsrRequestType; - -typedef enum { - eCSR_SCAN_RESULT_GET = 0, - eCSR_SCAN_RESULT_FLUSH = 1, /* to delete all cached scan results */ -} eCsrScanResultCmd; - typedef enum { eCSR_SCAN_SUCCESS, eCSR_SCAN_FAILURE, @@ -187,17 +171,6 @@ typedef enum { eCSR_SCAN_FOUND_PEER, } eCsrScanStatus; -/* - * Reason to abort the scan - * The reason can used later to decide whether to update the scan results - * to upper layer or not - */ -typedef enum { - eCSR_SCAN_ABORT_DEFAULT = 1, - eCSR_SCAN_ABORT_DUE_TO_BAND_CHANGE, /* Scan abort due to band change */ - eCSR_SCAN_ABORT_SSID_ONLY -} eCsrAbortReason; - typedef enum { eCSR_BW_20MHz_VAL = 20, eCSR_BW_40MHz_VAL = 40, @@ -288,31 +261,6 @@ typedef struct tagCsrStaParams { uint8_t supported_oper_classes[REG_MAX_SUPP_OPER_CLASSES]; } tCsrStaParams; -typedef struct tagCsrScanRequest { - tSirScanType scanType; - struct qdf_mac_addr bssid; - eCsrRoamBssType BSSType; - tCsrSSIDs SSIDs; - tCsrChannelInfo ChannelInfo; - uint32_t minChnTime; /* in units of milliseconds */ - uint32_t maxChnTime; /* in units of milliseconds */ - /* In units of milliseconds, ignored when not connected */ - uint32_t restTime; - /* In units of milliseconds, ignored when not connected */ - uint32_t min_rest_time; - /* In units of milliseconds, ignored when not connected */ - uint32_t idle_time; - uint32_t uIEFieldLen; - uint8_t *pIEField; - enum wmi_dwelltime_adaptive_mode scan_adaptive_dwell_mode; - eCsrRequestType requestType; /* 11d scan or full scan */ - bool p2pSearch; - bool skipDfsChnlInP2pSearch; - bool bcnRptReqScan; /* is Scan issued by Beacon Report Request */ - uint32_t scan_id; - uint32_t timestamp; -} tCsrScanRequest; - typedef struct tagCsrScanResultInfo { /* * Carry the IEs for the current BSSDescription. diff --git a/core/sme/inc/csr_internal.h b/core/sme/inc/csr_internal.h index 77044bb91a8a..871674fce056 100644 --- a/core/sme/inc/csr_internal.h +++ b/core/sme/inc/csr_internal.h @@ -324,24 +324,6 @@ struct csr_roamstart_bssparams { uint32_t dfs_regdomain; }; -struct scan_cmd { - uint32_t scanID; - csr_scan_completeCallback callback; - void *pContext; - eCsrScanStatus status; - enum csr_roam_state lastRoamState[CSR_ROAM_SESSION_MAX]; - tCsrRoamProfile *pToRoamProfile; - /* this is the ID related to the pToRoamProfile */ - uint32_t roamId; - union { - tCsrScanRequest scanRequest; - /* tCsrBGScanRequest bgScanRequest is no longer used */ - } u; - /* This flag will be set while aborting the scan due to band change */ - eCsrAbortReason abort_scan_indication; - qdf_mc_timer_t csr_scan_timer; -}; - struct roam_cmd { uint32_t roamId; enum csr_roam_reason roamReason; diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 350242b49d45..cce366824a72 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -844,7 +844,6 @@ QDF_STATUS sme_modify_add_ie(tHalHandle hHal, QDF_STATUS sme_update_add_ie(tHalHandle hHal, tSirUpdateIE *pUpdateIE, eUpdateIEsType updateType); QDF_STATUS sme_update_connect_debug(tHalHandle hHal, uint32_t set_value); -const char *sme_scan_type_to_string(const uint8_t scan_type); const char *sme_bss_type_to_string(const uint8_t bss_type); QDF_STATUS sme_ap_disable_intra_bss_fwd(tHalHandle hHal, uint8_t sessionId, bool disablefwd); diff --git a/core/sme/inc/sme_inside.h b/core/sme/inc/sme_inside.h index 421cee114412..ac49b1a1eea4 100644 --- a/core/sme/inc/sme_inside.h +++ b/core/sme/inc/sme_inside.h @@ -169,7 +169,6 @@ typedef struct tagSmeCmd { eSmeCommandType command; uint32_t sessionId; union { - struct scan_cmd scanCmd; struct roam_cmd roamCmd; struct wmstatus_changecmd wmStatusChangeCmd; tGenericPmcCmd pmcCmd; diff --git a/core/sme/inc/sme_internal.h b/core/sme/inc/sme_internal.h index b3503c182522..abbf749a39e3 100644 --- a/core/sme/inc/sme_internal.h +++ b/core/sme/inc/sme_internal.h @@ -56,7 +56,6 @@ typedef enum eSmeCommandType { eSmeDropCommand, /* this is not a command, it is to identify this is a CSR command */ eSmeCsrCommandMask = 0x10000, - eSmeCommandScan, eSmeCommandRoam, eSmeCommandWmStatusChange, #ifdef FEATURE_WLAN_TDLS @@ -238,7 +237,6 @@ typedef struct tagSmeStruct { void *dcc_stats_event_context; ocb_callback dcc_stats_event_callback; sme_set_thermal_level_callback set_thermal_level_cb; - void *saved_scan_cmd; void *bpf_get_offload_context; bpf_get_offload_cb bpf_get_offload_cb; p2p_lo_callback p2p_lo_event_callback; diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index a52c58b9168c..0658216926af 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -510,7 +510,6 @@ static void csr_assoc_rej_free_rssi_disallow_list(qdf_list_t *list) QDF_STATUS csr_close(tpAniSirGlobal pMac) { QDF_STATUS status = QDF_STATUS_SUCCESS; - tSmeCmd *saved_scan_cmd; csr_roam_close(pMac); csr_assoc_rej_free_rssi_disallow_list( @@ -518,27 +517,6 @@ QDF_STATUS csr_close(tpAniSirGlobal pMac) csr_scan_close(pMac); csr_ll_close(&pMac->roam.statsClientReqList); csr_ll_close(&pMac->roam.peStatsReqList); - saved_scan_cmd = (tSmeCmd *)pMac->sme.saved_scan_cmd; - if (saved_scan_cmd) { - csr_release_profile(pMac, saved_scan_cmd->u.scanCmd. - pToRoamProfile); - if (saved_scan_cmd->u.scanCmd.pToRoamProfile) { - qdf_mem_free(saved_scan_cmd->u.scanCmd.pToRoamProfile); - saved_scan_cmd->u.scanCmd.pToRoamProfile = NULL; - } - if (saved_scan_cmd->u.scanCmd.u.scanRequest.SSIDs.SSIDList) { - qdf_mem_free(saved_scan_cmd->u.scanCmd.u.scanRequest. - SSIDs.SSIDList); - saved_scan_cmd->u.scanCmd.u.scanRequest.SSIDs. - SSIDList = NULL; - } - if (saved_scan_cmd->u.roamCmd.pRoamBssEntry) { - qdf_mem_free(saved_scan_cmd->u.roamCmd.pRoamBssEntry); - saved_scan_cmd->u.roamCmd.pRoamBssEntry = NULL; - } - qdf_mem_free(saved_scan_cmd); - saved_scan_cmd = NULL; - } /* DeInit Globals */ csr_roam_de_init_globals(pMac); return status; @@ -6873,7 +6851,7 @@ static void csr_roam_process_results_default(tpAniSirGlobal mac_ctx, * else case by sending assoc failure */ csr_roam_call_callback(mac_ctx, session_id, - &roam_info, cmd->u.scanCmd.roamId, + &roam_info, cmd->u.roamCmd.roamId, eCSR_ROAM_ASSOCIATION_FAILURE, eCSR_ROAM_RESULT_FAILURE); } diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c index 192644111494..5527efa8d3c4 100644 --- a/core/sme/src/csr/csr_api_scan.c +++ b/core/sme/src/csr/csr_api_scan.c @@ -59,10 +59,6 @@ #include #include "wlan_reg_services_api.h" -#define MIN_CHN_TIME_TO_FIND_GO 100 -#define MAX_CHN_TIME_TO_FIND_GO 100 -#define DIRECT_SSID_LEN 7 - /* Purpose of HIDDEN_TIMER * When we remove hidden ssid from the profile i.e., forget the SSID via GUI * that SSID shouldn't see in the profile For above requirement we used timer @@ -89,9 +85,6 @@ #define CSR_SCAN_IS_OVER_BSS_LIMIT(pMac) \ ((pMac)->scan.nBssLimit <= (csr_ll_count(&(pMac)->scan.scanResultList))) -static void csr_set_default_scan_timing(tpAniSirGlobal pMac, - tSirScanType scanType, - tCsrScanRequest *pScanRequest); static void csr_set_cfg_valid_channel_list(tpAniSirGlobal pMac, uint8_t *pChannelList, uint8_t NumChannels); static void csr_save_tx_power_to_cfg(tpAniSirGlobal pMac, tDblLinkList *pList, @@ -104,113 +97,396 @@ static bool csr_roam_is_valid_channel(tpAniSirGlobal pMac, uint8_t channel); #define CSR_IS_SOCIAL_CHANNEL(channel) \ (((channel) == 1) || ((channel) == 6) || ((channel) == 11)) -/* pResult is invalid calling this function. */ -void csr_free_scan_result_entry(tpAniSirGlobal pMac, struct tag_csrscan_result - *pResult) -{ - if (NULL != pResult->Result.pvIes) - qdf_mem_free(pResult->Result.pvIes); +#ifndef NAPIER_SCAN - qdf_mem_free(pResult); -} +#define MIN_CHN_TIME_TO_FIND_GO 100 +#define MAX_CHN_TIME_TO_FIND_GO 100 +#define DIRECT_SSID_LEN 7 -static QDF_STATUS csr_ll_scan_purge_result(tpAniSirGlobal pMac, - tDblLinkList *pList) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - tListElem *pEntry; - struct tag_csrscan_result *pBssDesc; +/* Increase dwell time for P2P search in ms */ +#define P2P_SEARCH_DWELL_TIME_INCREASE 20 +#define P2P_SOCIAL_CHANNELS 3 - csr_ll_lock(pList); +/** + * 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; - while ((pEntry = csr_ll_remove_head(pList, LL_ACCESS_NOLOCK)) != NULL) { - pBssDesc = GET_BASE_ADDR(pEntry, struct tag_csrscan_result, - Link); - csr_free_scan_result_entry(pMac, pBssDesc); + if (!channel) { + sme_debug("Nothing to filter as no IBSS session"); + return true; } - csr_ll_unlock(pList); - - return status; -} - -QDF_STATUS csr_scan_open(tpAniSirGlobal mac_ctx) -{ - csr_ll_open(mac_ctx->hHdd, &mac_ctx->scan.channelPowerInfoList24); - csr_ll_open(mac_ctx->hHdd, &mac_ctx->scan.channelPowerInfoList5G); - - return QDF_STATUS_SUCCESS; -} - -QDF_STATUS csr_scan_close(tpAniSirGlobal pMac) -{ - csr_purge_channel_power(pMac, &pMac->scan.channelPowerInfoList24); - csr_purge_channel_power(pMac, &pMac->scan.channelPowerInfoList5G); - csr_ll_close(&pMac->scan.channelPowerInfoList24); - csr_ll_close(&pMac->scan.channelPowerInfoList5G); - ucfg_scan_set_enable(pMac->psoc, false); - 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) -{ -#ifdef WLAN_AP_STA_CONCURRENCY - 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; + 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++; } - pScanRequest->restTime = pMac->roam.configParam.nRestTimeConc; + } + if (filter_chnl_len == 0) { + sme_err("there no channels to scan due to IBSS session"); + return false; + } - pScanRequest->min_rest_time = - pMac->roam.configParam.min_rest_time_conc; - pScanRequest->idle_time = - pMac->roam.configParam.idle_time_conc; + if (dst_req->ChannelInfo.ChannelList) { + qdf_mem_free(dst_req->ChannelInfo.ChannelList); + dst_req->ChannelInfo.ChannelList = NULL; + dst_req->ChannelInfo.numOfChannels = 0; + } - /* Return so that fields set above will not be overwritten. */ + 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; } -#endif + pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan, + &unsafe_chan_cnt, + sizeof(unsafe_chan)); - /* 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. */ - 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; + 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 doesnt 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++; + } } -#ifdef WLAN_AP_STA_CONCURRENCY + dst_req->ChannelInfo.numOfChannels = new_index; +} - /* No rest time/Idle time if no sessions are connected. */ - pScanRequest->restTime = 0; - pScanRequest->min_rest_time = 0; - pScanRequest->idle_time = 0; +/** + * 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; -#endif + 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; } /** @@ -276,6 +552,67 @@ csr_scan_2g_only_request(tpAniSirGlobal mac_ctx, 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) +{ +#ifdef WLAN_AP_STA_CONCURRENCY + 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; + } +#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. */ + 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; + } +#ifdef WLAN_AP_STA_CONCURRENCY + + /* No rest time/Idle time if no sessions are connected. */ + pScanRequest->restTime = 0; + pScanRequest->min_rest_time = 0; + pScanRequest->idle_time = 0; + +#endif +} + static QDF_STATUS csr_issue_11d_scan(tpAniSirGlobal mac_ctx, tSmeCmd *scan_cmd, tCsrScanRequest *scan_req, uint16_t session_id) @@ -544,7 +881,55 @@ release_cmd: return status; } +#endif +/* pResult is invalid calling this function. */ +void csr_free_scan_result_entry(tpAniSirGlobal pMac, struct tag_csrscan_result + *pResult) +{ + if (NULL != pResult->Result.pvIes) + qdf_mem_free(pResult->Result.pvIes); + + qdf_mem_free(pResult); +} + +static QDF_STATUS csr_ll_scan_purge_result(tpAniSirGlobal pMac, + tDblLinkList *pList) +{ + QDF_STATUS status = QDF_STATUS_SUCCESS; + tListElem *pEntry; + struct tag_csrscan_result *pBssDesc; + + csr_ll_lock(pList); + + while ((pEntry = csr_ll_remove_head(pList, LL_ACCESS_NOLOCK)) != NULL) { + pBssDesc = GET_BASE_ADDR(pEntry, struct tag_csrscan_result, + Link); + csr_free_scan_result_entry(pMac, pBssDesc); + } + + csr_ll_unlock(pList); + + return status; +} + +QDF_STATUS csr_scan_open(tpAniSirGlobal mac_ctx) +{ + csr_ll_open(mac_ctx->hHdd, &mac_ctx->scan.channelPowerInfoList24); + csr_ll_open(mac_ctx->hHdd, &mac_ctx->scan.channelPowerInfoList5G); + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS csr_scan_close(tpAniSirGlobal pMac) +{ + csr_purge_channel_power(pMac, &pMac->scan.channelPowerInfoList24); + csr_purge_channel_power(pMac, &pMac->scan.channelPowerInfoList5G); + csr_ll_close(&pMac->scan.channelPowerInfoList24); + csr_ll_close(&pMac->scan.channelPowerInfoList5G); + ucfg_scan_set_enable(pMac->psoc, false); + return QDF_STATUS_SUCCESS; +} QDF_STATUS csr_scan_handle_search_for_ssid(tpAniSirGlobal mac_ctx, uint32_t session_id) { @@ -1751,7 +2136,7 @@ csr_diag_scan_complete(tpAniSirGlobal mac_ctx, * csr_saved_scan_cmd_free_fields() - Free internal fields of scan command * * @mac_ctx: Global MAC context - * @saved_scan_cmd: Pointer to scan command + * @session: sme session * * Frees data structures allocated inside saved_scan_cmd and releases * the profile. @@ -2044,427 +2429,6 @@ QDF_STATUS csr_move_bss_to_head_from_bssid(tpAniSirGlobal pMac, return status; } -/** - * 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 doesnt 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_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() - 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; -} - -QDF_STATUS csr_scan_free_request(tpAniSirGlobal pMac, tCsrScanRequest *pReq) -{ - - if (pReq->ChannelInfo.ChannelList) { - qdf_mem_free(pReq->ChannelInfo.ChannelList); - pReq->ChannelInfo.ChannelList = NULL; - } - pReq->ChannelInfo.numOfChannels = 0; - if (pReq->pIEField) { - qdf_mem_free(pReq->pIEField); - pReq->pIEField = NULL; - } - pReq->uIEFieldLen = 0; - if (pReq->SSIDs.SSIDList) { - qdf_mem_free(pReq->SSIDs.SSIDList); - pReq->SSIDs.SSIDList = NULL; - } - pReq->SSIDs.numOfSSIDs = 0; - - return QDF_STATUS_SUCCESS; -} - -void csr_scan_call_callback(tpAniSirGlobal pMac, tSmeCmd *pCommand, - eCsrScanStatus scanStatus) -{ - if (pCommand->u.scanCmd.callback) { - if (pCommand->u.scanCmd.abort_scan_indication) { - sme_debug("scanDone due to abort"); - scanStatus = eCSR_SCAN_ABORT; - } - pCommand->u.scanCmd.callback(pMac, pCommand->u.scanCmd.pContext, - pCommand->sessionId, - pCommand->u.scanCmd.scanID, - scanStatus); - } else { - sme_debug("Callback NULL!!!"); - } -} - QDF_STATUS csr_scan_get_pmkid_candidate_list(tpAniSirGlobal pMac, uint32_t sessionId, tPmkidCandidateInfo *pPmkidList, @@ -3263,29 +3227,6 @@ csr_get_bssdescr_from_scan_handle(tScanResultHandle result_handle, return bss_descr; } -/** - * scan_active_list_cmd_timeout_handle() - To handle scan active command timeout - * @userData: scan context - * - * This routine is to handle scan active command timeout - * - * Return: None - */ -void csr_scan_active_list_timeout_handle(void *userData) -{ - tSmeCmd *scan_cmd = (tSmeCmd *) userData; - uint16_t scan_id; - - if (scan_cmd == NULL) { - QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, - FL("Scan Timeout: Scan command is NULL")); - return; - } - scan_id = scan_cmd->u.scanCmd.scanID; - sme_err("Scan Timeout:Sending abort to Firmware ID %d session %d", - scan_id, scan_cmd->sessionId); -} - static enum wlan_auth_type csr_covert_auth_type_new(eCsrAuthType auth) { switch (auth) { diff --git a/core/sme/src/csr/csr_inside_api.h b/core/sme/src/csr/csr_inside_api.h index f66d6f1d9010..0cdbd20cf675 100644 --- a/core/sme/src/csr/csr_inside_api.h +++ b/core/sme/src/csr/csr_inside_api.h @@ -255,11 +255,6 @@ QDF_STATUS csr_scan_open(tpAniSirGlobal pMac); QDF_STATUS csr_scan_close(tpAniSirGlobal pMac); bool csr_scan_append_bss_description(tpAniSirGlobal pMac, tSirBssDescription *pSirBssDescription); -void csr_scan_call_callback(tpAniSirGlobal pMac, tSmeCmd *pCommand, - eCsrScanStatus scanStatus); -QDF_STATUS csr_scan_copy_request(tpAniSirGlobal pMac, tCsrScanRequest *pDstReq, - tCsrScanRequest *pSrcReq); -QDF_STATUS csr_scan_free_request(tpAniSirGlobal pMac, tCsrScanRequest *pReq); QDF_STATUS csr_scan_for_ssid(tpAniSirGlobal pMac, uint32_t sessionId, tCsrRoamProfile *pProfile, uint32_t roamId, bool notify); @@ -455,19 +450,6 @@ QDF_STATUS csr_roam_get_session_id_from_bssid(tpAniSirGlobal pMac, enum csr_cfgdot11mode csr_find_best_phy_mode(tpAniSirGlobal pMac, uint32_t phyMode); -/* - * csr_scan_request() - - * Request a 11d or full scan. - * - * callback - a callback function that scan calls upon finish, will not be - * called if csr_scan_request returns error - * pContext - a pointer passed in for the callback - * Return QDF_STATUS - */ -QDF_STATUS csr_scan_request(tpAniSirGlobal pMac, uint16_t sessionId, - tCsrScanRequest *scan_req, - csr_scan_completeCallback callback, void *pContext); - /* * csr_scan_get_result() - * Return scan results. diff --git a/core/sme/src/csr/csr_util.c b/core/sme/src/csr/csr_util.c index 7d8093ebf86e..51547530c47c 100644 --- a/core/sme/src/csr/csr_util.c +++ b/core/sme/src/csr/csr_util.c @@ -6418,23 +6418,6 @@ const char *sme_bss_type_to_string(const uint8_t bss_type) } } -/** - * sme_scantype_to_string() - converts scan type to string. - * @scan_type: scan type enum - * - * Return: printable string for scan type - */ -const char *sme_scan_type_to_string(const uint8_t scan_type) -{ - switch (scan_type) { - CASE_RETURN_STRING(eSIR_PASSIVE_SCAN); - CASE_RETURN_STRING(eSIR_ACTIVE_SCAN); - CASE_RETURN_STRING(eSIR_BEACON_TABLE); - default: - return "unknown scan type"; - } -} - QDF_STATUS csr_add_to_channel_list_front(uint8_t *pChannelList, int numChannels, uint8_t channel) { diff --git a/core/wma/inc/wma_internal.h b/core/wma/inc/wma_internal.h index 9b5d088261d2..d5d234a49029 100644 --- a/core/wma/inc/wma_internal.h +++ b/core/wma/inc/wma_internal.h @@ -236,15 +236,6 @@ int wma_roam_synch_frame_event_handler(void *handle, uint8_t *event, void wma_update_per_roam_config(WMA_HANDLE handle, struct wmi_per_roam_config_req *req_buf); -QDF_STATUS wma_get_buf_start_scan_cmd(tp_wma_handle wma_handle, - tSirScanOffloadReq *scan_req, - struct scan_req_params *cmd); - -QDF_STATUS wma_get_buf_stop_scan_cmd(tp_wma_handle wma_handle, - wmi_buf_t *buf, - int *buf_len, - tAbortScanParams *abort_scan_req); - QDF_STATUS wma_update_channel_list(WMA_HANDLE handle, tSirUpdateChanList *chan_list);