diff --git a/umac/regulatory/core/src/reg_services.c b/umac/regulatory/core/src/reg_services.c index 2cab5240959d..5c117b295310 100644 --- a/umac/regulatory/core/src/reg_services.c +++ b/umac/regulatory/core/src/reg_services.c @@ -224,7 +224,54 @@ static const struct reg_dmn_op_class_map_t japan_op_class[] = { {0, 0, 0, {0} }, }; +#define IS_VALID_REG_OBJ(soc_reg) (NULL != soc_reg) +#define IS_VALID_PDEV_REG_OBJ(pdev_reg) (NULL != pdev_reg) +/** + * reg_get_psoc_obj() - Provides the reg component object pointer + * @psoc: pointer to psoc object. + * + * Return: reg component object pointer + */ +static struct wlan_regulatory_psoc_priv_obj *reg_get_psoc_obj( + struct wlan_objmgr_psoc *psoc) +{ + struct wlan_regulatory_psoc_priv_obj *soc_reg; + + if (!psoc) { + reg_alert("psoc is NULL"); + return NULL; + } + wlan_psoc_obj_lock(psoc); + soc_reg = wlan_objmgr_psoc_get_comp_private_obj(psoc, + WLAN_UMAC_COMP_REGULATORY); + wlan_psoc_obj_unlock(psoc); + + return soc_reg; +} + +/** + * reg_get_pdev_obj() - Provides the reg component object pointer + * @psoc: pointer to psoc object. + * + * Return: reg component object pointer + */ +static struct wlan_regulatory_pdev_priv_obj *reg_get_pdev_obj( + struct wlan_objmgr_pdev *pdev) +{ + struct wlan_regulatory_pdev_priv_obj *pdev_reg; + + if (!pdev) { + reg_alert("pdev is NULL"); + return NULL; + } + wlan_pdev_obj_lock(pdev); + pdev_reg = wlan_objmgr_pdev_get_comp_private_obj(pdev, + WLAN_UMAC_COMP_REGULATORY); + wlan_pdev_obj_unlock(pdev); + + return pdev_reg; +} /** * reg_get_bw_value() - give bandwidth value * bw: bandwidth enum @@ -247,9 +294,9 @@ uint16_t reg_get_bw_value(enum phy_ch_width bw) case CH_WIDTH_INVALID: return 0; case CH_WIDTH_5MHZ: - return 10; - case CH_WIDTH_10MHZ: return 5; + case CH_WIDTH_10MHZ: + return 10; case CH_WIDTH_MAX: return 160; default: @@ -257,33 +304,6 @@ uint16_t reg_get_bw_value(enum phy_ch_width bw) } } - -/** - * reg_set_default_country() - Read the default country for the regdomain - * @country: country code. - * - * Return: QDF_STATUS - */ -void reg_set_default_country(struct wlan_objmgr_psoc *psoc, uint8_t *country) -{ - struct wlan_regulatory_psoc_priv_obj *soc_reg; - - wlan_psoc_obj_lock(psoc); - soc_reg = (struct wlan_regulatory_psoc_priv_obj *) - wlan_objmgr_psoc_get_comp_private_obj(psoc, - WLAN_UMAC_COMP_REGULATORY); - wlan_psoc_obj_unlock(psoc); - - if (NULL == soc_reg) { - reg_err("reg soc is NULL"); - return; - } - - qdf_mem_copy(soc_reg->default_country, country, - sizeof(soc_reg->default_country)); -} - - /** * reg_get_channel_list_with_power() - Provides the channel list with power * @ch_list: pointer to the channel list. @@ -330,38 +350,6 @@ QDF_STATUS reg_get_channel_list_with_power(struct wlan_objmgr_pdev *pdev, return QDF_STATUS_SUCCESS; } -/** - * reg_read_default_country() - Read the default country for the regdomain - * @country: pointer to the country code. - * - * Return: QDF_STATUS - */ -QDF_STATUS reg_read_default_country(struct wlan_objmgr_psoc *psoc, - uint8_t *country) -{ - struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj; - - wlan_psoc_obj_lock(psoc); - psoc_priv_obj = (struct wlan_regulatory_psoc_priv_obj *) - wlan_objmgr_psoc_get_comp_private_obj(psoc, - WLAN_UMAC_COMP_REGULATORY); - wlan_psoc_obj_unlock(psoc); - - if (NULL == psoc_priv_obj) { - reg_err("psoc priv obj is NULL"); - return QDF_STATUS_E_FAILURE; - } - - if (NULL == country) { - reg_err("country is NULL"); - return QDF_STATUS_E_FAILURE; - } - - qdf_mem_copy(country, psoc_priv_obj->default_country, - sizeof(psoc_priv_obj->default_country)); - - return QDF_STATUS_SUCCESS; -} enum channel_enum reg_get_chan_enum(uint32_t chan_num) { @@ -800,6 +788,115 @@ void reg_set_channel_params(struct wlan_objmgr_pdev *pdev, sec_ch_2g); } +QDF_STATUS reg_get_curr_band(struct wlan_objmgr_pdev *pdev, + enum band_info *band) +{ + struct wlan_regulatory_pdev_priv_obj *pdev_reg; + + pdev_reg = reg_get_pdev_obj(pdev); + if (!IS_VALID_PDEV_REG_OBJ(pdev_reg)) { + reg_alert("pdev reg component is NULL"); + return QDF_STATUS_E_INVAL; + } + + *band = pdev_reg->band_capability; + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS reg_read_default_country(struct wlan_objmgr_psoc *psoc, + uint8_t *country_code) +{ + struct wlan_regulatory_psoc_priv_obj *psoc_reg; + + if (!country_code) { + reg_err("country_code is NULL"); + return QDF_STATUS_E_INVAL; + } + + psoc_reg = reg_get_psoc_obj(psoc); + if (!IS_VALID_REG_OBJ(psoc_reg)) { + reg_alert("psoc reg component is NULL"); + return QDF_STATUS_E_INVAL; + } + + qdf_mem_copy(country_code, + psoc_reg->default_country, + sizeof(psoc_reg->default_country)); + + return QDF_STATUS_SUCCESS; +} + +/** + * reg_set_default_country() - Read the default country for the regdomain + * @country: country code. + * + * Return: QDF_STATUS + */ +QDF_STATUS reg_set_default_country(struct wlan_objmgr_psoc *psoc, + uint8_t *country) +{ + struct wlan_regulatory_psoc_priv_obj *psoc_reg; + + if (!country) { + reg_err("country is NULL"); + return QDF_STATUS_E_INVAL; + } + psoc_reg = reg_get_psoc_obj(psoc); + if (!IS_VALID_REG_OBJ(psoc_reg)) { + reg_alert("psoc reg component is NULL"); + return QDF_STATUS_E_INVAL; + } + + reg_info("setting default_country:n%s", country); + qdf_mem_copy(psoc_reg->default_country, + country, sizeof(psoc_reg->default_country)); + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS reg_set_country(struct wlan_objmgr_pdev *pdev, uint8_t *country) +{ + struct wlan_regulatory_psoc_priv_obj *psoc_reg; + struct wlan_objmgr_psoc *psoc; + + if (!country) { + reg_err("country code is NULL"); + return QDF_STATUS_E_INVAL; + } + + psoc = wlan_pdev_get_psoc(pdev); + psoc_reg = reg_get_psoc_obj(psoc); + if (!IS_VALID_REG_OBJ(psoc_reg)) { + reg_alert("psoc reg component is NULL"); + return QDF_STATUS_E_INVAL; + } + + reg_info("setting current_country:%s", country); + qdf_mem_copy(psoc_reg->current_country, + country, sizeof(psoc_reg->current_country)); + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS reg_reset_country(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_regulatory_psoc_priv_obj *psoc_reg; + + psoc_reg = reg_get_psoc_obj(psoc); + if (!IS_VALID_REG_OBJ(psoc_reg)) { + reg_alert("psoc reg component is NULL"); + return CHANNEL_STATE_INVALID; + } + + reg_info("re-setting current_country to default"); + qdf_mem_copy(psoc_reg->current_country, + psoc_reg->default_country, + sizeof(psoc_reg->current_country)); + + return QDF_STATUS_SUCCESS; +} + /** * reg_get_dfs_region () - Get the current dfs region * @dfs_reg: pointer to dfs region @@ -811,17 +908,11 @@ void reg_get_dfs_region(struct wlan_objmgr_psoc *psoc, { struct wlan_regulatory_psoc_priv_obj *soc_reg; - wlan_psoc_obj_lock(psoc); - soc_reg = (struct wlan_regulatory_psoc_priv_obj *) - wlan_objmgr_psoc_get_comp_private_obj(psoc, - WLAN_UMAC_COMP_REGULATORY); - wlan_psoc_obj_unlock(psoc); - - if (NULL == soc_reg) { - reg_err("reg soc is NULL"); + soc_reg = reg_get_psoc_obj(psoc); + if (!IS_VALID_REG_OBJ(soc_reg)) { + reg_alert("psoc reg component is NULL"); return; } - *dfs_reg = soc_reg->dfs_region; } @@ -836,17 +927,11 @@ void reg_set_dfs_region(struct wlan_objmgr_psoc *psoc, { struct wlan_regulatory_psoc_priv_obj *soc_reg; - wlan_psoc_obj_lock(psoc); - soc_reg = (struct wlan_regulatory_psoc_priv_obj *) - wlan_objmgr_psoc_get_comp_private_obj(psoc, - WLAN_UMAC_COMP_REGULATORY); - wlan_psoc_obj_unlock(psoc); - - if (NULL == soc_reg) { - reg_err("reg soc is NULL"); + soc_reg = reg_get_psoc_obj(psoc); + if (!IS_VALID_REG_OBJ(soc_reg)) { + reg_alert("psoc reg component is NULL"); return; } - soc_reg->dfs_region = dfs_reg; } @@ -1385,14 +1470,9 @@ QDF_STATUS reg_process_master_chan_list(struct cur_regulatory_info reg_debug("process reg master chan list"); - wlan_psoc_obj_lock(regulat_info->psoc); - soc_reg = (struct wlan_regulatory_psoc_priv_obj *) - wlan_objmgr_psoc_get_comp_private_obj(regulat_info->psoc, - WLAN_UMAC_COMP_REGULATORY); - wlan_psoc_obj_unlock(regulat_info->psoc); - - if (NULL == soc_reg) { - reg_err("soc_reg is NULL"); + soc_reg = reg_get_psoc_obj(regulat_info->psoc); + if (!IS_VALID_REG_OBJ(soc_reg)) { + reg_alert("psoc reg component is NULL"); return QDF_STATUS_E_FAILURE; } @@ -1555,6 +1635,98 @@ QDF_STATUS wlan_regulatory_psoc_obj_destroyed_notification( return status; } +QDF_STATUS reg_set_band(struct wlan_objmgr_pdev *pdev, enum band_info band) +{ + struct wlan_regulatory_pdev_priv_obj *pdev_reg; + struct wlan_regulatory_psoc_priv_obj *psoc_reg; + struct wlan_objmgr_psoc *psoc; + + psoc = wlan_pdev_get_psoc(pdev); + if (!psoc) { + reg_alert("psoc is NULL"); + return QDF_STATUS_E_INVAL; + } + + psoc_reg = reg_get_psoc_obj(psoc); + if (!IS_VALID_REG_OBJ(psoc_reg)) { + reg_alert("psoc reg component is NULL"); + return QDF_STATUS_E_INVAL; + } + pdev_reg = reg_get_pdev_obj(pdev); + if (!IS_VALID_PDEV_REG_OBJ(pdev_reg)) { + reg_alert("pdev reg component is NULL"); + return QDF_STATUS_E_INVAL; + } + + if (pdev_reg->band_capability == band) { + reg_info("band is already set to %d", band); + return QDF_STATUS_SUCCESS; + } + + reg_info("setting band_info: %d", band); + pdev_reg->band_capability = band; + + modify_chan_list_for_band(pdev_reg->cur_chan_list, + pdev_reg->band_capability); + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS reg_set_fcc_constraint(struct wlan_objmgr_pdev *pdev, + bool fcc_constraint) +{ + struct wlan_regulatory_pdev_priv_obj *pdev_reg; + + pdev_reg = reg_get_pdev_obj(pdev); + if (!IS_VALID_PDEV_REG_OBJ(pdev_reg)) { + reg_alert("pdev reg component is NULL"); + return QDF_STATUS_E_INVAL; + } + + reg_info("setting set_fcc_channel: %d", fcc_constraint); + pdev_reg->set_fcc_channel = fcc_constraint; + modify_chan_list_for_fcc_channel(pdev_reg->cur_chan_list, + pdev_reg->set_fcc_channel); + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS reg_enable_dfs_channels(struct wlan_objmgr_pdev *pdev, bool enable) +{ + struct wlan_regulatory_pdev_priv_obj *pdev_reg; + struct wlan_regulatory_psoc_priv_obj *psoc_reg; + struct wlan_objmgr_psoc *psoc; + + psoc = wlan_pdev_get_psoc(pdev); + if (!psoc) { + reg_alert("psoc is NULL"); + return QDF_STATUS_E_INVAL; + } + + psoc_reg = reg_get_psoc_obj(psoc); + if (!IS_VALID_REG_OBJ(psoc_reg)) { + reg_alert("psoc reg component is NULL"); + return QDF_STATUS_E_INVAL; + } + + pdev_reg = reg_get_pdev_obj(pdev); + if (!IS_VALID_PDEV_REG_OBJ(pdev_reg)) { + reg_alert("pdev reg component is NULL"); + return QDF_STATUS_E_INVAL; + } + + reg_info("setting dfs_enabled: %d", enable); + if (pdev_reg->dfs_enabled == enable) + return QDF_STATUS_SUCCESS; + + pdev_reg->dfs_enabled = enable; + + modify_chan_list_for_dfs_channels(pdev_reg->cur_chan_list, + pdev_reg->dfs_enabled); + + return QDF_STATUS_SUCCESS; +} + /** * wlan_regulatory_pdev_obj_created_notification() - PDEV obj create callback * @pdev: pdev object @@ -1771,9 +1943,10 @@ void reg_update_nol_ch(struct wlan_objmgr_pdev *pdev, uint8_t *ch_list, reg_err("pdev piv obj is NULL"); return; } - if (nol_ch) { + if (nol_ch || !pdev_priv_obj->dfs_enabled) { ch_state = CHANNEL_STATE_DISABLE; reg_ch_flags = REGULATORY_CHAN_DISABLED; + nol_ch = pdev_priv_obj->dfs_enabled; } else { ch_state = CHANNEL_STATE_DFS; reg_ch_flags = REGULATORY_CHAN_RADAR; diff --git a/umac/regulatory/core/src/reg_services.h b/umac/regulatory/core/src/reg_services.h index d5e49fbced2a..079808bbf6fb 100644 --- a/umac/regulatory/core/src/reg_services.h +++ b/umac/regulatory/core/src/reg_services.h @@ -100,9 +100,6 @@ QDF_STATUS reg_get_channel_list_with_power(struct wlan_objmgr_pdev *pdev, struct channel_power *ch_list, uint8_t *num_chan); -QDF_STATUS reg_read_default_country(struct wlan_objmgr_psoc *psoc, - uint8_t *country); - enum channel_state reg_get_channel_state(struct wlan_objmgr_pdev *pdev, uint32_t ch); @@ -121,6 +118,74 @@ void reg_set_channel_params(struct wlan_objmgr_pdev *pdev, uint8_t ch, uint8_t sec_ch_2g, struct ch_params *ch_params); +/** + * reg_set_band() - Sets the band information for the PDEV + * @pdev: The physical dev to set the band for + * @band: The set band parameters to configure for the pysical device + * + * Return: QDF_STATUS + */ +QDF_STATUS reg_set_band(struct wlan_objmgr_pdev *pdev, enum band_info band); + +/** + * reg_set_fcc_constraint() - Apply fcc constraints on channels 12/13 + * @pdev: The physical dev to set the band for + * + * This function reduces the transmit power on channels 12 and 13, to comply + * with FCC regulations in the USA. + * + * Return: QDF_STATUS + */ +QDF_STATUS reg_set_fcc_constraint(struct wlan_objmgr_pdev *pdev, + bool fcc_constraint); + + +/** + * reg_read_default_country() - Get the default regulatory country + * @psoc: The physical SoC to get default country from + * @country_code: the buffer to populate the country code into + * + * Return: QDF_STATUS + */ +QDF_STATUS reg_read_default_country(struct wlan_objmgr_psoc *psoc, + uint8_t *country_code); + +/** + * reg_set_default_country() - Set the default regulatory country + * @psoc: The physical SoC to set default country for + * @req: The country information to configure + * + * Return: QDF_STATUS + */ +QDF_STATUS reg_set_default_country(struct wlan_objmgr_psoc *psoc, + uint8_t *country); + +/** + * reg_set_country() - Set the current regulatory country + * @pdev: The physical dev to set current country for + * @country: The country information to configure + * + * Return: QDF_STATUS + */ +QDF_STATUS reg_set_country(struct wlan_objmgr_pdev *pdev, uint8_t *country); + +/** + * reg_reset_country() - Reset the regulatory country to default + * @psoc: The physical SoC to reset country for + * + * Return: QDF_STATUS + */ +QDF_STATUS reg_reset_country(struct wlan_objmgr_psoc *psoc); + +/** + * reg_enable_dfs_channels() - Enable the use of DFS channels + * @pdev: The physical dev to enable/disable DFS channels for + * + * Return: QDF_STATUS + */ +QDF_STATUS reg_enable_dfs_channels(struct wlan_objmgr_pdev *pdev, bool enable); + + void reg_get_dfs_region(struct wlan_objmgr_psoc *psoc, enum dfs_reg *dfs_reg); @@ -130,10 +195,6 @@ uint32_t reg_get_channel_reg_power(struct wlan_objmgr_pdev *pdev, uint32_t reg_get_channel_freq(struct wlan_objmgr_pdev *pdev, uint32_t chan_num); -QDF_STATUS reg_read_default_country(struct wlan_objmgr_psoc *psoc, - uint8_t *country); - -void reg_set_default_country(struct wlan_objmgr_psoc *psoc, uint8_t *country); uint16_t reg_get_bw_value(enum phy_ch_width bw); @@ -233,4 +294,9 @@ QDF_STATUS reg_program_default_cc(struct wlan_objmgr_psoc *psoc, QDF_STATUS reg_get_current_cc(struct wlan_objmgr_psoc *psoc, struct cc_regdmn_s *rd); + +QDF_STATUS reg_get_curr_band(struct wlan_objmgr_pdev *pdev, + enum band_info *band); + + #endif diff --git a/umac/regulatory/dispatcher/inc/reg_services_public_struct.h b/umac/regulatory/dispatcher/inc/reg_services_public_struct.h index 9cef34bba1ba..a6c75b1a6cfd 100644 --- a/umac/regulatory/dispatcher/inc/reg_services_public_struct.h +++ b/umac/regulatory/dispatcher/inc/reg_services_public_struct.h @@ -484,19 +484,6 @@ struct reg_config_vars { uint32_t indoor_chan_enabled; }; -struct set_band_req { - enum band_info band; - uint32_t pdev_id; -}; - -struct country_info { - uint8_t country_code[REG_ALPHA2_LEN + 1]; -}; - -struct reg_country_update { - uint8_t country_code[REG_ALPHA2_LEN + 1]; -}; - /** * struct reg_freq_range * @low_freq: low frequency diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h index a6d246703c89..4c0383a724b4 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h @@ -98,10 +98,9 @@ enum channel_state wlan_reg_get_channel_state(struct wlan_objmgr_pdev *pdev, * * Return: channel state */ -enum channel_state wlan_reg_get_5g_bonded_channel_state(struct wlan_objmgr_pdev - *pdev, - uint8_t ch, - enum phy_ch_width bw); +enum channel_state wlan_reg_get_5g_bonded_channel_state( + struct wlan_objmgr_pdev *pdev, uint8_t ch, + enum phy_ch_width bw); /** * wlan_reg_get_2g_bonded_channel_state() - Get 2G bonded channel state @@ -111,10 +110,8 @@ enum channel_state wlan_reg_get_5g_bonded_channel_state(struct wlan_objmgr_pdev * Return: channel state */ enum channel_state wlan_reg_get_2g_bonded_channel_state( - struct wlan_objmgr_pdev - *pdev, uint8_t ch, - uint8_t sec_ch, - enum phy_ch_width bw); + struct wlan_objmgr_pdev *pdev, uint8_t ch, + uint8_t sec_ch, enum phy_ch_width bw); /** * wlan_reg_set_channel_params () - Sets channel parameteres for given bandwidth @@ -167,16 +164,6 @@ enum channel_state wlan_reg_get_bonded_channel_state( struct wlan_objmgr_pdev *pdev, uint8_t ch, enum phy_ch_width bw, uint8_t sec_ch); -/** - * wlan_reg_set_default_country() - set default country - * @psoc: psoc ptr - * @country: country alpha2 - * - * Return: void - */ -void wlan_reg_set_default_country(struct wlan_objmgr_psoc *psoc, - uint8_t *country); - /** * wlan_reg_set_dfs_region() - set the dfs region * @psoc: psoc ptr @@ -281,19 +268,6 @@ QDF_STATUS regulatory_psoc_open(struct wlan_objmgr_psoc *psoc); */ QDF_STATUS regulatory_psoc_close(struct wlan_objmgr_psoc *psoc); -/** - * wlan_reg_get_current_chan_list () - Get the current channel list - * - * @pdev: pdev ptr - * @chan_list: channel list to be returned - * - * Return: QDF_STATUS - */ -QDF_STATUS wlan_reg_get_current_chan_list(struct wlan_objmgr_pdev - *pdev, - struct regulatory_channel - *chan_list); - /** * wlan_reg_update_nol_ch () - set nol channel * @pdev: pdev ptr diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h index f6abfd1db6bc..0d49e543deab 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h @@ -33,13 +33,83 @@ typedef QDF_STATUS (*reg_event_cb)(void *status_struct); -QDF_STATUS ucfg_reg_set_band(uint8_t vdev_id, uint8_t pdev_id, - struct set_band_req *req); -QDF_STATUS ucfg_reg_reset_country(uint8_t vdev_id, uint8_t pdev_id); -QDF_STATUS ucfg_reg_set_default_country(uint8_t vdev_id, uint8_t pdev_id, - struct country_info *cc_info); -QDF_STATUS ucfg_reg_update_country(uint8_t vdev_id, uint8_t pdev_id, - struct reg_country_update *country_update); +/** + * ucfg_reg_set_band() - Sets the band information for the PDEV + * @pdev: The physical pdev to set the band for + * @band: The set band parameter to configure for the pysical device + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_reg_set_band(struct wlan_objmgr_pdev *pdev, + enum band_info band); +/** + * ucfg_reg_set_fcc_constraint() - apply fcc constraints on channels 12/13 + * @pdev: The physical pdev to reduce tx power for + * + * This function adjusts the transmit power on channels 12 and 13, to comply + * with FCC regulations in the USA. + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_reg_set_fcc_constraint(struct wlan_objmgr_pdev *pdev, + bool fcc_constraint); + +/** + * ucfg_reg_get_default_country() - Get the default regulatory country + * @psoc: The physical SoC to get default country from + * @country_code: the buffer to populate the country code into + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_reg_get_default_country(struct wlan_objmgr_psoc *psoc, + uint8_t *country_code); + +/** + * ucfg_reg_set_default_country() - Set the default regulatory country + * @psoc: The physical SoC to set default country for + * @country_code: The country information to configure + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_reg_set_default_country(struct wlan_objmgr_psoc *psoc, + uint8_t *country_code); + +/** + * ucfg_reg_set_country() - Set the current regulatory country + * @pdev: The physical dev to set current country for + * @country_code: The country information to configure + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_reg_set_country(struct wlan_objmgr_pdev *pdev, + uint8_t *country_code); + +/** + * ucfg_reg_reset_country() - Reset the regulatory country to default + * @psoc: The physical SoC to reset country for + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_reg_reset_country(struct wlan_objmgr_psoc *psoc); + +/** + * ucfg_reg_get_curr_band() - Get the current band capability + * @pdev: The physical dev to get default country from + * @band: buffer to populate the band into + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_reg_get_curr_band(struct wlan_objmgr_pdev *pdev, + enum band_info *band); +/** + * ucfg_reg_enable_dfs_channels() - Enable the use of DFS channels + * @pdev: The physical dev to enable DFS channels for + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_reg_enable_dfs_channels(struct wlan_objmgr_pdev *pdev, + bool dfs_enable); + QDF_STATUS ucfg_reg_register_event_handler(uint8_t vdev_id, reg_event_cb cb, void *arg); QDF_STATUS ucfg_reg_unregister_event_handler(uint8_t vdev_id, reg_event_cb cb, diff --git a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c index b53c6dd32962..4a1d0b3639bb 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c @@ -171,18 +171,6 @@ uint16_t wlan_reg_get_bw_value(enum phy_ch_width bw) return reg_get_bw_value(bw); } -/** - * wlan_reg_set_default_country() - Set the default country for the regdomain - * @country: pointer to the country code. - * - * Return: None - */ -void wlan_reg_set_default_country(struct wlan_objmgr_psoc *psoc, - uint8_t *country) -{ - reg_set_default_country(psoc, country); -} - /** * wlan_reg_get_bonded_channel_state() - Get 2G bonded channel state * @ch: channel number. @@ -364,14 +352,6 @@ QDF_STATUS regulatory_psoc_close(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_SUCCESS; }; -QDF_STATUS wlan_reg_get_current_chan_list(struct wlan_objmgr_pdev - *pdev, - struct regulatory_channel - *chan_list) -{ - return reg_get_current_chan_list(pdev, chan_list); -} - void wlan_reg_update_nol_ch(struct wlan_objmgr_pdev *pdev, uint8_t *ch_list, uint8_t num_ch, bool nol_ch) { @@ -407,3 +387,4 @@ uint32_t wlan_reg_chan_to_freq(struct wlan_objmgr_pdev *pdev, { return reg_chan_to_freq(pdev, chan_num); } + diff --git a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c index 51fa77dcaa2c..6e1f967ac42b 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c @@ -25,50 +25,6 @@ #include #include "../../core/src/reg_services.h" -/** - * ucfg_reg_set_band () - set band req handler - * @vdev_id: vdev id - * @pdev_id: pdev id - * @req: pointer to request message - * - * Return: QDF_STATUS - */ -QDF_STATUS ucfg_reg_set_band(uint8_t vdev_id, uint8_t pdev_id, - struct set_band_req *req) -{ - /* Handle the set band request */ - return QDF_STATUS_SUCCESS; -} - -/** - * ucfg_reg_set_band () - set band req handler - * @vdev_id: vdev id - * @pdev_id: pdev id - * @req: pointer to request message - * - * Return: QDF_STATUS - */ -QDF_STATUS ucfg_reg_reset_country(uint8_t vdev_id, uint8_t pdev_id) -{ - /* Resets the pdev country info with default country info */ - return QDF_STATUS_SUCCESS; -} - -QDF_STATUS ucfg_reg_set_default_country(uint8_t vdev_id, uint8_t pdev_id, - struct country_info *cc_info) -{ - /* sets the default country info */ - return QDF_STATUS_SUCCESS; -} - - -QDF_STATUS ucfg_reg_update_country(uint8_t vdev_id, uint8_t pdev_id, - struct reg_country_update *country_update) -{ - /* Post a msg to target_if queue to update the country information */ - return QDF_STATUS_SUCCESS; -} - QDF_STATUS ucfg_reg_register_event_handler(uint8_t vdev_id, reg_event_cb cb, void *arg) { @@ -131,3 +87,101 @@ QDF_STATUS ucfg_reg_get_current_cc(struct wlan_objmgr_psoc *psoc, { return reg_get_current_cc(psoc, rd); } + +/** + * ucfg_reg_set_band() - Sets the band information for the PDEV + * @pdev: The physical pdev to set the band for + * @band: The set band parameter to configure for the pysical device + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_reg_set_band(struct wlan_objmgr_pdev *pdev, + enum band_info band) +{ + return reg_set_band(pdev, band); +} + +/** + * ucfg_reg_set_fcc_constraint() - apply fcc constraints on channels 12/13 + * @pdev: The physical pdev to reduce tx power for + * + * This function adjusts the transmit power on channels 12 and 13, to comply + * with FCC regulations in the USA. + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_reg_set_fcc_constraint(struct wlan_objmgr_pdev *pdev, + bool fcc_constraint) +{ + return reg_set_fcc_constraint(pdev, fcc_constraint); +} + + +/** + * ucfg_reg_get_default_country() - Get the default regulatory country + * @psoc: The physical SoC to get default country from + * @country_code: the buffer to populate the country code into + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_reg_get_default_country(struct wlan_objmgr_psoc *psoc, + uint8_t *country_code) +{ + return reg_read_default_country(psoc, country_code); +} + +/** + * ucfg_reg_set_default_country() - Set the default regulatory country + * @psoc: The physical SoC to set default country for + * @country: The country information to configure + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_reg_set_default_country(struct wlan_objmgr_psoc *psoc, + uint8_t *country) +{ + return reg_set_default_country(psoc, country); +} + +/** + * ucfg_reg_set_country() - Set the current regulatory country + * @pdev: The physical dev to set current country for + * @country: The country information to configure + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_reg_set_country(struct wlan_objmgr_pdev *pdev, + uint8_t *country) +{ + return reg_set_country(pdev, country); +} + +/** + * ucfg_reg_reset_country() - Reset the regulatory country to default + * @psoc: The physical SoC to reset country for + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_reg_reset_country(struct wlan_objmgr_psoc *psoc) +{ + return reg_reset_country(psoc); +} + +/** + * ucfg_reg_enable_dfs_channels() - Enable the use of DFS channels + * @pdev: The physical dev to enable DFS channels for + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_reg_enable_dfs_channels(struct wlan_objmgr_pdev *pdev, + bool dfs_enable) +{ + return reg_enable_dfs_channels(pdev, dfs_enable); +} + +QDF_STATUS ucfg_reg_get_curr_band(struct wlan_objmgr_pdev *pdev, + enum band_info *band) +{ + return reg_get_curr_band(pdev, band); + +}