Răsfoiți Sursa

qcacmn: Avoid switching to spur channels in UNII-1 band

When operating in 20/40MHz modes in channels 52/56/60/64, spur
is found on adjacent channels (40, 44, 48) if we switch to those
channels after radar. To avoid this issue, add a SW WAR to ignore
selecting the adjacent channels if radar is found on the UNII-2
channels (52-64).

Change-Id: I4d02c53bf57171b9e5e5704d36552d0d5c6423b9
Vignesh Mohan 3 ani în urmă
părinte
comite
5fc1705df5

+ 7 - 0
umac/dfs/core/src/dfs_random_chan_sel.h

@@ -136,6 +136,9 @@
  * ii) The AP is transmitting in 36/44/48/52/56/60/64 in 160MHz mode and then
  * the  AP moves to the adjacent channel 36/44/48 in 80MHz mode and starts
  * transmitting.
+ * iii) The AP is transmitting in 52/56/60/64 in 20MHz or 40MHz mode and
+ * the AP moves to the adjacent channels 40/44/48 in 20MHz mode or
+ * 36/40/44/48 in 40MHz mode and starts transmitting.
  * Hence, center frequencies from 5260MHz to 5320MHz in Spruce HW are called
  * Spruce Spur 80MHz Frequencies and, center frequencies from 5180MHz and
  * 5320MHz except 5200MHz are called Spruce Spur 160MHz Frequencies.
@@ -149,6 +152,10 @@
 /* Avoid channels 36/44/48 */
 #define DFS_IS_SPRUCE_SPUR_AVOID_FREQS(_ch) \
 		(((_ch) >= 5180) && ((_ch) <= 5240) && ((_ch) != 5200))
+
+/* Avoid channels 36/40/44/48 in HT40 mode and 40/44/48 in HT20 mode. */
+#define DFS_IS_CHAN_SPRUCE_SPUR_FREQ_20_40_MHZ(_ch) \
+		(((_ch) >= 5200) && ((_ch) <= 5240))
 #endif
 
 /**

+ 26 - 0
umac/dfs/core/src/misc/dfs_random_chan_sel.c

@@ -1440,6 +1440,26 @@ static void dfs_apply_rules_for_freq(struct wlan_dfs *dfs,
 }
 #endif
 
+/**
+ * dfs_remove_spruce_spur_channels_for_bw_20_40() - API to remove the
+ * spur channels in spruce if current bw is 20/40MHz.
+ * @freq_list: Input list from which spur channels are removed.
+ * @freq_count: Input list count.
+ *
+ * return: void.
+ */
+static void
+dfs_remove_spruce_spur_channels_for_bw_20_40(uint16_t *freq_list,
+					     uint8_t freq_count)
+{
+	uint8_t i;
+
+	for (i = 0; i < freq_count; i++) {
+		if (DFS_IS_CHAN_SPRUCE_SPUR_FREQ_20_40_MHZ(freq_list[i]))
+			freq_list[i] = 0;
+	}
+}
+
 #ifdef CONFIG_CHAN_FREQ_API
 uint16_t dfs_prepare_random_channel_for_freq(struct wlan_dfs *dfs,
 					     struct dfs_channel *chan_list,
@@ -1494,6 +1514,12 @@ uint16_t dfs_prepare_random_channel_for_freq(struct wlan_dfs *dfs,
 		return 0;
 	}
 
+	if (flag_no_spur_leakage_adj_chans &&
+	    (*chan_wd == DFS_CH_WIDTH_20MHZ ||
+	     *chan_wd == DFS_CH_WIDTH_40MHZ))
+		dfs_remove_spruce_spur_channels_for_bw_20_40(
+				random_chan_freq_list,
+				random_chan_cnt);
 	do {
 		int ret;
 

+ 3 - 1
umac/dfs/dispatcher/src/wlan_dfs_utils_api.c

@@ -353,7 +353,9 @@ bool utils_dfs_is_spruce_spur_war_applicable(struct wlan_objmgr_pdev *pdev)
 	cur_freq = dfs->dfs_curchan->dfs_ch_freq;
 
 	/* Is the current channel width 80MHz? */
-	if (WLAN_IS_CHAN_MODE_80(dfs->dfs_curchan)) {
+	if (WLAN_IS_CHAN_MODE_80(dfs->dfs_curchan) ||
+	    WLAN_IS_CHAN_MODE_40(dfs->dfs_curchan) ||
+	    WLAN_IS_CHAN_MODE_20(dfs->dfs_curchan)) {
 		/* is the primary channel 52/56/60/64? */
 		bool is_chan_spur_80mhzfreq =
 		    DFS_IS_CHAN_SPRUCE_SPUR_FREQ_80MHZ(cur_freq);