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

mac80211: minstrel_ht: update total packets counter in tx status path

Keep the update in one place and prepare for further rework

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://lore.kernel.org/r/20210127055735.78599-2-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Felix Fietkau and committed by
Johannes Berg
2012a2f7 a42fa256

+10 -11
+10 -11
net/mac80211/rc80211_minstrel_ht.c
··· 1092 1092 info->status.ampdu_len = 1; 1093 1093 } 1094 1094 1095 + /* wraparound */ 1096 + if (mi->total_packets >= ~0 - info->status.ampdu_len) { 1097 + mi->total_packets = 0; 1098 + mi->sample_packets = 0; 1099 + } 1100 + 1101 + mi->total_packets += info->status.ampdu_len; 1102 + if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) 1103 + mi->sample_packets += info->status.ampdu_len; 1104 + 1095 1105 mi->ampdu_packets++; 1096 1106 mi->ampdu_len += info->status.ampdu_len; 1097 1107 ··· 1112 1102 mi->sample_tries = 1; 1113 1103 mi->sample_count--; 1114 1104 } 1115 - 1116 - if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) 1117 - mi->sample_packets += info->status.ampdu_len; 1118 1105 1119 1106 if (mi->sample_mode != MINSTREL_SAMPLE_IDLE) 1120 1107 rate_sample = minstrel_get_ratestats(mi, mi->sample_rate); ··· 1509 1502 sample_idx = -1; 1510 1503 else 1511 1504 sample_idx = minstrel_get_sample_rate(mp, mi); 1512 - 1513 - mi->total_packets++; 1514 - 1515 - /* wraparound */ 1516 - if (mi->total_packets == ~0) { 1517 - mi->total_packets = 0; 1518 - mi->sample_packets = 0; 1519 - } 1520 1505 1521 1506 if (sample_idx < 0) 1522 1507 return;