Parcourir la source

qcalcd-3.0: Fix DFS-3 segment ID propagation from radar summary

Fix the segmentID propagation from radar summary report to phyerror
event structure to correctly identify the segment, on which a phyerror
is received for pattern match processing.  Also, to enhance the debug,
add all the radar summary parameters to dfs event and print while
processing the phyerror for a pattern match.

Change-Id: I1325ad541cf69685606e4905275244e207d95b29
CRs-Fixed: 1009784
Rakesh Sunki il y a 9 ans
Parent
commit
b26f431bb2

+ 47 - 0
core/sap/dfs/inc/dfs.h

@@ -101,6 +101,16 @@
 #define DFS_80P80_SEG0 0
 #define DFS_80P80_SEG1 1
 
+/**
+ * @DFS_RADAR_SUMMARY_REPORT_VERSION_2: DFS-2 radar summary report
+ * @DFS_RADAR_SUMMARY_REPORT_VERSION_3: DFS-3 radar summary report
+ */
+enum {
+	DFS_RADAR_SUMMARY_REPORT_VERSION_2 = 1,
+	DFS_RADAR_SUMMARY_REPORT_VERSION_3 = 2,
+};
+
+
 /*
  * Constants to use for chirping detection.
  *
@@ -286,6 +296,19 @@ struct dfs_event {
 	uint32_t re_freq_hi;    /* Upper bounds of frequency, KHz */
 	int sidx;               /* Pulse Index as in radar summary report */
 	int radar_80p80_segid;  /* 80p80 segment ID as in radar sum report */
+	int delta_peak;         /* delta peak reported in radar summary */
+	int delta_diff;         /* delta diff reported in radar summary */
+	int agc_total_gain;     /* agc total gain reported in radar summary */
+	int agc_mb_gain;        /* agc mb gain reported in radar summary */
+	int radar_subchan_mask; /* subchan mask reported in radar summary */
+	int pulse_height;       /* pulse height reported in radar summary */
+	int triggering_agc_event; /* triggering agc reported in radar summary */
+	int pulse_rssi;         /* rssi of phyerr reported in radar summary */
+	int radar_fft_pri80_inband_power; /* Pri80MHz pwr reported in summary */
+	int radar_fft_ext80_inband_power; /* Ext80MHz pwr reported in summary */
+	int rsu_version; /* Radar summary report version */
+	int phyerr_serial_num; /* phyerr seq num queued for pattern matching */
+	int peak_mag; /* Peak mag reported in radar search FFT report */
 	STAILQ_ENTRY(dfs_event) re_list;        /* List of radar events */
 } qdf_packed;
 #ifdef WIN32
@@ -737,6 +760,30 @@ struct dfs_phy_err {
 	 * when SAP is operating in 80p80 channel width.
 	 */
 	int radar_80p80_segid;
+	/* delta peak reported in radar summary */
+	int delta_peak;
+	/* delta diff reported in radar summary */
+	int delta_diff;
+	/* agc total gain reported in radar summary */
+	int agc_total_gain;
+	/* agc mb gain reported in radar summary */
+	int agc_mb_gain;
+	/* subchan mask reported in radar summary */
+	int radar_subchan_mask;
+	/* pulse height reported in radar summary */
+	int pulse_height;
+	/* triggering agc reported in radar summary */
+	int triggering_agc_event;
+	/* rssi of phyerr reported in radar summary */
+	int pulse_rssi;
+	/* Pri80MHz pwr reported in summary */
+	int radar_fft_pri80_inband_power;
+	/* Ext80MHz pwr reported in summary */
+	int radar_fft_ext80_inband_power;
+	/* Peak mag reported in radar search FFT report */
+	int peak_mag;
+	/* Radar summary report version */
+	int rsu_version;
 };
 
 /* Attach, detach, handle ioctl prototypes */

+ 17 - 12
core/sap/dfs/src/dfs_phyerr_tlv.c

@@ -35,16 +35,6 @@
 #include "dfs_phyerr.h"
 #include "dfs_phyerr_tlv.h"
 
-/**
- * enum RADAR_SUMMARY_VERSION - Radar summary report version
- * @DFS_RADAR_SUMMARY_REPORT_VERSION_2: DFS-2 radar summary report
- * @DFS_RADAR_SUMMARY_REPORT_VERSION_3: DFS-3 radar summary report
- */
-typedef enum {
-DFS_RADAR_SUMMARY_REPORT_VERSION_2 = 1,
-DFS_RADAR_SUMMARY_REPORT_VERSION_3 = 2,
-} RADAR_SUMMARY_VERSION;
-
 /*
  * Parsed radar status
  */
@@ -62,7 +52,7 @@ struct rx_radar_status {
 	int agc_mb_gain;
 	/*Parsed only for DFS-3*/
 	int radar_subchan_mask;
-	RADAR_SUMMARY_VERSION rsu_version;
+	int rsu_version;
 	/*
 	 * The parameters below are present only in
 	 * DFS-3 radar summary report and need to be
@@ -882,8 +872,23 @@ dfs_process_phyerr_bb_tlv(struct ath_dfs *dfs, void *buf, uint16_t datalen,
 	 * Copy the segment ID from the radar summary report
 	 * only when radar summary report version is DFS-3.
 	 */
-	if (rs.rsu_version == DFS_RADAR_SUMMARY_REPORT_VERSION_3)
+	if (rs.rsu_version == DFS_RADAR_SUMMARY_REPORT_VERSION_3) {
 		e->radar_80p80_segid = rs.radar_80p80_segid;
+		e->delta_peak = rs.delta_peak;
+		e->delta_diff = rs.delta_diff;
+		e->agc_total_gain = rs.agc_total_gain;
+		e->agc_mb_gain = rs.agc_mb_gain;
+		e->radar_subchan_mask = rs.radar_subchan_mask;
+		e->pulse_height = rs.pulse_height;
+		e->triggering_agc_event = rs.triggering_agc_event;
+		e->pulse_rssi = rs.pulse_rssi;
+		e->radar_fft_pri80_inband_power =
+				rs.radar_fft_pri80_inband_power;
+		e->radar_fft_ext80_inband_power =
+				rs.radar_fft_ext80_inband_power;
+		e->rsu_version = rs.rsu_version;
+		e->peak_mag = rsfr.peak_mag;
+	}
 	/*
 	 * XXX TODO: add a "chirp detection enabled" capability or config
 	 * bit somewhere, in case for some reason the hardware chirp

+ 48 - 0
core/sap/dfs/src/dfs_process_phyerr.c

@@ -560,6 +560,9 @@ dfs_process_phyerr(struct ieee80211com *ic, void *buf, uint16_t datalen,
 					      r_fulltsf, &e,
 					      enable_log) == 0) {
 			dfs->dfs_phyerr_reject_count++;
+			QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
+				  "%s:Rejected phyerr count after parsing=%d\n",
+				  __func__, dfs->dfs_phyerr_reject_count);
 			return;
 		} else {
 			if (dfs->dfs_phyerr_freq_min > e.freq)
@@ -737,6 +740,22 @@ dfs_process_phyerr(struct ieee80211com *ic, void *buf, uint16_t datalen,
 		event->re_chanindex = dfs->dfs_curchan_radindex;
 		event->re_flags = 0;
 		event->sidx = e.sidx;
+		if (e.rsu_version == DFS_RADAR_SUMMARY_REPORT_VERSION_3) {
+			event->delta_peak = e.delta_peak;
+			event->delta_diff = e.delta_diff;
+			event->agc_total_gain = e.agc_total_gain;
+			event->agc_mb_gain = e.agc_mb_gain;
+			event->radar_subchan_mask = e.radar_subchan_mask;
+			event->pulse_height = e.pulse_height;
+			event->triggering_agc_event = e.triggering_agc_event;
+			event->pulse_rssi = e.pulse_rssi;
+			event->radar_fft_pri80_inband_power =
+					e.radar_fft_pri80_inband_power;
+			event->radar_fft_ext80_inband_power =
+					e.radar_fft_ext80_inband_power;
+			event->rsu_version = e.rsu_version;
+			event->peak_mag = e.peak_mag;
+		}
 		/*
 		 * Copy the segment ID of the phyerror
 		 * from the radar summary report only
@@ -825,6 +844,35 @@ dfs_process_phyerr(struct ieee80211com *ic, void *buf, uint16_t datalen,
 			event->re_ts = (e.rs_tstamp) & DFS_TSMASK;
 			event->re_rssi = e.rssi;
 			event->sidx = e.sidx;
+			if (e.rsu_version ==
+				DFS_RADAR_SUMMARY_REPORT_VERSION_3) {
+				event->delta_peak = e.delta_peak;
+				event->delta_diff = e.delta_diff;
+				event->agc_total_gain = e.agc_total_gain;
+				event->agc_mb_gain = e.agc_mb_gain;
+				event->radar_subchan_mask = e.radar_subchan_mask;
+				event->pulse_height = e.pulse_height;
+				event->triggering_agc_event =
+						e.triggering_agc_event;
+				event->pulse_rssi = e.pulse_rssi;
+				event->radar_fft_pri80_inband_power =
+						e.radar_fft_pri80_inband_power;
+				event->radar_fft_ext80_inband_power =
+						e.radar_fft_ext80_inband_power;
+				event->rsu_version = e.rsu_version;
+				event->phyerr_serial_num =
+						dfs->dfs_phyerr_queued_count;
+				event->peak_mag = e.peak_mag;
+			}
+			/*
+			 * Copy the segment ID of the phyerror
+			 * from the radar summary report only
+			 * if SAP is operating in 80p80 mode
+			 * and both primary and extension segments
+			 * are DFS.
+			 */
+			if (chan->ic_80p80_both_dfs)
+				event->radar_80p80_segid = e.radar_80p80_segid;
 
 			/*
 			 * Handle chirp flags.

+ 25 - 10
core/sap/dfs/src/dfs_process_radarevent.c

@@ -115,8 +115,6 @@ static inline uint8_t dfs_process_pulse_dur(struct ath_dfs *dfs, uint8_t re_dur)
 int dfs_process_radarevent(struct ath_dfs *dfs,
 				struct dfs_ieee80211_channel *chan)
 {
-/* commenting for now to validate radar indication msg to SAP */
-/* #if 0 */
 	struct dfs_event re, *event;
 	struct dfs_state *rs = NULL;
 	struct dfs_filtertype *ft;
@@ -129,9 +127,7 @@ int dfs_process_radarevent(struct ath_dfs *dfs,
 	struct dfs_pulseline *pl;
 	static uint32_t diff_ts;
 	int ext_chan_event_flag = 0;
-#if 0
-	int pri_multiplier = 2;
-#endif
+	int is_hw_chirp = 0;
 	int i;
 	int seg_id = DFS_80P80_SEG0;
 	struct dfs_delayline *dl;
@@ -404,11 +400,30 @@ int dfs_process_radarevent(struct ath_dfs *dfs,
 			dfs->radar_log[i].dur = re.re_dur;
 			dfs->dfs_event_log_count++;
 		}
-		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
-			  "%s[%d]:xxxxx ts =%u re.re_dur=%u re.re_rssi =%u diff =%u pl->pl_lastelem.p_time=%llu xxxxx",
-			  __func__, __LINE__, (uint32_t) this_ts, re.re_dur,
-			  re.re_rssi, diff_ts,
-			  (unsigned long long)pl->pl_elems[index].p_time);
+		if (re.rsu_version == DFS_RADAR_SUMMARY_REPORT_VERSION_3) {
+			if ((re.re_flags & DFS_EVENT_HW_CHIRP) ==
+							DFS_EVENT_HW_CHIRP)
+				is_hw_chirp = 1;
+
+			QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
+				  "\n %s[%d]:PHYERR# = %d ts = %u  diff_ts = %u ppdu_rssi = %u dur = %u is_hw_chirp = %d segid = %d sidx = %d peak_mag = %d delta_peak = %d delta_diff = %d agc_total_gain = %d agc_mb_gain = %d radar_subchan_mask = 0x%x pulse_height = %d triggering_agc_event = %d rs_pulse_rssi = %d pri80_inband_power = %d ext80_inband_power = %d \n",
+				  __func__, __LINE__,
+				  re.phyerr_serial_num, (uint32_t) this_ts,
+				  diff_ts, re.re_rssi, re.re_dur, is_hw_chirp,
+				  re.radar_80p80_segid, re.sidx, re.peak_mag,
+				  re.delta_peak, re.delta_diff,
+				  re.agc_total_gain, re.agc_mb_gain,
+				  re.radar_subchan_mask, re.pulse_height,
+				  re.triggering_agc_event, re.pulse_rssi,
+				  re.radar_fft_pri80_inband_power,
+				  re.radar_fft_ext80_inband_power);
+		} else {
+			QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
+				  "%s[%d]:xxxxx ts =%u re.re_dur=%u re.re_rssi =%u diff =%u pl->pl_lastelem.p_time=%llu xxxxx",
+				  __func__, __LINE__, (uint32_t) this_ts, re.re_dur,
+				  re.re_rssi, diff_ts,
+				  (unsigned long long)pl->pl_elems[index].p_time);
+		}
 
 		/* If diff_ts is very small, we might be getting false pulse detects
 		 * due to heavy interference. We might be getting spectral splatter