From bc9c48582620716569efeed9279cc2150f72b588 Mon Sep 17 00:00:00 2001 From: Liangwei Dong Date: Wed, 7 Feb 2018 18:43:40 +0800 Subject: [PATCH] qcacmn: Keep unsafe chan enabled in curr_chan_list Station mode needs the full chan list including unsafe chan. And HDD and policy mgr has local copy the unsafe chan list for chan avoidance checking for SAP mode. Keep unsafe chan in curr_chan_list and add unit test ucfg API for chan avoidance internal test. Change-Id: I23e040048a6dc1cc604cc2be91ac74916eb74f23 CRs-Fixed: 2182400 --- umac/regulatory/core/src/reg_services.c | 34 ------------------- .../dispatcher/inc/wlan_reg_ucfg_api.h | 13 +++++++ .../dispatcher/src/wlan_reg_ucfg_api.c | 6 ++++ 3 files changed, 19 insertions(+), 34 deletions(-) diff --git a/umac/regulatory/core/src/reg_services.c b/umac/regulatory/core/src/reg_services.c index 257eb8b215f2..7031c975a2cd 100644 --- a/umac/regulatory/core/src/reg_services.c +++ b/umac/regulatory/core/src/reg_services.c @@ -2095,38 +2095,6 @@ reg_modify_chan_list_for_nol_list(struct regulatory_channel *chan_list) } } -static void -reg_modify_chan_list_for_unsafe_ch(struct wlan_regulatory_pdev_priv_obj - *pdev_priv_obj) -{ - enum channel_enum chan_enum; - struct regulatory_channel *chan_list; - struct wlan_objmgr_psoc *psoc; - struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj; - struct unsafe_ch_list *unsafe_list; - uint8_t i; - - psoc = wlan_pdev_get_psoc(pdev_priv_obj->pdev_ptr); - psoc_priv_obj = (struct wlan_regulatory_psoc_priv_obj *) - wlan_objmgr_psoc_get_comp_private_obj(psoc, - WLAN_UMAC_COMP_REGULATORY); - if (!psoc_priv_obj) { - reg_err("psoc priv obj is NULL"); - return; - } - - chan_list = pdev_priv_obj->cur_chan_list; - unsafe_list = &psoc_priv_obj->unsafe_chan_list; - - for (i = 0; i < unsafe_list->ch_cnt; i++) { - chan_enum = reg_get_chan_enum(unsafe_list->ch_list[i]); - if (chan_enum == INVALID_CHANNEL) - continue; - chan_list[chan_enum].state = CHANNEL_STATE_DISABLE; - chan_list[chan_enum].chan_flags |= REGULATORY_CHAN_DISABLED; - } -} - /** * reg_find_low_limit_chan_enum() - Find low limit 2G and 5G channel enums. * @chan_list: Pointer to regulatory channel list. @@ -2303,8 +2271,6 @@ static void reg_compute_pdev_current_chan_list( reg_modify_chan_list_for_chan_144(pdev_priv_obj->cur_chan_list, pdev_priv_obj->en_chan_144); - - reg_modify_chan_list_for_unsafe_ch(pdev_priv_obj); } static void reg_call_chan_change_cbks(struct wlan_objmgr_psoc *psoc, diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h index 219ada42bdc5..0a780af6a422 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h @@ -239,6 +239,19 @@ void ucfg_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc, */ enum country_src ucfg_reg_get_cc_and_src(struct wlan_objmgr_psoc *psoc, uint8_t *alpha2); + +/** + * ucfg_reg_unit_simulate_ch_avoid () - fake a ch avoid event + * @psoc: psoc ptr + * @ch_avoid: ch_avoid_ind_type ranges + * + * This function inject a ch_avoid event for unit test sap chan switch. + * + * Return: void + */ +void ucfg_reg_unit_simulate_ch_avoid(struct wlan_objmgr_psoc *psoc, + struct ch_avoid_ind_type *ch_avoid); + /** * ucfg_reg_11d_vdev_delete_update() - update vdev delete to regulatory * @vdev: vdev ptr diff --git a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c index 0997e0c56ea5..b367438884f8 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c @@ -222,6 +222,12 @@ enum country_src ucfg_reg_get_cc_and_src(struct wlan_objmgr_psoc *psoc, return reg_get_cc_and_src(psoc, alpha2); } +void ucfg_reg_unit_simulate_ch_avoid(struct wlan_objmgr_psoc *psoc, + struct ch_avoid_ind_type *ch_avoid) +{ + reg_process_ch_avoid_event(psoc, ch_avoid); +} + QDF_STATUS ucfg_reg_11d_vdev_delete_update(struct wlan_objmgr_vdev *vdev) { return reg_11d_vdev_delete_update(vdev);