浏览代码

qcacmn: Enable dynamic puncture for DFS radar

1. Enable sub chan DFS type if QCA_DFS_BW_PUNCTURE defined, or all bonded
operation freq will be affected and disabled for nol, puncture can't work,
always need to switch freq.

2. Find nearest puncture pattern for a bitmap.
For example, SAP started with channel width 320 MHz, if only 20 MHz freq
affected by radar, 320 + 20 puncture pattern is invalid, but puncture
pattern 320 + 40 can be used.

3. Fix build issue when QCA_DFS_BW_PUNCTURE defined as following.
error: incompatible pointer types passing 'qdf_freq_t[16]' (aka
'unsigned int[16]') to parameter of type 'uint16_t *' (aka 'unsigned
short *')

Change-Id: I374ed76c6a13ef5fac1a78073f1b8974b0a9bb30
CRs-Fixed: 3386020
Jianmin Zhu 2 年之前
父节点
当前提交
a8fbfe3aae

+ 20 - 0
umac/dfs/core/src/misc/dfs.c

@@ -187,6 +187,23 @@ int dfs_create_object(struct wlan_dfs **dfs)
 	return 0;
 }
 
+#if defined(QCA_DFS_BW_PUNCTURE) && defined(CONFIG_REG_CLIENT)
+static void dfs_puncture_init(struct wlan_dfs *dfs)
+{
+	/*
+	 * Enable sub chan DFS type if QCA_DFS_BW_PUNCTURE defined, or all
+	 * bonded operation freq will be affected and disabled for nol,
+	 * puncture can't work, always need to switch freq.
+	 */
+	dfs_set_nol_subchannel_marking(dfs, true);
+	dfs->dfs_use_puncture = true;
+}
+#else
+static inline void dfs_puncture_init(struct wlan_dfs *dfs)
+{
+}
+#endif
+
 int dfs_attach(struct wlan_dfs *dfs)
 {
 	int ret;
@@ -217,6 +234,9 @@ int dfs_attach(struct wlan_dfs *dfs)
 	 * and full offload, indicating test mode timer initialization for both.
 	 */
 	dfs_main_task_testtimer_init(dfs);
+
+	dfs_puncture_init(dfs);
+
 	return 0;
 }
 

+ 1 - 1
umac/dfs/core/src/misc/dfs_process_radar_found_ind.c

@@ -960,7 +960,7 @@ uint16_t dfs_generate_radar_bitmap(struct wlan_dfs *dfs,
 	uint16_t dfs_radar_bitmap = 0x0;
 	uint16_t bits = 0x1;
 	uint8_t i, j;
-	qdf_freq_t cur_freq_list[MAX_20MHZ_SUBCHANS];
+	uint16_t cur_freq_list[MAX_20MHZ_SUBCHANS] = {0};
 
 	n_cur_channels =
 		dfs_get_bonding_channel_without_seg_info_for_freq(dfs->dfs_curchan,

+ 1 - 1
umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c

@@ -712,7 +712,7 @@ register_dfs_bw_expand_rx_ops(struct wlan_lmac_if_dfs_rx_ops *rx_ops)
 }
 #endif
 
-#ifdef QCA_DFS_BW_PUNCTURE
+#if defined(QCA_DFS_BW_PUNCTURE) && !defined(CONFIG_REG_CLIENT)
 /* register_dfs_puncture_rx_ops() - Register DFS Rx-Ops for DFS puncture.
  * @rx_ops: Pointer to wlan_lmac_if_dfs_rx_ops.
  */

+ 5 - 4
umac/regulatory/core/src/reg_services_common.c

@@ -4660,7 +4660,6 @@ bool reg_is_punc_bitmap_valid(enum phy_ch_width bw, uint16_t puncture_bitmap)
 	return is_punc_bitmap_valid;
 }
 
-#ifdef QCA_DFS_BW_PUNCTURE
 uint16_t reg_find_nearest_puncture_pattern(enum phy_ch_width bw,
 					   uint16_t proposed_bitmap)
 {
@@ -4701,7 +4700,6 @@ uint16_t reg_find_nearest_puncture_pattern(enum phy_ch_width bw,
 
 	return final_bitmap;
 }
-#endif /* QCA_DFS_BW_PUNCTURE */
 
 /**
  * reg_update_5g_bonded_channel_state_punc_for_pwrmode() - update channel state
@@ -4723,6 +4721,7 @@ static void reg_update_5g_bonded_channel_state_punc_for_pwrmode(
 	qdf_freq_t chan_cfreq;
 	enum channel_state temp_chan_state;
 	uint16_t puncture_bitmap = 0;
+	uint16_t final_bitmap;
 	int i = 0;
 	enum channel_state update_state = CHANNEL_STATE_ENABLE;
 
@@ -4744,9 +4743,11 @@ static void reg_update_5g_bonded_channel_state_punc_for_pwrmode(
 		i++;
 	}
 	/* Validate puncture bitmap. Update channel state. */
-	if (reg_is_punc_bitmap_valid(ch_params->ch_width, puncture_bitmap)) {
+	final_bitmap = reg_find_nearest_puncture_pattern(ch_params->ch_width,
+							 puncture_bitmap);
+	if (final_bitmap) {
 		*chan_state = update_state;
-		ch_params->reg_punc_bitmap = puncture_bitmap;
+		ch_params->reg_punc_bitmap = final_bitmap;
 	}
 }
 

+ 0 - 9
umac/regulatory/core/src/reg_services_common.h

@@ -1158,7 +1158,6 @@ reg_fill_channel_list_for_pwrmode(struct wlan_objmgr_pdev *pdev,
  */
 bool reg_is_punc_bitmap_valid(enum phy_ch_width bw, uint16_t puncture_bitmap);
 
-#ifdef QCA_DFS_BW_PUNCTURE
 /**
  * reg_find_nearest_puncture_pattern() - is generated bitmap is valid or not
  * @bw: Input channel width.
@@ -1168,14 +1167,6 @@ bool reg_is_punc_bitmap_valid(enum phy_ch_width bw, uint16_t puncture_bitmap);
  */
 uint16_t reg_find_nearest_puncture_pattern(enum phy_ch_width bw,
 					   uint16_t proposed_bitmap);
-#else
-static inline
-uint16_t reg_find_nearest_puncture_pattern(enum phy_ch_width bw,
-					   uint16_t proposed_bitmap)
-{
-	return 0;
-}
-#endif /* QCA_DFS_BW_PUNCTURE */
 
 /**
  * reg_extract_puncture_by_bw() - generate new puncture bitmap from original

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

@@ -1565,7 +1565,6 @@ wlan_reg_get_channel_list_with_power(
 bool wlan_reg_is_punc_bitmap_valid(enum phy_ch_width bw,
 				   uint16_t puncture_bitmap);
 
-#ifdef QCA_DFS_BW_PUNCTURE
 /**
  * wlan_reg_find_nearest_puncture_pattern() - is proposed bitmap valid or not
  * @bw: Input channel width.
@@ -1575,14 +1574,6 @@ bool wlan_reg_is_punc_bitmap_valid(enum phy_ch_width bw,
  */
 uint16_t wlan_reg_find_nearest_puncture_pattern(enum phy_ch_width bw,
 						uint16_t proposed_bitmap);
-#else
-static inline
-uint16_t wlan_reg_find_nearest_puncture_pattern(enum phy_ch_width bw,
-						uint16_t proposed_bitmap)
-{
-	return 0;
-}
-#endif /* QCA_DFS_BW_PUNCTURE */
 
 /**
  * wlan_reg_extract_puncture_by_bw() - generate new puncture bitmap from

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

@@ -1306,13 +1306,11 @@ bool wlan_reg_is_punc_bitmap_valid(enum phy_ch_width bw,
 	return reg_is_punc_bitmap_valid(bw, puncture_bitmap);
 }
 
-#ifdef QCA_DFS_BW_PUNCTURE
 uint16_t wlan_reg_find_nearest_puncture_pattern(enum phy_ch_width bw,
 						uint16_t proposed_bitmap)
 {
 	return reg_find_nearest_puncture_pattern(bw, proposed_bitmap);
 }
-#endif /* QCA_DFS_BW_PUNCTURE */
 
 QDF_STATUS wlan_reg_extract_puncture_by_bw(enum phy_ch_width ori_bw,
 					   uint16_t ori_puncture_bitmap,