Jelajahi Sumber

qcacmn: Limit AFC maximum bandwidth in AFC list

Currently, maximum bandwidth in AFC channel list is set to 320 MHz.
Since 320 BW is supported only in 11BE mode, setting the maximum
bandwidth to 320 for devices that does not support 320 BW is not
correct.

Hence, to fix this issue, limit the Maximum AFC BW based on whether
the radio supports 11BE or not.

Move the puncture bitmap validation for 320 MHz BW in the API
'reg_get_320_bonded_channel_state_for_pwrmode' to within the
CONFIG_REG_CLIENT compilation flag. This validation of puncture
bitmap is currently done only for 320 MHz BW. The API used for lower
BW does not consider puncturing. This causes inconsistency in the
behaviour between 320 MHz BW and lower BWs.

Since the validation of puncture pattern is done separately for WIN,
add a WIN specific empty stub function.

Change-Id: Icbbbcae3fef2336df02291c5218d89942f3f1b68
CRs-Fixed: 3560313
Thirusenthil Kumaran J 1 tahun lalu
induk
melakukan
433eb772d1

+ 41 - 1
umac/regulatory/core/src/reg_build_chan_list.c

@@ -4765,6 +4765,44 @@ reg_process_afc_expiry_event(struct afc_regulatory_info *afc_info)
 	return QDF_STATUS_SUCCESS;
 }
 
+#ifdef WLAN_FEATURE_11BE
+/**
+ * reg_find_afc_max_bw_from_chip_cap() - Find the maximum AFC BW based on the
+ * chip capabilities.
+ *
+ * @pdev: Pointer to PDEV object.
+ *
+ * Return:
+ * AFC_BW_320 if the chip supports 11BE, else return AFC_BW_160.
+ */
+static uint16_t
+reg_find_afc_max_bw_from_chip_cap(struct wlan_objmgr_pdev *pdev)
+{
+	struct wlan_objmgr_psoc *psoc;
+	struct wlan_lmac_if_reg_tx_ops *reg_ops;
+	uint8_t phy_id, pdev_id;
+
+	psoc = wlan_pdev_get_psoc(pdev);
+	reg_ops = reg_get_psoc_tx_ops(psoc);
+	pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
+	if (reg_ops->get_phy_id_from_pdev_id)
+		reg_ops->get_phy_id_from_pdev_id(psoc, pdev_id, &phy_id);
+	else
+		phy_id = pdev_id;
+
+	if (reg_ops->is_chip_11be && reg_ops->is_chip_11be(psoc, phy_id))
+		return AFC_BW_320;
+
+	return AFC_BW_160;
+}
+#else
+static inline uint16_t
+reg_find_afc_max_bw_from_chip_cap(struct wlan_objmgr_pdev *pdev)
+{
+	return AFC_BW_160;
+}
+#endif
+
 /**
  * reg_fill_min_max_bw_for_afc_list() - Fill min and max bw in afc list from
  * from the SP AFC list
@@ -4779,10 +4817,12 @@ reg_fill_min_max_bw_for_afc_list(
 		struct regulatory_channel *afc_chan_list)
 {
 	uint8_t chan_idx;
+	uint16_t afc_max_bw;
 
+	afc_max_bw = reg_find_afc_max_bw_from_chip_cap(pdev_priv_obj->pdev_ptr);
 	for (chan_idx = 0; chan_idx < NUM_6GHZ_CHANNELS; chan_idx++) {
 		afc_chan_list[chan_idx].min_bw = MIN_AFC_BW;
-		afc_chan_list[chan_idx].max_bw = MAX_AFC_BW;
+		afc_chan_list[chan_idx].max_bw = afc_max_bw;
 	}
 }
 

+ 2 - 3
umac/regulatory/core/src/reg_build_chan_list.h

@@ -39,10 +39,9 @@
 #ifdef CONFIG_AFC_SUPPORT
 #define MIN_AFC_BW 2
 #ifdef WLAN_FEATURE_11BE
-#define MAX_AFC_BW 320
-#else
-#define MAX_AFC_BW 160
+#define AFC_BW_320 320
 #endif
+#define AFC_BW_160 160
 #endif
 
 #define HALF_IEEE_CH_SEP  2

+ 22 - 3
umac/regulatory/core/src/reg_services_common.c

@@ -5190,6 +5190,25 @@ reg_get_chan_state_for_320(struct wlan_objmgr_pdev *pdev,
 #endif
 
 #ifdef WLAN_FEATURE_11BE
+#ifdef CONFIG_REG_CLIENT
+static void
+reg_verify_punc_for_320_and_set_channel_state(uint16_t punc_bitmap,
+					      enum channel_state *chan_state,
+					      enum channel_state update_state)
+{
+	if (reg_is_punc_bitmap_valid(CH_WIDTH_320MHZ, punc_bitmap)) {
+		*chan_state = update_state;
+	}
+}
+#else /* CONFIG_REG_CLIENT */
+static inline void
+reg_verify_punc_for_320_and_set_channel_state(uint16_t punc_bitmap,
+					      enum channel_state *chan_state,
+					      enum channel_state update_state)
+{
+}
+#endif /* CONFIG_REG_CLIENT */
+
 enum channel_state
 reg_get_320_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev,
 					     qdf_freq_t freq,
@@ -5244,9 +5263,9 @@ reg_get_320_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev,
 	}
 
 	/* Validate puncture bitmap. Update channel state. */
-	if (reg_is_punc_bitmap_valid(CH_WIDTH_320MHZ, *out_punc_bitmap)) {
-		chan_state = update_state;
-	}
+	reg_verify_punc_for_320_and_set_channel_state(*out_punc_bitmap,
+						      &chan_state,
+						      update_state);
 
 	prim_chan_state =
 		reg_get_20mhz_channel_state_based_on_nol(pdev, freq,