summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Kossifidis <mickflemm@gmail.com>2015-04-29 23:51:19 +0000
committerKalle Valo <kvalo@codeaurora.org>2015-05-09 16:46:16 +0300
commit6b8f85a9188321e59995d172efab9e97afd3906f (patch)
treeec659cf54345ddb54be064f280c6626bd95e2d30
parent9acc98b9ecf9d12bfc6e3f914f3fc446d49b8641 (diff)
downloadop-kernel-dev-6b8f85a9188321e59995d172efab9e97afd3906f.zip
op-kernel-dev-6b8f85a9188321e59995d172efab9e97afd3906f.tar.gz
ath9k: Skip FFT reports if we are out of output buffers
There is no reason to keep processing FFT reports if there is no space left on the relayfs buffers for the results. This saves lots of CPU cycles, especially on normal (non-short) reports. Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r--drivers/net/wireless/ath/ath9k/common-spectral.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c b/drivers/net/wireless/ath/ath9k/common-spectral.c
index b8682bc..4ab08ed 100644
--- a/drivers/net/wireless/ath/ath9k/common-spectral.c
+++ b/drivers/net/wireless/ath/ath9k/common-spectral.c
@@ -473,6 +473,24 @@ ath_cmn_copy_fft_frame(u8 *in, u8 *out, int sample_len, int sample_bytes)
}
}
+static int
+ath_cmn_is_fft_buf_full(struct ath_spec_scan_priv *spec_priv)
+{
+ int i = 0;
+ int ret = 0;
+ struct rchan *rc = spec_priv->rfs_chan_spec_scan;
+
+ for_each_online_cpu(i)
+ ret += relay_buf_full(rc->buf[i]);
+
+ i = num_online_cpus();
+
+ if (ret == i)
+ return 1;
+ else
+ return 0;
+}
+
/* returns 1 if this was a spectral frame, even if not handled. */
int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv, struct ieee80211_hdr *hdr,
struct ath_rx_status *rs, u64 tsf)
@@ -509,6 +527,16 @@ int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv, struct ieee80211_h
if (!(radar_info->pulse_bw_info & SPECTRAL_SCAN_BITMASK))
return 0;
+ /* Output buffers are full, no need to process anything
+ * since there is no space to put the result anyway
+ */
+ ret = ath_cmn_is_fft_buf_full(spec_priv);
+ if (ret == 1) {
+ ath_dbg(common, SPECTRAL_SCAN, "FFT report ignored, no space "
+ "left on output buffers\n");
+ return 1;
+ }
+
chan_type = cfg80211_get_chandef_type(&common->hw->conf.chandef);
if ((chan_type == NL80211_CHAN_HT40MINUS) ||
(chan_type == NL80211_CHAN_HT40PLUS)) {
OpenPOWER on IntegriCloud