From 151c4bb3d6d23c1145b560458c57a5de9a421b22 Mon Sep 17 00:00:00 2001 From: Edayilliam Jayadev Date: Fri, 9 Aug 2019 15:15:11 +0530 Subject: [PATCH] qcacmn: Extend timestamp WAR for agile mode Target will be sharing the time taken for reset in the first Spectral report after reset. The reset delay value is common for all the Spectral modes. Host updates the timestamp WAR offset variable for all the Spectral modes. CRs-Fixed: 2504798 Change-Id: If7d47a434054f220b0717f7d8939f9f8922af30f --- target_if/spectral/target_if_spectral.c | 9 ++++----- target_if/spectral/target_if_spectral.h | 4 ++-- target_if/spectral/target_if_spectral_phyerr.c | 18 ++++++++++++++---- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/target_if/spectral/target_if_spectral.c b/target_if/spectral/target_if_spectral.c index 70ae22a771d8..638b7aee8e6b 100644 --- a/target_if/spectral/target_if_spectral.c +++ b/target_if/spectral/target_if_spectral.c @@ -2013,8 +2013,6 @@ target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev) spectral->inband_fftbin_size_adj = 0; spectral->null_fftbin_adj = 0; } - spectral->last_fft_timestamp = 0; - spectral->timestamp_war_offset = 0; if ((target_type == TARGET_TYPE_QCA8074) || (target_type == TARGET_TYPE_QCA8074V2) || @@ -2053,6 +2051,8 @@ target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev) /* Spectral mode specific init */ for (; smode < SPECTRAL_SCAN_MODE_MAX; smode++) { + spectral->last_fft_timestamp[smode] = 0; + spectral->timestamp_war_offset[smode] = 0; spectral->params_valid[smode] = false; qdf_spinlock_create(&spectral->param_info[smode].osps_lock); spectral->param_info[smode].osps_cache.osc_is_valid = 0; @@ -2655,9 +2655,8 @@ target_if_spectral_scan_enable_params(struct target_if_spectral *spectral, if (!p_sops->is_spectral_active(spectral, smode)) { p_sops->configure_spectral(spectral, spectral_params, smode); p_sops->start_spectral_scan(spectral, smode, err); - spectral->timestamp_war_offset = 0; - spectral->last_fft_timestamp = 0; - } else { + spectral->timestamp_war_offset[smode] = 0; + spectral->last_fft_timestamp[smode] = 0; } /* get current spectral configuration */ diff --git a/target_if/spectral/target_if_spectral.h b/target_if/spectral/target_if_spectral.h index e718b817eb1f..bf56bb587bb0 100644 --- a/target_if/spectral/target_if_spectral.h +++ b/target_if/spectral/target_if_spectral.h @@ -911,8 +911,8 @@ struct target_if_spectral { u_int8_t null_fftbin_adj; enum spectral_160mhz_report_delivery_state state_160mhz_delivery; void *spectral_report_cache; - uint32_t last_fft_timestamp; - uint32_t timestamp_war_offset; + uint32_t last_fft_timestamp[SPECTRAL_SCAN_MODE_MAX]; + uint32_t timestamp_war_offset[SPECTRAL_SCAN_MODE_MAX]; uint16_t fft_size_min; uint16_t fft_size_max; }; diff --git a/target_if/spectral/target_if_spectral_phyerr.c b/target_if/spectral/target_if_spectral_phyerr.c index 997c23f58a4c..79e258486eb8 100644 --- a/target_if/spectral/target_if_spectral_phyerr.c +++ b/target_if/spectral/target_if_spectral_phyerr.c @@ -1654,12 +1654,22 @@ target_if_consume_spectral_report_gen3( } if (report->reset_delay) { - spectral->timestamp_war_offset += (report->reset_delay + - spectral->last_fft_timestamp); + enum spectral_scan_mode mode = + SPECTRAL_SCAN_MODE_NORMAL; + + /* Adjust the offset for all the Spectral modes. + * Target will be sending the non zero reset delay for + * the first Spectral report after reset. This delay is + * common for all the Spectral modes. + */ + for (; mode < SPECTRAL_SCAN_MODE_MAX; mode++) + spectral->timestamp_war_offset[mode] += + (report->reset_delay + + spectral->last_fft_timestamp[mode]); } tsf64 = p_sfft->timestamp; - spectral->last_fft_timestamp = p_sfft->timestamp; - tsf64 += spectral->timestamp_war_offset; + spectral->last_fft_timestamp[params.smode] = p_sfft->timestamp; + tsf64 += spectral->timestamp_war_offset[params.smode]; /* Take care of state transitions for 160 MHz and 80p80 */ if (spectral->ch_width == CH_WIDTH_160MHZ) {