From f955b44a6de596d601d9202b13f9d0ecafe3fb28 Mon Sep 17 00:00:00 2001 From: gaurank kathpalia Date: Sun, 2 Aug 2020 13:34:51 +0530 Subject: [PATCH] qcacld-3.0: Enable/Disable SRD support for vdev Currently the driver enables the SRD channels support for both P2P_GO and SAP if the SRD master mode is enabled. Have individual ini values to enable/disable the SRD channel for each op-mode as required. Change-Id: If6e66996ed19dacbde7f71a6702f378a7e9a273c CRs-Fixed: 2748446 --- .../policy_mgr/src/wlan_policy_mgr_action.c | 20 +++++++++- .../policy_mgr/src/wlan_policy_mgr_core.c | 12 +----- .../policy_mgr/src/wlan_policy_mgr_pcl.c | 40 +++++++++++-------- components/mlme/core/src/wlan_mlme_main.c | 4 +- components/mlme/dispatcher/inc/cfg_mlme_reg.h | 21 +++++++--- .../mlme/dispatcher/inc/wlan_mlme_api.h | 13 ++++++ .../dispatcher/inc/wlan_mlme_public_struct.h | 16 +++++++- .../mlme/dispatcher/inc/wlan_mlme_ucfg_api.h | 19 +++++++-- .../mlme/dispatcher/src/wlan_mlme_api.c | 35 ++++++++++++++++ .../mlme/dispatcher/src/wlan_mlme_ucfg_api.c | 16 ++++++-- core/hdd/src/wlan_hdd_hostapd.c | 12 +++++- core/hdd/src/wlan_hdd_regulatory.c | 6 +-- core/sap/src/sap_fsm.c | 21 ++++++---- 13 files changed, 176 insertions(+), 59 deletions(-) diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c index 5111fd9716..e739607020 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c @@ -35,6 +35,7 @@ #include "nan_ucfg_api.h" #include "wlan_mlme_api.h" #include "sap_api.h" +#include "wlan_mlme_api.h" enum policy_mgr_conc_next_action (*policy_mgr_get_current_pref_hw_mode_ptr) (struct wlan_objmgr_psoc *psoc); @@ -2058,6 +2059,22 @@ QDF_STATUS policy_mgr_valid_sap_conc_channel_check( struct policy_mgr_psoc_priv_obj *pm_ctx; bool sta_sap_scc_on_dfs_chan; bool is_dfs; + struct wlan_objmgr_vdev *vdev; + enum QDF_OPMODE vdev_opmode; + bool enable_srd_channel; + + vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, sap_vdev_id, + WLAN_POLICY_MGR_ID); + if (!vdev) { + policy_mgr_err("vdev is NULL"); + return QDF_STATUS_E_INVAL; + } + + vdev_opmode = wlan_vdev_mlme_get_opmode(vdev); + wlan_objmgr_vdev_release_ref(vdev, WLAN_POLICY_MGR_ID); + + wlan_mlme_get_srd_master_mode_for_vdev(psoc, vdev_opmode, + &enable_srd_channel); pm_ctx = policy_mgr_get_context(psoc); if (!pm_ctx) { @@ -2100,8 +2117,7 @@ QDF_STATUS policy_mgr_valid_sap_conc_channel_check( ch_freq) || !(policy_mgr_sta_sap_scc_on_lte_coex_chan(psoc) || policy_mgr_is_safe_channel(psoc, ch_freq)) || - (!wlan_reg_is_etsi13_srd_chan_allowed_master_mode( - pm_ctx->pdev) && + (!enable_srd_channel && wlan_reg_is_etsi13_srd_chan_for_freq(pm_ctx->pdev, ch_freq))) { if (is_dfs && sta_sap_scc_on_dfs_chan) { diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c index 45687f2abc..e6133113f4 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c @@ -2101,7 +2101,6 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, uint32_t sbs_num_channels = 0; uint32_t chan_index_24 = 0, chan_index_5 = 0, chan_index_6 = 0; bool skip_dfs_channel = false; - bool is_etsi13_srd_chan_allowed_in_mas_mode = true; uint32_t i = 0, j = 0; struct policy_mgr_psoc_priv_obj *pm_ctx; uint32_t *channel_list, *channel_list_24, *channel_list_5, @@ -2150,13 +2149,9 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, goto end; } - if ((mode == PM_SAP_MODE) || (mode == PM_P2P_GO_MODE)) { + if ((mode == PM_SAP_MODE) || (mode == PM_P2P_GO_MODE)) policy_mgr_skip_dfs_ch(psoc, &skip_dfs_channel); - is_etsi13_srd_chan_allowed_in_mas_mode = - wlan_reg_is_etsi13_srd_chan_allowed_master_mode(pm_ctx-> - pdev); - } /* Let's divide the list in 2.4 & 5 Ghz lists */ for (i = 0; i < num_channels; i++) { @@ -2168,11 +2163,6 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, channel_list[i])) continue; - if (!is_etsi13_srd_chan_allowed_in_mas_mode && - wlan_reg_is_etsi13_srd_chan_for_freq( - pm_ctx->pdev, channel_list[i])) - continue; - channel_list_5[chan_index_5++] = channel_list[i]; } else if (wlan_reg_is_6ghz_chan_freq(channel_list[i])) { /* Add to 5G list untill 6G conc support is enabled */ diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c index c5a12cef9f..c107ae2375 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c @@ -590,18 +590,12 @@ policy_mgr_modify_pcl_based_on_srd(struct wlan_objmgr_psoc *psoc, uint32_t pcl_list[NUM_CHANNELS]; uint8_t weight_list[NUM_CHANNELS]; struct policy_mgr_psoc_priv_obj *pm_ctx; - bool is_etsi13_srd_chan_allowed_in_mas_mode = true; pm_ctx = policy_mgr_get_context(psoc); if (!pm_ctx) { policy_mgr_err("Invalid Context"); return QDF_STATUS_E_FAILURE; } - is_etsi13_srd_chan_allowed_in_mas_mode = - wlan_reg_is_etsi13_srd_chan_allowed_master_mode(pm_ctx->pdev); - - if (is_etsi13_srd_chan_allowed_in_mas_mode) - return QDF_STATUS_SUCCESS; if (*pcl_len_org > NUM_CHANNELS) { policy_mgr_err("Invalid PCL List Length %d", *pcl_len_org); @@ -634,6 +628,7 @@ static QDF_STATUS policy_mgr_pcl_modification_for_sap( bool nol_modified_pcl = false; bool dfs_modified_pcl = false; bool modified_final_pcl = false; + bool srd_chan_enabled; if (policy_mgr_is_sap_mandatory_channel_set(psoc)) { status = policy_mgr_modify_sap_pcl_based_on_mandatory_channel( @@ -662,12 +657,18 @@ static QDF_STATUS policy_mgr_pcl_modification_for_sap( } dfs_modified_pcl = true; - status = policy_mgr_modify_pcl_based_on_srd - (psoc, pcl_channels, pcl_weight, len); - if (QDF_IS_STATUS_ERROR(status)) { - policy_mgr_err("failed to get srd modified pcl for SAP"); - return status; + wlan_mlme_get_srd_master_mode_for_vdev(psoc, QDF_SAP_MODE, + &srd_chan_enabled); + + if (!srd_chan_enabled) { + status = policy_mgr_modify_pcl_based_on_srd + (psoc, pcl_channels, pcl_weight, len); + if (QDF_IS_STATUS_ERROR(status)) { + policy_mgr_err("Failed to modify SRD in pcl for SAP"); + return status; + } } + modified_final_pcl = true; policy_mgr_debug(" %d %d %d %d", mandatory_modified_pcl, @@ -685,6 +686,7 @@ static QDF_STATUS policy_mgr_pcl_modification_for_p2p_go( { QDF_STATUS status = QDF_STATUS_E_FAILURE; struct policy_mgr_psoc_priv_obj *pm_ctx; + bool srd_chan_enabled; pm_ctx = policy_mgr_get_context(psoc); if (!pm_ctx) { @@ -699,12 +701,18 @@ static QDF_STATUS policy_mgr_pcl_modification_for_p2p_go( return status; } - status = policy_mgr_modify_pcl_based_on_srd - (psoc, pcl_channels, pcl_weight, len); - if (QDF_IS_STATUS_ERROR(status)) { - policy_mgr_err("failed to get srd modified pcl for P2P-GO"); - return status; + wlan_mlme_get_srd_master_mode_for_vdev(psoc, QDF_P2P_GO_MODE, + &srd_chan_enabled); + + if (!srd_chan_enabled) { + status = policy_mgr_modify_pcl_based_on_srd + (psoc, pcl_channels, pcl_weight, len); + if (QDF_IS_STATUS_ERROR(status)) { + policy_mgr_err("Failed to modify SRD in pcl for GO"); + return status; + } } + policy_mgr_dump_channel_list(*len, pcl_channels, pcl_weight); return QDF_STATUS_SUCCESS; diff --git a/components/mlme/core/src/wlan_mlme_main.c b/components/mlme/core/src/wlan_mlme_main.c index 1c6158dbdd..0df5136705 100644 --- a/components/mlme/core/src/wlan_mlme_main.c +++ b/components/mlme/core/src/wlan_mlme_main.c @@ -2228,8 +2228,8 @@ static void mlme_init_reg_cfg(struct wlan_objmgr_psoc *psoc, struct wlan_objmgr_pdev *pdev = NULL; reg->self_gen_frm_pwr = cfg_get(psoc, CFG_SELF_GEN_FRM_PWR); - reg->etsi13_srd_chan_in_master_mode = - cfg_get(psoc, CFG_ETSI13_SRD_CHAN_IN_MASTER_MODE); + reg->etsi_srd_chan_in_master_mode = + cfg_get(psoc, CFG_ETSI_SRD_CHAN_IN_MASTER_MODE); reg->fcc_5dot9_ghz_chan_in_master_mode = cfg_get(psoc, CFG_FCC_5DOT9_GHZ_CHAN_IN_MASTER_MODE); reg->restart_beaconing_on_ch_avoid = diff --git a/components/mlme/dispatcher/inc/cfg_mlme_reg.h b/components/mlme/dispatcher/inc/cfg_mlme_reg.h index 0d96221050..30702c0e2f 100644 --- a/components/mlme/dispatcher/inc/cfg_mlme_reg.h +++ b/components/mlme/dispatcher/inc/cfg_mlme_reg.h @@ -73,14 +73,20 @@ /* * - * etsi13_srd_chan_in_master_mode - Enable/disable ETSI SRD channels in + * etsi_srd_chan_in_master_mode - Enable/disable ETSI SRD channels in * master mode PCL and ACS functionality * @Min: 0 - * @Max: 1 - * @Default: 0 + * @Max: 0xFF + * @Default: 6 * - * etsi13_srd_chan_in_master_mode is to enable/disable ETSI SRD channels in + * etsi_srd_chan_in_master_mode is to enable/disable ETSI SRD channels in * master mode PCL and ACS functionality + * Bit map for enabling the SRD mode in various modes are as follows:- + * BIT 0:- Enable/Disable SRD channels for SAP. + * BIT 1:- Enable/Disable SRD channels for P2P-GO. + * BIT 2:- Enable/Disable SRD channels for NAN. + * Rest of the bits are currently reserved for future SRD channel support for + * other vdevs. * * Related: None * @@ -90,9 +96,12 @@ * * */ -#define CFG_ETSI13_SRD_CHAN_IN_MASTER_MODE CFG_INI_BOOL( \ +#define CFG_ETSI_SRD_CHAN_IN_MASTER_MODE CFG_INI_UINT( \ "etsi13_srd_chan_in_master_mode", \ 0, \ + 0xff, \ + 6, \ + CFG_VALUE_OR_DEFAULT, \ "enable/disable ETSI SRD channels in master mode") /* @@ -323,7 +332,7 @@ CFG(CFG_SELF_GEN_FRM_PWR) \ CFG(CFG_ENABLE_PENDING_CHAN_LIST_REQ) \ CFG(CFG_ENABLE_11D_IN_WORLD_MODE) \ - CFG(CFG_ETSI13_SRD_CHAN_IN_MASTER_MODE) \ + CFG(CFG_ETSI_SRD_CHAN_IN_MASTER_MODE) \ CFG(CFG_FCC_5DOT9_GHZ_CHAN_IN_MASTER_MODE) \ CFG(CFG_RESTART_BEACONING_ON_CH_AVOID) \ CFG(CFG_INDOOR_CHANNEL_SUPPORT) \ diff --git a/components/mlme/dispatcher/inc/wlan_mlme_api.h b/components/mlme/dispatcher/inc/wlan_mlme_api.h index 30ba355951..ff3064e239 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h @@ -1941,6 +1941,19 @@ QDF_STATUS wlan_mlme_get_vht_tx_mcs_2x2(struct wlan_objmgr_psoc *psoc, QDF_STATUS wlan_mlme_get_vht20_mcs9(struct wlan_objmgr_psoc *psoc, bool *value); +/** + * wlan_mlme_get_srd_master_mode_for_vdev - Get SRD master mode for vdev + * @psoc: pointer to psoc object + * @vdev_opmode: vdev operating mode + * @value: pointer to the value which will be filled for the caller + * + * Return: QDF Status + */ +QDF_STATUS +wlan_mlme_get_srd_master_mode_for_vdev(struct wlan_objmgr_psoc *psoc, + enum QDF_OPMODE vdev_opmode, + bool *value); + /** * wlan_mlme_get_force_sap_enabled() - Get the value of force SAP enabled * @psoc: psoc context diff --git a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h index 833174cc0d..84e0a3f387 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h @@ -2243,11 +2243,23 @@ struct wlan_mlme_mwc { }; #endif +/** + * enum mlme_reg_srd_master_modes - Bitmap of SRD master modes supported + * @MLME_SRD_MASTER_MODE_SAP: SRD master mode for SAP + * @MLME_SRD_MASTER_MODE_P2P_GO: SRD master mode for P2P-GO + * @MLME_SRD_MASTER_MODE_NAN: SRD master mode for NAN + */ +enum mlme_reg_srd_master_modes { + MLME_SRD_MASTER_MODE_SAP = 1, + MLME_SRD_MASTER_MODE_P2P_GO = 2, + MLME_SRD_MASTER_MODE_NAN = 4, +}; + /** * struct wlan_mlme_reg - REG related configs * @self_gen_frm_pwr: self-generated frame power in tx chain mask * for CCK rates - * @etsi13_srd_chan_in_master_mode: etsi13 srd chan in master mode + * @etsi_srd_chan_in_master_mode: etsi srd chan in master mode * @fcc_5dot9_ghz_chan_in_master_mode: fcc 5.9 GHz chan in master mode * @restart_beaconing_on_ch_avoid: restart beaconing on ch avoid * @indoor_channel_support: indoor channel support @@ -2265,7 +2277,7 @@ struct wlan_mlme_mwc { */ struct wlan_mlme_reg { uint32_t self_gen_frm_pwr; - bool etsi13_srd_chan_in_master_mode; + uint8_t etsi_srd_chan_in_master_mode; bool fcc_5dot9_ghz_chan_in_master_mode; enum restart_beaconing_on_ch_avoid_rule restart_beaconing_on_ch_avoid; diff --git a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h index dba9f54693..68a649da9d 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h @@ -3777,7 +3777,7 @@ ucfg_mlme_get_mws_coex_scc_channel_avoid_delay(struct wlan_objmgr_psoc *psoc, #endif /** - * ucfg_mlme_get_etsi13_srd_chan_in_master_mode - get etsi13 srd chan + * ucfg_mlme_get_etsi_srd_chan_in_master_mode - get etsi srd chan * in master mode * @psoc: pointer to psoc object * @value: pointer to the value which will be filled for the caller @@ -3785,8 +3785,8 @@ ucfg_mlme_get_mws_coex_scc_channel_avoid_delay(struct wlan_objmgr_psoc *psoc, * Return: QDF Status */ QDF_STATUS -ucfg_mlme_get_etsi13_srd_chan_in_master_mode(struct wlan_objmgr_psoc *psoc, - bool *value); +ucfg_mlme_get_etsi_srd_chan_in_master_mode(struct wlan_objmgr_psoc *psoc, + uint8_t *value); /** * ucfg_mlme_get_5dot9_ghz_chan_in_master_mode - get fcc 5.9 GHz chan @@ -3800,6 +3800,19 @@ QDF_STATUS ucfg_mlme_get_5dot9_ghz_chan_in_master_mode(struct wlan_objmgr_psoc *psoc, bool *value); +/** + * ucfg_mlme_get_srd_master_mode_for_vdev() - Get SRD master mode for vdev + * @psoc: pointer to psoc object + * @vdev_opmode: vdev opmode + * @value: pointer to the value which will be filled for the caller + * + * Return: QDF Status + */ +QDF_STATUS +ucfg_mlme_get_srd_master_mode_for_vdev(struct wlan_objmgr_psoc *psoc, + enum QDF_OPMODE vdev_opmode, + bool *value); + #ifdef SAP_AVOID_ACS_FREQ_LIST /** * ucfg_mlme_get_acs_avoid_freq_list - get acs avoid frequency list diff --git a/components/mlme/dispatcher/src/wlan_mlme_api.c b/components/mlme/dispatcher/src/wlan_mlme_api.c index 7fcacae4aa..c49b871b34 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_api.c @@ -3052,6 +3052,41 @@ wlan_mlme_get_vht20_mcs9(struct wlan_objmgr_psoc *psoc, bool *value) return QDF_STATUS_SUCCESS; } +QDF_STATUS +wlan_mlme_get_srd_master_mode_for_vdev(struct wlan_objmgr_psoc *psoc, + enum QDF_OPMODE vdev_opmode, + bool *value) +{ + struct wlan_mlme_psoc_ext_obj *mlme_obj; + + mlme_obj = mlme_get_psoc_ext_obj(psoc); + if (!mlme_obj) { + *value = false; + mlme_legacy_err("Failed to get MLME Obj"); + return QDF_STATUS_E_INVAL; + } + + switch (vdev_opmode) { + case QDF_SAP_MODE: + *value = mlme_obj->cfg.reg.etsi_srd_chan_in_master_mode & + MLME_SRD_MASTER_MODE_SAP; + break; + case QDF_P2P_GO_MODE: + *value = mlme_obj->cfg.reg.etsi_srd_chan_in_master_mode & + MLME_SRD_MASTER_MODE_P2P_GO; + break; + case QDF_NAN_DISC_MODE: + *value = mlme_obj->cfg.reg.etsi_srd_chan_in_master_mode & + MLME_SRD_MASTER_MODE_NAN; + break; + default: + mlme_legacy_err("Unexpected opmode %d", vdev_opmode); + *value = false; + } + + return QDF_STATUS_SUCCESS; +} + QDF_STATUS wlan_mlme_get_enable_dynamic_nss_chains_cfg(struct wlan_objmgr_psoc *psoc, bool *value) diff --git a/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c b/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c index cf9e4548e3..2f61874a00 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c @@ -1475,19 +1475,19 @@ ucfg_mlme_get_mws_coex_scc_channel_avoid_delay(struct wlan_objmgr_psoc *psoc, #endif QDF_STATUS -ucfg_mlme_get_etsi13_srd_chan_in_master_mode(struct wlan_objmgr_psoc *psoc, - bool *value) +ucfg_mlme_get_etsi_srd_chan_in_master_mode(struct wlan_objmgr_psoc *psoc, + uint8_t *value) { struct wlan_mlme_psoc_ext_obj *mlme_obj; mlme_obj = mlme_get_psoc_ext_obj(psoc); if (!mlme_obj) { - *value = cfg_default(CFG_ETSI13_SRD_CHAN_IN_MASTER_MODE); + *value = cfg_default(CFG_ETSI_SRD_CHAN_IN_MASTER_MODE); mlme_legacy_err("Failed to get MLME Obj"); return QDF_STATUS_E_INVAL; } - *value = mlme_obj->cfg.reg.etsi13_srd_chan_in_master_mode; + *value = mlme_obj->cfg.reg.etsi_srd_chan_in_master_mode; return QDF_STATUS_SUCCESS; } @@ -1510,6 +1510,14 @@ ucfg_mlme_get_5dot9_ghz_chan_in_master_mode(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } +QDF_STATUS +ucfg_mlme_get_srd_master_mode_for_vdev(struct wlan_objmgr_psoc *psoc, + enum QDF_OPMODE vdev_opmode, + bool *value) +{ + return wlan_mlme_get_srd_master_mode_for_vdev(psoc, vdev_opmode, value); +} + #ifdef SAP_AVOID_ACS_FREQ_LIST QDF_STATUS ucfg_mlme_get_acs_avoid_freq_list(struct wlan_objmgr_psoc *psoc, diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index bc5d6b7572..6cf06b286f 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -6380,6 +6380,8 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, struct cfg80211_chan_def new_chandef; struct cfg80211_chan_def *chandef; uint16_t sap_ch; + bool srd_channel_allowed; + enum QDF_OPMODE vdev_opmode; hdd_enter(); @@ -6491,9 +6493,15 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, hdd_err("SAP not allowed on DFS channel if no dfs master capability!!"); return -EINVAL; } - if (!wlan_reg_is_etsi13_srd_chan_allowed_master_mode(hdd_ctx->pdev) && + + vdev_opmode = wlan_vdev_mlme_get_opmode(adapter->vdev); + ucfg_mlme_get_srd_master_mode_for_vdev(hdd_ctx->psoc, vdev_opmode, + &srd_channel_allowed); + + if (!srd_channel_allowed && wlan_reg_is_etsi13_srd_chan(hdd_ctx->pdev, channel)) { - hdd_err("SAP not allowed on SRD channel."); + hdd_err("vdev opmode %d not allowed on SRD channel.", + vdev_opmode); return -EINVAL; } if (cds_is_sub_20_mhz_enabled()) { diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index 0ac2b622fa..92ddc72dcb 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -215,7 +215,7 @@ static void reg_program_config_vars(struct hdd_context *hdd_ctx, uint32_t band_capability = 0, scan_11d_interval = 0; bool indoor_chan_enabled = false; uint32_t restart_beaconing = 0; - bool enable_srd_chan = false; + uint8_t enable_srd_chan; bool enable_5dot9_ghz_chan; QDF_STATUS status; bool country_priority = 0; @@ -262,8 +262,8 @@ static void reg_program_config_vars(struct hdd_context *hdd_ctx, &restart_beaconing); config_vars->restart_beaconing = restart_beaconing; - ucfg_mlme_get_etsi13_srd_chan_in_master_mode(hdd_ctx->psoc, - &enable_srd_chan); + ucfg_mlme_get_etsi_srd_chan_in_master_mode(hdd_ctx->psoc, + &enable_srd_chan); config_vars->enable_srd_chan_in_master_mode = enable_srd_chan; ucfg_mlme_get_11d_in_world_mode(hdd_ctx->psoc, diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index c67393d2b3..1b8abd12e7 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -3393,6 +3393,8 @@ static QDF_STATUS sap_get_freq_list(struct sap_context *sap_ctx, struct acs_weight_range *range_list; bool freq_present_in_list = false; uint8_t i; + bool srd_chan_enabled; + enum QDF_OPMODE vdev_opmode; mac_ctx = sap_get_mac_context(); if (!mac_ctx) { @@ -3515,15 +3517,18 @@ static QDF_STATUS sap_get_freq_list(struct sap_context *sap_ctx, freq_present_in_list = true; } - /* Dont scan ETSI13 SRD channels if the ETSI13 SRD channels - * are not enabled in master mode - */ - if (!wlan_reg_is_etsi13_srd_chan_allowed_master_mode(mac_ctx-> - pdev) && - wlan_reg_is_etsi13_srd_chan_for_freq( - mac_ctx->pdev, - WLAN_REG_CH_TO_FREQ(loop_count))) + vdev_opmode = wlan_vdev_mlme_get_opmode(sap_ctx->vdev); + wlan_mlme_get_srd_master_mode_for_vdev(mac_ctx->psoc, + vdev_opmode, + &srd_chan_enabled); + + if (!srd_chan_enabled && + wlan_reg_is_etsi13_srd_chan_for_freq(mac_ctx->pdev, + WLAN_REG_CH_TO_FREQ(loop_count))) { + sap_debug("vdev opmode %d not allowed on SRD freq %d", + vdev_opmode, WLAN_REG_CH_TO_FREQ(loop_count)); continue; + } /* Check if the freq is present in range list */ for (i = 0; i < mac_ctx->mlme_cfg->acs.num_weight_range; i++) {