瀏覽代碼

qcacmn: Modify get bonding pair function to accommodate 320 MHz bandwidth

Following are the changes:
1. Add macros relevant to the addition of the 320 MHz root to the preCAC
   tree.

2. Adding 320MHz bandwidth in switch case and separating
   'case CH_WIDTH_320MHZ' using a compile time macro ( 11BE), forces us
   to use the macro inside the function, which is not allowed by the
   coding guideline.

   Convert the "switch case" mapping (which is generally a binary search)
   into a linear search of a mapping (BW -> bonded pair) array , thereby
   using the macro WLAN_FEATURE_11BE to separate the 320MHz bandwidth
   in the data structure space instead of doing the separation inside
   the function space.

Change-Id: Iaab2328deef1cb7b2ff82bafe5d3cd2ea137e725
Ananya Barat 3 年之前
父節點
當前提交
c2bca12b79
共有 3 個文件被更改,包括 90 次插入38 次删除
  1. 6 0
      umac/dfs/core/src/dfs.h
  2. 27 6
      umac/dfs/core/src/dfs_zero_cac.h
  3. 57 32
      umac/regulatory/core/src/reg_services_common.c

+ 6 - 0
umac/dfs/core/src/dfs.h

@@ -1131,6 +1131,9 @@ struct dfs_rcac_params {
  *                                   CAC REQUIRED, CAC COMPLETED, NOL,
  *                                   PRECAC STARTED, PRECAC COMPLETED etc. of
  *                                   all the DFS channels.
+ * @dfs_precac_max_root_bw:          Stores the max bandwidth (in MHz) to be
+ *                                   included in the precac forest as per the
+ *                                   regulatory current channel list.
  */
 struct wlan_dfs {
 	uint32_t       dfs_debug_mask;
@@ -1302,6 +1305,9 @@ struct wlan_dfs {
 #if defined(WLAN_DISP_CHAN_INFO)
 	enum channel_dfs_state dfs_channel_state_array[NUM_DFS_CHANS];
 #endif /* WLAN_DISP_CHAN_INFO */
+#ifdef QCA_SUPPORT_AGILE_DFS
+	uint16_t       dfs_precac_max_root_bw;
+#endif
 };
 
 #if defined(QCA_SUPPORT_AGILE_DFS) || defined(ATH_SUPPORT_ZERO_CAC_DFS)

+ 27 - 6
umac/dfs/core/src/dfs_zero_cac.h

@@ -38,7 +38,13 @@
 #define OCAC_RESET 1
 #define OCAC_CANCEL 2
 
+#ifdef WLAN_FEATURE_11BE
+#define TREE_DEPTH_320                    5
+#define TREE_DEPTH_MAX                    TREE_DEPTH_320
+#else
 #define TREE_DEPTH_MAX                    TREE_DEPTH_160
+#endif
+
 #define TREE_DEPTH_160                    4
 #define TREE_DEPTH_80                     3
 #define TREE_DEPTH_40                     2
@@ -59,6 +65,8 @@
 #define DFS_CHWIDTH_80_VAL               80
 #define DFS_CHWIDTH_160_VAL             160
 #define DFS_CHWIDTH_165_VAL             165
+#define DFS_CHWIDTH_240_VAL             240
+#define DFS_CHWIDTH_320_VAL             320
 
 #define WEATHER_CHAN_START              120
 #define WEATHER_CHAN_END                128
@@ -85,10 +93,22 @@
 #define RESTRICTED_80P80_RIGHT_80_CENTER_CHAN 155
 #define RESTRICTED_80P80_LEFT_80_CENTER_FREQ  5690
 #define RESTRICTED_80P80_RIGHT_80_CENTER_FREQ 5775
-#define DEPTH_160_ROOT                        0
-#define DEPTH_80_ROOT                         1
-#define DEPTH_40_ROOT                         2
-#define DEPTH_20_ROOT                         3
+
+/* While building the precac tree with 320 MHz root, the center of the
+ * right side 160 MHz channel(which includes real IEEE channels 132, 136,
+ * 140, 144 and pseudo IEEE channels 148, 152, 156, 160)
+ */
+#define CENTER_OF_320_MHZ                     5650
+#define CENTER_OF_PSEUDO_160                  5730
+#define LAST_20_CENTER_OF_FIRST_160           5320
+#define FIRST_20_CENTER_OF_LAST_80            5745
+
+/* Depth of the tree of a given bandwidth. */
+#define DEPTH_320_ROOT                           0
+#define DEPTH_160_ROOT                           1
+#define DEPTH_80_ROOT                            2
+#define DEPTH_40_ROOT                            3
+#define DEPTH_20_ROOT                            4
 
 /**
  * struct precac_tree_node - Individual tree node structure for every node in
@@ -108,12 +128,12 @@ struct precac_tree_node {
 	struct precac_tree_node *left_child;
 	struct precac_tree_node *right_child;
 	uint8_t ch_ieee;
-	uint16_t ch_freq;
 	uint8_t n_caced_subchs;
 	uint8_t n_nol_subchs;
 	uint8_t n_valid_subchs;
-	uint8_t bandwidth;
 	uint8_t depth;
+	uint16_t bandwidth;
+	uint16_t ch_freq;
 };
 
 /**
@@ -944,6 +964,7 @@ static inline bool dfs_is_precac_timer_running(struct wlan_dfs *dfs)
 #define NEXT_40_CHAN_FREQ_OFFSET               40
 #define NEXT_80_CHAN_FREQ_OFFSET               80
 #define NEXT_160_CHAN_FREQ_OFFSET             160
+#define NEXT_320_CHAN_FREQ_OFFSET             320
 
 #define WEATHER_CHAN_START_FREQ              5600
 #define WEATHER_CHAN_END_FREQ                5640

+ 57 - 32
umac/regulatory/core/src/reg_services_common.c

@@ -139,28 +139,68 @@ static const struct bonded_channel_freq bonded_chan_160mhz_list_freq[] = {
 #endif /*CONFIG_BAND_6GHZ*/
 };
 
+#ifdef WLAN_FEATURE_11BE
+/* bonded_chan_320mhz_list_freq - List of 320MHz bonnded channel frequencies */
+static const struct bonded_channel_freq bonded_chan_320mhz_list_freq[] = {
+	{5500, 5800}, /* center freq: 5650 */
+#ifdef CONFIG_BAND_6GHZ
+	{5955, 6255}, /* center freq: 6105 */
+	{6115, 6415}, /* center freq: 6265 */
+	{6275, 6575}, /* center freq: 6425 */
+	{6435, 6735}, /* center freq: 6585 */
+	{6595, 6895}, /* center freq: 6745 */
+	{6755, 7055}  /* center freq: 6905 */
+#endif /*CONFIG_BAND_6GHZ*/
+};
+#endif
+
+/**
+ * struct bw_bonded_array_pair - Structure containing bandwidth, bonded_array
+ * corresponding to bandwidth and the size of the bonded array.
+ * @chwidth: channel width
+ * @bonded_chan_arr: bonded array corresponding to chwidth.
+ * @array_size: size of the bonded_chan_arr.
+ */
+struct bw_bonded_array_pair {
+	enum phy_ch_width chwidth;
+	const struct bonded_channel_freq *bonded_chan_arr;
+	uint16_t array_size;
+};
+
+/* Mapping of chwidth to bonded array and size of bonded array */
+static const
+struct bw_bonded_array_pair bw_bonded_array_pair_map[] = {
+#ifdef WLAN_FEATURE_11BE
+	{CH_WIDTH_320MHZ, bonded_chan_320mhz_list_freq,
+		QDF_ARRAY_SIZE(bonded_chan_320mhz_list_freq)},
+#endif
+	{CH_WIDTH_160MHZ, bonded_chan_160mhz_list_freq,
+		QDF_ARRAY_SIZE(bonded_chan_160mhz_list_freq)},
+	{CH_WIDTH_80P80MHZ, bonded_chan_80mhz_list_freq,
+		QDF_ARRAY_SIZE(bonded_chan_80mhz_list_freq)},
+	{CH_WIDTH_80MHZ, bonded_chan_80mhz_list_freq,
+		QDF_ARRAY_SIZE(bonded_chan_80mhz_list_freq)},
+	{CH_WIDTH_40MHZ, bonded_chan_40mhz_list_freq,
+		QDF_ARRAY_SIZE(bonded_chan_40mhz_list_freq)},
+};
+
 const struct bonded_channel_freq *
 reg_get_bonded_chan_entry(qdf_freq_t freq,
 			  enum phy_ch_width chwidth)
 {
 	const struct bonded_channel_freq *bonded_chan_arr;
-	uint16_t array_size, i;
-
-	switch (chwidth) {
-	case CH_WIDTH_160MHZ:
-		bonded_chan_arr = bonded_chan_160mhz_list_freq;
-		array_size = QDF_ARRAY_SIZE(bonded_chan_160mhz_list_freq);
-		break;
-	case CH_WIDTH_80MHZ:
-	case CH_WIDTH_80P80MHZ:
-		bonded_chan_arr = bonded_chan_80mhz_list_freq;
-		array_size = QDF_ARRAY_SIZE(bonded_chan_80mhz_list_freq);
-		break;
-	case CH_WIDTH_40MHZ:
-		bonded_chan_arr = bonded_chan_40mhz_list_freq;
-		array_size = QDF_ARRAY_SIZE(bonded_chan_40mhz_list_freq);
-		break;
-	default:
+	uint16_t array_size, i, num_bws;
+
+	num_bws = QDF_ARRAY_SIZE(bw_bonded_array_pair_map);
+	for (i = 0; i < num_bws; i++) {
+		if (chwidth == bw_bonded_array_pair_map[i].chwidth) {
+			bonded_chan_arr =
+				bw_bonded_array_pair_map[i].bonded_chan_arr;
+			array_size = bw_bonded_array_pair_map[i].array_size;
+			break;
+		}
+	}
+	if (i == num_bws) {
 		reg_debug("Could not find bonded_chan_array for chwidth %d",
 			  chwidth);
 		return NULL;
@@ -178,21 +218,6 @@ reg_get_bonded_chan_entry(qdf_freq_t freq,
 	return NULL;
 }
 
-#ifdef WLAN_FEATURE_11BE
-/* bonded_chan_320mhz_list_freq - List of 320MHz bonnded channel frequencies */
-static const struct bonded_channel_freq bonded_chan_320mhz_list_freq[] = {
-	{5500, 5800}, /* center freq: 5650 */
-#ifdef CONFIG_BAND_6GHZ
-	{5955, 6255}, /* center freq: 6105 */
-	{6115, 6415}, /* center freq: 6265 */
-	{6275, 6575}, /* center freq: 6425 */
-	{6435, 6735}, /* center freq: 6585 */
-	{6595, 6895}, /* center freq: 6745 */
-	{6755, 7055}  /* center freq: 6905 */
-#endif /*CONFIG_BAND_6GHZ*/
-};
-#endif
-
 #endif /*CONFIG_CHAN_FREQ_API*/
 
 enum phy_ch_width get_next_lower_bandwidth(enum phy_ch_width ch_width)