diff --git a/umac/regulatory/core/src/reg_opclass.c b/umac/regulatory/core/src/reg_opclass.c index c34a36f454..a1dff6fa6b 100644 --- a/umac/regulatory/core/src/reg_opclass.c +++ b/umac/regulatory/core/src/reg_opclass.c @@ -261,8 +261,8 @@ static const struct reg_dmn_op_class_map_t japan_op_class[] = { * * Return: class. */ -static const -struct reg_dmn_op_class_map_t *reg_get_class_from_country(uint8_t *country) +static const struct reg_dmn_op_class_map_t +*reg_get_class_from_country(const uint8_t *country) { const struct reg_dmn_op_class_map_t *class = NULL; @@ -369,6 +369,42 @@ uint8_t reg_dmn_get_opclass_from_freq_width(uint8_t *country, return 0; } +uint8_t reg_get_band_cap_from_op_class(const uint8_t *country, + uint8_t num_of_opclass, + const uint8_t *opclass) +{ + const struct reg_dmn_op_class_map_t *op_class_tbl; + uint8_t supported_band = 0, opclassidx; + + op_class_tbl = reg_get_class_from_country(country); + + while (op_class_tbl && op_class_tbl->op_class) { + for (opclassidx = 0; opclassidx < num_of_opclass; + opclassidx++) { + if (op_class_tbl->op_class == opclass[opclassidx]) { + if (op_class_tbl->start_freq == + TWOG_START_FREQ) { + supported_band |= BIT(REG_BAND_2G); + } else if (op_class_tbl->start_freq == + FIVEG_START_FREQ) { + supported_band |= BIT(REG_BAND_5G); + } else if (op_class_tbl->start_freq == + SIXG_STARTING_FREQ) { + supported_band |= BIT(REG_BAND_6G); + } else { + reg_err_rl("Unknown band"); + } + } + } + op_class_tbl++; + } + + if (!supported_band) + reg_err_rl("None of the operating classes is found"); + + return supported_band; +} + void reg_dmn_print_channels_in_opclass(uint8_t *country, uint8_t op_class) { const struct reg_dmn_op_class_map_t *class = NULL; diff --git a/umac/regulatory/core/src/reg_opclass.h b/umac/regulatory/core/src/reg_opclass.h index f8bafca34c..7e06b262d5 100644 --- a/umac/regulatory/core/src/reg_opclass.h +++ b/umac/regulatory/core/src/reg_opclass.h @@ -62,6 +62,21 @@ uint8_t reg_dmn_get_opclass_from_freq_width(uint8_t *country, uint8_t ch_width, uint16_t behav_limit); +/** + * reg_get_band_cap_from_op_class() - Return band capability bitmap + * @country: Pointer to Country code. + * @num_of_opclass: Number of Operating class. + * @opclass: Pointer to opclass. + * + * Return supported band bitmap based on the input operating class list + * provided. + * + * Return: Return supported band capability + */ +uint8_t reg_get_band_cap_from_op_class(const uint8_t *country, + uint8_t num_of_opclass, + const uint8_t *opclass); + /** * reg_dmn_get_opclass_from_channe() - Print channels in op class. * @country: Country code. @@ -265,6 +280,14 @@ uint8_t reg_dmn_get_opclass_from_freq_width(uint8_t *country, return 0; } +static inline +uint8_t reg_get_band_cap_from_op_class(uint8_t *country, + uint8_t num_of_opclass, + const uint8_t *opclass) +{ + return 0; +} + static inline void reg_dmn_print_channels_in_opclass(uint8_t *country, uint8_t op_class) { diff --git a/umac/regulatory/dispatcher/inc/reg_services_public_struct.h b/umac/regulatory/dispatcher/inc/reg_services_public_struct.h index 463f5529e7..d7487c75a9 100644 --- a/umac/regulatory/dispatcher/inc/reg_services_public_struct.h +++ b/umac/regulatory/dispatcher/inc/reg_services_public_struct.h @@ -40,6 +40,8 @@ #define CH_AVOID_MAX_RANGE 4 #define REG_ALPHA2_LEN 2 #define MAX_REG_RULES 10 +#define TWOG_START_FREQ 2407 +#define FIVEG_START_FREQ 5000 #define REGULATORY_CHAN_DISABLED BIT(0) #define REGULATORY_CHAN_NO_IR BIT(1) diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h index 5f6d5d0e6b..3c56878968 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h @@ -561,6 +561,21 @@ uint8_t wlan_reg_get_opclass_from_freq_width(uint8_t *country, uint8_t ch_width, uint16_t behav_limit); +/** + * wlan_reg_get_band_cap_from_op_class() - Return band capability bitmap + * @country: Pointer to Country code. + * @num_of_opclass: Number of Operating class. + * @opclass: Pointer to opclass. + * + * Return supported band bitmap based on the input operating class list + * provided. + * + * Return: Return supported band capability + */ +uint8_t wlan_reg_get_band_cap_from_op_class(const uint8_t *country, + uint8_t num_of_opclass, + const uint8_t *opclass); + /** * wlan_reg_dmn_print_channels_in_opclass() - Print channels in op-class * @country: country alpha2 diff --git a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c index 47bd7a8466..cd0e542c3f 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c @@ -267,6 +267,14 @@ uint16_t wlan_reg_dmn_get_opclass_from_channel(uint8_t *country, offset); } +uint8_t wlan_reg_get_band_cap_from_op_class(const uint8_t *country, + uint8_t num_of_opclass, + const uint8_t *opclass) +{ + return reg_get_band_cap_from_op_class(country, + num_of_opclass, opclass); +} + uint8_t wlan_reg_get_opclass_from_freq_width(uint8_t *country, qdf_freq_t freq, uint8_t ch_width,