瀏覽代碼

qca-wifi: Use pdev instead of regulatory private object

Use pdev pointer instead of regulatory private object in
regulatory APIs that are defined in the common services.

Also check if the channel is in NOL/NOL History and do not
consider them disabled if true, while checking if the channel
supports a phymode-chwidth combination.

Change-Id: I55c40afc5a0c7469956c666ae9fd3ed283f456bc
Vignesh Mohan 4 年之前
父節點
當前提交
c491be826b

+ 28 - 8
umac/regulatory/core/reg_channel.c

@@ -26,7 +26,7 @@
 #include <wlan_objmgr_psoc_obj.h>
 #include <reg_priv_objs.h>
 #include <reg_services_common.h>
-#include <reg_channel.h>
+#include "reg_channel.h"
 
 #ifdef CONFIG_HOST_FIND_CHAN
 
@@ -66,13 +66,23 @@ static inline int is_11a_supported(uint32_t wireless_modes, uint32_t phybitmap)
 		!(phybitmap & REGULATORY_PHYMODE_NO11A);
 }
 
-void reg_update_max_phymode_chwidth_for_pdev(
-		struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
+void reg_update_max_phymode_chwidth_for_pdev(struct wlan_objmgr_pdev *pdev)
 {
-	uint32_t wireless_modes = pdev_priv_obj->wireless_modes;
-	uint32_t phybitmap = pdev_priv_obj->phybitmap;
+	uint32_t wireless_modes;
+	uint32_t phybitmap;
 	enum phy_ch_width max_chwidth = CH_WIDTH_20MHZ;
 	enum reg_phymode max_phymode = REG_PHYMODE_MAX;
+	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
+
+	pdev_priv_obj = reg_get_pdev_obj(pdev);
+
+	if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
+		reg_err("reg pdev priv obj is NULL");
+		return;
+	}
+
+	wireless_modes = pdev_priv_obj->wireless_modes;
+	phybitmap = pdev_priv_obj->phybitmap;
 
 	if (is_11ax_supported(wireless_modes, phybitmap)) {
 		max_phymode = REG_PHYMODE_11AX;
@@ -110,10 +120,18 @@ void reg_update_max_phymode_chwidth_for_pdev(
 }
 
 void reg_modify_chan_list_for_max_chwidth(
-		struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj,
+		struct wlan_objmgr_pdev *pdev,
 		struct regulatory_channel *cur_chan_list)
 {
 	int i;
+	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
+
+	pdev_priv_obj = reg_get_pdev_obj(pdev);
+
+	if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
+		reg_err("reg pdev priv obj is NULL");
+		return;
+	}
 
 	for (i = 0; i < NUM_CHANNELS; i++) {
 		struct ch_params chan_params;
@@ -180,8 +198,10 @@ bool reg_is_phymode_chwidth_allowed(
 		if (pdev_priv_obj->cur_chan_list[i].center_freq != freq)
 			continue;
 
-		if (pdev_priv_obj->cur_chan_list[i].state ==
-		    CHANNEL_STATE_DISABLE)
+		if ((pdev_priv_obj->cur_chan_list[i].state ==
+		     CHANNEL_STATE_DISABLE) &&
+		    !(pdev_priv_obj->cur_chan_list[i].nol_chan) &&
+		    !(pdev_priv_obj->cur_chan_list[i].nol_history))
 			return false;
 
 		if (bw < pdev_priv_obj->cur_chan_list[i].min_bw ||

+ 8 - 3
umac/regulatory/dispatcher/inc/wlan_reg_channel_api.h

@@ -29,6 +29,8 @@
 
 #ifdef CONFIG_HOST_FIND_CHAN
 
+#define WLAN_CHAN_PASSIVE       0x0000000000000200 /* Passive channel flag */
+
 #define WLAN_CHAN_DFS              0x0002  /* DFS set on primary segment */
 #define WLAN_CHAN_DFS_CFREQ2       0x0004  /* DFS set on secondary segment */
 #define WLAN_CHAN_DISALLOW_ADHOC   0x0040  /* ad-hoc is not allowed */
@@ -111,13 +113,15 @@ void wlan_reg_get_txpow_ant_gain(struct wlan_objmgr_pdev *pdev,
  * @pdev: pdev pointer.
  * @freq1: Frequency in primary segment.
  * @freq2: Frequency in secondary segment.
- * @flags: Flags to be filled.
+ * @sec_flags: Secondary flags to be filled.
+ * @pri_flags: Primary flags to be filled.
  *
  */
 void wlan_reg_get_chan_flags(struct wlan_objmgr_pdev *pdev,
 			     qdf_freq_t freq1,
 			     qdf_freq_t freq2,
-			     uint16_t *flags);
+			     uint16_t *sec_flags,
+			     uint64_t *pri_flags);
 #else
 static inline
 void wlan_reg_set_chan_blocked(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
@@ -163,7 +167,8 @@ static inline void
 wlan_reg_get_chan_flags(struct wlan_objmgr_pdev *pdev,
 			qdf_freq_t freq1,
 			qdf_freq_t freq2,
-			uint16_t *flags)
+			uint16_t *sec_flags,
+			uint64_t *pri_flags)
 {
 }
 #endif /* CONFIG_HOST_FIND_CHAN */

+ 17 - 9
umac/regulatory/dispatcher/src/wlan_reg_channel_api.c

@@ -29,7 +29,7 @@
 #include <wlan_objmgr_psoc_obj.h>
 #include <reg_priv_objs.h>
 #include <reg_services_common.h>
-#include <reg_channel.h>
+#include "../../core/reg_channel.h"
 #include <wlan_reg_services_api.h>
 
 #ifdef CONFIG_HOST_FIND_CHAN
@@ -99,7 +99,8 @@ void wlan_reg_get_txpow_ant_gain(struct wlan_objmgr_pdev *pdev,
 void wlan_reg_get_chan_flags(struct wlan_objmgr_pdev *pdev,
 			     qdf_freq_t freq1,
 			     qdf_freq_t freq2,
-			     uint16_t *flags)
+			     uint16_t *sec_flags,
+			     uint64_t *pri_flags)
 {
 	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
 	struct regulatory_channel *cur_chan_list;
@@ -115,21 +116,28 @@ void wlan_reg_get_chan_flags(struct wlan_objmgr_pdev *pdev,
 	cur_chan_list = pdev_priv_obj->cur_chan_list;
 
 	for (i = 0; i < NUM_CHANNELS; i++) {
-		if (cur_chan_list[i].center_freq == freq1 &&
-		    cur_chan_list[i].chan_flags & REGULATORY_CHAN_RADAR) {
-			*flags |= WLAN_CHAN_DFS;
-			*flags |= WLAN_CHAN_DISALLOW_ADHOC;
+		if (cur_chan_list[i].center_freq == freq1) {
+			if (cur_chan_list[i].chan_flags &
+			    REGULATORY_CHAN_RADAR) {
+				*sec_flags |= WLAN_CHAN_DFS;
+				*pri_flags |= WLAN_CHAN_PASSIVE;
+				*sec_flags |= WLAN_CHAN_DISALLOW_ADHOC;
+			} else if (cur_chan_list[i].chan_flags &
+				   REGULATORY_CHAN_NO_IR) {
+				/* For 2Ghz passive channels. */
+				*pri_flags |= WLAN_CHAN_PASSIVE;
+			}
 		}
 
 		if (cur_chan_list[i].center_freq == freq2 &&
 		    cur_chan_list[i].chan_flags & REGULATORY_CHAN_RADAR) {
-			*flags |= WLAN_CHAN_DFS_CFREQ2;
-			*flags |= WLAN_CHAN_DISALLOW_ADHOC;
+			*sec_flags |= WLAN_CHAN_DFS_CFREQ2;
+			*sec_flags |= WLAN_CHAN_DISALLOW_ADHOC;
 		}
 	}
 
 	if (WLAN_REG_IS_6GHZ_PSC_CHAN_FREQ(freq1))
-		*flags |= WLAN_CHAN_PSC;
+		*sec_flags |= WLAN_CHAN_PSC;
 }
 
 void wlan_reg_set_chan_blocked(struct wlan_objmgr_pdev *pdev,