From f0b20488a1deea401de54250a00e6206eedca81f Mon Sep 17 00:00:00 2001 From: sheenam monga Date: Thu, 21 Jan 2021 15:24:02 +0530 Subject: [PATCH] qcacld-3.0: Remove usage of wlan_reg_get_channel_state Use wlan_reg_get_channel_state_for_freq to get channel state instead of wlan_reg_get_channel_state. Change-Id: I0ab0465458801747cc97bf03b3aee4ec255beb57 CRs-Fixed: 2859852 --- .../policy_mgr/inc/wlan_policy_mgr_api.h | 10 +++--- .../src/wlan_policy_mgr_get_set_utils.c | 9 +++--- components/tdls/core/src/wlan_tdls_peer.c | 5 +-- core/hdd/src/wlan_hdd_cfg80211.c | 15 ++++----- core/hdd/src/wlan_hdd_ext_scan.c | 32 ++++++++----------- core/hdd/src/wlan_hdd_hostapd.c | 6 ++-- 6 files changed, 38 insertions(+), 39 deletions(-) diff --git a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h index 593d27fa6189..3f99bacf2494 100644 --- a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h +++ b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h @@ -3200,18 +3200,18 @@ void policy_mgr_set_weight_of_dfs_passive_channels_to_zero( struct wlan_objmgr_psoc *psoc, uint32_t *pcl, uint32_t *len, uint8_t *weight_list, uint32_t weight_len); /** - * policy_mgr_is_sap_allowed_on_dfs_chan() - check if sap allowed on dfs channel + * policy_mgr_is_sap_allowed_on_dfs_freq() - check if sap allowed on dfs freq * @pdev: id of objmgr pdev * @vdev_id: vdev id - * @channel: channel number + * @ch_freq: channel freq * This function is used to check if sta_sap_scc_on_dfs_chan ini is set, * DFS master capability is assumed disabled in the driver. * - * Return: true if sap is allowed on dfs channel, + * Return: true if sap is allowed on dfs freq, * otherwise false */ -bool policy_mgr_is_sap_allowed_on_dfs_chan(struct wlan_objmgr_pdev *pdev, - uint8_t vdev_id, uint8_t channel); +bool policy_mgr_is_sap_allowed_on_dfs_freq(struct wlan_objmgr_pdev *pdev, + uint8_t vdev_id, qdf_freq_t ch_freq); /** * policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan() - check if sta+sap scc * allowed on dfs chan diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c index 1a705b4c0606..08ca8466a5ea 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c @@ -4000,8 +4000,8 @@ bool policy_mgr_is_force_scc(struct wlan_objmgr_psoc *psoc) QDF_MCC_TO_SCC_WITH_PREFERRED_BAND)); } -bool policy_mgr_is_sap_allowed_on_dfs_chan(struct wlan_objmgr_pdev *pdev, - uint8_t vdev_id, uint8_t channel) +bool policy_mgr_is_sap_allowed_on_dfs_freq(struct wlan_objmgr_pdev *pdev, + uint8_t vdev_id, qdf_freq_t ch_freq) { struct wlan_objmgr_psoc *psoc; uint32_t sta_sap_scc_on_dfs_chan; @@ -4019,12 +4019,13 @@ bool policy_mgr_is_sap_allowed_on_dfs_chan(struct wlan_objmgr_pdev *pdev, PM_P2P_CLIENT_MODE, NULL); policy_mgr_debug("sta_sap_scc_on_dfs_chan %u, sta_cnt %u, gc_cnt %u", - sta_sap_scc_on_dfs_chan, sta_cnt, gc_cnt); + sta_sap_scc_on_dfs_chan, sta_cnt, gc_cnt); /* if sta_sap_scc_on_dfs_chan ini is set, DFS master capability is * assumed disabled in the driver. */ - if ((wlan_reg_get_channel_state(pdev, channel) == CHANNEL_STATE_DFS) && + if ((wlan_reg_get_channel_state_for_freq(pdev, ch_freq) == + CHANNEL_STATE_DFS) && !sta_cnt && !gc_cnt && sta_sap_scc_on_dfs_chan && !policy_mgr_get_dfs_master_dynamic_enabled(psoc, vdev_id)) { policy_mgr_err("SAP not allowed on DFS channel if no dfs master capability!!"); diff --git a/components/tdls/core/src/wlan_tdls_peer.c b/components/tdls/core/src/wlan_tdls_peer.c index 20a085d27ffd..571d00d67c9e 100644 --- a/components/tdls/core/src/wlan_tdls_peer.c +++ b/components/tdls/core/src/wlan_tdls_peer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2021 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 @@ -530,7 +530,8 @@ void tdls_extract_peer_state_param(struct tdls_peer_update_state *peer_param, num = 0; for (i = 0; i < peer->supported_channels_len; i++) { chan_id = peer->supported_channels[i]; - ch_state = wlan_reg_get_channel_state(pdev, chan_id); + ch_freq = wlan_reg_legacy_chan_to_freq(pdev, chan_id); + ch_state = wlan_reg_get_channel_state_for_freq(pdev, ch_freq); if (CHANNEL_STATE_INVALID != ch_state && CHANNEL_STATE_DFS != ch_state && diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 8002f7401157..a28b3f8ef9c2 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -15850,9 +15850,9 @@ int wlan_hdd_cfg80211_update_band(struct hdd_context *hdd_ctx, for (j = 0; j < wiphy->bands[i]->n_channels; j++) { struct ieee80211_supported_band *band = wiphy->bands[i]; - channel_state = wlan_reg_get_channel_state( + channel_state = wlan_reg_get_channel_state_for_freq( hdd_ctx->pdev, - band->channels[j].hw_value); + band->channels[j].center_freq); if (HDD_NL80211_BAND_2GHZ == i && BAND_5G == new_band) { @@ -23374,7 +23374,7 @@ static int __wlan_hdd_cfg80211_channel_switch(struct wiphy *wiphy, { struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); struct hdd_context *hdd_ctx; - int ret, channel; + int ret; enum phy_ch_width ch_width; bool status; @@ -23391,11 +23391,10 @@ static int __wlan_hdd_cfg80211_channel_switch(struct wiphy *wiphy, (QDF_SAP_MODE != adapter->device_mode)) return -ENOTSUPP; - channel = ieee80211_frequency_to_channel( - csa_params->chandef.chan->center_freq); - - status = policy_mgr_is_sap_allowed_on_dfs_chan(hdd_ctx->pdev, - adapter->vdev_id, channel); + status = policy_mgr_is_sap_allowed_on_dfs_freq( + hdd_ctx->pdev, + adapter->vdev_id, + csa_params->chandef.chan->center_freq); if (!status) return -EINVAL; diff --git a/core/hdd/src/wlan_hdd_ext_scan.c b/core/hdd/src/wlan_hdd_ext_scan.c index 2aab2e8e6e54..d160e7cf420c 100644 --- a/core/hdd/src/wlan_hdd_ext_scan.c +++ b/core/hdd/src/wlan_hdd_ext_scan.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2021 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 @@ -2538,10 +2538,9 @@ static int hdd_extscan_start_fill_bucket_channel_spec( channel->channel = chan_list[j]; channel->channel_class = 0; - if ((wlan_reg_get_channel_state( - hdd_ctx->pdev, - cds_freq_to_chan(chan_list[j]))) != - CHANNEL_STATE_ENABLE) { + if ((wlan_reg_get_channel_state_for_freq( + hdd_ctx->pdev, chan_list[j])) != + CHANNEL_STATE_ENABLE) { channel->passive = 1; channel->dwell_time_ms = max_dwell_time_passive_bucket; @@ -2677,11 +2676,9 @@ static int hdd_extscan_start_fill_bucket_channel_spec( hdd_debug("WiFi band is unspecified, dwellTime:%d", channel->dwell_time_ms); - if ((wlan_reg_get_channel_state( - hdd_ctx->pdev, - cds_freq_to_chan( - channel->channel))) - != CHANNEL_STATE_ENABLE) { + if ((wlan_reg_get_channel_state_for_freq( + hdd_ctx->pdev, channel->channel)) != + CHANNEL_STATE_ENABLE) { channel->dwell_time_ms = max_dwell_time_passive_bucket; } else { @@ -2693,10 +2690,9 @@ static int hdd_extscan_start_fill_bucket_channel_spec( hdd_debug("New Dwell time %u ms", channel->dwell_time_ms); - if ((wlan_reg_get_channel_state(hdd_ctx->pdev, - cds_freq_to_chan( - channel->channel))) - != CHANNEL_STATE_ENABLE) { + if ((wlan_reg_get_channel_state_for_freq( + hdd_ctx->pdev, channel->channel)) != + CHANNEL_STATE_ENABLE) { if (min_dwell_time_passive_bucket > channel->dwell_time_ms) { min_dwell_time_passive_bucket = @@ -2732,10 +2728,10 @@ static int hdd_extscan_start_fill_bucket_channel_spec( hdd_debug("Chnl spec passive %u", channel->passive); /* Override scan type if required */ - if ((wlan_reg_get_channel_state(hdd_ctx->pdev, - cds_freq_to_chan( - channel->channel))) - != CHANNEL_STATE_ENABLE) { + if ((wlan_reg_get_channel_state_for_freq( + hdd_ctx->pdev, + channel->channel)) + != CHANNEL_STATE_ENABLE) { channel->passive = true; } else { channel->passive = false; diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index cd221efd336d..1e3604b7ce44 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -6531,8 +6531,10 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, adapter->session.ap.sap_config.ch_params.mhz_freq_seg1 = chandef->center_freq2; - status = policy_mgr_is_sap_allowed_on_dfs_chan(hdd_ctx->pdev, - adapter->vdev_id, channel); + status = policy_mgr_is_sap_allowed_on_dfs_freq( + hdd_ctx->pdev, + adapter->vdev_id, + chandef->chan->center_freq); if (!status) return -EINVAL;