瀏覽代碼

qcacmn: Check discrepancies in Spectral timestamps

If the timestamp field in the current Spectral report is equal to the
timestamp field in the previous report, assert the FW.

Change-Id: Idb32807f0cdd59a2eaab5dd6c1e62567fd5a45d0
CRs-Fixed: 2478593
Shwetha G K 5 年之前
父節點
當前提交
389eae6224
共有 2 個文件被更改,包括 32 次插入0 次删除
  1. 3 0
      target_if/spectral/target_if_spectral.h
  2. 29 0
      target_if/spectral/target_if_spectral_phyerr.c

+ 3 - 0
target_if/spectral/target_if_spectral.h

@@ -841,6 +841,8 @@ struct spectral_param_properties {
  * @dbr_ring_debug: Whether Spectral DBR ring debug is enabled
  * @dbr_buff_debug: Whether Spectral DBR buffer debug is enabled
  * @direct_dma_support: Whether Direct-DMA is supported on the current radio
+ * @prev_tstamp: Timestamp of the previously received sample, which has to be
+ * compared with the current tstamp to check descrepancy
  */
 struct target_if_spectral {
 	struct wlan_objmgr_pdev *pdev_obj;
@@ -958,6 +960,7 @@ struct target_if_spectral {
 	bool  dbr_ring_debug;
 	bool  dbr_buff_debug;
 	bool direct_dma_support;
+	uint32_t prev_tstamp;
 };
 
 /**

+ 29 - 0
target_if/spectral/target_if_spectral_phyerr.c

@@ -1603,6 +1603,27 @@ static void target_if_spectral_check_buffer_poisoning(
 		target_if_spectral_fw_hang(spectral);
 	}
 }
+
+static void target_if_spectral_verify_ts(struct target_if_spectral *spectral,
+					 uint8_t *buf, uint32_t current_ts)
+{
+	if (!spectral) {
+		spectral_err_rl("Spectral LMAC object is null");
+		return;
+	}
+
+	if (!spectral->dbr_buff_debug)
+		return;
+
+	if (spectral->prev_tstamp) {
+		if (current_ts == spectral->prev_tstamp) {
+			spectral_err("Spectral timestamp(%u) in the current buffer(%pK) is equal to the previous timestamp, same report DMAed twice? Asserting the FW",
+				     current_ts, buf);
+			target_if_spectral_fw_hang(spectral);
+		}
+	}
+	spectral->prev_tstamp = current_ts;
+}
 #else
 static void target_if_spectral_check_buffer_poisoning(
 	struct target_if_spectral *spectral,
@@ -1610,6 +1631,11 @@ static void target_if_spectral_check_buffer_poisoning(
 	int num_fft_bins, enum spectral_scan_mode smode)
 {
 }
+
+static void target_if_spectral_verify_ts(struct target_if_spectral *spectral,
+					 uint8_t *buf, uint32_t current_ts)
+{
+}
 #endif
 
 int
@@ -1840,6 +1866,9 @@ target_if_consume_spectral_report_gen3(
 		params.datalen           = (fft_hdr_length * 4);
 		params.pwr_count         = fft_bin_len;
 		params.tstamp            = (tsf64 & SPECTRAL_TSMASK);
+
+		target_if_spectral_verify_ts(spectral, report->data,
+					     params.tstamp);
 	} else if (is_secondaryseg_expected(spectral)) {
 		/* RSSI is in 1/2 dBm steps, Covert it to dBm scale */
 		rssi = (sscan_report_fields.inband_pwr_db) >> 1;