From 88f78ec8d825e2a5eabe7890ddb37f804d9ce912 Mon Sep 17 00:00:00 2001 From: gaurank kathpalia Date: Wed, 4 Sep 2019 20:18:02 +0530 Subject: [PATCH] qcacld-3.0: Change chan to freq in csr structures Change chan to freq in csr structures for 6ghz Change-Id: I6dc962175d95b202e647f55cfcb1f3d849fef6e2 CRs-Fixed: 2522212 --- .../mlme/dispatcher/inc/cfg_mlme_ibss.h | 42 ++-- .../dispatcher/inc/wlan_mlme_public_struct.h | 2 +- core/hdd/src/wlan_hdd_cfg.c | 4 +- core/hdd/src/wlan_hdd_ioctl.c | 16 +- core/sme/inc/csr_api.h | 15 +- core/sme/inc/csr_internal.h | 12 +- core/sme/inc/csr_neighbor_roam.h | 6 - core/sme/src/common/sme_api.c | 20 +- core/sme/src/csr/csr_api_roam.c | 217 ++++++++---------- core/sme/src/csr/csr_api_scan.c | 40 ++-- core/sme/src/csr/csr_host_scan_roam.c | 4 +- core/sme/src/csr/csr_inside_api.h | 9 +- core/sme/src/csr/csr_neighbor_roam.c | 17 +- core/sme/src/rrm/sme_rrm.c | 3 +- 14 files changed, 196 insertions(+), 211 deletions(-) diff --git a/components/mlme/dispatcher/inc/cfg_mlme_ibss.h b/components/mlme/dispatcher/inc/cfg_mlme_ibss.h index 6295a0d54a92..dd15791db384 100644 --- a/components/mlme/dispatcher/inc/cfg_mlme_ibss.h +++ b/components/mlme/dispatcher/inc/cfg_mlme_ibss.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -42,13 +42,13 @@ /* * - * gAdHocChannel5G - Default 5Ghz IBSS channel if channel is not + * gAdHocChannel5G - Default 5Ghz IBSS channel if channel freq is not * provided by supplicant. - * @Min: 36 - * @Max: 165 - * @Default: 44 + * @Min: 5180 + * @Max: 5825 + * @Default: 5220 * - * This ini is used to set default 5Ghz IBSS channel + * This ini is used to set default 5Ghz IBSS channel frequency * if channel is not provided by supplicant and band is 5Ghz * * Related: None @@ -60,22 +60,22 @@ * */ #define CFG_IBSS_ADHOC_CHANNEL_5GHZ CFG_INI_UINT( \ - "gAdHocChannel5G", \ - 36, \ - 165, \ - 44, \ + "ad_hoc_ch_freq_5g", \ + 5180, \ + 5825, \ + 5220, \ CFG_VALUE_OR_DEFAULT, \ - "Default 5Ghz IBSS channel if not provided by supplicant") + "Default 5Ghz IBSS ch freq if not provided by supplicant") /* * - * gAdHocChannel24G - Default 2.4Ghz IBSS channel if channel is not + * gAdHocChannel24G - Default 2.4Ghz IBSS channel if channel freq is not * provided by supplicant. - * @Min: 1 - * @Max: 14 - * @Default: 6 + * @Min: 2412 + * @Max: 2484 + * @Default: 2437 * - * This ini is used to set default 2.4Ghz IBSS channel + * This ini is used to set default 2.4Ghz IBSS channel frequency * if channel is not provided by supplicant and band is 2.4Ghz * * Related: None @@ -87,12 +87,12 @@ * */ #define CFG_IBSS_ADHOC_CHANNEL_24GHZ CFG_INI_UINT( \ - "gAdHocChannel24G", \ - 1, \ - 14, \ - 6, \ + "ad_hoc_ch_freq_2g", \ + 2412, \ + 2484, \ + 2437, \ CFG_VALUE_OR_DEFAULT, \ - "Default 2.4Ghz IBSS channel if not provided by supplicant") + "Default 2.4Ghz IBSS ch freq if not provided by supplicant") /* * diff --git a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h index 884b1ee3e6c5..791e62911f41 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h @@ -2057,7 +2057,7 @@ struct wlan_mlme_reg { bool indoor_channel_support; uint32_t scan_11d_interval; uint32_t valid_channel_freq_list[CFG_VALID_CHANNEL_LIST_LEN]; - uint8_t valid_channel_list_num; + uint32_t valid_channel_list_num; uint8_t country_code[CFG_COUNTRY_CODE_LEN + 1]; uint8_t country_code_len; bool enable_11d_in_world_mode; diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 793c5a6575ff..e090f7f54e79 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -856,8 +856,8 @@ QDF_STATUS hdd_set_sme_config(struct hdd_context *hdd_ctx) */ /* This param cannot be configured from INI */ sme_config->csr_config.send_smps_action = true; - sme_config->csr_config.AdHocChannel5G = ibss_cfg.adhoc_ch_5g; - sme_config->csr_config.AdHocChannel24 = ibss_cfg.adhoc_ch_2g; + sme_config->csr_config.ad_hoc_ch_freq_5g = ibss_cfg.adhoc_ch_5g; + sme_config->csr_config.ad_hoc_ch_freq_2g = ibss_cfg.adhoc_ch_2g; sme_config->csr_config.ProprietaryRatesEnabled = 0; sme_config->csr_config.HeartbeatThresh50 = 40; ucfg_scan_cfg_get_dfs_chan_scan_allowed(hdd_ctx->psoc, diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index 26b2722b35e0..f010f4c605e9 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -769,7 +769,7 @@ int hdd_reassoc(struct hdd_adapter *adapter, const uint8_t *bssid, } else { tCsrHandoffRequest handoff; - handoff.channel = channel; + handoff.ch_freq = wlan_reg_chan_to_freq(hdd_ctx->pdev, channel); handoff.src = src; qdf_mem_copy(handoff.bssid.bytes, bssid, QDF_MAC_ADDR_SIZE); sme_handoff_request(hdd_ctx->mac_handle, adapter->vdev_id, @@ -2532,7 +2532,8 @@ done: * * Return: 0 for success non-zero for failure */ -static int hdd_parse_ese_beacon_req(uint8_t *command, +static int hdd_parse_ese_beacon_req(struct wlan_objmgr_pdev *pdev, + uint8_t *command, tCsrEseBeaconReq *req) { uint8_t *in_ptr = command; @@ -2619,7 +2620,8 @@ static int hdd_parse_ese_beacon_req(uint8_t *command, temp_int); return -EINVAL; } - req->bcnReq[j].channel = temp_int; + req->bcnReq[j].ch_freq = + wlan_reg_chan_to_freq(pdev, temp_int); break; case 2: /* Scan mode */ @@ -2650,10 +2652,10 @@ static int hdd_parse_ese_beacon_req(uint8_t *command, } for (j = 0; j < req->numBcnReqIe; j++) { - hdd_debug("Index: %d Measurement Token: %u Channel: %u Scan Mode: %u Measurement Duration: %u", + hdd_debug("Index: %d Measurement Token: %u ch_freq: %u Scan Mode: %u Measurement Duration: %u", j, req->bcnReq[j].measurementToken, - req->bcnReq[j].channel, + req->bcnReq[j].ch_freq, req->bcnReq[j].scanMode, req->bcnReq[j].measurementDuration); } @@ -4388,7 +4390,7 @@ static int drv_cmd_fast_reassoc(struct hdd_adapter *adapter, goto exit; } /* Proceed with reassoc */ - req.channel = channel; + req.ch_freq = wlan_reg_chan_to_freq(hdd_ctx->pdev, channel); req.src = FASTREASSOC; qdf_mem_copy(req.bssid.bytes, bssid, sizeof(tSirMacAddr)); sme_handoff_request(mac_handle, adapter->vdev_id, &req); @@ -5619,7 +5621,7 @@ static int drv_cmd_ccx_beacon_req(struct hdd_adapter *adapter, return -EINVAL; } - ret = hdd_parse_ese_beacon_req(value, &req); + ret = hdd_parse_ese_beacon_req(hdd_ctx->pdev, value, &req); if (ret) { hdd_err("Failed to parse ese beacon req"); goto exit; diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h index 4630e82523fb..abbe5e5b40d1 100644 --- a/core/sme/inc/csr_api.h +++ b/core/sme/inc/csr_api.h @@ -311,7 +311,6 @@ typedef struct tagCsrScanResultFilter { * used to support whitelist ssid feature. */ uint8_t scan_filter_for_roam; - struct sCsrChannel_ pcl_channels; struct qdf_mac_addr bssid_hint; enum QDF_OPMODE csrPersona; bool realm_check; @@ -321,7 +320,7 @@ typedef struct tagCsrScanResultFilter { } tCsrScanResultFilter; typedef struct sCsrChnPower_ { - uint8_t first_chan_freq; + uint32_t first_chan_freq; uint8_t numChannels; uint8_t maxtxPower; } sCsrChnPower; @@ -955,8 +954,8 @@ struct csr_config_params { eCsrRoamWmmUserModeType WMMSupportMode; bool Is11eSupportEnabled; bool ProprietaryRatesEnabled; - uint8_t AdHocChannel24; - uint8_t AdHocChannel5G; + uint32_t ad_hoc_ch_freq_5g; + uint32_t ad_hoc_ch_freq_2g; /* * this number minus one is the number of times a scan doesn't find it * before it is removed @@ -1097,16 +1096,12 @@ struct csr_roam_info { uint16_t tsmRoamDelay; struct ese_bcn_report_rsp *pEseBcnReportRsp; #endif - void *pRemainCtx; - uint32_t roc_scan_id; - uint32_t rxChan; #ifdef FEATURE_WLAN_TDLS /* * TDLS parameters to check whether TDLS * and TDLS channel switch is allowed in the * AP network */ - uint8_t staType; bool tdls_prohibited; /* per ExtCap in Assoc/Reassoc resp */ bool tdls_chan_swit_prohibited; /* per ExtCap in Assoc/Reassoc resp */ #endif @@ -1307,14 +1302,14 @@ typedef enum { typedef struct tagCsrHandoffRequest { struct qdf_mac_addr bssid; - uint8_t channel; + uint32_t ch_freq; uint8_t src; /* To check if its a REASSOC or a FASTREASSOC IOCTL */ } tCsrHandoffRequest; #ifdef FEATURE_WLAN_ESE typedef struct tagCsrEseBeaconReqParams { uint16_t measurementToken; - uint8_t channel; + uint32_t ch_freq; uint8_t scanMode; uint16_t measurementDuration; } tCsrEseBeaconReqParams, *tpCsrEseBeaconReqParams; diff --git a/core/sme/inc/csr_internal.h b/core/sme/inc/csr_internal.h index 80f18519c592..1c49395825ec 100644 --- a/core/sme/inc/csr_internal.h +++ b/core/sme/inc/csr_internal.h @@ -346,8 +346,8 @@ struct csr_config { bool mcc_rts_cts_prot_enable; bool mcc_bcast_prob_resp_enable; uint8_t fAllowMCCGODiffBI; - uint8_t AdHocChannel24; - uint8_t AdHocChannel5G; + uint32_t ad_hoc_ch_freq_2g; + uint32_t ad_hoc_ch_freq_5g; /* each RSSI category has one value */ uint32_t BssPreferValue[CSR_NUM_RSSI_CAT]; int RSSICat[CSR_NUM_RSSI_CAT]; @@ -557,11 +557,6 @@ struct csr_roam_session { uint16_t curr_cache_idx; /* the index in pmkidcache to write next to */ tPmkidCacheInfo PmkidCacheInfo[CSR_MAX_PMKID_ALLOWED]; uint8_t cJoinAttemps; - /* - * This may or may not have the up-to-date valid channel list. It is - * used to get CFG_VALID_CHANNEL_LIST and not alloc memory all time - */ - tSirMacChanNum validChannelList[CFG_VALID_CHANNEL_LIST_LEN]; int32_t sPendingCommands; /* 0 means CSR is ok to low power */ #ifdef FEATURE_WLAN_WAPI uint16_t NumBkidCache; @@ -623,7 +618,6 @@ struct csr_roam_session { bool isPrevApInfoValid; tSirMacSSid prevApSSID; struct qdf_mac_addr prevApBssid; - uint8_t prevOpChannel; uint16_t clientDissSecs; uint32_t roamTS1; tCsrEseCckmIe suppCckmIeInfo; @@ -674,7 +668,7 @@ struct csr_roamstruct { * This may or may not have the up-to-date valid channel list. It is * used to get CFG_VALID_CHANNEL_LIST and not alloc mem all time */ - tSirMacChanNum validChannelList[CFG_VALID_CHANNEL_LIST_LEN]; + uint32_t valid_ch_freq_list[CFG_VALID_CHANNEL_LIST_LEN]; uint32_t numValidChannels; /* total number of channels in CFG */ int32_t sPendingCommands; qdf_mc_timer_t hTimerWaitForKey; /* support timeout for WaitForKey */ diff --git a/core/sme/inc/csr_neighbor_roam.h b/core/sme/inc/csr_neighbor_roam.h index 634441318813..4f7a5cedc87e 100644 --- a/core/sme/inc/csr_neighbor_roam.h +++ b/core/sme/inc/csr_neighbor_roam.h @@ -95,12 +95,6 @@ typedef struct sCsrPreauthFailListInfo { tSirMacAddr macAddress[MAX_NUM_PREAUTH_FAIL_LIST_ADDRESS]; } tCsrPreauthFailListInfo, *tpCsrPreauthFailListInfo; -typedef struct sCsrNeighborReportBssInfo { - uint8_t channelNum; - uint8_t neighborScore; - tSirMacAddr neighborBssId; -} tCsrNeighborReportBssInfo, *tpCsrNeighborReportBssInfo; - typedef struct sCsr11rAssocNeighborInfo { bool preauthRspPending; bool neighborRptPending; diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 3c532926c9b4..2cf860897d44 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -1683,7 +1683,7 @@ QDF_STATUS sme_set_ese_beacon_request(mac_handle_t mac_handle, pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration); pSmeBcnReportReq->channelList.channelNumber[counter] = - pBeaconReq->channel; + wlan_reg_freq_to_chan(mac->pdev, pBeaconReq->ch_freq); } status = sme_rrm_process_beacon_report_req_ind(mac, pSmeBcnReportReq); @@ -5191,11 +5191,12 @@ QDF_STATUS sme_set_tsf_gpio(mac_handle_t mac_handle, uint32_t pinvalue) } #endif -QDF_STATUS sme_get_cfg_valid_channels(uint8_t *aValidChannels, - uint32_t *len) +QDF_STATUS sme_get_cfg_valid_channels(uint8_t *valid_ch, uint32_t *len) { QDF_STATUS status = QDF_STATUS_E_FAILURE; struct mac_context *mac_ctx = sme_get_mac_context(); + uint32_t *valid_ch_freq_list; + uint32_t i; if (!mac_ctx) { QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, @@ -5203,13 +5204,24 @@ QDF_STATUS sme_get_cfg_valid_channels(uint8_t *aValidChannels, return QDF_STATUS_E_FAILURE; } + valid_ch_freq_list = qdf_mem_malloc(CFG_VALID_CHANNEL_LIST_LEN * + sizeof(uint32_t)); + if (!valid_ch_freq_list) + return QDF_STATUS_E_NOMEM; + status = sme_acquire_global_lock(&mac_ctx->sme); if (QDF_IS_STATUS_SUCCESS(status)) { status = csr_get_cfg_valid_channels(mac_ctx, - aValidChannels, len); + valid_ch_freq_list, len); sme_release_global_lock(&mac_ctx->sme); } + for (i = 0; i < *len; i++) + valid_ch[i] = + wlan_reg_freq_to_chan(mac_ctx->pdev, valid_ch_freq_list[i]); + + qdf_mem_free(valid_ch_freq_list); + return status; } diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index cf876920b855..30da18838fd0 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -374,10 +374,12 @@ enum mgmt_bss_type diag_persona_from_csr_type(enum QDF_OPMODE persona) } #endif /* #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR */ -static const uint8_t -csr_start_ibss_channels50[CSR_NUM_IBSS_START_CHAN_50] = { 36, 44, 52, 56, 140 }; -static const uint8_t -csr_start_ibss_channels24[CSR_NUM_IBSS_START_CHANNELS_24] = { 1, 6, 11 }; +static const uint32_t +csr_start_ibss_channels50[CSR_NUM_IBSS_START_CHAN_50] = + { 5180, 5220, 5260, 5280, 5700 }; +static const uint32_t +csr_start_ibss_channels24[CSR_NUM_IBSS_START_CHANNELS_24] = + { 2412, 2437, 2462 }; static const uint8_t social_channel[MAX_SOCIAL_CHANNELS] = { 1, 6, 11 }; @@ -2400,8 +2402,11 @@ QDF_STATUS csr_change_default_config_param(struct mac_context *mac, pParam->HeartbeatThresh50; mac->roam.configParam.ProprietaryRatesEnabled = pParam->ProprietaryRatesEnabled; - mac->roam.configParam.AdHocChannel24 = pParam->AdHocChannel24; - mac->roam.configParam.AdHocChannel5G = pParam->AdHocChannel5G; + mac->roam.configParam.ad_hoc_ch_freq_5g = + pParam->ad_hoc_ch_freq_5g; + mac->roam.configParam.ad_hoc_ch_freq_2g = + pParam->ad_hoc_ch_freq_2g; + mac->roam.configParam.wep_tkip_in_he = pParam->wep_tkip_in_he; mac->roam.configParam.uCfgDot11Mode = @@ -2592,8 +2597,8 @@ QDF_STATUS csr_get_config_param(struct mac_context *mac, pParam->phyMode = cfg_params->phyMode; pParam->HeartbeatThresh50 = cfg_params->HeartbeatThresh50; pParam->ProprietaryRatesEnabled = cfg_params->ProprietaryRatesEnabled; - pParam->AdHocChannel24 = cfg_params->AdHocChannel24; - pParam->AdHocChannel5G = cfg_params->AdHocChannel5G; + pParam->ad_hoc_ch_freq_5g = cfg_params->ad_hoc_ch_freq_5g; + pParam->ad_hoc_ch_freq_2g = cfg_params->ad_hoc_ch_freq_2g; pParam->bCatRssiOffset = cfg_params->bCatRssiOffset; pParam->statsReqPeriodicity = cfg_params->statsReqPeriodicity; pParam->statsReqPeriodicityInPS = cfg_params->statsReqPeriodicityInPS; @@ -13355,25 +13360,27 @@ QDF_STATUS csr_roam_issue_stop_bss(struct mac_context *mac, } /* pNumChan is a caller allocated space with the sizeof pChannels */ -QDF_STATUS csr_get_cfg_valid_channels(struct mac_context *mac, uint8_t *pChannels, - uint32_t *pNumChan) +QDF_STATUS csr_get_cfg_valid_channels(struct mac_context *mac, + uint32_t *ch_freq_list, + uint32_t *num_ch_freq) { uint8_t num_chan_temp = 0; int i; uint8_t chan; + uint32_t *valid_ch_freq_list = + mac->mlme_cfg->reg.valid_channel_freq_list; - *pNumChan = (uint32_t)mac->mlme_cfg->reg.valid_channel_list_num; + *num_ch_freq = mac->mlme_cfg->reg.valid_channel_list_num; - for (i = 0; i < *pNumChan; i++) { - chan = wlan_reg_freq_to_chan(mac->pdev, - mac->mlme_cfg->reg.valid_channel_freq_list[i]); + for (i = 0; i < *num_ch_freq; i++) { + chan = wlan_reg_freq_to_chan(mac->pdev, valid_ch_freq_list[i]); if (!wlan_reg_is_dsrc_chan(mac->pdev, chan)) { - pChannels[num_chan_temp] = chan; + ch_freq_list[num_chan_temp] = valid_ch_freq_list[i]; num_chan_temp++; } } - *pNumChan = num_chan_temp; + *num_ch_freq = num_chan_temp; return QDF_STATUS_SUCCESS; } @@ -13454,15 +13461,15 @@ error: bool csr_roam_is_channel_valid(struct mac_context *mac, uint8_t channel) { bool fValid = false; - uint32_t idxValidChannels; - uint32_t len = sizeof(mac->roam.validChannelList); + uint32_t id_Valid_ch; + uint32_t len = sizeof(mac->roam.valid_ch_freq_list); if (QDF_IS_STATUS_SUCCESS(csr_get_cfg_valid_channels(mac, - mac->roam.validChannelList, &len))) { - for (idxValidChannels = 0; (idxValidChannels < len); - idxValidChannels++) { - if (channel == - mac->roam.validChannelList[idxValidChannels]) { + mac->roam.valid_ch_freq_list, &len))) { + for (id_Valid_ch = 0; (id_Valid_ch < len); + id_Valid_ch++) { + if (channel == wlan_reg_freq_to_chan(mac->pdev, + mac->roam.valid_ch_freq_list[id_Valid_ch])) { fValid = true; break; } @@ -13697,35 +13704,33 @@ static bool csr_roam_is_same_profile_keys(struct mac_context *mac, /* IBSS */ -static uint8_t csr_roam_get_ibss_start_channel_number50(struct mac_context *mac) +static uint32_t +csr_roam_get_ibss_start_channel_number50(struct mac_context *mac) { - uint8_t channel = 0; + uint32_t ch_freq = 0; uint32_t idx; - uint32_t idxValidChannels; + uint32_t id_Valid_ch; bool fFound = false; - uint32_t len = sizeof(mac->roam.validChannelList); + uint32_t len = sizeof(mac->roam.valid_ch_freq_list); - if (eCSR_OPERATING_CHANNEL_ANY != mac->roam.configParam. - AdHocChannel5G) { - channel = mac->roam.configParam.AdHocChannel5G; - if (!csr_roam_is_channel_valid(mac, channel)) - channel = 0; + if (mac->roam.configParam.ad_hoc_ch_freq_5g) { + ch_freq = mac->roam.configParam.ad_hoc_ch_freq_5g; + if (!csr_roam_is_chan_freq_valid(mac, ch_freq)) + ch_freq = 0; } - if (0 == channel + if (0 == ch_freq && - QDF_IS_STATUS_SUCCESS(csr_get_cfg_valid_channels - (mac, (uint8_t *) mac->roam. - validChannelList, &len))) { + QDF_IS_STATUS_SUCCESS(csr_get_cfg_valid_channels(mac, + mac->roam.valid_ch_freq_list, &len))) { for (idx = 0; (idx < CSR_NUM_IBSS_START_CHAN_50) && !fFound; idx++) { - for (idxValidChannels = 0; - (idxValidChannels < len) && !fFound; - idxValidChannels++) { + for (id_Valid_ch = 0; + (id_Valid_ch < len) && !fFound; + id_Valid_ch++) { if (csr_start_ibss_channels50[idx] == - mac->roam. - validChannelList[idxValidChannels]) { + mac->roam.valid_ch_freq_list[id_Valid_ch]) { fFound = true; - channel = + ch_freq = csr_start_ibss_channels50[idx]; } } @@ -13736,16 +13741,16 @@ static uint8_t csr_roam_get_ibss_start_channel_number50(struct mac_context *mac) * return the first 11a channel found! */ if (!fFound) { - for (idxValidChannels = 0; idxValidChannels < len; - idxValidChannels++) { - if (WLAN_REG_IS_5GHZ_CH(mac->roam. - validChannelList[idxValidChannels])) { + for (id_Valid_ch = 0; id_Valid_ch < len; + id_Valid_ch++) { + if (WLAN_REG_IS_5GHZ_CH_FREQ( + mac->roam.valid_ch_freq_list[id_Valid_ch])) { /* the max channel# in 11g is 14 */ - if (idxValidChannels < + if (id_Valid_ch < CSR_NUM_IBSS_START_CHAN_50) { - channel = - mac->roam.validChannelList - [idxValidChannels]; + ch_freq = + mac->roam.valid_ch_freq_list + [id_Valid_ch]; } break; } @@ -13753,46 +13758,45 @@ static uint8_t csr_roam_get_ibss_start_channel_number50(struct mac_context *mac) } } /* if */ - return channel; + return wlan_reg_freq_to_chan(mac->pdev, ch_freq); } -static uint8_t csr_roam_get_ibss_start_channel_number24(struct mac_context *mac) +static uint32_t +csr_roam_get_ibss_start_channel_number24(struct mac_context *mac) { - uint8_t channel = 1; + uint32_t ch_freq = 2412; uint32_t idx; - uint32_t idxValidChannels; + uint32_t id_Valid_ch; bool fFound = false; - uint32_t len = sizeof(mac->roam.validChannelList); + uint32_t len = sizeof(mac->roam.valid_ch_freq_list); - if (eCSR_OPERATING_CHANNEL_ANY != mac->roam.configParam. - AdHocChannel24) { - channel = mac->roam.configParam.AdHocChannel24; - if (!csr_roam_is_channel_valid(mac, channel)) - channel = 0; + if (mac->roam.configParam.ad_hoc_ch_freq_2g) { + ch_freq = mac->roam.configParam.ad_hoc_ch_freq_2g; + if (!csr_roam_is_chan_freq_valid(mac, ch_freq)) + ch_freq = 0; } - if (0 == channel + if (0 == ch_freq && QDF_IS_STATUS_SUCCESS(csr_get_cfg_valid_channels(mac, - (uint8_t *) mac->roam.validChannelList, - &len))) { + mac->roam.valid_ch_freq_list, + &len))) { for (idx = 0; (idx < CSR_NUM_IBSS_START_CHANNELS_24) && !fFound; idx++) { - for (idxValidChannels = 0; - (idxValidChannels < len) && !fFound; - idxValidChannels++) { + for (id_Valid_ch = 0; + (id_Valid_ch < len) && !fFound; + id_Valid_ch++) { if (csr_start_ibss_channels24[idx] == - mac->roam. - validChannelList[idxValidChannels]) { + mac->roam.valid_ch_freq_list[id_Valid_ch]) { fFound = true; - channel = + ch_freq = csr_start_ibss_channels24[idx]; } } } } - return channel; + return wlan_reg_freq_to_chan(mac->pdev, ch_freq); } /** * csr_populate_basic_rates() - populates OFDM or CCK rates @@ -14908,17 +14912,18 @@ static void csr_add_supported_5Ghz_channels(struct mac_context *mac_ctx, return; } - size = sizeof(mac_ctx->roam.validChannelList); + size = sizeof(mac_ctx->roam.valid_ch_freq_list); if (QDF_IS_STATUS_SUCCESS (csr_get_cfg_valid_channels(mac_ctx, - (uint8_t *) mac_ctx->roam.validChannelList, - &size))) { + mac_ctx->roam.valid_ch_freq_list, + &size))) { for (i = 0, j = 0; i < size; i++) { /* Only add 5ghz channels.*/ - if (WLAN_REG_IS_5GHZ_CH - (mac_ctx->roam.validChannelList[i])) { - chan_list[j] - = mac_ctx->roam.validChannelList[i]; + if (WLAN_REG_IS_5GHZ_CH_FREQ + (mac_ctx->roam.valid_ch_freq_list[i])) { + chan_list[j] = + wlan_reg_freq_to_chan(mac_ctx->pdev, + mac_ctx->roam.valid_ch_freq_list[i]); j++; if (supp_chan_ie) { @@ -17700,29 +17705,6 @@ csr_check_band_freq_match(enum band_info band, uint32_t freq) return false; } -/** - * csr_check_band_channel_match() - check if passed band and channel match - * parameters - * @band: band to match with channel - * @channel: channel to match with band - * - * Return: bool if match else false - */ -static bool -csr_check_band_channel_match(enum band_info band, uint8_t channel) -{ - if (BAND_ALL == band) - return true; - - if (BAND_2G == band && WLAN_REG_IS_24GHZ_CH(channel)) - return true; - - if (BAND_5G == band && WLAN_REG_IS_5GHZ_CH(channel)) - return true; - - return false; -} - /** * csr_populate_roam_chan_list() * parameters @@ -17957,7 +17939,7 @@ csr_fetch_valid_ch_lst(struct mac_context *mac_ctx, { QDF_STATUS status; uint32_t host_channels = 0; - uint8_t *ch_lst = NULL; + uint32_t *ch_freq_list = NULL; uint8_t i = 0, num_channels = 0; uint16_t unsafe_chan[NUM_CHANNELS]; uint16_t unsafe_chan_cnt = 0; @@ -17976,9 +17958,9 @@ csr_fetch_valid_ch_lst(struct mac_context *mac_ctx, &unsafe_chan_cnt, sizeof(unsafe_chan)); - host_channels = sizeof(mac_ctx->roam.validChannelList); + host_channels = sizeof(mac_ctx->roam.valid_ch_freq_list); status = csr_get_cfg_valid_channels(mac_ctx, - mac_ctx->roam.validChannelList, + mac_ctx->roam.valid_ch_freq_list, &host_channels); if (!QDF_IS_STATUS_SUCCESS(status)) { QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, @@ -17997,15 +17979,18 @@ csr_fetch_valid_ch_lst(struct mac_context *mac_ctx, connectedProfile.op_freq); } - ch_lst = mac_ctx->roam.validChannelList; + ch_freq_list = mac_ctx->roam.valid_ch_freq_list; mac_ctx->roam.numValidChannels = host_channels; for (i = 0; i < mac_ctx->roam.numValidChannels; i++) { - if (!csr_check_band_channel_match(band, *ch_lst)) { + uint8_t channel = + wlan_reg_freq_to_chan(mac_ctx->pdev, *ch_freq_list); + + if (!csr_check_band_freq_match(band, *ch_freq_list)) { QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, ("ignoring non-intra band channel %d"), - *ch_lst); - ch_lst++; + channel); + ch_freq_list++; continue; } @@ -18013,10 +17998,10 @@ csr_fetch_valid_ch_lst(struct mac_context *mac_ctx, ROAMING_DFS_CHANNEL_DISABLED) || (mac_ctx->roam.configParam.sta_roam_policy.dfs_mode == CSR_STA_ROAM_POLICY_DFS_DISABLED)) && - (wlan_reg_is_dfs_ch(mac_ctx->pdev, *ch_lst))) { + (wlan_reg_is_dfs_ch(mac_ctx->pdev, channel))) { QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, - ("ignoring dfs channel %d"), *ch_lst); - ch_lst++; + ("ignoring dfs channel %d"), channel); + ch_freq_list++; continue; } @@ -18025,7 +18010,7 @@ csr_fetch_valid_ch_lst(struct mac_context *mac_ctx, unsafe_chan_cnt) { is_unsafe_chan = false; for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) { - if (unsafe_chan[cnt] == *ch_lst) { + if (unsafe_chan[cnt] == channel) { is_unsafe_chan = true; break; } @@ -18034,14 +18019,14 @@ csr_fetch_valid_ch_lst(struct mac_context *mac_ctx, QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, ("ignoring unsafe channel %d"), - *ch_lst); - ch_lst++; + channel); + ch_freq_list++; continue; } } req_buf->ConnectedNetwork.chan_freq_cache[num_channels++] = - wlan_reg_chan_to_freq(mac_ctx->pdev, *ch_lst); - ch_lst++; + *ch_freq_list; + ch_freq_list++; } req_buf->ChannelCacheType = CHANNEL_LIST_DYNAMIC; req_buf->ConnectedNetwork.ChannelCount = num_channels; @@ -20081,7 +20066,7 @@ QDF_STATUS csr_handoff_request(struct mac_context *mac, pMsg->msgType = eWNI_SME_HANDOFF_REQ; pMsg->msgLen = (uint16_t) sizeof(tAniHandoffReq); pMsg->sessionId = sessionId; - pMsg->channel = pHandoffInfo->channel; + pMsg->channel = wlan_reg_freq_to_chan(mac->pdev, pHandoffInfo->ch_freq); pMsg->handoff_src = pHandoffInfo->src; qdf_mem_copy(pMsg->bssid, pHandoffInfo->bssid.bytes, QDF_MAC_ADDR_SIZE); msg.type = eWNI_SME_HANDOFF_REQ; diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c index 39b11429cb41..633bc795f846 100644 --- a/core/sme/src/csr/csr_api_scan.c +++ b/core/sme/src/csr/csr_api_scan.c @@ -65,7 +65,8 @@ static void csr_set_cfg_country_code(struct mac_context *mac, static void csr_purge_channel_power(struct mac_context *mac, tDblLinkList *pChannelList); -static bool csr_roam_is_valid_channel(struct mac_context *mac, uint8_t channel); +static bool csr_roam_is_valid_channel(struct mac_context *mac, + uint32_t ch_freq); /* pResult is invalid calling this function. */ void csr_free_scan_result_entry(struct mac_context *mac, @@ -1410,9 +1411,7 @@ QDF_STATUS csr_scan_for_ssid(struct mac_context *mac_ctx, uint32_t session_id, if (profile->ChannelInfo.numOfChannels) { for (i = 0; i < profile->ChannelInfo.numOfChannels; i++) { if (csr_roam_is_valid_channel(mac_ctx, - wlan_reg_freq_to_chan( - mac_ctx->pdev, - profile->ChannelInfo.freq_list[i]))) { + profile->ChannelInfo.freq_list[i])) { req->scan_req.chan_list.chan[num_chan].freq = profile->ChannelInfo.freq_list[i]; num_chan++; @@ -1744,14 +1743,14 @@ QDF_STATUS csr_remove_nonscan_cmd_from_pending_list(struct mac_context *mac, return status; } -bool csr_roam_is_valid_channel(struct mac_context *mac, uint8_t channel) +bool csr_roam_is_valid_channel(struct mac_context *mac, uint32_t ch_freq) { bool fValid = false; uint32_t idx_valid_ch; uint32_t len = mac->roam.numValidChannels; for (idx_valid_ch = 0; (idx_valid_ch < len); idx_valid_ch++) { - if (channel == mac->roam.validChannelList[idx_valid_ch]) { + if (ch_freq == mac->roam.valid_ch_freq_list[idx_valid_ch]) { fValid = true; break; } @@ -1762,7 +1761,7 @@ bool csr_roam_is_valid_channel(struct mac_context *mac, uint8_t channel) QDF_STATUS csr_scan_create_entry_in_scan_cache(struct mac_context *mac, uint32_t sessionId, struct qdf_mac_addr bssid, - uint8_t channel) + uint32_t ch_freq) { QDF_STATUS status = QDF_STATUS_SUCCESS; struct csr_roam_session *pSession = CSR_GET_SESSION(mac, sessionId); @@ -1774,8 +1773,8 @@ QDF_STATUS csr_scan_create_entry_in_scan_cache(struct mac_context *mac, } sme_debug("Current bssid::"QDF_MAC_ADDR_STR, QDF_MAC_ADDR_ARRAY(pSession->pConnectBssDesc->bssId)); - sme_debug("My bssid::"QDF_MAC_ADDR_STR" channel %d", - QDF_MAC_ADDR_ARRAY(bssid.bytes), channel); + sme_debug("My bssid::"QDF_MAC_ADDR_STR" ch_freq %d", + QDF_MAC_ADDR_ARRAY(bssid.bytes), ch_freq); size = pSession->pConnectBssDesc->length + sizeof(pSession->pConnectBssDesc->length); @@ -1791,8 +1790,7 @@ QDF_STATUS csr_scan_create_entry_in_scan_cache(struct mac_context *mac, /* change the BSSID & channel as passed */ qdf_mem_copy(pNewBssDescriptor->bssId, bssid.bytes, sizeof(tSirMacAddr)); - pNewBssDescriptor->chan_freq = wlan_reg_chan_to_freq(mac->pdev, - channel); + pNewBssDescriptor->chan_freq = ch_freq; if (!csr_scan_append_bss_description(mac, pNewBssDescriptor)) { sme_err("csr_scan_append_bss_description failed"); status = QDF_STATUS_E_FAILURE; @@ -3084,8 +3082,11 @@ void csr_init_occupied_channels_list(struct mac_context *mac_ctx, QDF_STATUS csr_scan_filter_results(struct mac_context *mac_ctx) { QDF_STATUS status = QDF_STATUS_SUCCESS; - uint32_t len = sizeof(mac_ctx->roam.validChannelList); + uint32_t len = sizeof(mac_ctx->roam.valid_ch_freq_list); struct wlan_objmgr_pdev *pdev = NULL; + uint32_t i; + uint32_t ch_freq; + uint8_t valid_ch_list[CFG_VALID_CHANNEL_LIST_LEN]; pdev = wlan_objmgr_get_pdev_by_id(mac_ctx->psoc, 0, WLAN_LEGACY_MAC_ID); @@ -3094,7 +3095,7 @@ QDF_STATUS csr_scan_filter_results(struct mac_context *mac_ctx) return QDF_STATUS_E_INVAL; } status = csr_get_cfg_valid_channels(mac_ctx, - mac_ctx->roam.validChannelList, + mac_ctx->roam.valid_ch_freq_list, &len); /* Get valid channels list from CFG */ @@ -3105,8 +3106,17 @@ QDF_STATUS csr_scan_filter_results(struct mac_context *mac_ctx) } sme_debug("No of valid channel %d", len); - ucfg_scan_filter_valid_channel(pdev, - mac_ctx->roam.validChannelList, len); + /* This is a temporary conversion till the scm handles freq */ + + for (i = 0; i < len; i++) { + ch_freq = + wlan_reg_freq_to_chan(pdev, + mac_ctx->roam.valid_ch_freq_list[i]); + valid_ch_list[i] = ch_freq; + } + + ucfg_scan_filter_valid_channel(pdev, valid_ch_list, len); + wlan_objmgr_pdev_release_ref(pdev, WLAN_LEGACY_MAC_ID); return QDF_STATUS_SUCCESS; } diff --git a/core/sme/src/csr/csr_host_scan_roam.c b/core/sme/src/csr/csr_host_scan_roam.c index dc44d1ca81e3..204dde46124e 100644 --- a/core/sme/src/csr/csr_host_scan_roam.c +++ b/core/sme/src/csr/csr_host_scan_roam.c @@ -216,8 +216,8 @@ void csr_neighbor_roam_process_scan_results(struct mac_context *mac_ctx, descr->bssId, n_roam_info->handoffReqInfo.bssid.bytes, sizeof(tSirMacAddr))) || - (bss_chan_id != - n_roam_info->handoffReqInfo.channel))) { + (descr->chan_freq != + n_roam_info->handoffReqInfo.ch_freq))) { QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, "SKIP-not a candidate AP for OS requested roam"); diff --git a/core/sme/src/csr/csr_inside_api.h b/core/sme/src/csr/csr_inside_api.h index 4b623dd69680..fbb98ad856e5 100644 --- a/core/sme/src/csr/csr_inside_api.h +++ b/core/sme/src/csr/csr_inside_api.h @@ -318,7 +318,7 @@ bool csr_is_phy_mode_match(struct mac_context *mac, uint32_t phyMode, struct csr_roam_profile *pProfile, enum csr_cfgdot11mode *pReturnCfgDot11Mode, tDot11fBeaconIEs *pIes); -bool csr_roam_is_channel_valid(struct mac_context *mac, uint8_t channel); +bool csr_roam_is_channel_valid(struct mac_context *mac, uint8_t ch_freq); /** * csr_roam_is_chan_freq_valid() - validate channel frequency @@ -333,8 +333,9 @@ bool csr_roam_is_channel_valid(struct mac_context *mac, uint8_t channel); bool csr_roam_is_chan_freq_valid(struct mac_context *mac, uint32_t freq); /* pNumChan is a caller allocated space with the sizeof pChannels */ -QDF_STATUS csr_get_cfg_valid_channels(struct mac_context *mac, uint8_t *pChannels, - uint32_t *pNumChan); +QDF_STATUS csr_get_cfg_valid_channels(struct mac_context *mac, + uint32_t *ch_freq_list, + uint32_t *num_ch_freq); /** * csr_get_cfg_valid_freqs() - Get valid channel frequency list * @mac: mac context @@ -878,7 +879,7 @@ bool csr_neighbor_roam_connected_profile_match(struct mac_context *mac, QDF_STATUS csr_scan_create_entry_in_scan_cache(struct mac_context *mac, uint32_t sessionId, struct qdf_mac_addr bssid, - uint8_t channel); + uint32_t ch_freq); QDF_STATUS csr_update_channel_list(struct mac_context *mac); QDF_STATUS csr_roam_del_pmkid_from_cache(struct mac_context *mac, diff --git a/core/sme/src/csr/csr_neighbor_roam.c b/core/sme/src/csr/csr_neighbor_roam.c index 3c0cee8c7658..58f137219f83 100644 --- a/core/sme/src/csr/csr_neighbor_roam.c +++ b/core/sme/src/csr/csr_neighbor_roam.c @@ -853,10 +853,6 @@ QDF_STATUS csr_neighbor_roam_indicate_disconnect(struct mac_context *mac, sizeof(tSirMacSSid)); qdf_copy_macaddr(&pSession->prevApBssid, &pSession->connectedProfile.bssid); - pSession->prevOpChannel = - wlan_reg_freq_to_chan( - mac->pdev, - pSession->connectedProfile.op_freq); pSession->isPrevApInfoValid = true; pSession->roamTS1 = qdf_mc_timer_get_system_time(); } @@ -1504,8 +1500,7 @@ static QDF_STATUS csr_neighbor_roam_process_handoff_req( } profile->ChannelInfo.freq_list[0] = - wlan_reg_chan_to_freq(mac_ctx->pdev, - roam_ctrl_info->handoffReqInfo.channel); + roam_ctrl_info->handoffReqInfo.ch_freq; /* * For User space connect requests, the scan has already been done. @@ -1576,10 +1571,8 @@ QDF_STATUS csr_neighbor_roam_sssid_scan_done(struct mac_context *mac, if (!QDF_IS_STATUS_SUCCESS(status)) { sme_err("Add an entry to csr scan cache"); hstatus = csr_scan_create_entry_in_scan_cache(mac, sessionId, - pNeighborRoamInfo-> - handoffReqInfo.bssid, - pNeighborRoamInfo-> - handoffReqInfo.channel); + pNeighborRoamInfo->handoffReqInfo.bssid, + pNeighborRoamInfo->handoffReqInfo.ch_freq); if (QDF_STATUS_SUCCESS != hstatus) { sme_err( "csr_scan_create_entry_in_scan_cache failed with status %d", @@ -1642,8 +1635,8 @@ QDF_STATUS csr_neighbor_roam_handoff_req_hdlr( sme_err("Received req has same BSSID as current AP!!"); return QDF_STATUS_E_FAILURE; } - roam_ctrl_info->handoffReqInfo.channel = - handoff_req->channel; + roam_ctrl_info->handoffReqInfo.ch_freq = + wlan_reg_chan_to_freq(mac_ctx->pdev, handoff_req->channel); roam_ctrl_info->handoffReqInfo.src = handoff_req->handoff_src; qdf_mem_copy(&roam_ctrl_info->handoffReqInfo.bssid.bytes, diff --git a/core/sme/src/rrm/sme_rrm.c b/core/sme/src/rrm/sme_rrm.c index 795229669fbb..52b4523ab1a9 100644 --- a/core/sme/src/rrm/sme_rrm.c +++ b/core/sme/src/rrm/sme_rrm.c @@ -309,8 +309,7 @@ static QDF_STATUS sme_ese_send_beacon_req_scan_results( qdf_mem_zero(&bcn_rpt_rsp, sizeof(bcn_rpt_rsp)); for (i = 0; i < rrm_ctx->eseBcnReqInfo.numBcnReqIe; i++) { - if (rrm_ctx->eseBcnReqInfo.bcnReq[i].channel == - wlan_reg_freq_to_chan(mac_ctx->pdev, freq)) { + if (rrm_ctx->eseBcnReqInfo.bcnReq[i].ch_freq == freq) { cur_meas_req = &rrm_ctx->eseBcnReqInfo.bcnReq[i]; break;