Skip to contentSkip to conversation

mac80211: get the rates masks from the txrc in rate_control_get_rate

PATCH New Karl Beldan 1 participant 2 messages Mar 4, 2013 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 mac80211: get the rates masks from the txrc in rate_control_get_rate

From: Karl Beldan <[email protected]>

Currently we get it from the sdata. This uses the ad-hoc masks of the ieee80211_tx_rate_control txrc and lets the mcs mask get overwritten to spare an IEEE80211_HT_MCS_MASK_LEN bytes memcpy since it is not used afterwards.

---
 net/mac80211/rate.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
net/mac80211/rate.c +4 -5
index dd88381..cedc2ef 100644
@@ -436,7 +436,7 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
 	int i;
 	u32 mask;
-	u8 mcs_mask[IEEE80211_HT_MCS_MASK_LEN];
+	u8 *mcs_mask;
 
 	if (sta && test_sta_flag(sta, WLAN_STA_RATE_CONTROL)) {
 		ista = &sta->sta;
@@ -459,14 +459,13 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
 	 * default mask (allow all rates) is used to save some processing for
 	 * the common case.
 	 */
-	mask = sdata->rc_rateidx_mask[info->band];
-	memcpy(mcs_mask, sdata->rc_rateidx_mcs_mask[info->band],
-	       sizeof(mcs_mask));
+	mask = txrc->rate_idx_mask;
+	mcs_mask = txrc->rate_idx_mcs_mask;
 	if (mask != (1 << txrc->sband->n_bitrates) - 1) {
 		if (sta) {
 			/* Filter out rates that the STA does not support */
 			mask &= sta->sta.supp_rates[info->band];
-			for (i = 0; i < sizeof(mcs_mask); i++)
+			for (i = 0; i < sizeof(txrc->rate_idx_mcs_mask); i++)
 				mcs_mask[i] &= sta->sta.ht_cap.mcs.rx_mask[i];
 		}
 		/*
Signature · 1 line
1.7.9.dirty
#1 lore raw

PATCH v3 2/2 mac80211: fix the check for mcs rates masking

From: Karl Beldan <[email protected]>

Currently the mcs bitrates mask rate_idx_mcs_mask is only applied when the pre-ht bitrates mask rate_idx_mask of the same band differs from the default mask.
Fix it by comparing the rate_idx_mcs_mask with the driver ht caps, and update the comments accordingly.

---
 net/mac80211/rate.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
net/mac80211/rate.c +6 -4
index cedc2ef..94daf34 100644
@@ -455,13 +455,15 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
 	ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
 
 	/*
-	 * Try to enforce the rateidx mask the user wanted. skip this if the
-	 * default mask (allow all rates) is used to save some processing for
-	 * the common case.
+	 * Try to enforce the rateidx masks the user wanted. Skip this if mask
+	 * is the default mask (allow all rates) and mcs_mask does not differ
+	 * from the driver ht caps to save some processing for the common case.
 	 */
 	mask = txrc->rate_idx_mask;
 	mcs_mask = txrc->rate_idx_mcs_mask;
-	if (mask != (1 << txrc->sband->n_bitrates) - 1) {
+	if (mask != (1 << txrc->sband->n_bitrates) - 1 ||
+	    memcmp(txrc->sband->ht_cap.mcs.rx_mask, txrc->rate_idx_mcs_mask,
+		   sizeof(txrc->rate_idx_mcs_mask))) {
 		if (sta) {
 			/* Filter out rates that the STA does not support */
 			mask &= sta->sta.supp_rates[info->band];
Signature · 1 line
1.7.9.dirty