aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnkita Bajaj <bankita@codeaurora.org>2018-09-27 11:01:57 -0400
committerJohannes Berg <johannes.berg@intel.com>2018-10-12 06:56:34 -0400
commit0d4e14a32dcab9c4bd559d02874120fbb86b1322 (patch)
tree32b79aceecd4d9bc56f93ee30a7ea3620248d6db
parentbc847970f43281cb07c9f7d0897ee08cd1e08cf3 (diff)
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>
-rw-r--r--include/net/cfg80211.h7
-rw-r--r--include/uapi/linux/nl80211.h8
-rw-r--r--net/wireless/nl80211.c2
3 files changed, 17 insertions, 0 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 0e16e723dcef..1fa41b7a1be3 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1303,6 +1303,10 @@ struct cfg80211_tid_stats {
1303 * @ack_signal: signal strength (in dBm) of the last ACK frame. 1303 * @ack_signal: signal strength (in dBm) of the last ACK frame.
1304 * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has 1304 * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
1305 * been sent. 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 */
1307struct station_info { 1311struct station_info {
1308 u64 filled; 1312 u64 filled;
@@ -1349,6 +1353,9 @@ struct station_info {
1349 struct cfg80211_tid_stats *pertid; 1353 struct cfg80211_tid_stats *pertid;
1350 s8 ack_signal; 1354 s8 ack_signal;
1351 s8 avg_ack_signal; 1355 s8 avg_ack_signal;
1356
1357 u32 rx_mpdu_count;
1358 u32 fcs_err_count;
1352}; 1359};
1353 1360
1354#if IS_ENABLED(CONFIG_CFG80211) 1361#if IS_ENABLED(CONFIG_CFG80211)
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index dc6d5a1ef470..6d610bae30a9 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -3068,6 +3068,12 @@ enum nl80211_sta_bss_param {
3068 * @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment 3068 * @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment
3069 * @NL80211_STA_INFO_ACK_SIGNAL: signal strength of the last ACK frame(u8, dBm) 3069 * @NL80211_STA_INFO_ACK_SIGNAL: signal strength of the last ACK frame(u8, dBm)
3070 * @NL80211_STA_INFO_ACK_SIGNAL_AVG: avg signal strength of ACK frames (s8, dBm) 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 * @__NL80211_STA_INFO_AFTER_LAST: internal 3077 * @__NL80211_STA_INFO_AFTER_LAST: internal
3072 * @NL80211_STA_INFO_MAX: highest possible station info attribute 3078 * @NL80211_STA_INFO_MAX: highest possible station info attribute
3073 */ 3079 */
@@ -3108,6 +3114,8 @@ enum nl80211_sta_info {
3108 NL80211_STA_INFO_PAD, 3114 NL80211_STA_INFO_PAD,
3109 NL80211_STA_INFO_ACK_SIGNAL, 3115 NL80211_STA_INFO_ACK_SIGNAL,
3110 NL80211_STA_INFO_ACK_SIGNAL_AVG, 3116 NL80211_STA_INFO_ACK_SIGNAL_AVG,
3117 NL80211_STA_INFO_RX_MPDUS,
3118 NL80211_STA_INFO_FCS_ERROR_COUNT,
3111 3119
3112 /* keep last */ 3120 /* keep last */
3113 __NL80211_STA_INFO_AFTER_LAST, 3121 __NL80211_STA_INFO_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 758bb069d000..744b5851bbf9 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4761,6 +4761,8 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid,
4761 PUT_SINFO_U64(RX_DROP_MISC, rx_dropped_misc); 4761 PUT_SINFO_U64(RX_DROP_MISC, rx_dropped_misc);
4762 PUT_SINFO_U64(BEACON_RX, rx_beacon); 4762 PUT_SINFO_U64(BEACON_RX, rx_beacon);
4763 PUT_SINFO(BEACON_SIGNAL_AVG, rx_beacon_signal_avg, u8); 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 if (wiphy_ext_feature_isset(&rdev->wiphy, 4766 if (wiphy_ext_feature_isset(&rdev->wiphy,
4765 NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT)) { 4767 NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT)) {
4766 PUT_SINFO(ACK_SIGNAL, ack_signal, u8); 4768 PUT_SINFO(ACK_SIGNAL, ack_signal, u8);