Browse Source

qcacmn: Populate the correct opclass for 6G channels

For the 6G band, the only valid opclass_table is the global_op_class
as per the current specification. Therefore, if the band is 6G set the
opclass to global_op_class instead of the default us_op_class.

As per specification for chan width 40 MHz, there is no behav limit
for both Low Primary and High Primary channels. Hence, set behav limit
as BIT(BEHAV_NONE) if channel width is 40 MHz.

Change-Id: I534f5b898e10cf21042a117aa71e824a85d73fb3
CRs-Fixed: 2608059
Ananya Barat 5 năm trước cách đây
mục cha
commit
9a4c328738

+ 24 - 0
umac/regulatory/core/src/reg_opclass.c

@@ -434,6 +434,30 @@ uint16_t reg_dmn_get_curr_opclasses(uint8_t *num_classes, uint8_t *class)
 }
 
 #ifdef CONFIG_CHAN_FREQ_API
+void reg_freq_width_to_chan_op_class_auto(struct wlan_objmgr_pdev *pdev,
+					  qdf_freq_t freq,
+					  uint16_t chan_width,
+					  bool global_tbl_lookup,
+					  uint16_t behav_limit,
+					  uint8_t *op_class,
+					  uint8_t *chan_num)
+{
+	if (reg_freq_to_band(freq) == REG_BAND_6G) {
+		global_tbl_lookup = true;
+		if (chan_width == BW_40_MHZ)
+			behav_limit = BIT(BEHAV_NONE);
+	} else {
+		global_tbl_lookup = false;
+	}
+
+	reg_freq_width_to_chan_op_class(pdev, freq,
+					chan_width,
+					global_tbl_lookup,
+					behav_limit,
+					op_class,
+					chan_num);
+}
+
 void reg_freq_width_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
 				     qdf_freq_t freq,
 				     uint16_t chan_width,

+ 32 - 0
umac/regulatory/core/src/reg_opclass.h

@@ -127,6 +127,28 @@ void reg_freq_width_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
 				     uint8_t *op_class,
 				     uint8_t *chan_num);
 
+/**
+ * reg_freq_width_to_chan_op_class_auto() - convert frequency to operating
+ * class,channel after fixing up the global_tbl_lookup and behav_limit
+ * for 6G frequencies.
+ * @pdev: pdev pointer
+ * @freq: channel frequency in mhz
+ * @chan_width: channel width
+ * @global_tbl_lookup: whether to lookup global op class tbl
+ * @behav_limit: behavior limit
+ * @op_class: operating class
+ * @chan_num: channel number
+ *
+ * Return: Void.
+ */
+void reg_freq_width_to_chan_op_class_auto(struct wlan_objmgr_pdev *pdev,
+					  qdf_freq_t freq,
+					  uint16_t chan_width,
+					  bool global_tbl_lookup,
+					  uint16_t behav_limit,
+					  uint8_t *op_class,
+					  uint8_t *chan_num);
+
 /**
  * reg_freq_to_chan_op_class() - convert frequency to oper class,
  *                                   channel
@@ -248,6 +270,16 @@ reg_freq_width_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
 {
 }
 
+static inline void
+reg_freq_width_to_chan_op_class_auto(struct wlan_objmgr_pdev *pdev,
+				     qdf_freq_t freq,
+				     bool global_tbl_lookup,
+				     uint16_t behav_limit,
+				     uint8_t *op_class,
+				     uint8_t *chan_num)
+{
+}
+
 static inline void
 reg_freq_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
 			  qdf_freq_t freq,

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

@@ -63,6 +63,7 @@
 
 #define BW_80_MHZ     80
 #define BW_160_MHZ    160
+#define BW_40_MHZ     40
 
 /**
  * enum dfs_reg - DFS region

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

@@ -1153,6 +1153,27 @@ void wlan_reg_freq_width_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
 					  uint8_t *op_class,
 					  uint8_t *chan_num);
 
+/**
+ * wlan_reg_freq_width_to_chan_op_class_auto() - convert frequency to
+ * operating class,channel
+ * @pdev: pdev pointer
+ * @freq: channel frequency in mhz
+ * @chan_width: channel width
+ * @global_tbl_lookup: whether to lookup global op class tbl
+ * @behav_limit: behavior limit
+ * @op_class: operating class
+ * @chan_num: channel number
+ *
+ * Return: Void.
+ */
+void wlan_reg_freq_width_to_chan_op_class_auto(struct wlan_objmgr_pdev *pdev,
+					       qdf_freq_t freq,
+					       uint16_t chan_width,
+					       bool global_tbl_lookup,
+					       uint16_t behav_limit,
+					       uint8_t *op_class,
+					       uint8_t *chan_num);
+
 /**
  * wlan_reg_freq_to_chan_and_op_class() - Converts freq to oper class
  * @pdev: pdev ptr

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

@@ -997,6 +997,21 @@ void wlan_reg_freq_width_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
 					       chan_num);
 }
 
+void wlan_reg_freq_width_to_chan_op_class_auto(struct wlan_objmgr_pdev *pdev,
+					       qdf_freq_t freq,
+					       uint16_t chan_width,
+					       bool global_tbl_lookup,
+					       uint16_t behav_limit,
+					       uint8_t *op_class,
+					       uint8_t *chan_num)
+{
+	reg_freq_width_to_chan_op_class_auto(pdev, freq, chan_width,
+					     global_tbl_lookup,
+					     behav_limit,
+					     op_class,
+					     chan_num);
+}
+
 void wlan_reg_freq_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
 				    qdf_freq_t freq,
 				    bool global_tbl_lookup,