diff --git a/umac/regulatory/core/src/reg_opclass.c b/umac/regulatory/core/src/reg_opclass.c index df7a7d7654be..f01c007350d8 100644 --- a/umac/regulatory/core/src/reg_opclass.c +++ b/umac/regulatory/core/src/reg_opclass.c @@ -357,6 +357,24 @@ uint16_t reg_dmn_get_chanwidth_from_opclass(uint8_t *country, uint8_t channel, return 0; } +uint16_t reg_dmn_get_chanwidth_from_opclass_auto(uint8_t *country, + uint8_t channel, + uint8_t opclass) +{ + uint16_t ret; + uint8_t global_country[REG_ALPHA2_LEN + 1]; + + ret = reg_dmn_get_chanwidth_from_opclass(country, channel, opclass); + + if (!ret) { + global_country[2] = OP_CLASS_GLOBAL; + ret = reg_dmn_get_chanwidth_from_opclass(global_country, + channel, opclass); + } + + return ret; +} + uint16_t reg_dmn_get_opclass_from_channel(uint8_t *country, uint8_t channel, uint8_t offset) { diff --git a/umac/regulatory/core/src/reg_opclass.h b/umac/regulatory/core/src/reg_opclass.h index 96f1650db6a9..8db4d261fdcd 100644 --- a/umac/regulatory/core/src/reg_opclass.h +++ b/umac/regulatory/core/src/reg_opclass.h @@ -426,6 +426,20 @@ reg_chan_opclass_to_freq_auto(uint8_t chan, uint8_t op_class, { return 0; } +#endif -#endif +/** + * reg_dmn_get_chanwidth_from_opclass_auto()- Get channel width for the + * given channel and opclass. If not found then search it in the global + * op class. + * @country - Country + * @channel - Channel for which channel spacing is required + * @opclass - Opclass to search from. + * + * Return: valid channel spacing if found. If not found then + * return 0. + */ +uint16_t reg_dmn_get_chanwidth_from_opclass_auto(uint8_t *country, + uint8_t channel, + uint8_t opclass); #endif diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h index 6d6d8a272fa3..70c5b307c077 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h @@ -757,6 +757,20 @@ void wlan_reg_dmn_print_channels_in_opclass(uint8_t *country, uint16_t wlan_reg_dmn_get_chanwidth_from_opclass(uint8_t *country, uint8_t channel, uint8_t opclass); + +/** + * wlan_reg_dmn_get_chanwidth_from_opclass_auto() - get channel width from + * operating class. If opclass not found then search in global opclass. + * @country: country alpha2 + * @channel: channel number + * @opclass: operating class + * + * Return: int + */ +uint16_t wlan_reg_dmn_get_chanwidth_from_opclass_auto(uint8_t *country, + uint8_t channel, + uint8_t opclass); + /** * wlan_reg_dmn_set_curr_opclasses() - set operating class * @num_classes: number of classes diff --git a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c index 20c23c8cfbd2..d7736d57c356 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c @@ -316,6 +316,14 @@ uint16_t wlan_reg_dmn_get_chanwidth_from_opclass(uint8_t *country, opclass); } +uint16_t wlan_reg_dmn_get_chanwidth_from_opclass_auto(uint8_t *country, + uint8_t channel, + uint8_t opclass) +{ + return reg_dmn_get_chanwidth_from_opclass_auto(country, channel, + opclass); +} + uint16_t wlan_reg_dmn_set_curr_opclasses(uint8_t num_classes, uint8_t *class) {