From 8e992e56f026ab50c499280382f0540f27e24f76 Mon Sep 17 00:00:00 2001 From: Amar Singhal Date: Mon, 11 Nov 2019 11:13:24 -0800 Subject: [PATCH] qcacmn: Add check for regulatory channel list Regulatory module calls registered callbacks when channel list is changed. But channel list may not have been received when path for callbacks is reached. So keep a track if channel list has been received. If not, do not call the callbacks. Change-Id: I2e1a6e442b0d5c79e786806e00b1c50c9491dae0 CRs-Fixed: 2563759 --- .../dispatcher/src/dispatcher_init_deinit.c | 11 --------- .../regulatory/core/src/reg_build_chan_list.c | 3 +++ umac/regulatory/core/src/reg_callbacks.c | 24 +++++++++++++++++++ umac/regulatory/core/src/reg_priv_objs.c | 5 ++++ umac/regulatory/core/src/reg_priv_objs.h | 3 +++ .../dispatcher/inc/wlan_reg_services_api.h | 8 ------- .../dispatcher/src/wlan_reg_services_api.c | 17 ------------- 7 files changed, 35 insertions(+), 36 deletions(-) diff --git a/init_deinit/dispatcher/src/dispatcher_init_deinit.c b/init_deinit/dispatcher/src/dispatcher_init_deinit.c index 8d3d2d7d8e8c..2dab50623966 100644 --- a/init_deinit/dispatcher/src/dispatcher_init_deinit.c +++ b/init_deinit/dispatcher/src/dispatcher_init_deinit.c @@ -252,12 +252,6 @@ static QDF_STATUS dispatcher_regulatory_psoc_close(struct wlan_objmgr_psoc return regulatory_psoc_close(psoc); } -static QDF_STATUS dispatcher_regulatory_pdev_open(struct wlan_objmgr_pdev - *pdev) -{ - return regulatory_pdev_open(pdev); -} - #ifdef WLAN_CONV_SPECTRAL_ENABLE #ifdef SPECTRAL_MODULIZED_ENABLE QDF_STATUS dispatcher_register_spectral_pdev_open_handler( @@ -1064,9 +1058,6 @@ QDF_STATUS dispatcher_pdev_open(struct wlan_objmgr_pdev *pdev) { QDF_STATUS status; - if (QDF_STATUS_SUCCESS != dispatcher_regulatory_pdev_open(pdev)) - goto regulatory_pdev_open_fail; - status = dispatcher_spectral_pdev_open(pdev); if (status != QDF_STATUS_SUCCESS && status != QDF_STATUS_COMP_DISABLED) goto spectral_pdev_open_fail; @@ -1089,8 +1080,6 @@ mgmt_txrx_pdev_open_fail: cfr_pdev_open_fail: dispatcher_spectral_pdev_close(pdev); spectral_pdev_open_fail: - dispatcher_regulatory_pdev_close(pdev); -regulatory_pdev_open_fail: return QDF_STATUS_E_FAILURE; } qdf_export_symbol(dispatcher_pdev_open); diff --git a/umac/regulatory/core/src/reg_build_chan_list.c b/umac/regulatory/core/src/reg_build_chan_list.c index 1055339dbefd..c2f3e72c47c7 100644 --- a/umac/regulatory/core/src/reg_build_chan_list.c +++ b/umac/regulatory/core/src/reg_build_chan_list.c @@ -719,6 +719,8 @@ void reg_propagate_mas_chan_list_to_pdev(struct wlan_objmgr_psoc *psoc, psoc_reg_rules = &psoc_priv_obj->mas_chan_params[pdev_id].reg_rules; reg_save_reg_rules_to_pdev(psoc_reg_rules, pdev_priv_obj); reg_modify_chan_list_for_japan(pdev); + pdev_priv_obj->chan_list_recvd = + psoc_priv_obj->chan_list_recvd[pdev_id]; reg_compute_pdev_current_chan_list(pdev_priv_obj); reg_tx_ops = reg_get_psoc_tx_ops(psoc); @@ -930,6 +932,7 @@ QDF_STATUS reg_process_master_chan_list( mas_chan_list); } + soc_reg->chan_list_recvd[phy_id] = true; if (soc_reg->new_user_ctry_pending[phy_id]) { soc_reg->new_user_ctry_pending[phy_id] = false; soc_reg->cc_src = SOURCE_USERSPACE; diff --git a/umac/regulatory/core/src/reg_callbacks.c b/umac/regulatory/core/src/reg_callbacks.c index 7aa601f6e623..5c5b73bc14e7 100644 --- a/umac/regulatory/core/src/reg_callbacks.c +++ b/umac/regulatory/core/src/reg_callbacks.c @@ -200,8 +200,20 @@ QDF_STATUS reg_send_scheduler_msg_sb(struct wlan_objmgr_psoc *psoc, { struct scheduler_msg msg = {0}; struct reg_sched_payload *payload; + struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; QDF_STATUS status; + pdev_priv_obj = reg_get_pdev_obj(pdev); + if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { + reg_alert("pdev reg component is NULL"); + return QDF_STATUS_E_FAILURE; + } + + if (!pdev_priv_obj->chan_list_recvd) { + reg_err("channel list is empty"); + return QDF_STATUS_E_FAILURE; + } + status = wlan_objmgr_psoc_try_get_ref(psoc, WLAN_REGULATORY_SB_ID); if (QDF_IS_STATUS_ERROR(status)) { reg_err("error taking psoc ref cnt"); @@ -245,8 +257,20 @@ QDF_STATUS reg_send_scheduler_msg_nb(struct wlan_objmgr_psoc *psoc, { struct scheduler_msg msg = {0}; struct reg_sched_payload *payload; + struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; QDF_STATUS status; + pdev_priv_obj = reg_get_pdev_obj(pdev); + if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { + reg_alert("pdev reg component is NULL"); + return QDF_STATUS_E_FAILURE; + } + + if (!pdev_priv_obj->chan_list_recvd) { + reg_err("channel list is empty"); + return QDF_STATUS_E_FAILURE; + } + status = wlan_objmgr_psoc_try_get_ref(psoc, WLAN_REGULATORY_NB_ID); if (QDF_IS_STATUS_ERROR(status)) { reg_err("error taking psoc ref cnt"); diff --git a/umac/regulatory/core/src/reg_priv_objs.c b/umac/regulatory/core/src/reg_priv_objs.c index 026f04990171..614033e6fcf0 100644 --- a/umac/regulatory/core/src/reg_priv_objs.c +++ b/umac/regulatory/core/src/reg_priv_objs.c @@ -32,6 +32,7 @@ #include "reg_services_common.h" #include "reg_build_chan_list.h" #include "reg_host_11d.h" +#include "reg_callbacks.h" struct wlan_regulatory_psoc_priv_obj *reg_get_psoc_obj( struct wlan_objmgr_psoc *psoc) @@ -102,6 +103,7 @@ QDF_STATUS wlan_regulatory_psoc_obj_created_notification( for (pdev_cnt = 0; pdev_cnt < PSOC_MAX_PHY_REG_CAP; pdev_cnt++) { mas_chan_list = soc_reg_obj->mas_chan_params[pdev_cnt].mas_chan_list; + soc_reg_obj->chan_list_recvd[pdev_cnt] = false; for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) { mas_chan_list[chan_enum].chan_flags |= @@ -232,6 +234,8 @@ QDF_STATUS wlan_regulatory_pdev_obj_created_notification( psoc_reg_rules = &psoc_priv_obj->mas_chan_params[pdev_id].reg_rules; reg_save_reg_rules_to_pdev(psoc_reg_rules, pdev_priv_obj); + pdev_priv_obj->chan_list_recvd = + psoc_priv_obj->chan_list_recvd[pdev_id]; status = wlan_objmgr_pdev_component_obj_attach( pdev, WLAN_UMAC_COMP_REGULATORY, pdev_priv_obj, @@ -243,6 +247,7 @@ QDF_STATUS wlan_regulatory_pdev_obj_created_notification( } reg_compute_pdev_current_chan_list(pdev_priv_obj); + reg_send_scheduler_msg_nb(parent_psoc, pdev); if (!psoc_priv_obj->is_11d_offloaded) reg_11d_host_scan_init(parent_psoc); diff --git a/umac/regulatory/core/src/reg_priv_objs.h b/umac/regulatory/core/src/reg_priv_objs.h index 5d5b47f7084d..5d9e9bd929ab 100644 --- a/umac/regulatory/core/src/reg_priv_objs.h +++ b/umac/regulatory/core/src/reg_priv_objs.h @@ -80,6 +80,7 @@ struct chan_change_cbk_entry { /** * struct wlan_regulatory_psoc_priv_obj - wlan regulatory psoc private object + * @chan_list_recvd: whether channel list has been received * @new_user_ctry_pending: In this array, element[phy_id] is true if any user * country update is pending for pdev (phy_id), used in case of MCL. * @new_init_ctry_pending: In this array, element[phy_id] is true if any user @@ -93,6 +94,7 @@ struct chan_change_cbk_entry { */ struct wlan_regulatory_psoc_priv_obj { struct mas_chan_params mas_chan_params[PSOC_MAX_PHY_REG_CAP]; + bool chan_list_recvd[PSOC_MAX_PHY_REG_CAP]; bool offload_enabled; bool six_ghz_supported; uint8_t num_phy; @@ -172,6 +174,7 @@ struct wlan_regulatory_pdev_priv_obj { bool sap_state; struct reg_rule_info reg_rules; qdf_spinlock_t reg_rules_lock; + bool chan_list_recvd; }; /** diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h index e0130e2a36b4..8122a847fe08 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h @@ -632,14 +632,6 @@ QDF_STATUS regulatory_psoc_open(struct wlan_objmgr_psoc *psoc); */ QDF_STATUS regulatory_psoc_close(struct wlan_objmgr_psoc *psoc); -/** - * regulatory_pdev_open() - Open regulatory component - * @pdev: Pointer to pdev structure. - * - * Return: Success or Failure - */ -QDF_STATUS regulatory_pdev_open(struct wlan_objmgr_pdev *pdev); - /** * regulatory_pdev_close() - Close regulatory component * @pdev: Pointer to pdev structure. diff --git a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c index 3c1a1baa2fef..4550a73e55f7 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c @@ -344,8 +344,6 @@ QDF_STATUS wlan_regulatory_init(void) reg_debug("regulatory handlers registered with obj mgr"); - channel_map = channel_map_global; - return status; unreg_pdev_create: @@ -440,21 +438,6 @@ QDF_STATUS regulatory_psoc_close(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_SUCCESS; } -QDF_STATUS regulatory_pdev_open(struct wlan_objmgr_pdev *pdev) -{ - struct wlan_objmgr_psoc *parent_psoc; - QDF_STATUS status; - - parent_psoc = wlan_pdev_get_psoc(pdev); - - status = reg_send_scheduler_msg_sb(parent_psoc, pdev); - - if (QDF_IS_STATUS_ERROR(status)) - reg_err("scheduler send msg failed"); - - return status; -} - QDF_STATUS regulatory_pdev_close(struct wlan_objmgr_pdev *pdev) { struct wlan_objmgr_psoc *psoc;