diff --git a/target_if/spectral/target_if_spectral.h b/target_if/spectral/target_if_spectral.h index 73e9aae97c..11b970a7ab 100644 --- a/target_if/spectral/target_if_spectral.h +++ b/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; }; /** diff --git a/target_if/spectral/target_if_spectral_phyerr.c b/target_if/spectral/target_if_spectral_phyerr.c index 59d6a519f0..92df8666fe 100644 --- a/target_if/spectral/target_if_spectral_phyerr.c +++ b/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;