aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-12-17 07:38:34 -0500
committerJohannes Berg <johannes.berg@intel.com>2014-12-19 15:34:22 -0500
commit8d819a92cc7fef4294dd11faa60050fd3c5460e0 (patch)
treee03e57c24526321164eae39d8e89dc43c7228b96 /net
parent79f241b41b5f581c6be66785ab8b9c8e3b1651c7 (diff)
mac80211: minstrel: reduce size of struct minstrel_rate_stats
On minstrel_ht, the size of the per-sta struct is almost 18k, making it an order-3 allocation. A few fields inside the per-rate statistics are bigger than they need to be. This patch reduces the size enough to cut down the per-sta struct to about 13k (order-2 allocation). Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/rc80211_minstrel.c6
-rw-r--r--net/mac80211/rc80211_minstrel.h15
2 files changed, 11 insertions, 10 deletions
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index d51f6b1c549b..7c86a002df95 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -263,12 +263,12 @@ static inline unsigned int
263minstrel_get_retry_count(struct minstrel_rate *mr, 263minstrel_get_retry_count(struct minstrel_rate *mr,
264 struct ieee80211_tx_info *info) 264 struct ieee80211_tx_info *info)
265{ 265{
266 unsigned int retry = mr->adjusted_retry_count; 266 u8 retry = mr->adjusted_retry_count;
267 267
268 if (info->control.use_rts) 268 if (info->control.use_rts)
269 retry = max(2U, min(mr->stats.retry_count_rtscts, retry)); 269 retry = max_t(u8, 2, min(mr->stats.retry_count_rtscts, retry));
270 else if (info->control.use_cts_prot) 270 else if (info->control.use_cts_prot)
271 retry = max(2U, min(mr->retry_count_cts, retry)); 271 retry = max_t(u8, 2, min(mr->retry_count_cts, retry));
272 return retry; 272 return retry;
273} 273}
274 274
diff --git a/net/mac80211/rc80211_minstrel.h b/net/mac80211/rc80211_minstrel.h
index 97eca86a4af0..410efe620c57 100644
--- a/net/mac80211/rc80211_minstrel.h
+++ b/net/mac80211/rc80211_minstrel.h
@@ -33,8 +33,8 @@ minstrel_ewma(int old, int new, int weight)
33 33
34struct minstrel_rate_stats { 34struct minstrel_rate_stats {
35 /* current / last sampling period attempts/success counters */ 35 /* current / last sampling period attempts/success counters */
36 unsigned int attempts, last_attempts; 36 u16 attempts, last_attempts;
37 unsigned int success, last_success; 37 u16 success, last_success;
38 38
39 /* total attempts/success counters */ 39 /* total attempts/success counters */
40 u64 att_hist, succ_hist; 40 u64 att_hist, succ_hist;
@@ -46,8 +46,8 @@ struct minstrel_rate_stats {
46 unsigned int cur_prob, probability; 46 unsigned int cur_prob, probability;
47 47
48 /* maximum retry counts */ 48 /* maximum retry counts */
49 unsigned int retry_count; 49 u8 retry_count;
50 unsigned int retry_count_rtscts; 50 u8 retry_count_rtscts;
51 51
52 u8 sample_skipped; 52 u8 sample_skipped;
53 bool retry_updated; 53 bool retry_updated;
@@ -55,14 +55,15 @@ struct minstrel_rate_stats {
55 55
56struct minstrel_rate { 56struct minstrel_rate {
57 int bitrate; 57 int bitrate;
58 int rix; 58
59 s8 rix;
60 u8 retry_count_cts;
61 u8 adjusted_retry_count;
59 62
60 unsigned int perfect_tx_time; 63 unsigned int perfect_tx_time;
61 unsigned int ack_time; 64 unsigned int ack_time;
62 65
63 int sample_limit; 66 int sample_limit;
64 unsigned int retry_count_cts;
65 unsigned int adjusted_retry_count;
66 67
67 struct minstrel_rate_stats stats; 68 struct minstrel_rate_stats stats;
68}; 69};