From af142cc6729e3a089a820b416c14021cd7182b51 Mon Sep 17 00:00:00 2001 From: Amar Singhal Date: Thu, 4 Jun 2020 21:58:58 -0700 Subject: [PATCH] qcacmn: Use channel flags to determine DFS channel Use channel flags to determine DFS channel. Channel state is set to CHANNEL_STATE_DFS even for passive channel. Change-Id: I5ff88f05d2967f9e93de028d59d91369b66303c5 CRs-Fixed: 2695162 --- .../regulatory/core/src/reg_services_common.c | 29 +++++++++++++++++-- .../inc/reg_services_public_struct.h | 1 + 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/umac/regulatory/core/src/reg_services_common.c b/umac/regulatory/core/src/reg_services_common.c index d5ea29d3ec..5d6066a699 100644 --- a/umac/regulatory/core/src/reg_services_common.c +++ b/umac/regulatory/core/src/reg_services_common.c @@ -3110,6 +3110,29 @@ enum channel_state reg_get_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, return pdev_priv_obj->cur_chan_list[ch_idx].state; } +static uint32_t reg_get_channel_flags_for_freq(struct wlan_objmgr_pdev *pdev, + qdf_freq_t freq) +{ + enum channel_enum chan_enum; + struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; + + chan_enum = reg_get_chan_enum_for_freq(freq); + + if (chan_enum == INVALID_CHANNEL) { + reg_err("chan freq is not valid"); + return REGULATORY_CHAN_INVALID; + } + + pdev_priv_obj = reg_get_pdev_obj(pdev); + + if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { + reg_err("pdev reg obj is NULL"); + return REGULATORY_CHAN_INVALID; + } + + return pdev_priv_obj->cur_chan_list[chan_enum].chan_flags; +} + /** * reg_get_5g_bonded_chan_array_for_freq()- Return the channel state for a * 5G or 6G channel frequency based on the bonded channel. @@ -3575,11 +3598,11 @@ uint8_t reg_get_channel_reg_power_for_freq(struct wlan_objmgr_pdev *pdev, bool reg_is_dfs_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) { - enum channel_state ch_state; + uint32_t chan_flags; - ch_state = reg_get_channel_state_for_freq(pdev, freq); + chan_flags = reg_get_channel_flags_for_freq(pdev, freq); - return ch_state == CHANNEL_STATE_DFS; + return chan_flags & REGULATORY_CHAN_RADAR; } void reg_update_nol_ch_for_freq(struct wlan_objmgr_pdev *pdev, diff --git a/umac/regulatory/dispatcher/inc/reg_services_public_struct.h b/umac/regulatory/dispatcher/inc/reg_services_public_struct.h index c698e7926c..1b656c70ec 100644 --- a/umac/regulatory/dispatcher/inc/reg_services_public_struct.h +++ b/umac/regulatory/dispatcher/inc/reg_services_public_struct.h @@ -54,6 +54,7 @@ #define REGULATORY_CHAN_NO_160MHZ BIT(8) #define REGULATORY_CHAN_NO_20MHZ BIT(11) #define REGULATORY_CHAN_NO_10MHZ BIT(12) +#define REGULATORY_CHAN_INVALID BIT(14) #define REGULATORY_PHYMODE_NO11A BIT(0) #define REGULATORY_PHYMODE_NO11B BIT(1)