From 957cf8edef98ee4a831ffdb2fa2abf9abcc74d80 Mon Sep 17 00:00:00 2001 From: Hariharan Basuthkar Date: Wed, 21 Oct 2020 23:55:05 +0530 Subject: [PATCH] qcacmn: Expand regdomain to include 6Ghz superdomain The regulatory structure which contains country and regulatory domain, needs to be expanded to include 6Ghz superdomain. Make changes in the regulatory component to send the 6G super domain set by the user, to the target. Change-Id: I84b96cd74012e33d464d98675158c9cd5eabff4e CRs-Fixed: 2802131 --- umac/regulatory/core/src/reg_db_parser.c | 4 ++-- umac/regulatory/core/src/reg_priv_objs.h | 2 ++ umac/regulatory/core/src/reg_services_common.c | 5 +++-- umac/regulatory/core/src/reg_utils.c | 5 +++-- .../inc/reg_services_public_struct.h | 18 ++++++++++++------ wmi/src/wmi_unified_tlv.c | 5 ++++- 6 files changed, 26 insertions(+), 13 deletions(-) diff --git a/umac/regulatory/core/src/reg_db_parser.c b/umac/regulatory/core/src/reg_db_parser.c index 3cff4ca52b0d..000982bdd18e 100644 --- a/umac/regulatory/core/src/reg_db_parser.c +++ b/umac/regulatory/core/src/reg_db_parser.c @@ -128,7 +128,7 @@ QDF_STATUS reg_get_rdpair_from_country_iso(uint8_t *alpha2, return QDF_STATUS_SUCCESS; } -QDF_STATUS reg_get_rdpair_from_regdmn_id(uint16_t regdmn_id, +QDF_STATUS reg_get_rdpair_from_regdmn_id(uint16_t reg_2g_5g_pair_id, uint16_t *regdmn_pair) { uint16_t j; @@ -137,7 +137,7 @@ QDF_STATUS reg_get_rdpair_from_regdmn_id(uint16_t regdmn_id, reg_get_num_reg_dmn_pairs(&num_reg_dmn); for (j = 0; j < num_reg_dmn; j++) { - if (g_reg_dmn_pairs[j].reg_dmn_pair_id == regdmn_id) + if (g_reg_dmn_pairs[j].reg_dmn_pair_id == reg_2g_5g_pair_id) break; } diff --git a/umac/regulatory/core/src/reg_priv_objs.h b/umac/regulatory/core/src/reg_priv_objs.h index e35745f44418..f40a7a76e754 100644 --- a/umac/regulatory/core/src/reg_priv_objs.h +++ b/umac/regulatory/core/src/reg_priv_objs.h @@ -160,6 +160,7 @@ struct wlan_regulatory_psoc_priv_obj { * @pdev_opened: whether pdev has been opened by application * @band_capability: bitmap of bands enabled, using enum reg_wifi_band as the * bit position value + * @reg_6g_superid: 6Ghz super domain id */ struct wlan_regulatory_pdev_priv_obj { struct regulatory_channel cur_chan_list[NUM_CHANNELS]; @@ -174,6 +175,7 @@ struct wlan_regulatory_pdev_priv_obj { uint16_t def_country_code; char current_country[REG_ALPHA2_LEN + 1]; uint16_t reg_dmn_pair; + uint16_t reg_6g_superid; uint16_t ctry_code; #ifdef DISABLE_UNII_SHARED_BANDS uint8_t unii_5g_bitmap; diff --git a/umac/regulatory/core/src/reg_services_common.c b/umac/regulatory/core/src/reg_services_common.c index da767ff807dc..81a2cab2ab4a 100644 --- a/umac/regulatory/core/src/reg_services_common.c +++ b/umac/regulatory/core/src/reg_services_common.c @@ -2045,7 +2045,7 @@ QDF_STATUS reg_program_chan_list(struct wlan_objmgr_pdev *pdev, &country_index, ®dmn_pair); } else if (rd->flags == REGDMN_IS_SET) { - reg_get_rdpair_from_regdmn_id(rd->cc.regdmn_id, + reg_get_rdpair_from_regdmn_id(rd->cc.regdmn.reg_2g_5g_pair_id, ®dmn_pair); } @@ -2085,7 +2085,8 @@ QDF_STATUS reg_get_current_cc(struct wlan_objmgr_pdev *pdev, qdf_mem_copy(rd->cc.alpha, pdev_priv_obj->current_country, sizeof(rd->cc.alpha)); } else if (rd->flags == REGDMN_IS_SET) { - rd->cc.regdmn_id = pdev_priv_obj->reg_dmn_pair; + rd->cc.regdmn.reg_2g_5g_pair_id = pdev_priv_obj->reg_dmn_pair; + rd->cc.regdmn.sixg_superdmn_id = pdev_priv_obj->reg_6g_superid; } return QDF_STATUS_SUCCESS; diff --git a/umac/regulatory/core/src/reg_utils.c b/umac/regulatory/core/src/reg_utils.c index 9eb9bb5e5f8b..bda68f59bfee 100644 --- a/umac/regulatory/core/src/reg_utils.c +++ b/umac/regulatory/core/src/reg_utils.c @@ -258,10 +258,11 @@ QDF_STATUS reg_set_country(struct wlan_objmgr_pdev *pdev, } if (reg_is_world_ctry_code( pdev_priv_obj->def_region_domain)) - rd.cc.regdmn_id = + rd.cc.regdmn.reg_2g_5g_pair_id = pdev_priv_obj->def_region_domain; else - rd.cc.regdmn_id = DEFAULT_WORLD_REGDMN; + rd.cc.regdmn.reg_2g_5g_pair_id = + DEFAULT_WORLD_REGDMN; rd.flags = REGDMN_IS_SET; } else { qdf_mem_copy(rd.cc.alpha, cc.country, diff --git a/umac/regulatory/dispatcher/inc/reg_services_public_struct.h b/umac/regulatory/dispatcher/inc/reg_services_public_struct.h index 7a942a405b38..30d0af2c074b 100644 --- a/umac/regulatory/dispatcher/inc/reg_services_public_struct.h +++ b/umac/regulatory/dispatcher/inc/reg_services_public_struct.h @@ -888,6 +888,7 @@ struct cur_reg_rule { * @num_phy: number of phy * @phy_id: phy id * @reg_dmn_pair: reg domain pair + * @reg_6g_superid: 6G super domain id * @ctry_code: country code * @alpha2: country alpha2 * @offload_enabled: offload enabled @@ -908,6 +909,7 @@ struct cur_regulatory_info { uint8_t num_phy; uint8_t phy_id; uint16_t reg_dmn_pair; + uint16_t reg_6g_superid; uint16_t ctry_code; uint8_t alpha2[REG_ALPHA2_LEN + 1]; bool offload_enabled; @@ -1081,7 +1083,7 @@ struct mas_chan_params { char current_country[REG_ALPHA2_LEN + 1]; uint16_t def_region_domain; uint16_t def_country_code; - uint16_t reg_dmn_pair; + uint32_t reg_dmn_pair; uint16_t ctry_code; struct reg_rule_info reg_rules; }; @@ -1102,15 +1104,19 @@ enum cc_regdmn_flag { /** * struct cc_regdmn_s: User country code or regdomain - * @country_code: Country code - * @regdmn_id: Regdomain pair ID - * @alpha: Country ISO - * @flags: Regdomain flags + * @country_code: Country code + * @reg_2g_5g_pair_id: Regdomain pair ID (2Ghz + 5Ghz domain pair) + * @sixg_superdmn_id: 6Ghz super domain id + * @alpha: Country ISO + * @flags: Regdomain flags */ struct cc_regdmn_s { union { uint16_t country_code; - uint16_t regdmn_id; + struct { + uint16_t reg_2g_5g_pair_id; + uint16_t sixg_superdmn_id; + } regdmn; uint8_t alpha[REG_ALPHA2_LEN + 1]; } cc; uint8_t flags; diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index b539d7a80efb..1078bdc9b0fb 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -12437,7 +12437,10 @@ static QDF_STATUS send_user_country_code_cmd_tlv(wmi_unified_t wmi_handle, rd->cc.alpha[2]); } else if (rd->flags == REGDMN_IS_SET) { cmd->countrycode_type = WMI_COUNTRYCODE_DOMAIN_CODE; - cmd->country_code.domain_code = rd->cc.regdmn_id; + WMI_SET_BITS(cmd->country_code.domain_code, 0, 16, + rd->cc.regdmn.reg_2g_5g_pair_id); + WMI_SET_BITS(cmd->country_code.domain_code, 16, 16, + rd->cc.regdmn.sixg_superdmn_id); } wmi_mtrace(WMI_SET_INIT_COUNTRY_CMDID, NO_SESSION, 0);