a1cdf99e05bbd9e117251402c208078b0f7e4aa0
[openwrt/staging/hauke.git] /
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Fri, 22 Jan 2021 18:21:13 +0100
3 Subject: [PATCH] mac80211: minstrel_ht: update total packets counter in tx
4 status path
5
6 Keep the update in one place and prepare for further rework
7
8 Signed-off-by: Felix Fietkau <nbd@nbd.name>
9 ---
10
11 --- a/net/mac80211/rc80211_minstrel_ht.c
12 +++ b/net/mac80211/rc80211_minstrel_ht.c
13 @@ -1093,6 +1093,16 @@ minstrel_ht_tx_status(void *priv, struct
14 info->status.ampdu_len = 1;
15 }
16
17 + /* wraparound */
18 + if (mi->total_packets >= ~0 - info->status.ampdu_len) {
19 + mi->total_packets = 0;
20 + mi->sample_packets = 0;
21 + }
22 +
23 + mi->total_packets += info->status.ampdu_len;
24 + if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
25 + mi->sample_packets += info->status.ampdu_len;
26 +
27 mi->ampdu_packets++;
28 mi->ampdu_len += info->status.ampdu_len;
29
30 @@ -1104,9 +1114,6 @@ minstrel_ht_tx_status(void *priv, struct
31 mi->sample_count--;
32 }
33
34 - if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
35 - mi->sample_packets += info->status.ampdu_len;
36 -
37 if (mi->sample_mode != MINSTREL_SAMPLE_IDLE)
38 rate_sample = minstrel_get_ratestats(mi, mi->sample_rate);
39
40 @@ -1504,14 +1511,6 @@ minstrel_ht_get_rate(void *priv, struct
41 else
42 sample_idx = minstrel_get_sample_rate(mp, mi);
43
44 - mi->total_packets++;
45 -
46 - /* wraparound */
47 - if (mi->total_packets == ~0) {
48 - mi->total_packets = 0;
49 - mi->sample_packets = 0;
50 - }
51 -
52 if (sample_idx < 0)
53 return;
54