From d1f2d7a868d03141c41d461df764118e76b887fd Mon Sep 17 00:00:00 2001 From: Sachin Ahuja Date: Mon, 31 Aug 2020 14:54:43 +0530 Subject: [PATCH] qcacmn: Search opclass from global opclass also While querying for the channel width, the opclass is extracted from the country opclass. If opclass is not found then 20Mhz channel width is considered for connection. This fails the cert test case when AP sends the global opclass in ECSA Change is done to search in the global opclass if the opclass is not found in the country specific opclass. CRs-Fixed: 2763702 Change-Id: If8c962e1e164cfccda13f19cbf925499c9cc0394 --- umac/regulatory/core/src/reg_opclass.c | 18 ++++++++++++++++++ umac/regulatory/core/src/reg_opclass.h | 16 +++++++++++++++- .../dispatcher/inc/wlan_reg_services_api.h | 14 ++++++++++++++ .../dispatcher/src/wlan_reg_services_api.c | 8 ++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) 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) {