Skip to content

Commit 906a5a8

Browse files
Sarika Sharmajmberg-intel
authored andcommitted
wifi: mac80211: add tx_handlers_drop statistics to ethtool
Currently tx_handlers_drop statistics are handled only for slow TX path and only at radio level. This also requires CONFIG_MAC80211_DEBUG_COUNTERS to be enabled to account the dropped packets. There is no way to check these stats for fast TX, at interface level and monitor without enabling the debug configuration. Hence, add a new counter at the sdata level to track packets dropped with reason as TX_DROP during transmission for fast path, slow path and other tx management packets. Expose this via ethtool statistics, to improve visibility into transmission failures at interface level and aid debugging and performance monitoring. Place the counter in ethtool with other available tx_* stats for better readability and accurate tracking. Sample output: root@buildroot:~# ethtool -S wlan0 NIC statistics: rx_packets: 5904 rx_bytes: 508122 rx_duplicates: 12 rx_fragments: 5900 rx_dropped: 12 tx_packets: 391487 tx_bytes: 600423383 tx_filtered: 0 tx_retry_failed: 10332 tx_retries: 1548 tx_handlers_drop: 4 .... Co-developed-by: Hari Chandrakanthan <[email protected]> Signed-off-by: Hari Chandrakanthan <[email protected]> Signed-off-by: Sarika Sharma <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent eebccbf commit 906a5a8

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

net/mac80211/ethtool.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
4848
"rx_duplicates", "rx_fragments", "rx_dropped",
4949
"tx_packets", "tx_bytes",
5050
"tx_filtered", "tx_retry_failed", "tx_retries",
51-
"sta_state", "txrate", "rxrate", "signal",
52-
"channel", "noise", "ch_time", "ch_time_busy",
51+
"tx_handlers_drop", "sta_state", "txrate", "rxrate",
52+
"signal", "channel", "noise", "ch_time", "ch_time_busy",
5353
"ch_time_ext_busy", "ch_time_rx", "ch_time_tx"
5454
};
5555
#define STA_STATS_LEN ARRAY_SIZE(ieee80211_gstrings_sta_stats)
@@ -120,6 +120,7 @@ static void ieee80211_get_stats(struct net_device *dev,
120120
i = 0;
121121
ADD_STA_STATS(&sta->deflink);
122122

123+
data[i++] = sdata->tx_handlers_drop;
123124
data[i++] = sta->sta_state;
124125

125126

@@ -145,6 +146,7 @@ static void ieee80211_get_stats(struct net_device *dev,
145146
sta_set_sinfo(sta, &sinfo, false);
146147
i = 0;
147148
ADD_STA_STATS(&sta->deflink);
149+
data[i++] = sdata->tx_handlers_drop;
148150
}
149151
}
150152

net/mac80211/ieee80211_i.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,6 +1218,7 @@ struct ieee80211_sub_if_data {
12181218
} debugfs;
12191219
#endif
12201220

1221+
u32 tx_handlers_drop;
12211222
/* must be last, dynamically sized area in this! */
12221223
struct ieee80211_vif vif;
12231224
};

net/mac80211/tx.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1814,6 +1814,7 @@ static int invoke_tx_handlers_early(struct ieee80211_tx_data *tx)
18141814

18151815
txh_done:
18161816
if (unlikely(res == TX_DROP)) {
1817+
tx->sdata->tx_handlers_drop++;
18171818
I802_DEBUG_INC(tx->local->tx_handlers_drop);
18181819
if (tx->skb)
18191820
ieee80211_free_txskb(&tx->local->hw, tx->skb);
@@ -1858,6 +1859,7 @@ static int invoke_tx_handlers_late(struct ieee80211_tx_data *tx)
18581859

18591860
txh_done:
18601861
if (unlikely(res == TX_DROP)) {
1862+
tx->sdata->tx_handlers_drop++;
18611863
I802_DEBUG_INC(tx->local->tx_handlers_drop);
18621864
if (tx->skb)
18631865
ieee80211_free_txskb(&tx->local->hw, tx->skb);
@@ -1942,6 +1944,7 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
19421944

19431945
if (unlikely(res_prepare == TX_DROP)) {
19441946
ieee80211_free_txskb(&local->hw, skb);
1947+
tx.sdata->tx_handlers_drop++;
19451948
return true;
19461949
} else if (unlikely(res_prepare == TX_QUEUED)) {
19471950
return true;
@@ -3728,8 +3731,10 @@ void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
37283731
r = ieee80211_xmit_fast_finish(sdata, sta, fast_tx->pn_offs,
37293732
fast_tx->key, &tx);
37303733
tx.skb = NULL;
3731-
if (r == TX_DROP)
3734+
if (r == TX_DROP) {
3735+
tx.sdata->tx_handlers_drop++;
37323736
goto free;
3737+
}
37333738

37343739
if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
37353740
sdata = container_of(sdata->bss,

0 commit comments

Comments
 (0)