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
This commit is contained in:
Shwetha G K
2019-06-25 19:50:19 +05:30
committed by nshrivas
parent 8db4b4ac32
commit 389eae6224
2 changed files with 32 additions and 0 deletions

View File

@@ -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;
};
/**

View File

@@ -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;