Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nl80211: Add per peer statistics to compute FCS error rate

Add support for drivers to report the total number of MPDUs received
and the number of MPDUs received with an FCS error from a specific
peer. These counters will be incremented only when the TA of the
frame matches the MAC address of the peer irrespective of FCS
error.

It should be noted that the TA field in the frame might be corrupted
when there is an FCS error and TA matching logic would fail in such
cases. Hence, FCS error counter might not be fully accurate, but it can
provide help in detecting bad RX links in significant number of cases.
This FCS error counter without full accuracy can be used, e.g., to
trigger a kick-out of a connected client with a bad link in AP mode to
force such a client to roam to another AP.

Signed-off-by: Ankita Bajaj <bankita@codeaurora.org>
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Ankita Bajaj and committed by
Johannes Berg
0d4e14a3 bc847970

+17
+7
include/net/cfg80211.h
··· 1303 1303 * @ack_signal: signal strength (in dBm) of the last ACK frame. 1304 1304 * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has 1305 1305 * been sent. 1306 + * @rx_mpdu_count: number of MPDUs received from this station 1307 + * @fcs_err_count: number of packets (MPDUs) received from this station with 1308 + * an FCS error. This counter should be incremented only when TA of the 1309 + * received packet with an FCS error matches the peer MAC address. 1306 1310 */ 1307 1311 struct station_info { 1308 1312 u64 filled; ··· 1353 1349 struct cfg80211_tid_stats *pertid; 1354 1350 s8 ack_signal; 1355 1351 s8 avg_ack_signal; 1352 + 1353 + u32 rx_mpdu_count; 1354 + u32 fcs_err_count; 1356 1355 }; 1357 1356 1358 1357 #if IS_ENABLED(CONFIG_CFG80211)
+8
include/uapi/linux/nl80211.h
··· 3068 3068 * @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment 3069 3069 * @NL80211_STA_INFO_ACK_SIGNAL: signal strength of the last ACK frame(u8, dBm) 3070 3070 * @NL80211_STA_INFO_ACK_SIGNAL_AVG: avg signal strength of ACK frames (s8, dBm) 3071 + * @NL80211_STA_INFO_RX_MPDUS: total number of received packets (MPDUs) 3072 + * (u32, from this station) 3073 + * @NL80211_STA_INFO_FCS_ERROR_COUNT: total number of packets (MPDUs) received 3074 + * with an FCS error (u32, from this station). This count may not include 3075 + * some packets with an FCS error due to TA corruption. Hence this counter 3076 + * might not be fully accurate. 3071 3077 * @__NL80211_STA_INFO_AFTER_LAST: internal 3072 3078 * @NL80211_STA_INFO_MAX: highest possible station info attribute 3073 3079 */ ··· 3114 3108 NL80211_STA_INFO_PAD, 3115 3109 NL80211_STA_INFO_ACK_SIGNAL, 3116 3110 NL80211_STA_INFO_ACK_SIGNAL_AVG, 3111 + NL80211_STA_INFO_RX_MPDUS, 3112 + NL80211_STA_INFO_FCS_ERROR_COUNT, 3117 3113 3118 3114 /* keep last */ 3119 3115 __NL80211_STA_INFO_AFTER_LAST,
+2
net/wireless/nl80211.c
··· 4761 4761 PUT_SINFO_U64(RX_DROP_MISC, rx_dropped_misc); 4762 4762 PUT_SINFO_U64(BEACON_RX, rx_beacon); 4763 4763 PUT_SINFO(BEACON_SIGNAL_AVG, rx_beacon_signal_avg, u8); 4764 + PUT_SINFO(RX_MPDUS, rx_mpdu_count, u32); 4765 + PUT_SINFO(FCS_ERROR_COUNT, fcs_err_count, u32); 4764 4766 if (wiphy_ext_feature_isset(&rdev->wiphy, 4765 4767 NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT)) { 4766 4768 PUT_SINFO(ACK_SIGNAL, ack_signal, u8);