Jelajahi Sumber

qcacmn: Log Spectral FFT timestamp WAR parametrs

Log Spectral FFT timestamp WAR related parameters

Change-Id: I11e3107f41049e9fb05c3f9f7960279b88392598
CRs-Fixed: 2556803
Shwetha G K 5 tahun lalu
induk
melakukan
7887593414

+ 22 - 0
spectral/dispatcher/inc/spectral_ioctl.h

@@ -363,6 +363,22 @@ struct spectral_classifier_params {
  *                            if this is set. Applicable only if smode =
  *                            if this is set. Applicable only if smode =
  *                            SPECTRAL_SCAN_MODE_NORMAL and for 160/80+80 MHz
  *                            SPECTRAL_SCAN_MODE_NORMAL and for 160/80+80 MHz
  *                            Spectral operation.
  *                            Spectral operation.
+ * @last_raw_timestamp:       Previous FFT report's raw timestamp. In case of
+ *                            160Mhz it will be primary 80 segment's timestamp
+ *                            as both primary & secondary segment's timestamp
+ *                            are expected to be almost equal.
+ * @timestamp_war_offset:     Offset calculated based on reset_delay and
+ *                            last_raw_timestamp. It will be added to
+ *                            raw_timestamp to get spectral_tstamp.
+ * @raw_timestamp:            Actual FFT timestamp reported by HW on primary
+ *                            segment.
+ * @raw_timestamp_sec80:      Actual FFT timestamp reported by HW on sec80 MHz
+ *                            segment.
+ * @reset_delay:              Time gap between the last spectral report before
+ *                            reset and the end of reset. It is provided by FW
+ *                            via direct DMA framework.
+ * @target_reset_count:       Indicates the number of times target went through
+ *                            reset routine after spectral was enabled.
  */
  */
 struct spectral_samp_data {
 struct spectral_samp_data {
 	int16_t spectral_data_len;
 	int16_t spectral_data_len;
@@ -422,6 +438,12 @@ struct spectral_samp_data {
 	enum spectral_scan_mode spectral_mode;
 	enum spectral_scan_mode spectral_mode;
 	uint8_t spectral_pri80ind;
 	uint8_t spectral_pri80ind;
 	uint8_t spectral_pri80ind_sec80;
 	uint8_t spectral_pri80ind_sec80;
+	uint32_t last_raw_timestamp;
+	uint32_t timestamp_war_offset;
+	uint32_t raw_timestamp;
+	uint32_t raw_timestamp_sec80;
+	uint32_t reset_delay;
+	uint32_t target_reset_count;
 } __packed;
 } __packed;
 
 
 /**
 /**

+ 1 - 0
target_if/spectral/target_if_spectral.c

@@ -2147,6 +2147,7 @@ target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev)
 	target_if_init_spectral_ops(spectral);
 	target_if_init_spectral_ops(spectral);
 
 
 	/* Spectral mode specific init */
 	/* Spectral mode specific init */
+	spectral->target_reset_count = 0;
 	for (; smode < SPECTRAL_SCAN_MODE_MAX; smode++) {
 	for (; smode < SPECTRAL_SCAN_MODE_MAX; smode++) {
 		spectral->last_fft_timestamp[smode] = 0;
 		spectral->last_fft_timestamp[smode] = 0;
 		spectral->timestamp_war_offset[smode] = 0;
 		spectral->timestamp_war_offset[smode] = 0;

+ 21 - 2
target_if/spectral/target_if_spectral.h

@@ -843,6 +843,7 @@ struct spectral_param_properties {
  * @direct_dma_support: Whether Direct-DMA is supported on the current radio
  * @direct_dma_support: Whether Direct-DMA is supported on the current radio
  * @prev_tstamp: Timestamp of the previously received sample, which has to be
  * @prev_tstamp: Timestamp of the previously received sample, which has to be
  * compared with the current tstamp to check descrepancy
  * compared with the current tstamp to check descrepancy
+ * @target_reset_count: Number of times target excercised the reset routine
  */
  */
 struct target_if_spectral {
 struct target_if_spectral {
 	struct wlan_objmgr_pdev *pdev_obj;
 	struct wlan_objmgr_pdev *pdev_obj;
@@ -957,10 +958,11 @@ struct target_if_spectral {
 	uint32_t timestamp_war_offset[SPECTRAL_SCAN_MODE_MAX];
 	uint32_t timestamp_war_offset[SPECTRAL_SCAN_MODE_MAX];
 	uint16_t fft_size_min;
 	uint16_t fft_size_min;
 	uint16_t fft_size_max;
 	uint16_t fft_size_max;
-	bool  dbr_ring_debug;
-	bool  dbr_buff_debug;
+	bool dbr_ring_debug;
+	bool dbr_buff_debug;
 	bool direct_dma_support;
 	bool direct_dma_support;
 	uint32_t prev_tstamp;
 	uint32_t prev_tstamp;
+	uint32_t target_reset_count;
 };
 };
 
 
 /**
 /**
@@ -1012,6 +1014,17 @@ struct target_if_spectral {
  * channel switch - Software may choose to ignore the sample if this is set.
  * channel switch - Software may choose to ignore the sample if this is set.
  * Applicable only if smode = SPECTRAL_SCAN_MODE_NORMAL and for 160/80+80 MHz
  * Applicable only if smode = SPECTRAL_SCAN_MODE_NORMAL and for 160/80+80 MHz
  * Spectral operation.
  * Spectral operation.
+ * @last_raw_timestamp: Previous FFT report's raw timestamp. In case of 160MHz
+ * it will be primary 80 segment's timestamp as both primary & secondary
+ * segment's timestamps are expected to be almost equal
+ * @timestamp_war_offset: Offset calculated based on reset_delay and
+ * last_raw_stamp. It will be added to raw_timestamp to get tstamp.
+ * @raw_timestamp: FFT timestamp reported by HW on primary segment.
+ * @raw_timestamp_sec80: FFT timestamp reported by HW on secondary 80 segment.
+ * @reset_delay: Time gap between the last spectral report before reset and the
+ * end of reset.
+ * @target_reset_count: Indicates the the number of times the target went
+ * through reset routine after spectral was enabled.
  */
  */
 struct target_if_samp_msg_params {
 struct target_if_samp_msg_params {
 	int8_t      rssi;
 	int8_t      rssi;
@@ -1056,6 +1069,12 @@ struct target_if_samp_msg_params {
 	enum spectral_scan_mode smode;
 	enum spectral_scan_mode smode;
 	uint8_t pri80ind;
 	uint8_t pri80ind;
 	uint8_t pri80ind_sec80;
 	uint8_t pri80ind_sec80;
+	uint32_t last_raw_timestamp;
+	uint32_t timestamp_war_offset;
+	uint32_t raw_timestamp;
+	uint32_t raw_timestamp_sec80;
+	uint32_t reset_delay;
+	uint32_t target_reset_count;
 };
 };
 
 
 #ifdef WLAN_CONV_SPECTRAL_ENABLE
 #ifdef WLAN_CONV_SPECTRAL_ENABLE

+ 7 - 0
target_if/spectral/target_if_spectral_netlink.c

@@ -82,6 +82,11 @@ target_if_spectral_create_samp_msg(struct target_if_spectral *spectral,
 		samp_data->spectral_agc_total_gain = params->agc_total_gain;
 		samp_data->spectral_agc_total_gain = params->agc_total_gain;
 		samp_data->spectral_gainchange = params->gainchange;
 		samp_data->spectral_gainchange = params->gainchange;
 		samp_data->spectral_pri80ind = params->pri80ind;
 		samp_data->spectral_pri80ind = params->pri80ind;
+		samp_data->last_raw_timestamp = params->last_raw_timestamp;
+		samp_data->timestamp_war_offset = params->timestamp_war_offset;
+		samp_data->raw_timestamp = params->raw_timestamp;
+		samp_data->reset_delay = params->reset_delay;
+		samp_data->target_reset_count = params->target_reset_count;
 
 
 		samp_data->spectral_combined_rssi =
 		samp_data->spectral_combined_rssi =
 		    (uint8_t)params->rssi;
 		    (uint8_t)params->rssi;
@@ -192,6 +197,8 @@ target_if_spectral_create_samp_msg(struct target_if_spectral *spectral,
 		samp_data->spectral_max_mag_sec80 =
 		samp_data->spectral_max_mag_sec80 =
 		    params->max_mag_sec80;
 		    params->max_mag_sec80;
 
 
+		samp_data->raw_timestamp_sec80 = params->raw_timestamp_sec80;
+
 		/*
 		/*
 		 * Currently, we compute pwr_count_sec80 considering the size of
 		 * Currently, we compute pwr_count_sec80 considering the size of
 		 * the samp_data->bin_pwr_sec80 array rather than the number of
 		 * the samp_data->bin_pwr_sec80 array rather than the number of

+ 12 - 0
target_if/spectral/target_if_spectral_phyerr.c

@@ -1792,6 +1792,10 @@ target_if_consume_spectral_report_gen3(
 			}
 			}
 		}
 		}
 
 
+		params.last_raw_timestamp =
+				spectral->last_fft_timestamp[params.smode];
+		params.reset_delay = 0;
+
 		if (report->reset_delay) {
 		if (report->reset_delay) {
 			enum spectral_scan_mode mode =
 			enum spectral_scan_mode mode =
 						SPECTRAL_SCAN_MODE_NORMAL;
 						SPECTRAL_SCAN_MODE_NORMAL;
@@ -1805,8 +1809,14 @@ target_if_consume_spectral_report_gen3(
 				spectral->timestamp_war_offset[mode] +=
 				spectral->timestamp_war_offset[mode] +=
 					(report->reset_delay +
 					(report->reset_delay +
 					 spectral->last_fft_timestamp[mode]);
 					 spectral->last_fft_timestamp[mode]);
+			params.reset_delay = report->reset_delay;
+			spectral->target_reset_count++;
 		}
 		}
+		params.target_reset_count = spectral->target_reset_count;
+		params.timestamp_war_offset =
+				   spectral->timestamp_war_offset[params.smode];
 		tsf64 = p_sfft->timestamp;
 		tsf64 = p_sfft->timestamp;
+		params.raw_timestamp = tsf64;
 		spectral->last_fft_timestamp[params.smode] = p_sfft->timestamp;
 		spectral->last_fft_timestamp[params.smode] = p_sfft->timestamp;
 		tsf64 += spectral->timestamp_war_offset[params.smode];
 		tsf64 += spectral->timestamp_war_offset[params.smode];
 
 
@@ -1952,6 +1962,8 @@ target_if_consume_spectral_report_gen3(
 			}
 			}
 		}
 		}
 
 
+		params.raw_timestamp_sec80 = p_sfft->timestamp;
+
 		/* Take care of state transitions for 160 MHz and 80p80 */
 		/* Take care of state transitions for 160 MHz and 80p80 */
 		if (spectral->ch_width == CH_WIDTH_160MHZ) {
 		if (spectral->ch_width == CH_WIDTH_160MHZ) {
 			ret = target_if_160mhz_delivery_state_change(
 			ret = target_if_160mhz_delivery_state_change(