Bladeren bron

qcacmn: Set/unset AFC not done bit for super channel entries

To add AFC outdoor device deployment support,set the AP power type as
REG_STANDARD_POWER_AP during the creation of regulatory pdev private
object. Update the flag REGULATORY_CHAN_AFC_NOT_DONE in super channel
list based on the AFC_POWER_EVENT. On receiving the SWITCH_TO_LPI event,
if no LPI channels are present return an error. If LPI channels are
present move to LPI mode and update the channel list both in presence and
absence of ACS.

Change-Id: Ib4653a83d4c7ea2ec5212f9ba4d517c0e7e5027a
CRs-Fixed: 3195189
Ananya Barat 3 jaren geleden
bovenliggende
commit
6593844e79

+ 108 - 16
umac/regulatory/core/src/reg_build_chan_list.c

@@ -773,9 +773,9 @@ static void reg_propagate_6g_mas_channel_list(
 		mas_chan_params->is_6g_channel_list_populated;
 	pdev_priv_obj->reg_6g_superid =
 		mas_chan_params->reg_6g_superid;
-	pdev_priv_obj->reg_cur_6g_ap_pwr_type = REG_INDOOR_AP;
 	pdev_priv_obj->reg_6g_thresh_priority_freq =
 				mas_chan_params->reg_6g_thresh_priority_freq;
+	reg_set_ap_pwr_type(pdev_priv_obj);
 }
 #else
 static inline void reg_propagate_6g_mas_channel_list(
@@ -785,6 +785,21 @@ static inline void reg_propagate_6g_mas_channel_list(
 }
 #endif
 
+#ifdef CONFIG_AFC_SUPPORT
+void reg_set_ap_pwr_type(struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
+{
+	if (pdev_priv_obj->reg_afc_dev_deployment_type == AFC_DEPLOYMENT_OUTDOOR)
+		pdev_priv_obj->reg_cur_6g_ap_pwr_type = REG_STANDARD_POWER_AP;
+	else
+		pdev_priv_obj->reg_cur_6g_ap_pwr_type = REG_INDOOR_AP;
+}
+#else
+void reg_set_ap_pwr_type(struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
+{
+	pdev_priv_obj->reg_cur_6g_ap_pwr_type = REG_INDOOR_AP;
+}
+#endif
+
 void reg_init_pdev_mas_chan_list(
 		struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj,
 		struct mas_chan_params *mas_chan_params)
@@ -1918,6 +1933,70 @@ static bool reg_is_edge_chan_disable_needed(struct wlan_objmgr_psoc *psoc,
 	return is_lower_edge_disable || is_upper_edge_disable;
 }
 
+#ifdef CONFIG_AFC_SUPPORT
+/**
+ * reg_set_flag_afc_not_done() - Set channel flag REGULATORY_CHAN_AFC_NOT_DONE
+ * @chan_flags: Channel flags
+ * @is_set:     boolean to set/unset the flag
+ *
+ * Return: void
+ */
+static inline void
+reg_set_flag_afc_not_done(uint32_t *chan_flags, bool is_set)
+{
+	if (is_set)
+		*chan_flags |= REGULATORY_CHAN_AFC_NOT_DONE;
+	else
+		*chan_flags &= ~REGULATORY_CHAN_AFC_NOT_DONE;
+}
+
+/**
+ * reg_update_6g_chan_for_outdoor() - Update channel state and flags for
+ * outdoor
+ * @pdev_priv: Regulatory pdev private object
+ * @chan_info: Channel parameters
+ * @chan_idx:  Channel index.
+ *
+ * Return: void
+ */
+static void
+reg_update_6g_chan_for_outdoor(struct wlan_regulatory_pdev_priv_obj *pdev_priv,
+			       struct super_chan_info *chan_info,
+			       uint16_t chan_idx)
+{
+	uint32_t *p_chan_flags;
+
+	if (pdev_priv->reg_afc_dev_deployment_type != AFC_DEPLOYMENT_OUTDOOR)
+		return;
+
+	if (chan_info->state_arr[REG_AP_SP] == CHANNEL_STATE_DISABLE)
+		return;
+
+	p_chan_flags = &chan_info->chan_flags_arr[REG_AP_SP];
+
+	if (pdev_priv->is_6g_afc_power_event_received) {
+		reg_set_flag_afc_not_done(p_chan_flags, false);
+		return;
+	}
+
+	reg_set_flag_afc_not_done(p_chan_flags, true);
+}
+
+#else
+static inline void
+reg_set_flag_afc_not_done(uint32_t *chan_flags, bool is_set)
+{
+}
+
+static inline void
+reg_update_6g_chan_for_outdoor(struct wlan_regulatory_pdev_priv_obj *pdev_priv,
+			       struct super_chan_info *chan_info,
+			       uint16_t chan_idx)
+{
+}
+
+#endif
+
 /**
  * reg_dis_6g_edge_chan_in_enh_chan() - Disable the 6g edge
  * channels in the super channel list
@@ -2258,16 +2337,13 @@ static void reg_update_sup_ch_entry_for_mode(
 		return;
 
 	if (reg_is_sp_supp_pwr_mode(supp_pwr_mode)) {
-		if (wlan_reg_is_afc_power_event_received(pdev))
-			reg_assign_afc_chan_entry_to_mas_chan(pdev_priv_obj,
-							      &mas_chan,
-							      chn_idx);
-		else
-			/*
-			 * Disable the SP channels if AFC power event
-			 * is not received
-			 */
-			return;
+		/* Add the entry to super channel list whether or not AFC
+		 * response is received. If AFC response is not received
+		 * mark the channel flag as REGULATORY_AFC_NOT_DONE
+		 */
+		reg_assign_afc_chan_entry_to_mas_chan(pdev_priv_obj,
+						      &mas_chan,
+						      chn_idx);
 	}
 
 	if (!mas_chan)
@@ -2294,6 +2370,10 @@ static void reg_update_sup_ch_entry_for_mode(
 					 &temp_reg_chan);
 	reg_dis_6g_edge_chan_in_enh_chan(pdev, &super_chan_list[chn_idx],
 					 chn_idx, supp_pwr_mode);
+	reg_update_6g_chan_for_outdoor(pdev_priv_obj,
+				       &super_chan_list[chn_idx],
+				       chn_idx);
+
 	reg_fill_best_pwr_mode(pdev_priv_obj, super_chan_list, chn_idx,
 			       supp_pwr_mode, temp_reg_chan.tx_power,
 			       max_eirp_pwr);
@@ -3516,11 +3596,13 @@ static void reg_free_expiry_afc_info(struct afc_regulatory_info *afc_info)
  * reg_disable_sp_entries_in_supr_chan_entry() - Disable the SP entries in the
  * super channel list
  * @chan_info: Pointer to chan_info
+ * @reg_afc_dev_type: AFC device deployment type
  *
  * Return: void
  */
 static void reg_disable_sp_entries_in_supr_chan_entry(
-		struct super_chan_info *chan_info)
+				struct super_chan_info *chan_info,
+				enum reg_afc_dev_deploy_type reg_afc_dev_type)
 {
 	uint8_t j;
 	static enum supported_6g_pwr_types list_of_sp_lists[] = {
@@ -3536,8 +3618,17 @@ static void reg_disable_sp_entries_in_supr_chan_entry(
 		if (reg_is_supp_pwr_mode_invalid(idx))
 			continue;
 
-		reg_dis_chan_state_and_flags(&chan_info->state_arr[idx],
-					     &chan_info->chan_flags_arr[idx]);
+		if (chan_info->state_arr[idx] == CHANNEL_STATE_DISABLE)
+			continue;
+
+		if (reg_afc_dev_type == AFC_DEPLOYMENT_OUTDOOR)
+			reg_set_flag_afc_not_done(
+					&chan_info->chan_flags_arr[idx],
+					true);
+		else
+			reg_dis_chan_state_and_flags(
+					&chan_info->state_arr[idx],
+					&chan_info->chan_flags_arr[idx]);
 	}
 }
 
@@ -3559,8 +3650,9 @@ reg_disable_sp_channels_in_super_chan_list(
 	for (i = 0; i < NUM_6GHZ_CHANNELS; i++) {
 		struct super_chan_info *chan_info =
 						&super_chan_list[i];
-
-		reg_disable_sp_entries_in_supr_chan_entry(chan_info);
+		reg_disable_sp_entries_in_supr_chan_entry(
+				chan_info,
+				pdev_priv_obj->reg_afc_dev_deployment_type);
 	}
 }
 

+ 11 - 0
umac/regulatory/core/src/reg_build_chan_list.h

@@ -53,6 +53,17 @@ void reg_init_pdev_mas_chan_list(
 		struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj,
 		struct mas_chan_params *mas_chan_params);
 
+/*
+ * reg_set_ap_pwr_type() - Set the AP power type.
+ * @pdev_priv_obj: pdev private object
+ *
+ * Set the AP power type as per AFC device deployment if AFC is available.
+ * Otherwise set it to indoor by default.
+ *
+ * Return: None
+ */
+void reg_set_ap_pwr_type(struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj);
+
 #ifdef CONFIG_REG_CLIENT
 /**
  * reg_save_reg_rules_to_pdev() - Save psoc reg-rules to pdev.

+ 1 - 1
umac/regulatory/core/src/reg_priv_objs.c

@@ -240,7 +240,7 @@ reg_init_def_client_type(struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
 static void
 reg_init_6g_vars(struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
 {
-	pdev_priv_obj->reg_cur_6g_ap_pwr_type = REG_INDOOR_AP;
+	reg_set_ap_pwr_type(pdev_priv_obj);
 	pdev_priv_obj->reg_rnr_tpe_usable = false;
 	pdev_priv_obj->reg_unspecified_ap_usable = false;
 	reg_init_def_client_type(pdev_priv_obj);

+ 1 - 0
umac/regulatory/dispatcher/inc/reg_services_public_struct.h

@@ -59,6 +59,7 @@
 #define REGULATORY_CHAN_NO_OFDM      BIT(6)
 #define REGULATORY_CHAN_INDOOR_ONLY  BIT(9)
 #define REGULATORY_CHAN_AFC          BIT(13)
+#define REGULATORY_CHAN_AFC_NOT_DONE BIT(16)
 
 #define REGULATORY_CHAN_NO_HT40      BIT(4)
 #define REGULATORY_CHAN_NO_80MHZ     BIT(7)

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

@@ -1755,6 +1755,7 @@ wlan_reg_get_afc_dev_deploy_type(struct wlan_objmgr_pdev *pdev,
 	return reg_get_afc_dev_deploy_type(pdev, afc_dev_type);
 }
 
+qdf_export_symbol(wlan_reg_get_afc_dev_deploy_type);
 #endif /* CONFIG_AFC_SUPPORT */
 
 QDF_STATUS wlan_reg_is_chwidth_supported(struct wlan_objmgr_pdev *pdev,