瀏覽代碼

qcacmn: Update nol properly

When second segment bangradar is issued, the primary channels are
added to NOL. During preCAC, when a bangradar or real radar is injected in
the second segment, no channels are added to NOL.

dfs_seg_id is updated by enhanced bangradar even when the command is not
issued. During preCAC, the second segment frequency stored in current
channel is invalid and it is stored in dfs itself.

Correct the condition for enhanced bangradar command. Update dfs_seg_id and
radar found segment id. Move the portion of code that update radar_found
parameters when enhanced bangradar command is issued. This portion checks
for radar found segment id that would not have been updated yet. Use proper
second segment frequency to add to NOL during preCAC.

Change-Id: I5e1f1004b45bc30b5da7bfa174a5c03bdea4fa71
CRs-Fixed: 2303458
Vignesh U 6 年之前
父節點
當前提交
aea8656c81

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

@@ -890,6 +890,8 @@ struct dfs_event_log {
  * @dfs_second_segment_bangradar:    Bangaradar on second segment of
  *                                   VHT80_80/160.
  * @is_radar_found_on_secondary_seg: Radar on second segment.
+ * @dfs_radar_found_for_fo:          Radar found event for FO(Full Offload) is
+ *                                   received.
  * @is_radar_during_precac:          Radar found during precac.
  * @dfs_precac_lock:                 Lock to protect precac lists.
  * @dfs_precac_enable:               Enable the precac.
@@ -976,7 +978,6 @@ struct dfs_event_log {
  * @dfs_is_chirp:                    Radar Chirp in pulse present or not.
  * @dfs_bw_reduced:                  DFS bandwidth reduced channel bit.
  * @dfs_freq_offset:                 Frequency offset where radar was found.
- * @dfs_enhanced_bangradar:          DFS enhance bagradar bit for Full offload.
  * @dfs_cac_aborted:                 DFS cac is aborted.
  */
 struct wlan_dfs {
@@ -1021,6 +1022,7 @@ struct wlan_dfs {
 	uint8_t        dfs_bangradar;
 	bool           dfs_second_segment_bangradar;
 	bool           is_radar_found_on_secondary_seg;
+	bool           dfs_radar_found_for_fo;
 	bool           is_radar_during_precac;
 	qdf_spinlock_t dfs_precac_lock;
 	bool           dfs_precac_enable;
@@ -1106,7 +1108,6 @@ struct wlan_dfs {
 	uint8_t        dfs_is_chirp;
 	uint8_t        dfs_bw_reduced;
 	int32_t        dfs_freq_offset;
-	uint8_t        dfs_enhanced_bangradar;
 	bool           dfs_cac_aborted;
 };
 
@@ -1865,13 +1866,15 @@ void dfs_start_cac_timer(struct wlan_dfs *dfs);
 
 /**
  * dfs_is_subset_channel() - Check if the new_chan is subset of the old_chan.
+ * @dfs: Pointer to wlan_dfs structure.
  * @old_chan: Pointer to old channel.
  * @new_chan: Pointer to new channel.
  *
  * Return: true if the new channel is subset of or same as the old channel,
  * else false.
  */
-bool dfs_is_subset_channel(struct dfs_channel *old_chan,
+bool dfs_is_subset_channel(struct wlan_dfs *dfs,
+			   struct dfs_channel *old_chan,
 			   struct dfs_channel *new_chan);
 
 /**

+ 3 - 1
umac/dfs/core/src/dfs_process_radar_found_ind.h

@@ -138,13 +138,15 @@ void dfs_radarfound_action_generic(struct wlan_dfs *dfs, uint8_t seg_id);
 
 /**
  * dfs_get_bonding_channels() - Get bonding channels.
+ * @dfs: Pointer to wlan_dfs structure.
  * @curchan: Pointer to dfs_channels to know width and primary channel.
  * @segment_id: Segment id, useful for 80+80/160 MHz operating band.
  * @channels: Pointer to save radar affected channels.
  *
  * Return: Number of channels.
  */
-uint8_t dfs_get_bonding_channels(struct dfs_channel *curchan,
+uint8_t dfs_get_bonding_channels(struct wlan_dfs *dfs,
+				 struct dfs_channel *curchan,
 				 uint32_t segment_id,
 				 uint8_t *channels);
 

+ 1 - 0
umac/dfs/core/src/filtering/dfs_process_radarevent.c

@@ -1291,6 +1291,7 @@ void dfs_radarfound_action_generic(struct wlan_dfs *dfs, uint8_t seg_id)
 
 	qdf_mem_zero(radar_found, sizeof(*radar_found));
 	radar_found->segment_id = seg_id;
+	dfs->dfs_seg_id = seg_id;
 	radar_found->pdev_id =
 		wlan_objmgr_pdev_get_pdev_id(dfs->dfs_pdev_obj);
 

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

@@ -355,7 +355,6 @@ int dfs_control(struct wlan_dfs *dfs,
 			dfs->dfs_is_chirp = bangradar_enh_params->is_chirp;
 			dfs->dfs_freq_offset =
 					      bangradar_enh_params->freq_offset;
-			dfs->dfs_enhanced_bangradar = 1;
 
 			if (dfs->dfs_is_offload_enabled) {
 				error = dfs_fill_emulate_bang_radar_test

+ 6 - 4
umac/dfs/core/src/misc/dfs_cac.c

@@ -253,7 +253,8 @@ void dfs_stacac_stop(struct wlan_dfs *dfs)
 		 dfs->dfs_curchan->dfs_ch_freq, phyerr);
 }
 
-bool dfs_is_subset_channel(struct dfs_channel *old_chan,
+bool dfs_is_subset_channel(struct wlan_dfs *dfs,
+			   struct dfs_channel *old_chan,
 			   struct dfs_channel *new_chan)
 {
 	uint8_t old_subchans[NUM_CHANNELS_160MHZ];
@@ -267,7 +268,8 @@ bool dfs_is_subset_channel(struct dfs_channel *old_chan,
 	    WLAN_IS_CHAN_11AC_VHT80_80(old_chan)) {
 		/* If primary segment is NON-DFS */
 		if (!WLAN_IS_CHAN_DFS(old_chan))
-			old_n_chans = dfs_get_bonding_channels(old_chan,
+			old_n_chans = dfs_get_bonding_channels(dfs,
+							       old_chan,
 							       SEG_ID_SECONDARY,
 							       old_subchans);
 		else
@@ -283,7 +285,7 @@ bool dfs_is_subset_channel(struct dfs_channel *old_chan,
 		/* If primary segment is NON-DFS */
 		if (WLAN_IS_CHAN_DFS(new_chan))
 			new_n_chans = dfs_get_bonding_channels(
-					new_chan, SEG_ID_SECONDARY,
+					dfs, new_chan, SEG_ID_SECONDARY,
 					new_subchans);
 		else
 			new_n_chans = dfs_get_bonding_channels_without_seg_info(
@@ -317,7 +319,7 @@ bool dfs_is_subset_channel(struct dfs_channel *old_chan,
 
 bool dfs_is_curchan_subset_of_cac_started_chan(struct wlan_dfs *dfs)
 {
-	return dfs_is_subset_channel(&dfs->dfs_cac_started_chan,
+	return dfs_is_subset_channel(dfs, &dfs->dfs_cac_started_chan,
 				     dfs->dfs_curchan);
 }
 

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

@@ -618,7 +618,7 @@ void dfs_remove_spoof_channel_from_nol(struct wlan_dfs *dfs)
 	uint8_t channels[NUM_CHANNELS_160MHZ];
 	int i, nchans = 0;
 
-	nchans = dfs_get_bonding_channels(&dfs->dfs_radar_found_chan, 0,
+	nchans = dfs_get_bonding_channels(dfs, &dfs->dfs_radar_found_chan, 0,
 					  channels);
 
 	WLAN_DFSNOL_LOCK(dfs);

+ 25 - 16
umac/dfs/core/src/misc/dfs_process_radar_found_ind.c

@@ -408,7 +408,8 @@ uint8_t dfs_get_bonding_channels_without_seg_info(struct dfs_channel *chan,
 	return nchannels;
 }
 
-uint8_t dfs_get_bonding_channels(struct dfs_channel *curchan,
+uint8_t dfs_get_bonding_channels(struct wlan_dfs *dfs,
+				 struct dfs_channel *curchan,
 				 uint32_t segment_id,
 				 uint8_t *channels)
 {
@@ -417,8 +418,16 @@ uint8_t dfs_get_bonding_channels(struct dfs_channel *curchan,
 
 	if (!segment_id)
 		center_chan = curchan->dfs_ch_vhtop_ch_freq_seg1;
-	else
-		center_chan = curchan->dfs_ch_vhtop_ch_freq_seg2;
+	else {
+		/* When precac is running "dfs_ch_vhtop_ch_freq_seg2" is
+		 * zero and "dfs_precac_secondary_freq" holds the secondary
+		 * frequency.
+		 */
+		if (dfs_is_precac_timer_running(dfs))
+			center_chan = dfs->dfs_precac_secondary_freq;
+		else
+			center_chan = curchan->dfs_ch_vhtop_ch_freq_seg2;
+	}
 
 	if (WLAN_IS_CHAN_MODE_20(curchan)) {
 		nchannels = 1;
@@ -518,6 +527,17 @@ QDF_STATUS dfs_process_radar_ind(struct wlan_dfs *dfs,
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	/* For Full Offload, FW sends segment id,freq_offset and chirp
+	 * information and gets assigned when there is radar detect. In
+	 * case of radartool bangradar enhanced command and real radar
+	 * for DA and PO, we assign these information here.
+	 */
+	if (!(dfs->dfs_is_offload_enabled && dfs->dfs_radar_found_for_fo)) {
+		radar_found->segment_id = dfs->dfs_seg_id;
+		radar_found->freq_offset = dfs->dfs_freq_offset;
+		radar_found->is_chirp = dfs->dfs_is_chirp;
+	}
+
 	if (radar_found->segment_id == SEG_ID_SECONDARY)
 		dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
 			 "Radar found on second segment VHT80 freq=%d MHz",
@@ -534,25 +554,14 @@ QDF_STATUS dfs_process_radar_ind(struct wlan_dfs *dfs,
 		return QDF_STATUS_SUCCESS;
 	}
 
-	/* For Full Offload, FW sends segment id,freq_offset and
-	 * is chirp information and gets assigned when there is radar detect.
-	 * In case of radartool bangradar enhanced command and real radar
-	 * for FO and PO, we assign these information here.
-	 */
-	if (!dfs->dfs_is_offload_enabled || dfs->dfs_enhanced_bangradar) {
-		radar_found->segment_id = dfs->dfs_seg_id;
-		radar_found->freq_offset = dfs->dfs_freq_offset;
-		radar_found->is_chirp = dfs->dfs_is_chirp;
-		dfs->dfs_enhanced_bangradar = 0;
-	}
-
 	if (dfs->dfs_use_nol_subchannel_marking &&
 	    !(dfs->dfs_bangradar || dfs->dfs_second_segment_bangradar))
 		num_channels = dfs_find_radar_affected_subchans(dfs,
 								radar_found,
 								channels);
 	else
-		num_channels = dfs_get_bonding_channels(dfs->dfs_curchan,
+		num_channels = dfs_get_bonding_channels(dfs,
+							dfs->dfs_curchan,
 							radar_found->segment_id,
 							channels);
 

+ 8 - 3
umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c

@@ -373,19 +373,24 @@ QDF_STATUS tgt_dfs_process_radar_ind(struct wlan_objmgr_pdev *pdev,
 				     struct radar_found_info *radar_found)
 {
 	struct wlan_dfs *dfs;
+	QDF_STATUS status = QDF_STATUS_E_FAILURE;
 
 	if (!pdev) {
 		dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, "null pdev");
-		return QDF_STATUS_E_FAILURE;
+		return status;
 	}
 
 	dfs = global_dfs_to_mlme.pdev_get_comp_private_obj(pdev);
 	if (!dfs) {
 		dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs is null");
-		return QDF_STATUS_E_FAILURE;
+		return status;
 	}
 
-	return dfs_process_radar_ind(dfs, radar_found);
+	dfs->dfs_radar_found_for_fo = 1;
+	status = dfs_process_radar_ind(dfs, radar_found);
+	dfs->dfs_radar_found_for_fo = 0;
+
+	return status;
 }
 qdf_export_symbol(tgt_dfs_process_radar_ind);