From a8940a2ddf8bf32b8f0911b8277d058d0af413b0 Mon Sep 17 00:00:00 2001 From: wadesong Date: Mon, 11 Nov 2019 16:58:16 +0800 Subject: [PATCH] qcacld-3.0: Convert HDD/SME/CSR legacy channel ID usage 1) Change the following functions' signatures and/or code to make them using frequencies instead of channel IDs: hdd_get_adapter_home_channel hdd_get_operating_channel wlan_hdd_request_pre_cac wlan_hdd_validate_and_get_pre_cac_ch __wlan_hdd_request_pre_cac hdd_check_and_disconnect_sta_on_invalid_channel set_first_connection_operating_channel sme_is_channel_valid csr_roam_is_channel_valid 2) Remove the declaration, definition and usage of csr_roam_is_chan_freq_valid, and replace it with csr_roam_is_channel_valid as this API does exactly the same thing. 3) Retain the code/logic for chan ID utilization in function set_first_connection_operating_channel as it is used to convert the parameters issued by user space apps. 4) Fix a few camel cases in csr_api_roam.c Change-Id: I4f9cfa21a5f40288ad9492ac8be7939ed8eb6484 CRs-Fixed: 2565002 --- core/hdd/inc/wlan_hdd_main.h | 22 +++++++-- core/hdd/src/wlan_hdd_cfg80211.h | 13 +++++- core/hdd/src/wlan_hdd_hostapd.c | 15 +++--- core/hdd/src/wlan_hdd_main.c | 40 ++++------------ core/hdd/src/wlan_hdd_p2p.c | 10 ++-- core/hdd/src/wlan_hdd_sap_cond_chan_switch.c | 49 ++++++++------------ core/sme/inc/sme_api.h | 15 +++++- core/sme/src/common/sme_api.c | 13 +----- core/sme/src/csr/csr_api_roam.c | 39 +++++++--------- core/sme/src/csr/csr_inside_api.h | 7 ++- core/sme/src/rrm/sme_rrm.c | 5 +- 11 files changed, 109 insertions(+), 119 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 3cef5ca740c7..d82366e3e680 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -2248,7 +2248,7 @@ struct hdd_adapter *hdd_get_adapter_by_macaddr(struct hdd_context *hdd_ctx, * * Return: home channel if connected/started or invalid channel 0 */ -uint8_t hdd_get_adapter_home_channel(struct hdd_adapter *adapter); +uint32_t hdd_get_adapter_home_channel(struct hdd_adapter *adapter); /* * hdd_get_adapter_by_rand_macaddr() - find Random mac adapter @@ -2324,8 +2324,24 @@ uint8_t *wlan_hdd_get_intf_addr(struct hdd_context *hdd_ctx, enum QDF_OPMODE interface_type); void wlan_hdd_release_intf_addr(struct hdd_context *hdd_ctx, uint8_t *releaseAddr); -uint8_t hdd_get_operating_channel(struct hdd_context *hdd_ctx, - enum QDF_OPMODE mode); + +/** + * hdd_get_operating_chan_freq() - return operating channel of the device mode + * @hdd_ctx: Pointer to the HDD context. + * @mode: Device mode for which operating channel is required. + * Supported modes: + * QDF_STA_MODE, + * QDF_P2P_CLIENT_MODE, + * QDF_SAP_MODE, + * QDF_P2P_GO_MODE. + * + * This API returns the operating channel of the requested device mode + * + * Return: channel frequency, or + * 0 if the requested device mode is not found. + */ +uint32_t hdd_get_operating_chan_freq(struct hdd_context *hdd_ctx, + enum QDF_OPMODE mode); void hdd_set_conparam(int32_t con_param); enum QDF_GLOBAL_MODE hdd_get_conparam(void); diff --git a/core/hdd/src/wlan_hdd_cfg80211.h b/core/hdd/src/wlan_hdd_cfg80211.h index b6c0054ca525..bcae6eb7a9e7 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.h +++ b/core/hdd/src/wlan_hdd_cfg80211.h @@ -413,7 +413,18 @@ static inline int wlan_hdd_send_roam_auth_event(struct hdd_adapter *adapter, #endif int wlan_hdd_cfg80211_update_apies(struct hdd_adapter *adapter); -int wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx, uint8_t channel); + +/** + * wlan_hdd_request_pre_cac() - Start pre CAC in the driver + * @hdd_ctx: the HDD context to operate against + * @chan_freq: channel freq option provided by userspace + * + * Sets the driver to the required hardware mode and start an adapter for + * pre CAC which will mimic an AP. + * + * Return: Zero on success, non-zero value on error + */ +int wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx, uint32_t chan_freq); int wlan_hdd_sap_cfg_dfs_override(struct hdd_adapter *adapter); int wlan_hdd_enable_dfs_chan_scan(struct hdd_context *hdd_ctx, diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 311de05d2657..9608489c1320 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -4546,19 +4546,18 @@ void hdd_check_and_disconnect_sta_on_invalid_channel( struct hdd_context *hdd_ctx) { struct hdd_adapter *sta_adapter; - uint8_t sta_chan; + uint32_t sta_chan_freq; - sta_chan = hdd_get_operating_channel(hdd_ctx, QDF_STA_MODE); - - if (!sta_chan) { + sta_chan_freq = hdd_get_operating_chan_freq(hdd_ctx, QDF_STA_MODE); + if (!sta_chan_freq) { hdd_err("STA not connected"); return; } - hdd_err("STA connected on chan %d", sta_chan); + hdd_err("STA connected on %d", sta_chan_freq); - if (sme_is_channel_valid(hdd_ctx->mac_handle, sta_chan)) { - hdd_err("STA connected on chan %d and it is valid", sta_chan); + if (sme_is_channel_valid(hdd_ctx->mac_handle, sta_chan_freq)) { + hdd_err("STA connected on %d and it is valid", sta_chan_freq); return; } @@ -4569,7 +4568,7 @@ void hdd_check_and_disconnect_sta_on_invalid_channel( return; } - hdd_err("chan %d not valid, issue disconnect", sta_chan); + hdd_err("chan %d not valid, issue disconnect", sta_chan_freq); /* Issue Disconnect request */ wlan_hdd_disconnect(sta_adapter, eCSR_DISCONNECT_REASON_DEAUTH); } diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index d48bd92c627a..687ff0bc6377 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -856,9 +856,9 @@ int hdd_validate_channel_and_bandwidth(struct hdd_adapter *adapter, return 0; } -uint8_t hdd_get_adapter_home_channel(struct hdd_adapter *adapter) +uint32_t hdd_get_adapter_home_channel(struct hdd_adapter *adapter) { - uint8_t home_channel = 0; + uint32_t home_chan_freq = 0; struct hdd_context *hdd_ctx; hdd_ctx = WLAN_HDD_GET_CTX(adapter); @@ -870,20 +870,15 @@ uint8_t hdd_get_adapter_home_channel(struct hdd_adapter *adapter) if ((adapter->device_mode == QDF_SAP_MODE || adapter->device_mode == QDF_P2P_GO_MODE) && test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) { - home_channel = wlan_reg_freq_to_chan( - hdd_ctx->pdev, - adapter->session.ap.operating_chan_freq); + home_chan_freq = adapter->session.ap.operating_chan_freq; } else if ((adapter->device_mode == QDF_STA_MODE || adapter->device_mode == QDF_P2P_CLIENT_MODE) && adapter->session.station.conn_info.conn_state == eConnectionState_Associated) { - home_channel = - wlan_reg_freq_to_chan( - hdd_ctx->pdev, - adapter->session.station.conn_info.chan_freq); + home_chan_freq = adapter->session.station.conn_info.chan_freq; } - return home_channel; + return home_chan_freq; } #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) @@ -7323,36 +7318,21 @@ enum QDF_OPMODE hdd_get_device_mode(uint32_t vdev_id) return adapter->device_mode; } -/** - * hdd_get_operating_channel() - return operating channel of the device mode - * @hdd_ctx: Pointer to the HDD context. - * @mode: Device mode for which operating channel is required. - * Supported modes: - * QDF_STA_MODE, - * QDF_P2P_CLIENT_MODE, - * QDF_SAP_MODE, - * QDF_P2P_GO_MODE. - * - * This API returns the operating channel of the requested device mode - * - * Return: channel number. "0" id the requested device is not found OR it is - * not connected. - */ -uint8_t hdd_get_operating_channel(struct hdd_context *hdd_ctx, - enum QDF_OPMODE mode) +uint32_t hdd_get_operating_chan_freq(struct hdd_context *hdd_ctx, + enum QDF_OPMODE mode) { struct hdd_adapter *adapter; - uint8_t operatingChannel = 0; + uint32_t oper_chan_freq = 0; hdd_for_each_adapter(hdd_ctx, adapter) { if (mode == adapter->device_mode) { - operatingChannel = + oper_chan_freq = hdd_get_adapter_home_channel(adapter); break; } } - return operatingChannel; + return oper_chan_freq; } static inline QDF_STATUS hdd_unregister_wext_all_adapters(struct hdd_context * diff --git a/core/hdd/src/wlan_hdd_p2p.c b/core/hdd/src/wlan_hdd_p2p.c index 6b0ba2842978..2da9a2db8e42 100644 --- a/core/hdd/src/wlan_hdd_p2p.c +++ b/core/hdd/src/wlan_hdd_p2p.c @@ -1269,16 +1269,18 @@ static uint32_t set_first_connection_operating_channel( enum QDF_OPMODE dev_mode) { uint8_t operating_channel; + uint32_t oper_chan_freq; - operating_channel = hdd_get_operating_channel( - hdd_ctx, dev_mode); - if (!operating_channel) { + oper_chan_freq = hdd_get_operating_chan_freq(hdd_ctx, dev_mode); + if (!oper_chan_freq) { hdd_err(" First adpter operating channel is invalid"); return -EINVAL; } + operating_channel = wlan_reg_freq_to_chan(hdd_ctx->pdev, + oper_chan_freq); hdd_info("First connection channel No.:%d and quota:%dms", - operating_channel, set_value); + operating_channel, set_value); /* Move the time quota for first channel to bits 15-8 */ set_value = set_value << 8; diff --git a/core/hdd/src/wlan_hdd_sap_cond_chan_switch.c b/core/hdd/src/wlan_hdd_sap_cond_chan_switch.c index bef051a5cc61..e9510762fc3d 100644 --- a/core/hdd/src/wlan_hdd_sap_cond_chan_switch.c +++ b/core/hdd/src/wlan_hdd_sap_cond_chan_switch.c @@ -83,8 +83,8 @@ static int wlan_hdd_set_chan_before_pre_cac(struct hdd_adapter *ap_adapter, * wlan_hdd_validate_and_get_pre_cac_ch() - Validate and get pre cac channel * @hdd_ctx: HDD context * @ap_adapter: AP adapter - * @channel: Channel requested by userspace - * @pre_cac_chan_freq: Pointer to the pre CAC channel freq + * @chan_freq: Channel frequency requested by userspace + * @pre_cac_chan_freq: Pointer to the pre CAC channel frequency storage * * Validates the channel provided by userspace. If user provided channel 0, * a valid outdoor channel must be selected from the regulatory channel. @@ -93,7 +93,7 @@ static int wlan_hdd_set_chan_before_pre_cac(struct hdd_adapter *ap_adapter, */ static int wlan_hdd_validate_and_get_pre_cac_ch(struct hdd_context *hdd_ctx, struct hdd_adapter *ap_adapter, - uint8_t channel, + uint32_t chan_freq, uint32_t *pre_cac_chan_freq) { uint32_t i; @@ -104,7 +104,7 @@ static int wlan_hdd_validate_and_get_pre_cac_ch(struct hdd_context *hdd_ctx, uint8_t pcl_weights[NUM_CHANNELS] = {0}; mac_handle_t mac_handle; - if (channel == 0) { + if (!chan_freq) { /* Channel is not obtained from PCL because PCL may not have * the entire channel list. For example: if SAP is up on * channel 6 and PCL is queried for the next SAP interface, @@ -139,13 +139,12 @@ static int wlan_hdd_validate_and_get_pre_cac_ch(struct hdd_context *hdd_ctx, * the user is expected to take care of this. */ mac_handle = hdd_ctx->mac_handle; - if (!sme_is_channel_valid(mac_handle, channel) || - !wlan_reg_is_dfs_ch(hdd_ctx->pdev, channel)) { - hdd_err("Invalid channel for pre cac:%d", channel); + if (!sme_is_channel_valid(mac_handle, chan_freq) || + !wlan_reg_is_dfs_for_freq(hdd_ctx->pdev, chan_freq)) { + hdd_err("Invalid channel for pre cac:%d", chan_freq); return -EINVAL; } - *pre_cac_chan_freq = wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev, - channel); + *pre_cac_chan_freq = chan_freq; } hdd_debug("selected pre cac channel:%d", *pre_cac_chan_freq); return 0; @@ -154,7 +153,7 @@ static int wlan_hdd_validate_and_get_pre_cac_ch(struct hdd_context *hdd_ctx, /** * __wlan_hdd_request_pre_cac() - Start pre CAC in the driver * @hdd_ctx: the HDD context to operate against - * @channel: Channel option provided by userspace + * @chan_freq: Channel frequency option provided by userspace * @out_adapter: out parameter for the newly created pre-cac adapter * * Sets the driver to the required hardware mode and start an adapter for @@ -163,7 +162,7 @@ static int wlan_hdd_validate_and_get_pre_cac_ch(struct hdd_context *hdd_ctx, * Return: Zero on success, non-zero value on error */ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx, - uint8_t channel, + uint32_t chan_freq, struct hdd_adapter **out_adapter) { uint8_t *mac_addr; @@ -176,7 +175,6 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx, struct net_device *dev; struct cfg80211_chan_def chandef; enum nl80211_channel_type channel_type; - uint32_t freq; struct ieee80211_channel *chan; mac_handle_t mac_handle; bool val; @@ -224,10 +222,10 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx, return -EINVAL; } - hdd_debug("channel:%d", channel); + hdd_debug("channel: %d", chan_freq); - ret = wlan_hdd_validate_and_get_pre_cac_ch(hdd_ctx, ap_adapter, channel, - &pre_cac_chan_freq); + ret = wlan_hdd_validate_and_get_pre_cac_ch( + hdd_ctx, ap_adapter, chan_freq, &pre_cac_chan_freq); if (ret != 0) { hdd_err("can't validate pre-cac channel"); goto release_intf_addr_and_return_failure; @@ -312,18 +310,16 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx, break; } - freq = pre_cac_chan_freq; - chan = ieee80211_get_channel(wiphy, freq); + chan = ieee80211_get_channel(wiphy, pre_cac_chan_freq); if (!chan) { hdd_err("channel converion failed"); goto stop_close_pre_cac_adapter; } - cfg80211_chandef_create(&chandef, chan, channel_type); hdd_debug("orig width:%d channel_type:%d freq:%d", ap_adapter->session.ap.sap_config.ch_width_orig, - channel_type, freq); + channel_type, pre_cac_chan_freq); /* * Doing update after opening and starting pre-cac adapter will make * sure that driver won't do hardware mode change if there are any @@ -397,7 +393,7 @@ release_intf_addr_and_return_failure: return -EINVAL; } -int wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx, uint8_t channel) +int wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx, uint32_t chan_freq) { struct hdd_adapter *adapter; struct osif_vdev_sync *vdev_sync; @@ -408,7 +404,7 @@ int wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx, uint8_t channel) if (errno) return errno; - errno = __wlan_hdd_request_pre_cac(hdd_ctx, channel, &adapter); + errno = __wlan_hdd_request_pre_cac(hdd_ctx, chan_freq, &adapter); if (errno) goto destroy_sync; @@ -450,7 +446,6 @@ __wlan_hdd_cfg80211_conditional_chan_switch(struct wiphy *wiphy, *tb[QCA_WLAN_VENDOR_ATTR_SAP_CONDITIONAL_CHAN_SWITCH_MAX + 1]; uint32_t freq_len, i; uint32_t *freq; - uint8_t chans[QDF_MAX_NUM_CHAN] = {0}; bool is_dfs_mode_enabled = false; hdd_enter_dev(dev); @@ -512,14 +507,8 @@ __wlan_hdd_cfg80211_conditional_chan_switch(struct wiphy *wiphy, freq = nla_data( tb[QCA_WLAN_VENDOR_ATTR_SAP_CONDITIONAL_CHAN_SWITCH_FREQ_LIST]); - for (i = 0; i < freq_len; i++) { - if (freq[i] == 0) - chans[i] = 0; - else - chans[i] = ieee80211_frequency_to_channel(freq[i]); - + for (i = 0; i < freq_len; i++) hdd_debug("freq[%d]=%d", i, freq[i]); - } /* * The input frequency list from user space is designed to be a @@ -530,7 +519,7 @@ __wlan_hdd_cfg80211_conditional_chan_switch(struct wiphy *wiphy, * If channel is zero, any channel in the available outdoor regulatory * domain will be selected. */ - ret = wlan_hdd_request_pre_cac(hdd_ctx, chans[0]); + ret = wlan_hdd_request_pre_cac(hdd_ctx, freq[0]); if (ret) { hdd_err("pre cac request failed with reason:%d", ret); return ret; diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 5c3ebe321aca..12c7ca7a98ed 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -778,9 +778,20 @@ QDF_STATUS sme_get_cfg_valid_channels(uint32_t *valid_ch_freq, uint32_t *len); QDF_STATUS sme_8023_multicast_list(mac_handle_t mac_handle, uint8_t sessionId, tpSirRcvFltMcAddrList pMulticastAddrs); #endif /* WLAN_FEATURE_PACKET_FILTERING */ -bool sme_is_channel_valid(mac_handle_t mac_handle, uint8_t channel); uint16_t sme_chn_to_freq(uint8_t chanNum); -bool sme_is_channel_valid(mac_handle_t mac_handle, uint8_t channel); + +/* + * sme_is_channel_valid() - validate a channel against current regdmn + * To check if the channel is valid for currently established domain + * This is a synchronous API. + * + * mac_handle - The handle returned by mac_open. + * chan_freq - channel to verify + * + * Return: true/false, true if channel is valid + */ +bool sme_is_channel_valid(mac_handle_t mac_handle, uint32_t chan_freq); + QDF_STATUS sme_set_max_tx_power(mac_handle_t mac_handle, struct qdf_mac_addr pBssid, struct qdf_mac_addr pSelfMacAddress, int8_t dB); diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 902862c37dd2..4cba470c8143 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -5504,16 +5504,7 @@ QDF_STATUS sme_8023_multicast_list(mac_handle_t mac_handle, uint8_t sessionId, } #endif /* WLAN_FEATURE_PACKET_FILTERING */ -/* - * sme_is_channel_valid() - - * To check if the channel is valid for currently established domain - * This is a synchronous API. - * - * mac_handle - The handle returned by mac_open. - * channel - channel to verify - * Return true/false, true if channel is valid - */ -bool sme_is_channel_valid(mac_handle_t mac_handle, uint8_t channel) +bool sme_is_channel_valid(mac_handle_t mac_handle, uint32_t chan_freq) { QDF_STATUS status = QDF_STATUS_E_FAILURE; bool valid = false; @@ -5522,7 +5513,7 @@ bool sme_is_channel_valid(mac_handle_t mac_handle, uint8_t channel) status = sme_acquire_global_lock(&mac->sme); if (QDF_IS_STATUS_SUCCESS(status)) { - valid = csr_roam_is_channel_valid(mac, channel); + valid = csr_roam_is_channel_valid(mac, chan_freq); sme_release_global_lock(&mac->sme); } diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 887794faa542..0898e484a115 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -830,7 +830,7 @@ csr_roam_get_ibss_start_chan_freq50(struct mac_context *mac) 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)) + if (!csr_roam_is_channel_valid(mac, ch_freq)) ch_freq = 0; } if (0 == ch_freq @@ -887,7 +887,7 @@ csr_roam_get_ibss_start_chan_freq24(struct mac_context *mac) 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)) + if (!csr_roam_is_channel_valid(mac, ch_freq)) ch_freq = 0; } @@ -2224,7 +2224,7 @@ QDF_STATUS csr_create_roam_scan_channel_list(struct mac_context *mac, if (BAND_2G == band) { for (i = 0; i < inNumChannels; i++) { if (WLAN_REG_IS_24GHZ_CH_FREQ(in_ptr[i]) && - csr_roam_is_chan_freq_valid(mac, in_ptr[i])) { + csr_roam_is_channel_valid(mac, in_ptr[i])) { csr_freq_list[out_num_chan++] = in_ptr[i]; } } @@ -2232,14 +2232,14 @@ QDF_STATUS csr_create_roam_scan_channel_list(struct mac_context *mac, for (i = 0; i < inNumChannels; i++) { /* Add 5G Non-DFS channel */ if (WLAN_REG_IS_5GHZ_CH_FREQ(in_ptr[i]) && - csr_roam_is_chan_freq_valid(mac, in_ptr[i]) && + csr_roam_is_channel_valid(mac, in_ptr[i]) && !wlan_reg_is_dfs_for_freq(mac->pdev, in_ptr[i])) { csr_freq_list[out_num_chan++] = in_ptr[i]; } } } else if (BAND_ALL == band) { for (i = 0; i < inNumChannels; i++) { - if (csr_roam_is_chan_freq_valid(mac, in_ptr[i]) && + if (csr_roam_is_channel_valid(mac, in_ptr[i]) && !wlan_reg_is_dfs_for_freq(mac->pdev, in_ptr[i])) { csr_freq_list[out_num_chan++] = in_ptr[i]; } @@ -11433,8 +11433,8 @@ csr_roam_get_scan_filter_from_profile(struct mac_context *mac_ctx, filter->num_of_channels); break; } - if (csr_roam_is_chan_freq_valid(mac_ctx, - ch_info->freq_list[i])) { + if (csr_roam_is_channel_valid(mac_ctx, + ch_info->freq_list[i])) { filter->chan_freq_list[filter->num_of_channels] = ch_info->freq_list[i]; filter->num_of_channels++; @@ -13966,32 +13966,25 @@ error: return maxTxPwr; } -bool csr_roam_is_channel_valid(struct mac_context *mac, uint8_t channel) +bool csr_roam_is_channel_valid(struct mac_context *mac, uint32_t chan_freq) { - bool fValid = false; - uint32_t id_Valid_ch; + bool valid = false; + 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.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; + for (id_valid_ch = 0; (id_valid_ch < len); + id_valid_ch++) { + if (chan_freq == + mac->roam.valid_ch_freq_list[id_valid_ch]) { + valid = true; break; } } } mac->roam.numValidChannels = len; - return fValid; -} - -bool csr_roam_is_chan_freq_valid(struct mac_context *mac, uint32_t freq) -{ - return csr_roam_is_channel_valid( - mac, - (uint8_t)wlan_reg_freq_to_chan(mac->pdev, freq)); + return valid; } /* This function check and validate whether the NIC can do CB (40MHz) */ diff --git a/core/sme/src/csr/csr_inside_api.h b/core/sme/src/csr/csr_inside_api.h index e96ff4e50899..6b7260cf9ed2 100644 --- a/core/sme/src/csr/csr_inside_api.h +++ b/core/sme/src/csr/csr_inside_api.h @@ -298,19 +298,18 @@ 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 ch_freq); /** - * csr_roam_is_chan_freq_valid() - validate channel frequency + * csr_roam_is_channel_valid() - validate channel frequency * @mac: mac context - * @freq: channel frequency + * @chan_freq: channel frequency * * This function validates channel frequency present in valid channel * list or not. * * Return: true or false */ -bool csr_roam_is_chan_freq_valid(struct mac_context *mac, uint32_t freq); +bool csr_roam_is_channel_valid(struct mac_context *mac, uint32_t chan_freq); /** * csr_get_cfg_valid_channels() - Get valid channel frequency list diff --git a/core/sme/src/rrm/sme_rrm.c b/core/sme/src/rrm/sme_rrm.c index 479325d5621e..2aac88bd1509 100644 --- a/core/sme/src/rrm/sme_rrm.c +++ b/core/sme/src/rrm/sme_rrm.c @@ -1128,7 +1128,7 @@ QDF_STATUS sme_rrm_process_beacon_report_req_ind(struct mac_context *mac, if (beacon_req->channel_info.chan_num != 255) { chan_valid = - csr_roam_is_chan_freq_valid(mac, bcn_chan_freq); + csr_roam_is_channel_valid(mac, bcn_chan_freq); if (chan_valid) { rrm_freq_list[num_chan] = bcn_chan_freq; @@ -1143,8 +1143,7 @@ QDF_STATUS sme_rrm_process_beacon_report_req_ind(struct mac_context *mac, bcn_chan_freq = beacon_req->channel_list.chan_freq_lst[i]; chan_valid = - csr_roam_is_chan_freq_valid(mac, - bcn_chan_freq); + csr_roam_is_channel_valid(mac, bcn_chan_freq); if (chan_valid) { rrm_freq_list[num_chan] = bcn_chan_freq;