@@ -3269,6 +3269,7 @@ enum nl80211_he_ru_alloc {
NL80211_RATE_INFO_HE_RU_ALLOC_484,
NL80211_RATE_INFO_HE_RU_ALLOC_996,
NL80211_RATE_INFO_HE_RU_ALLOC_2x996,
+ NL80211_RATE_INFO_HE_RU_ALLOC_LAST /* new entries before this */
};
/**
@@ -295,6 +295,17 @@ config MAC80211_DEBUG_COUNTERS
If unsure, say N.
+config MAC80211_DEBUG_STA_COUNTERS
+ bool "Extra Station TX/RX statistics"
+ depends on MAC80211_DEBUG_MENU
+ depends on MAC80211_DEBUGFS
+ help
+ Selecting this option causes mac80211 to keep additional
+ and very verbose station-specific TX and RX statistics
+ These will be exposed in debugfs.
+
+ If unsure, say N.
+
config MAC80211_STA_HASH_MAX_SIZE
int "Station hash table maximum size" if MAC80211_DEBUG_MENU
default 0
@@ -181,6 +181,37 @@ static ssize_t sta_stats_read(struct file *file, char __user *userbuf,
PRINT_MY_STATS(tmp, rx_stats.msdu[i]);
}
+#ifdef CONFIG_MAC80211_DEBUG_STA_COUNTERS
+ PRINT_MY_STATS("rx-bw-20", rx_stats.msdu_20);
+ PRINT_MY_STATS("rx-bw-40", rx_stats.msdu_40);
+ PRINT_MY_STATS("rx-bw-80", rx_stats.msdu_80);
+ PRINT_MY_STATS("rx-bw-160", rx_stats.msdu_160);
+
+ PRINT_MY_STATS("rx-he-total", rx_stats.msdu_he_tot);
+ PRINT_MY_STATS("rx-he-mu", rx_stats.msdu_he_mu);
+ PRINT_MY_STATS("rx-vht", rx_stats.msdu_vht);
+ PRINT_MY_STATS("rx-ht", rx_stats.msdu_ht);
+ PRINT_MY_STATS("rx-legacy", rx_stats.msdu_legacy);
+
+ PRINT_MY_STATS("rx-he-ru-alloc[ 26]", rx_stats.msdu_he_ru_alloc[NL80211_RATE_INFO_HE_RU_ALLOC_26]);
+ PRINT_MY_STATS("rx-he-ru-alloc[ 52]", rx_stats.msdu_he_ru_alloc[NL80211_RATE_INFO_HE_RU_ALLOC_52]);
+ PRINT_MY_STATS("rx-he-ru-alloc[ 106]", rx_stats.msdu_he_ru_alloc[NL80211_RATE_INFO_HE_RU_ALLOC_106]);
+ PRINT_MY_STATS("rx-he-ru-alloc[ 242]", rx_stats.msdu_he_ru_alloc[NL80211_RATE_INFO_HE_RU_ALLOC_242]);
+ PRINT_MY_STATS("rx-he-ru-alloc[ 484]", rx_stats.msdu_he_ru_alloc[NL80211_RATE_INFO_HE_RU_ALLOC_484]);
+ PRINT_MY_STATS("rx-he-ru-alloc[ 996]", rx_stats.msdu_he_ru_alloc[NL80211_RATE_INFO_HE_RU_ALLOC_996]);
+ PRINT_MY_STATS("rx-he-ru-alloc[2x996]", rx_stats.msdu_he_ru_alloc[NL80211_RATE_INFO_HE_RU_ALLOC_2x996]);
+
+ for (i = 0; i<8; i++) {
+ sprintf(tmp, "rx-msdu-nss[%i]", i);
+ PRINT_MY_STATS(tmp, rx_stats.msdu_nss[i]);
+ }
+
+ for (i = 0; i<32; i++) {
+ sprintf(tmp, "rx-rate-idx[%3i]", i);
+ PRINT_MY_STATS(tmp, rx_stats.msdu_rate_idx[i]);
+ }
+#endif
+
#undef PRINT_MY_STATS
done:
i = simple_read_from_buffer(userbuf, count, ppos, buf, strlen(buf));
@@ -1732,6 +1732,52 @@ static void ieee80211_update_data_rx_stats(struct ieee80211_rx_data *rx,
stats->msdu[rx->seqno_idx]++;
stats->bytes += skb_len;
u64_stats_update_end(&stats->syncp);
+
+#ifdef CONFIG_MAC80211_DEBUG_STA_COUNTERS
+ /* This code has a lot in common with ieee80211_add_rx_radiotap_header */
+ switch (status->bw) {
+ case RATE_INFO_BW_20:
+ stats->msdu_20++;
+ break;
+ case RATE_INFO_BW_40:
+ stats->msdu_40++;
+ break;
+ case RATE_INFO_BW_80:
+ stats->msdu_80++;
+ break;
+ case RATE_INFO_BW_160:
+ stats->msdu_160++;
+ break;
+ case RATE_INFO_BW_HE_RU:
+ stats->msdu_he_ru_alloc[status->he_ru]++;
+ break;
+ };
+
+ if (status->encoding == RX_ENC_HE) {
+ stats->msdu_he_tot++;
+ if (status->flag & RX_FLAG_RADIOTAP_HE_MU)
+ stats->msdu_he_mu++;
+ }
+ else if (status->encoding == RX_ENC_VHT) {
+ stats->msdu_vht++;
+ }
+ else if (status->encoding == RX_ENC_HT) {
+ stats->msdu_ht++;
+ }
+ else {
+ stats->msdu_legacy++;
+ }
+
+ if (status->nss >= 7)
+ stats->msdu_nss[7]++;
+ else
+ stats->msdu_nss[status->nss]++;
+
+ if (status->rate_idx >= 31)
+ stats->msdu_rate_idx[31]++;
+ else
+ stats->msdu_rate_idx[status->rate_idx]++;
+#endif
}
static ieee80211_rx_result debug_noinline
@@ -2680,6 +2680,23 @@ void sta_accum_rx_stats(struct sta_info *sta,
for (i = 0; i<=IEEE80211_NUM_TIDS; i++) {
rx_stats->msdu[i] += sta_get_tidstats_msdu(cpurxs, i);
}
+#ifdef CONFIG_MAC80211_DEBUG_STA_COUNTERS
+ rx_stats->msdu_20 += cpurxs->msdu_20;
+ rx_stats->msdu_40 += cpurxs->msdu_40;
+ rx_stats->msdu_80 += cpurxs->msdu_80;
+ rx_stats->msdu_160 += cpurxs->msdu_160;
+ for (i = 0; i<NL80211_RATE_INFO_HE_RU_ALLOC_LAST; i++)
+ rx_stats->msdu_he_ru_alloc[i] += cpurxs->msdu_he_ru_alloc[i];
+ rx_stats->msdu_he_tot += cpurxs->msdu_he_tot;
+ rx_stats->msdu_he_mu += cpurxs->msdu_he_mu;
+ rx_stats->msdu_vht += cpurxs->msdu_vht;
+ rx_stats->msdu_ht += cpurxs->msdu_ht;
+ rx_stats->msdu_legacy += cpurxs->msdu_legacy;
+ for (i = 0; i<8; i++)
+ rx_stats->msdu_nss[i] += cpurxs->msdu_nss[i];
+ for (i = 0; i<32; i++)
+ rx_stats->msdu_rate_idx[i] += cpurxs->msdu_rate_idx[i];
+#endif
}
}
@@ -436,6 +436,24 @@ struct ieee80211_sta_rx_stats {
struct u64_stats_sync syncp;
u64 bytes;
u64 msdu[IEEE80211_NUM_TIDS + 1];
+
+#ifdef CONFIG_MAC80211_DEBUG_STA_COUNTERS
+ /* these take liberty with how things are defined, and are
+ * designed to give a rough idea of how things are going.
+ */
+ u32 msdu_20;
+ u32 msdu_40;
+ u32 msdu_80;
+ u32 msdu_160;
+ u32 msdu_he_ru_alloc[NL80211_RATE_INFO_HE_RU_ALLOC_LAST];
+ u32 msdu_he_tot;
+ u32 msdu_he_mu;
+ u32 msdu_vht;
+ u32 msdu_ht;
+ u32 msdu_legacy;
+ u32 msdu_nss[8];
+ u32 msdu_rate_idx[32];
+#endif
};
/*