Skip to contentSkip to conversation

mac80211: minstrel: reduce size of struct minstrel_rate_stats

PATCH Applied Felix Fietkau 2 participants 2 messages Dec 17, 2014 – Dec 19, 2014 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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).

---
 net/mac80211/rc80211_minstrel.c |  6 +++---
 net/mac80211/rc80211_minstrel.h | 15 ++++++++-------
 2 files changed, 11 insertions(+), 10 deletions(-)
net/mac80211/rc80211_minstrel.c +3 -3
index d51f6b1..7c86a00 100644
@@ -263,12 +263,12 @@ static inline unsigned int
 minstrel_get_retry_count(struct minstrel_rate *mr,
 			 struct ieee80211_tx_info *info)
 {
-	unsigned int retry = mr->adjusted_retry_count;
+	u8 retry = mr->adjusted_retry_count;
 
 	if (info->control.use_rts)
-		retry = max(2U, min(mr->stats.retry_count_rtscts, retry));
+		retry = max_t(u8, 2, min(mr->stats.retry_count_rtscts, retry));
 	else if (info->control.use_cts_prot)
-		retry = max(2U, min(mr->retry_count_cts, retry));
+		retry = max_t(u8, 2, min(mr->retry_count_cts, retry));
 	return retry;
 }
 
net/mac80211/rc80211_minstrel.h +8 -7
index 97eca86..410efe6 100644
@@ -33,8 +33,8 @@ minstrel_ewma(int old, int new, int weight)
 
 struct minstrel_rate_stats {
 	/* current / last sampling period attempts/success counters */
-	unsigned int attempts, last_attempts;
-	unsigned int success, last_success;
+	u16 attempts, last_attempts;
+	u16 success, last_success;
 
 	/* total attempts/success counters */
 	u64 att_hist, succ_hist;
@@ -46,8 +46,8 @@ struct minstrel_rate_stats {
 	unsigned int cur_prob, probability;
 
 	/* maximum retry counts */
-	unsigned int retry_count;
-	unsigned int retry_count_rtscts;
+	u8 retry_count;
+	u8 retry_count_rtscts;
 
 	u8 sample_skipped;
 	bool retry_updated;
@@ -55,14 +55,15 @@ struct minstrel_rate_stats {
 
 struct minstrel_rate {
 	int bitrate;
-	int rix;
+
+	s8 rix;
+	u8 retry_count_cts;
+	u8 adjusted_retry_count;
 
 	unsigned int perfect_tx_time;
 	unsigned int ack_time;
 
 	int sample_limit;
-	unsigned int retry_count_cts;
-	unsigned int adjusted_retry_count;
 
 	struct minstrel_rate_stats stats;
 };
Signature · 1 line
2.1.2
maintainer Applied
#1 lore raw
Quoted 5 lines · Felix Fietkau

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).

Applied to mac80211-next.

johannes