Commit 9b99e665 authored by Simon Wunderlich's avatar Simon Wunderlich Committed by John W. Linville

ath9k: drop spectral packets after processing them

Spectral packets are "bogus" packets and should not be further evaluated
by the RX path.

Statistics are added to keep track of these packets.
Signed-off-by: default avatarSimon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: default avatarMathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 04ccd4a1
...@@ -895,6 +895,7 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf, ...@@ -895,6 +895,7 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf,
RXS_ERR("RX-Bytes-All", rx_bytes_all); RXS_ERR("RX-Bytes-All", rx_bytes_all);
RXS_ERR("RX-Beacons", rx_beacons); RXS_ERR("RX-Beacons", rx_beacons);
RXS_ERR("RX-Frags", rx_frags); RXS_ERR("RX-Frags", rx_frags);
RXS_ERR("RX-Spectral", rx_spectral);
if (len > size) if (len > size)
len = size; len = size;
......
...@@ -219,6 +219,7 @@ struct ath_tx_stats { ...@@ -219,6 +219,7 @@ struct ath_tx_stats {
* @rx_too_many_frags_err: Frames dropped due to too-many-frags received. * @rx_too_many_frags_err: Frames dropped due to too-many-frags received.
* @rx_beacons: No. of beacons received. * @rx_beacons: No. of beacons received.
* @rx_frags: No. of rx-fragements received. * @rx_frags: No. of rx-fragements received.
* @rx_spectral: No of spectral packets received.
*/ */
struct ath_rx_stats { struct ath_rx_stats {
u32 rx_pkts_all; u32 rx_pkts_all;
...@@ -237,6 +238,7 @@ struct ath_rx_stats { ...@@ -237,6 +238,7 @@ struct ath_rx_stats {
u32 rx_too_many_frags_err; u32 rx_too_many_frags_err;
u32 rx_beacons; u32 rx_beacons;
u32 rx_frags; u32 rx_frags;
u32 rx_spectral;
}; };
struct ath_stats { struct ath_stats {
......
...@@ -1023,9 +1023,9 @@ static s8 fix_rssi_inv_only(u8 rssi_val) ...@@ -1023,9 +1023,9 @@ static s8 fix_rssi_inv_only(u8 rssi_val)
return (s8) rssi_val; return (s8) rssi_val;
} }
/* returns 1 if this was a spectral frame, even if not handled. */
static void ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr, static int ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr,
struct ath_rx_status *rs, u64 tsf) struct ath_rx_status *rs, u64 tsf)
{ {
#ifdef CONFIG_ATH_DEBUG #ifdef CONFIG_ATH_DEBUG
struct ath_hw *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah;
...@@ -1044,7 +1044,14 @@ static void ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr, ...@@ -1044,7 +1044,14 @@ static void ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr,
if (rs->rs_phyerr != ATH9K_PHYERR_RADAR && if (rs->rs_phyerr != ATH9K_PHYERR_RADAR &&
rs->rs_phyerr != ATH9K_PHYERR_FALSE_RADAR_EXT && rs->rs_phyerr != ATH9K_PHYERR_FALSE_RADAR_EXT &&
rs->rs_phyerr != ATH9K_PHYERR_SPECTRAL) rs->rs_phyerr != ATH9K_PHYERR_SPECTRAL)
return; return 0;
/* check if spectral scan bit is set. This does not have to be checked
* if received through a SPECTRAL phy error, but shouldn't hurt.
*/
radar_info = ((struct ath_radar_info *)&vdata[len]) - 1;
if (!(radar_info->pulse_bw_info & SPECTRAL_SCAN_BITMASK))
return 0;
/* Variation in the data length is possible and will be fixed later. /* Variation in the data length is possible and will be fixed later.
* Note that we only support HT20 for now. * Note that we only support HT20 for now.
...@@ -1053,14 +1060,7 @@ static void ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr, ...@@ -1053,14 +1060,7 @@ static void ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr,
*/ */
if ((len > SPECTRAL_HT20_TOTAL_DATA_LEN + 2) || if ((len > SPECTRAL_HT20_TOTAL_DATA_LEN + 2) ||
(len < SPECTRAL_HT20_TOTAL_DATA_LEN - 1)) (len < SPECTRAL_HT20_TOTAL_DATA_LEN - 1))
return; return 1;
/* check if spectral scan bit is set. This does not have to be checked
* if received through a SPECTRAL phy error, but shouldn't hurt.
*/
radar_info = ((struct ath_radar_info *)&vdata[len]) - 1;
if (!(radar_info->pulse_bw_info & SPECTRAL_SCAN_BITMASK))
return;
fft_sample.tlv.type = ATH_FFT_SAMPLE_HT20; fft_sample.tlv.type = ATH_FFT_SAMPLE_HT20;
fft_sample.tlv.length = sizeof(fft_sample) - sizeof(fft_sample.tlv); fft_sample.tlv.length = sizeof(fft_sample) - sizeof(fft_sample.tlv);
...@@ -1093,7 +1093,7 @@ static void ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr, ...@@ -1093,7 +1093,7 @@ static void ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr,
memcpy(&bins[32], &vdata[33], SPECTRAL_HT20_NUM_BINS - 32); memcpy(&bins[32], &vdata[33], SPECTRAL_HT20_NUM_BINS - 32);
break; break;
default: default:
return; return 1;
} }
/* DC value (value in the middle) is the blind spot of the spectral /* DC value (value in the middle) is the blind spot of the spectral
...@@ -1115,6 +1115,9 @@ static void ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr, ...@@ -1115,6 +1115,9 @@ static void ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr,
fft_sample.tsf = tsf; fft_sample.tsf = tsf;
ath_debug_send_fft_sample(sc, &fft_sample.tlv); ath_debug_send_fft_sample(sc, &fft_sample.tlv);
return 1;
#else
return 0;
#endif #endif
} }
...@@ -1202,8 +1205,12 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) ...@@ -1202,8 +1205,12 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
unlikely(tsf_lower - rs.rs_tstamp > 0x10000000)) unlikely(tsf_lower - rs.rs_tstamp > 0x10000000))
rxs->mactime += 0x100000000ULL; rxs->mactime += 0x100000000ULL;
if ((rs.rs_status & ATH9K_RXERR_PHY)) if (rs.rs_status & ATH9K_RXERR_PHY) {
ath_process_fft(sc, hdr, &rs, rxs->mactime); if (ath_process_fft(sc, hdr, &rs, rxs->mactime)) {
RX_STAT_INC(rx_spectral);
goto requeue_drop_frag;
}
}
retval = ath9k_rx_skb_preprocess(common, hw, hdr, &rs, retval = ath9k_rx_skb_preprocess(common, hw, hdr, &rs,
rxs, &decrypt_error); rxs, &decrypt_error);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment