瀏覽代碼

qcacmn: Refactor set AP power type logic

Currently 'reg_compute_pdev_current_chan_list' is called
twice as shown below, when 'wmi_reg_chan_list_cc_ext_event'
from FW is handled.

LIST_CC_EXT event:
	reg_compute_pdev_current_chan_list() [ 1st call]
	reg_send_scheduler_msg_nb()/reg_send_scheduler_msg_sb()
	    wlan_reg_decide_6g_ap_pwr_type()
	        reg_decide_6g_ap_pwr_type()
	            reg_set_ap_pwr_and_update_chan_list()
		        reg_compute_pdev_current_chan_list() [2nd call]

To solve this, do not call 'wlan_reg_decide_6g_ap_pwr_type'
from north bound or south bound callbacks.

However, the above fix creates another problem because the function
'reg_decide_6g_ap_pwr_type', in addition to calling
'reg_compute_pdev_current_chan_list', also sets the current 6 GHz
power type for the pdev. A proper place to set the 6 GHz
power type is in function 'reg_set_ap_pwr_type',
which currently does not set 6 GHz power type correctly.

Hence remove 'wlan_reg_decide_6g_ap_pwr_type' and
'reg_decide_6g_ap_pwr_type' functions and modify
'reg_set_ap_pwr_type' to set the best 6 GHz power type
based on the 6 GHz regulatory rules.

CRs-Fixed: 3609342
Change-Id: I1bdfd71245552a51fd5123931a7a6dcc16f2a942
Asutosh Mohapatra 1 年之前
父節點
當前提交
69a0ec3acd

+ 35 - 7
umac/regulatory/core/src/reg_build_chan_list.c

@@ -1362,11 +1362,12 @@ static void reg_propagate_6g_mas_channel_list(
 	reg_set_ap_pwr_type(pdev_priv_obj);
 }
 
-#if defined(CONFIG_AFC_SUPPORT) && !defined(CONFIG_REG_CLIENT)
+#ifndef CONFIG_REG_CLIENT
+#ifdef CONFIG_AFC_SUPPORT
 #ifdef CONFIG_6G_FREQ_OVERLAP
 void reg_set_ap_pwr_type(struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
 {
-	uint8_t  *num_rules = pdev_priv_obj->reg_rules.num_of_6g_ap_reg_rules;
+	uint8_t  *num_rules;
 	bool is_6ghz_pdev;
 
 	is_6ghz_pdev = reg_is_range_overlap_6g(pdev_priv_obj->range_5g_low,
@@ -1377,6 +1378,7 @@ void reg_set_ap_pwr_type(struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
 		return;
 	}
 
+	num_rules = pdev_priv_obj->reg_rules.num_of_6g_ap_reg_rules;
 	if (pdev_priv_obj->reg_afc_dev_deployment_type ==
 	    AFC_DEPLOYMENT_OUTDOOR) {
 		if (num_rules[REG_VERY_LOW_POWER_AP])
@@ -1409,6 +1411,32 @@ void reg_set_ap_pwr_type(struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
 }
 #endif /* CONFIG_AFC_SUPPORT */
 #else
+void reg_set_ap_pwr_type(struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
+{
+	enum reg_6g_ap_type ap_pwr_type = REG_CURRENT_MAX_AP_TYPE;
+	uint8_t  *num_rules;
+
+	num_rules = pdev_priv_obj->reg_rules.num_of_6g_ap_reg_rules;
+
+	if (wlan_reg_is_afc_power_event_received(pdev_priv_obj->pdev_ptr) &&
+	    num_rules[REG_STANDARD_POWER_AP]) {
+		ap_pwr_type = REG_STANDARD_POWER_AP;
+	} else if (pdev_priv_obj->indoor_chan_enabled) {
+		if (num_rules[REG_INDOOR_AP])
+			ap_pwr_type = REG_INDOOR_AP;
+		else if (num_rules[REG_VERY_LOW_POWER_AP])
+			ap_pwr_type = REG_VERY_LOW_POWER_AP;
+	} else if (num_rules[REG_VERY_LOW_POWER_AP]) {
+		ap_pwr_type = REG_VERY_LOW_POWER_AP;
+	}
+
+	pdev_priv_obj->reg_cur_6g_ap_pwr_type = ap_pwr_type;
+
+	reg_debug("indoor_chan_enabled %d ap_pwr_type %d",
+		  pdev_priv_obj->indoor_chan_enabled, ap_pwr_type);
+}
+#endif /* CONFIG_REG_CLIENT */
+#else
 static inline void reg_propagate_6g_mas_channel_list(
 		struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj,
 		struct mas_chan_params *mas_chan_params)
@@ -2067,6 +2095,7 @@ reg_populate_secondary_cur_chan_list(struct wlan_regulatory_pdev_priv_obj
 	struct wlan_regulatory_psoc_priv_obj *soc_reg;
 	struct regulatory_channel *chan_list;
 	uint32_t len_6ghz;
+	enum reg_6g_ap_type cur_ap_power_type = REG_CURRENT_MAX_AP_TYPE;
 
 	psoc = wlan_pdev_get_psoc(pdev_priv_obj->pdev_ptr);
 	if (!psoc) {
@@ -2100,14 +2129,14 @@ reg_populate_secondary_cur_chan_list(struct wlan_regulatory_pdev_priv_obj
 	if (!chan_list)
 		return;
 
-	if (pdev_priv_obj->indoor_chan_enabled &&
-	    pdev_priv_obj->reg_rules.num_of_6g_ap_reg_rules[REG_INDOOR_AP]) {
+	reg_get_cur_6g_ap_pwr_type(pdev_priv_obj->pdev_ptr, &cur_ap_power_type);
+
+	if (cur_ap_power_type == REG_INDOOR_AP) {
 		qdf_mem_copy(chan_list,
 			     pdev_priv_obj->mas_chan_list_6g_ap[REG_INDOOR_AP],
 			     len_6ghz);
 		/* has flag REGULATORY_CHAN_INDOOR_ONLY */
-	} else if (pdev_priv_obj->reg_rules.num_of_6g_ap_reg_rules
-		   [REG_VERY_LOW_POWER_AP]) {
+	} else if (cur_ap_power_type == REG_VERY_LOW_POWER_AP) {
 		qdf_mem_copy(chan_list,
 			     pdev_priv_obj->mas_chan_list_6g_ap
 			     [REG_VERY_LOW_POWER_AP],
@@ -3655,7 +3684,6 @@ void reg_propagate_mas_chan_list_to_pdev(struct wlan_objmgr_psoc *psoc,
 			&psoc_priv_obj->mas_chan_params[phy_id]);
 	psoc_reg_rules = &psoc_priv_obj->mas_chan_params[phy_id].reg_rules;
 	reg_save_reg_rules_to_pdev(psoc_reg_rules, pdev_priv_obj);
-	reg_set_ap_pwr_type(pdev_priv_obj);
 	reg_init_pdev_super_chan_list(pdev_priv_obj);
 	pdev_priv_obj->chan_list_recvd =
 		psoc_priv_obj->chan_list_recvd[phy_id];

+ 0 - 33
umac/regulatory/core/src/reg_utils.c

@@ -1030,39 +1030,6 @@ bool reg_is_fcc_constraint_set(struct wlan_objmgr_pdev *pdev)
 
 	return true;
 }
-
-#ifdef CONFIG_BAND_6GHZ
-enum reg_6g_ap_type reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev)
-{
-	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
-	enum reg_6g_ap_type ap_pwr_type = REG_INDOOR_AP;
-
-	pdev_priv_obj = reg_get_pdev_obj(pdev);
-	if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
-		reg_err("pdev reg component is NULL");
-		return REG_VERY_LOW_POWER_AP;
-	}
-
-	if (wlan_reg_is_afc_power_event_received(pdev) &&
-	    pdev_priv_obj->reg_rules.num_of_6g_ap_reg_rules[REG_STANDARD_POWER_AP]) {
-		ap_pwr_type = REG_STANDARD_POWER_AP;
-	} else if (pdev_priv_obj->indoor_chan_enabled) {
-		if (pdev_priv_obj->reg_rules.num_of_6g_ap_reg_rules[REG_INDOOR_AP])
-			ap_pwr_type = REG_INDOOR_AP;
-		else
-			ap_pwr_type = REG_VERY_LOW_POWER_AP;
-	} else if (pdev_priv_obj->reg_rules.num_of_6g_ap_reg_rules[REG_VERY_LOW_POWER_AP]) {
-		ap_pwr_type = REG_VERY_LOW_POWER_AP;
-	}
-	reg_debug("indoor_chan_enabled %d ap_pwr_type %d",
-		  pdev_priv_obj->indoor_chan_enabled, ap_pwr_type);
-
-	reg_set_ap_pwr_and_update_chan_list(pdev, ap_pwr_type);
-
-	return ap_pwr_type;
-}
-#endif /* CONFIG_BAND_6GHZ */
-
 #endif /* CONFIG_REG_CLIENT */
 
 /**

+ 0 - 22
umac/regulatory/core/src/reg_utils.h

@@ -404,22 +404,6 @@ QDF_STATUS reg_set_curr_country(
 bool reg_ignore_default_country(struct wlan_regulatory_psoc_priv_obj *soc_reg,
 				struct cur_regulatory_info *regulat_info);
 
-#ifdef CONFIG_BAND_6GHZ
-/**
- * reg_decide_6g_ap_pwr_type() - Decide which power mode AP should operate in
- *
- * @pdev: pdev ptr
- *
- * Return: AP power type
- */
-enum reg_6g_ap_type reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev);
-#else
-static inline enum reg_6g_ap_type
-reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev)
-{
-	return REG_CURRENT_MAX_AP_TYPE;
-}
-#endif /* CONFIG_BAND_6GHZ */
 #else
 static inline QDF_STATUS reg_read_current_country(struct wlan_objmgr_psoc *psoc,
 						  uint8_t *country_code)
@@ -529,12 +513,6 @@ bool reg_is_user_country_set_allowed(struct wlan_objmgr_psoc *psoc)
 	return true;
 }
 
-static inline enum reg_6g_ap_type
-reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev)
-{
-	return REG_CURRENT_MAX_AP_TYPE;
-}
-
 static inline
 bool reg_get_keep_6ghz_sta_cli_connection(struct wlan_objmgr_pdev *pdev)
 {

+ 0 - 19
umac/regulatory/dispatcher/inc/wlan_reg_services_api.h

@@ -2430,17 +2430,6 @@ wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev,
 				      bool *is_psd, uint16_t *tx_power,
 				      uint16_t *eirp_psd_power);
 
-/**
- * wlan_reg_decide_6g_ap_pwr_type() - Decide which power mode AP should operate
- * in
- *
- * @pdev: pdev ptr
- *
- * Return: AP power type
- */
-enum reg_6g_ap_type
-wlan_reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev);
-
 /**
  * wlan_reg_set_ap_pwr_and_update_chan_list() - Set the AP power mode and
  * recompute the current channel list
@@ -2577,12 +2566,6 @@ wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev,
 	return QDF_STATUS_E_NOSUPPORT;
 }
 
-static inline enum reg_6g_ap_type
-wlan_reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev)
-{
-	return REG_INDOOR_AP;
-}
-
 static inline QDF_STATUS
 wlan_reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev,
 					 enum reg_6g_ap_type ap_pwr_type)
@@ -2866,7 +2849,6 @@ wlan_reg_get_num_afc_freq_obj(struct wlan_objmgr_pdev *pdev,
 QDF_STATUS wlan_reg_set_afc_power_event_received(struct wlan_objmgr_pdev *pdev,
 						 bool val);
 #endif
-
 #else
 static inline bool
 wlan_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev,
@@ -2881,7 +2863,6 @@ wlan_reg_display_super_chan_list(struct wlan_objmgr_pdev *pdev)
 {
 	return QDF_STATUS_E_NOSUPPORT;
 }
-
 #endif
 
 /**

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

@@ -1701,12 +1701,6 @@ wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev,
 						eirp_psd_power);
 }
 
-enum reg_6g_ap_type
-wlan_reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev)
-{
-	return reg_decide_6g_ap_pwr_type(pdev);
-}
-
 QDF_STATUS
 wlan_reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev,
 					 enum reg_6g_ap_type ap_pwr_type)