From 6a80e3c5d3f11e93e051f6ca8215fb8142bfbe2f Mon Sep 17 00:00:00 2001 From: Lincoln Tran Date: Thu, 21 Jan 2021 22:41:58 -0800 Subject: [PATCH] qcacmn: Append 6g reg rules to main list Currently, there are separate list for 2g/5g and 6g reg rules. Only one list is sent north from pdev, so append the corresponding rules to the existing list in the pdev only. Change-Id: I28e68f345ae6faad3ac2d929dac3922e9389d53e CRs-fixed: 2860702 --- .../regulatory/core/src/reg_build_chan_list.c | 47 ++++++++++++++++++- .../regulatory/core/src/reg_build_chan_list.h | 8 ++++ 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/umac/regulatory/core/src/reg_build_chan_list.c b/umac/regulatory/core/src/reg_build_chan_list.c index 1251e3f60d65..781064cad5ca 100644 --- a/umac/regulatory/core/src/reg_build_chan_list.c +++ b/umac/regulatory/core/src/reg_build_chan_list.c @@ -1067,7 +1067,15 @@ void reg_reset_reg_rules(struct reg_rule_info *reg_rules) qdf_mem_zero(reg_rules, sizeof(*reg_rules)); } +#ifdef CONFIG_REG_CLIENT #ifdef CONFIG_BAND_6GHZ +/** + * reg_copy_6g_reg_rules() - Copy the 6G reg rules from PSOC to PDEV + * @pdev_reg_rules: Pointer to pdev reg rules + * @psoc_reg_rules: Pointer to psoc reg rules + * + * Return: void + */ static void reg_copy_6g_reg_rules(struct reg_rule_info *pdev_reg_rules, struct reg_rule_info *psoc_reg_rules) { @@ -1093,12 +1101,45 @@ static void reg_copy_6g_reg_rules(struct reg_rule_info *pdev_reg_rules, reg_rule_len_6g_client); } } -#else + +/** + * reg_append_6g_reg_rules_in_pdev() - Append the 6G reg rules to the reg rules + * list in pdev so that all currently used reg rules are in one common list + * @pdev_priv_obj: Pointer to pdev private object + * + * Return: void + */ +static void reg_append_6g_reg_rules_in_pdev( + struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj) +{ + struct reg_rule_info *pdev_reg_rules; + enum reg_6g_ap_type cur_pwr_type; + uint8_t num_reg_rules; + + pdev_reg_rules = &pdev_priv_obj->reg_rules; + cur_pwr_type = pdev_priv_obj->reg_cur_6g_ap_pwr_type; + + num_reg_rules = pdev_reg_rules->num_of_reg_rules; + pdev_reg_rules->num_of_reg_rules += + pdev_reg_rules->num_of_6g_client_reg_rules[cur_pwr_type]; + + qdf_mem_copy(&pdev_reg_rules->reg_rules[num_reg_rules], + pdev_reg_rules->reg_rules_6g_client[cur_pwr_type], + pdev_reg_rules->num_of_6g_client_reg_rules[cur_pwr_type] * + sizeof(struct cur_reg_rule)); +} + +#else /* CONFIG_BAND_6GHZ */ static inline void reg_copy_6g_reg_rules(struct reg_rule_info *pdev_reg_rules, struct reg_rule_info *psoc_reg_rules) { } -#endif + +static inline void reg_append_6g_reg_rules_in_pdev( + struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj) +{ +} +#endif /* CONFIG_BAND_6GHZ */ void reg_save_reg_rules_to_pdev( struct reg_rule_info *psoc_reg_rules, @@ -1125,6 +1166,7 @@ void reg_save_reg_rules_to_pdev( reg_rule_len); reg_copy_6g_reg_rules(pdev_reg_rules, psoc_reg_rules); + reg_append_6g_reg_rules_in_pdev(pdev_priv_obj); qdf_mem_copy(pdev_reg_rules->alpha2, pdev_priv_obj->current_country, REG_ALPHA2_LEN + 1); @@ -1132,6 +1174,7 @@ void reg_save_reg_rules_to_pdev( qdf_spin_unlock_bh(&pdev_priv_obj->reg_rules_lock); } +#endif /* CONFIG_REG_CLIENT */ void reg_propagate_mas_chan_list_to_pdev(struct wlan_objmgr_psoc *psoc, void *object, void *arg) diff --git a/umac/regulatory/core/src/reg_build_chan_list.h b/umac/regulatory/core/src/reg_build_chan_list.h index af12850461e3..d47502e0f815 100644 --- a/umac/regulatory/core/src/reg_build_chan_list.h +++ b/umac/regulatory/core/src/reg_build_chan_list.h @@ -46,6 +46,7 @@ void reg_init_pdev_mas_chan_list( struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj, struct mas_chan_params *mas_chan_params); +#ifdef CONFIG_REG_CLIENT /** * reg_save_reg_rules_to_pdev() - Save psoc reg-rules to pdev. * @pdev_priv_obj: Pointer to regdb pdev private object. @@ -53,6 +54,13 @@ void reg_init_pdev_mas_chan_list( void reg_save_reg_rules_to_pdev( struct reg_rule_info *psoc_reg_rules, struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj); +#else +static inline void +reg_save_reg_rules_to_pdev(struct reg_rule_info *psoc_reg_rules, + struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj) +{ +} +#endif /** * reg_compute_pdev_current_chan_list() - Compute pdev current channel list.