From c4f7f445a6ae59c0857af13a95b7e4bb5c328d15 Mon Sep 17 00:00:00 2001 From: Shashikala Prabhu Date: Wed, 9 Aug 2017 09:42:07 +0530 Subject: [PATCH] qcacmn: Add support to enable or disable channel 144 By default channel 144 is enabled. Support added to disable channel 144 through iwpriv command. Change-Id: I0a193571c2ca36e0cedcac19851459448fc141cf CRs-Fixed: 2076792 --- umac/regulatory/core/src/reg_priv.h | 1 + umac/regulatory/core/src/reg_services.c | 107 +++++++++++++++--- umac/regulatory/core/src/reg_services.h | 20 +++- .../dispatcher/inc/wlan_reg_ucfg_api.h | 18 +++ .../dispatcher/src/wlan_reg_ucfg_api.c | 11 ++ 5 files changed, 143 insertions(+), 14 deletions(-) diff --git a/umac/regulatory/core/src/reg_priv.h b/umac/regulatory/core/src/reg_priv.h index 00e0ac1510aa..cb7ed06fbe85 100644 --- a/umac/regulatory/core/src/reg_priv.h +++ b/umac/regulatory/core/src/reg_priv.h @@ -90,6 +90,7 @@ struct wlan_regulatory_pdev_priv_obj { bool set_fcc_channel; enum band_info band_capability; bool indoor_chan_enabled; + bool en_chan_144; uint32_t wireless_modes; }; diff --git a/umac/regulatory/core/src/reg_services.c b/umac/regulatory/core/src/reg_services.c index cd5c9a57af2a..bb36e4786ea5 100644 --- a/umac/regulatory/core/src/reg_services.c +++ b/umac/regulatory/core/src/reg_services.c @@ -39,6 +39,7 @@ #define MAX_PWR_FCC_CHAN_12 8 #define CHAN_13_CENT_FREQ 2472 #define MAX_PWR_FCC_CHAN_13 2 +#define CHAN_144_CENT_FREQ 5720 #define SCAN_11D_PERIOD_MS 360000 #define IS_VALID_PSOC_REG_OBJ(psoc_priv_obj) (NULL != psoc_priv_obj) @@ -1861,7 +1862,7 @@ static void reg_modify_chan_list_for_indoor_channels(struct regulatory_channel } static void reg_modify_chan_list_for_band(struct regulatory_channel *chan_list, - enum band_info band_val) + enum band_info band_val) { enum channel_enum chan_enum; @@ -1887,8 +1888,8 @@ static void reg_modify_chan_list_for_band(struct regulatory_channel *chan_list, } static void reg_modify_chan_list_for_fcc_channel(struct regulatory_channel - *chan_list, - bool set_fcc_channel) + *chan_list, + bool set_fcc_channel) { enum channel_enum chan_enum; @@ -1906,6 +1907,25 @@ static void reg_modify_chan_list_for_fcc_channel(struct regulatory_channel } } +static void reg_modify_chan_list_for_chan_144(struct regulatory_channel + *chan_list, + bool en_chan_144) +{ + enum channel_enum chan_enum; + + if (en_chan_144) + return; + + for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) { + if (chan_list[chan_enum].center_freq == CHAN_144_CENT_FREQ) { + chan_list[chan_enum].chan_flags |= + REGULATORY_CHAN_DISABLED; + chan_list[chan_enum].state = + CHANNEL_STATE_DISABLE; + } + } +} + static void reg_modify_chan_list_for_nol_list(struct regulatory_channel *chan_list) { @@ -2014,31 +2034,34 @@ static void reg_init_pdev_mas_chan_list(struct wlan_regulatory_pdev_priv_obj static void reg_compute_pdev_current_chan_list(struct wlan_regulatory_pdev_priv_obj - *pdev_priv_obj) + *pdev_priv_obj) { qdf_mem_copy(pdev_priv_obj->cur_chan_list, pdev_priv_obj->mas_chan_list, NUM_CHANNELS * sizeof(struct regulatory_channel)); reg_modify_chan_list_for_freq_range(pdev_priv_obj->cur_chan_list, - pdev_priv_obj->range_2g_low, - pdev_priv_obj->range_2g_high, - pdev_priv_obj->range_5g_low, - pdev_priv_obj->range_5g_high); + pdev_priv_obj->range_2g_low, + pdev_priv_obj->range_2g_high, + pdev_priv_obj->range_5g_low, + pdev_priv_obj->range_5g_high); reg_modify_chan_list_for_band(pdev_priv_obj->cur_chan_list, - pdev_priv_obj->band_capability); + pdev_priv_obj->band_capability); reg_modify_chan_list_for_dfs_channels(pdev_priv_obj->cur_chan_list, - pdev_priv_obj->dfs_enabled); + pdev_priv_obj->dfs_enabled); reg_modify_chan_list_for_nol_list(pdev_priv_obj->cur_chan_list); reg_modify_chan_list_for_indoor_channels(pdev_priv_obj->cur_chan_list, - pdev_priv_obj->indoor_chan_enabled); + pdev_priv_obj->indoor_chan_enabled); reg_modify_chan_list_for_fcc_channel(pdev_priv_obj->cur_chan_list, - pdev_priv_obj->set_fcc_channel); + pdev_priv_obj->set_fcc_channel); + + reg_modify_chan_list_for_chan_144(pdev_priv_obj->cur_chan_list, + pdev_priv_obj->en_chan_144); } static void reg_call_chan_change_cbks(struct wlan_objmgr_psoc *psoc, @@ -2346,7 +2369,7 @@ static void reg_propagate_mas_chan_list_to_pdev(struct wlan_objmgr_psoc *psoc, reg_compute_pdev_current_chan_list(pdev_priv_obj); reg_tx_ops = reg_get_psoc_tx_ops(psoc); - if(reg_tx_ops->fill_umac_legacy_chanlist) + if (reg_tx_ops->fill_umac_legacy_chanlist) reg_tx_ops->fill_umac_legacy_chanlist(pdev, pdev_priv_obj->cur_chan_list); @@ -2838,6 +2861,7 @@ QDF_STATUS wlan_regulatory_pdev_obj_created_notification( pdev_priv_obj->band_capability = psoc_priv_obj->band_capability; pdev_priv_obj->indoor_chan_enabled = psoc_priv_obj->indoor_chan_enabled; + pdev_priv_obj->en_chan_144 = true; reg_cap_ptr = parent_psoc->ext_service_param.reg_cap; @@ -3671,3 +3695,60 @@ QDF_STATUS reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev, return QDF_STATUS_SUCCESS; } + +QDF_STATUS reg_modify_chan_144(struct wlan_objmgr_pdev *pdev, + bool enable_ch_144) +{ + struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj; + struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; + struct wlan_objmgr_psoc *psoc; + struct wlan_lmac_if_reg_tx_ops *reg_tx_ops; + QDF_STATUS status; + + pdev_priv_obj = reg_get_pdev_obj(pdev); + + if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { + reg_err("pdev reg component is NULL"); + return QDF_STATUS_E_INVAL; + } + + if (pdev_priv_obj->en_chan_144 == enable_ch_144) { + reg_info("chan 144 is already %d", enable_ch_144); + return QDF_STATUS_SUCCESS; + } + + psoc = wlan_pdev_get_psoc(pdev); + if (!psoc) { + reg_err("psoc is NULL"); + return QDF_STATUS_E_INVAL; + } + + psoc_priv_obj = reg_get_psoc_obj(psoc); + if (!IS_VALID_PSOC_REG_OBJ(psoc_priv_obj)) { + reg_err("psoc reg component is NULL"); + return QDF_STATUS_E_INVAL; + } + + reg_debug("setting chan 144: %d", enable_ch_144); + pdev_priv_obj->en_chan_144 = enable_ch_144; + + reg_compute_pdev_current_chan_list(pdev_priv_obj); + + reg_tx_ops = reg_get_psoc_tx_ops(psoc); + if (reg_tx_ops->fill_umac_legacy_chanlist) + reg_tx_ops->fill_umac_legacy_chanlist(pdev, + pdev_priv_obj->cur_chan_list); + + status = reg_send_scheduler_msg_sb(psoc, pdev); + + return status; + +} + +bool reg_get_en_chan_144(struct wlan_objmgr_pdev *pdev) +{ + struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; + + pdev_priv_obj = reg_get_pdev_obj(pdev); + return pdev_priv_obj->en_chan_144; +} diff --git a/umac/regulatory/core/src/reg_services.h b/umac/regulatory/core/src/reg_services.h index ad91a6625802..32ad7c89990a 100644 --- a/umac/regulatory/core/src/reg_services.h +++ b/umac/regulatory/core/src/reg_services.h @@ -372,5 +372,23 @@ QDF_STATUS reg_set_11d_offloaded(struct wlan_objmgr_psoc *psoc, * Return: QDF status */ QDF_STATUS reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev, - struct cur_regdmn_info *cur_regdmn); + struct cur_regdmn_info *cur_regdmn); + +/** + * reg_modify_chan_144() - Enable/Disable channel 144 + * @pdev: pdev pointer + * @enable_chan_144: flag to disable/enable channel 144 + * + * Return: Success or Failure + */ +QDF_STATUS reg_modify_chan_144(struct wlan_objmgr_pdev *pdev, + bool en_chan_144); + +/** + * reg_get_en_chan_144() - get en_chan_144 flag value + * @pdev: pdev pointer + * + * Return: en_chan_144 flag value + */ +bool reg_get_en_chan_144(struct wlan_objmgr_pdev *pdev); #endif diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h index 071c7a63c3d3..e889fa8d326e 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h @@ -152,6 +152,24 @@ QDF_STATUS ucfg_reg_set_config_vars(struct wlan_objmgr_psoc *psoc, QDF_STATUS ucfg_reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev, struct regulatory_channel *chan_list); +/** + * ucfg_reg_modify_chan_144() - Enable/Disable channel 144 + * @pdev: pdev pointer + * @enable_chan_144: flag to disable/enable channel 144 + * + * Return: Success or Failure + */ +QDF_STATUS ucfg_reg_modify_chan_144(struct wlan_objmgr_pdev *pdev, + bool enable_ch_144); + +/** + * ucfg_reg_get_en_chan_144() - get en_chan_144 flag value + * @pdev: pdev pointer + * + * Return: en_chan_144 flag value + */ +bool ucfg_reg_get_en_chan_144(struct wlan_objmgr_pdev *pdev); + /** * ucfg_reg_is_regdb_offloaded () - is regulatory database offloaded * @psoc: psoc ptr diff --git a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c index 0757a4161e5f..e250ca0ef4b8 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c @@ -51,6 +51,17 @@ QDF_STATUS ucfg_reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev, return reg_get_current_chan_list(pdev, chan_list); } +QDF_STATUS ucfg_reg_modify_chan_144(struct wlan_objmgr_pdev *pdev, + bool enable_ch_144) +{ + return reg_modify_chan_144(pdev, enable_ch_144); +} + +bool ucfg_reg_get_en_chan_144(struct wlan_objmgr_pdev *pdev) +{ + return reg_get_en_chan_144(pdev); +} + QDF_STATUS ucfg_reg_set_config_vars(struct wlan_objmgr_psoc *psoc, struct reg_config_vars config_vars) {