diff --git a/umac/regulatory/core/src/reg_services_common.c b/umac/regulatory/core/src/reg_services_common.c index a87f86a2cb..b0523058bd 100644 --- a/umac/regulatory/core/src/reg_services_common.c +++ b/umac/regulatory/core/src/reg_services_common.c @@ -1547,6 +1547,53 @@ QDF_STATUS reg_read_default_country(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } +QDF_STATUS reg_get_max_5g_bw_from_country_code(uint16_t cc, + uint16_t *max_bw_5g) +{ + uint16_t i; + int num_countries; + + *max_bw_5g = 0; + reg_get_num_countries(&num_countries); + + for (i = 0; i < num_countries; i++) { + if (g_all_countries[i].country_code == cc) + break; + } + + if (i == num_countries) + return QDF_STATUS_E_FAILURE; + + *max_bw_5g = g_all_countries[i].max_bw_5g; + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS reg_get_max_5g_bw_from_regdomain(uint16_t regdmn, + uint16_t *max_bw_5g) +{ + uint16_t i; + int num_reg_dmn; + + *max_bw_5g = 0; + reg_get_num_reg_dmn_pairs(&num_reg_dmn); + + for (i = 0; i < num_reg_dmn; i++) { + if (g_reg_dmn_pairs[i].reg_dmn_pair_id == regdmn) + break; + } + + if (i == num_reg_dmn) + return QDF_STATUS_E_FAILURE; + + if (!regdomains_5g[g_reg_dmn_pairs[i].dmn_id_5g].num_reg_rules) + *max_bw_5g = 0; + else + *max_bw_5g = BW_160_MHZ; + + return QDF_STATUS_SUCCESS; +} + void reg_get_current_dfs_region(struct wlan_objmgr_pdev *pdev, enum dfs_reg *dfs_reg) { diff --git a/umac/regulatory/core/src/reg_services_common.h b/umac/regulatory/core/src/reg_services_common.h index 48f5b1d6d6..cac5cb7ea9 100644 --- a/umac/regulatory/core/src/reg_services_common.h +++ b/umac/regulatory/core/src/reg_services_common.h @@ -219,6 +219,30 @@ void reg_set_channel_params(struct wlan_objmgr_pdev *pdev, QDF_STATUS reg_read_default_country(struct wlan_objmgr_psoc *psoc, uint8_t *country_code); +/** + * reg_get_ctry_idx_max_bw_from_country_code() - Get the max 5G bandwidth + * from country code + * @cc : Country Code + * @max_bw_5g : Max 5G bandwidth supported by the country + * + * Return : QDF_STATUS + */ + +QDF_STATUS reg_get_max_5g_bw_from_country_code(uint16_t cc, + uint16_t *max_bw_5g); + +/** + * reg_get_max_5g_bw_from_regdomain() - Get the max 5G bandwidth + * supported by the regdomain + * @orig_regdmn : Regdomain pair value + * @max_bw_5g : Max 5G bandwidth supported by the country + * + * Return : QDF_STATUS + */ + +QDF_STATUS reg_get_max_5g_bw_from_regdomain(uint16_t regdmn, + uint16_t *max_bw_5g); + /** * reg_get_current_dfs_region () - Get the current dfs region * @pdev: Pointer to pdev diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h index f3b48e6e04..aecba4b132 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h @@ -336,6 +336,29 @@ QDF_STATUS wlan_reg_get_channel_list_with_power(struct wlan_objmgr_pdev *pdev, QDF_STATUS wlan_reg_read_default_country(struct wlan_objmgr_psoc *psoc, uint8_t *country); +/** + * wlan_reg_get_ctry_idx_max_bw_from_country_code() - Get the max 5G + * bandwidth from country code + * @cc : Country Code + * @max_bw_5g : Max 5G bandwidth supported by the country + * + * Return : QDF_STATUS + */ + +QDF_STATUS wlan_reg_get_max_5g_bw_from_country_code(uint16_t cc, + uint16_t *max_bw_5g); + +/** + * wlan_reg_get_max_5g_bw_from_regdomain() - Get the max 5G bandwidth + * supported by the regdomain + * @orig_regdmn : Regdomain Pair value + * @max_bw_5g : Max 5G bandwidth supported by the country + * + * Return : QDF_STATUS + */ +QDF_STATUS wlan_reg_get_max_5g_bw_from_regdomain(uint16_t regdmn, + uint16_t *max_bw_5g); + /** * wlan_reg_get_fcc_constraint() - Check FCC constraint on given frequency * @pdev: physical dev to get diff --git a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c index 9b90573a16..0d46224537 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c @@ -84,6 +84,24 @@ QDF_STATUS wlan_reg_read_current_country(struct wlan_objmgr_psoc *psoc, return reg_read_current_country(psoc, country); } +QDF_STATUS wlan_reg_get_max_5g_bw_from_country_code(uint16_t cc, + uint16_t *max_bw_5g) +{ + /* + * Get the max 5G bandwidth from country code + */ + return reg_get_max_5g_bw_from_country_code(cc, max_bw_5g); +} + +QDF_STATUS wlan_reg_get_max_5g_bw_from_regdomain(uint16_t regdmn, + uint16_t *max_bw_5g) +{ + /* + * Get the max 5G bandwidth from regdomain pair value + */ + return reg_get_max_5g_bw_from_regdomain(regdmn, max_bw_5g); +} + #ifdef CONFIG_CHAN_NUM_API /** * wlan_reg_get_channel_state() - Get channel state from regulatory