Переглянути джерело

qcacmn: Support timestamp verification per-detector

Modify prev_tstamp variable in target_if_spectral
structure to an array and index it based on detector ID.
Also, modify target_if_spectral_verify_ts() to include
detector_id parameter and compare current timestamp with previously
received sample on per-detector level, to check discrepancy.

Change-Id: I9f6382909ac0661323db54f160f1350cb8bd8153
CRs-Fixed: 2945318
Jhalak Naik 4 роки тому
батько
коміт
2ae296f522

+ 4 - 0
target_if/spectral/target_if_spectral.h

@@ -1225,7 +1225,11 @@ struct target_if_spectral {
 	bool dbr_ring_debug;
 	bool dbr_buff_debug;
 	bool direct_dma_support;
+#ifdef OPTIMIZED_SAMP_MESSAGE
+	uint32_t prev_tstamp[MAX_DETECTORS_PER_PDEV];
+#else
 	uint32_t prev_tstamp;
+#endif
 	struct spectral_report_params rparams;
 	struct spectral_param_min_max param_min_max;
 	struct target_if_finite_spectral_scan_params

+ 32 - 0
target_if/spectral/target_if_spectral_phyerr.c

@@ -2188,6 +2188,29 @@ static void target_if_spectral_check_buffer_poisoning(
 	}
 }
 
+#ifdef OPTIMIZED_SAMP_MESSAGE
+static void target_if_spectral_verify_ts(struct target_if_spectral *spectral,
+					 uint8_t *buf, uint32_t current_ts,
+					 uint8_t detector_id)
+{
+	if (!spectral) {
+		spectral_err_rl("Spectral LMAC object is null");
+		return;
+	}
+
+	if (!spectral->dbr_buff_debug)
+		return;
+
+	if (spectral->prev_tstamp[detector_id]) {
+		if (current_ts == spectral->prev_tstamp[detector_id]) {
+			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[detector_id] = current_ts;
+}
+#else
 static void target_if_spectral_verify_ts(struct target_if_spectral *spectral,
 					 uint8_t *buf, uint32_t current_ts)
 {
@@ -2208,6 +2231,7 @@ static void target_if_spectral_verify_ts(struct target_if_spectral *spectral,
 	}
 	spectral->prev_tstamp = current_ts;
 }
+#endif /* OPTIMIZED_SAMP_MESSAGE */
 #else
 static void target_if_spectral_check_buffer_poisoning(
 	struct target_if_spectral *spectral,
@@ -2216,10 +2240,18 @@ static void target_if_spectral_check_buffer_poisoning(
 {
 }
 
+#ifdef OPTIMIZED_SAMP_MESSAGE
+static void target_if_spectral_verify_ts(struct target_if_spectral *spectral,
+					 uint8_t *buf, uint32_t current_ts,
+					 uint8_t detector_id)
+{
+}
+#else
 static void target_if_spectral_verify_ts(struct target_if_spectral *spectral,
 					 uint8_t *buf, uint32_t current_ts)
 {
 }
+#endif /* OPTIMIZED_SAMP_MESSAGE */
 #endif
 
 /**