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
This commit is contained in:
sheenam monga 2021-01-21 15:24:02 +05:30 • committed by Madan Koyyalamudi
commit f0b20488a1
6 changed files with 38 additions and 39 deletions

View file

@ -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

View file

@ -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!!");

View file

@ -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 &&

View file

@ -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;

View file

@ -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;

View file

@ -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;