فهرست منبع

qcacmn: Update EHT cap IE as per current country code

On set country code, host updates EHT cap IE to FW via
WMI_VDEV_SET_IE_CMDID command. 320 MHz BW capability in
EHT cap IE should be as per new country code.

Change-Id: I3b80dbeee6f35dacc41f15612373ea7f8efc5803
CRs-Fixed: 3670311
Abhinav Kumar 1 سال پیش
والد
کامیت
abcf99cc9c

+ 28 - 11
umac/regulatory/core/src/reg_build_chan_list.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -333,16 +333,21 @@ static void reg_populate_band_channels(enum channel_enum start_chan,
  * @num_reg_rules: Number of regulatory rules.
  * @reg_rule_start: Pointer to regulatory rules.
  * @max_bw: Maximum bandwidth
+ * @country_max_allowed_bw: max allowed bw for all reg rules of client
  */
 static void reg_update_max_bw_per_rule(uint32_t num_reg_rules,
 				       struct cur_reg_rule *reg_rule_start,
-				       uint16_t max_bw)
+				       uint16_t max_bw,
+				       uint32_t *country_max_allowed_bw)
 {
 	uint32_t count;
 
-	for (count = 0; count < num_reg_rules; count++)
+	for (count = 0; count < num_reg_rules; count++) {
 		reg_rule_start[count].max_bw =
 			min(reg_rule_start[count].max_bw, max_bw);
+		if (reg_rule_start[count].max_bw > *country_max_allowed_bw)
+			*country_max_allowed_bw = reg_rule_start[count].max_bw;
+	}
 }
 
 /**
@@ -4274,7 +4279,7 @@ reg_fill_master_channels(struct cur_regulatory_info *regulat_info,
 		[REG_CURRENT_MAX_AP_TYPE][REG_MAX_CLIENT_TYPE],
 	struct wlan_regulatory_psoc_priv_obj *soc_reg)
 {
-	uint32_t i, j, k, curr_reg_rule_location;
+	uint32_t i, j, k, curr_reg_rule_location, country_max_allowed_bw = 0;
 	uint32_t num_2g_reg_rules, num_5g_reg_rules;
 	uint32_t num_6g_reg_rules_ap[REG_CURRENT_MAX_AP_TYPE];
 	uint32_t *num_6g_reg_rules_client[REG_CURRENT_MAX_AP_TYPE];
@@ -4291,13 +4296,15 @@ reg_fill_master_channels(struct cur_regulatory_info *regulat_info,
 	max_bw_2g = regulat_info->max_bw_2g;
 	reg_rule_2g = regulat_info->reg_rules_2g_ptr;
 	num_2g_reg_rules = regulat_info->num_2g_reg_rules;
-	reg_update_max_bw_per_rule(num_2g_reg_rules, reg_rule_2g, max_bw_2g);
+	reg_update_max_bw_per_rule(num_2g_reg_rules, reg_rule_2g, max_bw_2g,
+				   &country_max_allowed_bw);
 
 	min_bw_5g = regulat_info->min_bw_5g;
 	max_bw_5g = regulat_info->max_bw_5g;
 	reg_rule_5g = regulat_info->reg_rules_5g_ptr;
 	num_5g_reg_rules = regulat_info->num_5g_reg_rules;
-	reg_update_max_bw_per_rule(num_5g_reg_rules, reg_rule_5g, max_bw_5g);
+	reg_update_max_bw_per_rule(num_5g_reg_rules, reg_rule_5g, max_bw_5g,
+				   &country_max_allowed_bw);
 
 	for (i = 0; i < REG_CURRENT_MAX_AP_TYPE; i++) {
 		min_bw_6g_ap[i] = regulat_info->min_bw_6g_ap[i];
@@ -4305,7 +4312,8 @@ reg_fill_master_channels(struct cur_regulatory_info *regulat_info,
 		reg_rule_6g_ap[i] = regulat_info->reg_rules_6g_ap_ptr[i];
 		num_6g_reg_rules_ap[i] = regulat_info->num_6g_reg_rules_ap[i];
 		reg_update_max_bw_per_rule(num_6g_reg_rules_ap[i],
-					   reg_rule_6g_ap[i], max_bw_6g_ap[i]);
+					   reg_rule_6g_ap[i], max_bw_6g_ap[i],
+					   &country_max_allowed_bw);
 	}
 
 	for (j = 0; j < REG_CURRENT_MAX_AP_TYPE; j++) {
@@ -4319,10 +4327,15 @@ reg_fill_master_channels(struct cur_regulatory_info *regulat_info,
 			reg_update_max_bw_per_rule(
 						num_6g_reg_rules_client[j][k],
 						reg_rule_6g_client[j][k],
-						max_bw_6g_client[j][k]);
+						max_bw_6g_client[j][k],
+						&country_max_allowed_bw);
 		}
 	}
 
+	soc_reg->country_max_allowed_bw = country_max_allowed_bw;
+	reg_debug("max_allowed_bw as per current reg rules: %d",
+		  country_max_allowed_bw);
+
 	reg_reset_reg_rules(reg_rules);
 
 	reg_rules->num_of_reg_rules = num_5g_reg_rules + num_2g_reg_rules;
@@ -5808,7 +5821,7 @@ static QDF_STATUS
 __reg_process_master_chan_list(struct cur_regulatory_info *regulat_info)
 {
 	struct wlan_regulatory_psoc_priv_obj *soc_reg;
-	uint32_t num_2g_reg_rules, num_5g_reg_rules;
+	uint32_t num_2g_reg_rules, num_5g_reg_rules, country_max_allowed_bw = 0;
 	struct cur_reg_rule *reg_rule_2g, *reg_rule_5g;
 	uint16_t min_bw_2g, max_bw_2g, min_bw_5g, max_bw_5g;
 	struct regulatory_channel *mas_chan_list;
@@ -5891,14 +5904,18 @@ __reg_process_master_chan_list(struct cur_regulatory_info *regulat_info)
 	reg_rule_2g = regulat_info->reg_rules_2g_ptr;
 	num_2g_reg_rules = regulat_info->num_2g_reg_rules;
 	reg_update_max_bw_per_rule(num_2g_reg_rules,
-				   reg_rule_2g, max_bw_2g);
+				   reg_rule_2g, max_bw_2g,
+				   &country_max_allowed_bw);
 
 	min_bw_5g = regulat_info->min_bw_5g;
 	max_bw_5g = regulat_info->max_bw_5g;
 	reg_rule_5g = regulat_info->reg_rules_5g_ptr;
 	num_5g_reg_rules = regulat_info->num_5g_reg_rules;
 	reg_update_max_bw_per_rule(num_5g_reg_rules,
-				   reg_rule_5g, max_bw_5g);
+				   reg_rule_5g, max_bw_5g,
+				   &country_max_allowed_bw);
+
+	soc_reg->country_max_allowed_bw = country_max_allowed_bw;
 	soc_reg->mas_chan_params[phy_id].max_bw_5g = regulat_info->max_bw_5g;
 	reg_rules = &soc_reg->mas_chan_params[phy_id].reg_rules;
 	reg_reset_reg_rules(reg_rules);

+ 3 - 1
umac/regulatory/core/src/reg_priv_objs.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -225,6 +225,7 @@ struct indoor_concurrency_list {
  * @fcc_rules_ptr: Value of fcc channel frequency and tx_power list received
  * from firmware
  * @set_fcc_channel: Flag to set fcc channels
+ * @country_max_allowed_bw: max allowed bw for all reg rules of client
  */
 struct wlan_regulatory_psoc_priv_obj {
 	struct mas_chan_params mas_chan_params[PSOC_MAX_PHY_REG_CAP];
@@ -307,6 +308,7 @@ struct wlan_regulatory_psoc_priv_obj {
 	struct cur_fcc_rule fcc_rules_ptr[MAX_NUM_FCC_RULES];
 #endif
 	bool set_fcc_channel;
+	uint32_t country_max_allowed_bw;
 };
 
 /**

+ 21 - 1
umac/regulatory/core/src/reg_utils.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -996,6 +996,26 @@ bool reg_get_fcc_constraint(struct wlan_objmgr_pdev *pdev, uint32_t freq)
 	return true;
 }
 
+uint32_t reg_get_country_max_allowed_bw(struct wlan_objmgr_pdev *pdev)
+{
+	struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
+	struct wlan_objmgr_psoc *psoc;
+
+	psoc = wlan_pdev_get_psoc(pdev);
+	if (!psoc) {
+		reg_err("psoc is NULL");
+		return 0;
+	}
+
+	psoc_priv_obj = reg_get_psoc_obj(psoc);
+	if (!IS_VALID_PSOC_REG_OBJ(psoc_priv_obj)) {
+		reg_err("psoc reg component is NULL");
+		return 0;
+	}
+
+	return psoc_priv_obj->country_max_allowed_bw;
+}
+
 bool reg_is_user_country_set_allowed(struct wlan_objmgr_psoc *psoc)
 {
 	struct wlan_regulatory_psoc_priv_obj *psoc_reg;

+ 16 - 1
umac/regulatory/core/src/reg_utils.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  *
  * Permission to use, copy, modify, and/or distribute this software for
@@ -200,6 +200,15 @@ QDF_STATUS reg_set_fcc_constraint(struct wlan_objmgr_pdev *pdev,
  */
 bool reg_get_fcc_constraint(struct wlan_objmgr_pdev *pdev, uint32_t freq);
 
+/**
+ * reg_get_country_max_allowed_bw() - get max allowed bw as per all reg rules
+ * of client
+ * @pdev: physical dev to get
+ *
+ * Return: max allowed channel width for current country code
+ */
+uint32_t reg_get_country_max_allowed_bw(struct wlan_objmgr_pdev *pdev);
+
 /**
  * reg_is_fcc_constraint_set() - Check if FCC constraint set
  * @pdev: physical dev to get
@@ -513,6 +522,12 @@ bool reg_is_user_country_set_allowed(struct wlan_objmgr_psoc *psoc)
 	return true;
 }
 
+static inline
+uint32_t reg_get_country_max_allowed_bw(struct wlan_objmgr_pdev *pdev)
+{
+	return 0;
+}
+
 static inline
 bool reg_get_keep_6ghz_sta_cli_connection(struct wlan_objmgr_pdev *pdev)
 {

+ 10 - 1
umac/regulatory/dispatcher/inc/wlan_reg_services_api.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -606,6 +606,15 @@ bool wlan_reg_is_regdb_offloaded(struct wlan_objmgr_psoc *psoc);
  */
 bool wlan_reg_get_fcc_constraint(struct wlan_objmgr_pdev *pdev, uint32_t freq);
 
+/**
+ * wlan_reg_get_country_max_allowed_bw() - get max allowed channel width as per
+ * all reg rules of client
+ * @pdev: physical dev to get
+ *
+ * Return: max allowed channel width for current country code
+ */
+uint32_t wlan_reg_get_country_max_allowed_bw(struct wlan_objmgr_pdev *pdev);
+
 /**
  * wlan_reg_is_6ghz_band_set - Check if 6 GHz band set
  * @pdev: Pointer to pdev

+ 6 - 1
umac/regulatory/dispatcher/src/wlan_reg_services_api.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  *
  * Permission to use, copy, modify, and/or distribute this software for
@@ -740,6 +740,11 @@ bool wlan_reg_get_fcc_constraint(struct wlan_objmgr_pdev *pdev, uint32_t freq)
 	return reg_get_fcc_constraint(pdev, freq);
 }
 
+uint32_t wlan_reg_get_country_max_allowed_bw(struct wlan_objmgr_pdev *pdev)
+{
+	return reg_get_country_max_allowed_bw(pdev);
+}
+
 QDF_STATUS wlan_reg_get_chip_mode(struct wlan_objmgr_pdev *pdev,
 		uint64_t *chip_mode)
 {