Skip to contentSkip to conversation

mac80211: get the rates masks from the txrc in rate_control_get_rate

PATCH Superseded Karl Beldan 2 participants 5 messages Feb 27, 2013 – Mar 4, 2013 mac80211

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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

From: Karl Beldan <[email protected]>

Currently it gets it from the sdata, the behavior remains unchanged.

---
 net/mac80211/rate.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
net/mac80211/rate.c +2 -3
index dd88381..cfbd7d5 100644
@@ -459,9 +459,8 @@ 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;
+	memcpy(mcs_mask, txrc->rate_idx_mcs_mask, sizeof(mcs_mask));
 	if (mask != (1 << txrc->sband->n_bitrates) - 1) {
 		if (sta) {
 			/* Filter out rates that the STA does not support */
Signature · 1 line
1.7.10.GIT
#1 lore raw

PATCH 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 ht_cap.mcs.rx_mask, the copy of the rate_idx_mcs_mask is now done if the check succeeds. This results, when no pre-ht bitrates is disabled && an mcs idx is, to one more memcmp, otherwise the cost remains identical.

---
 net/mac80211/rate.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
net/mac80211/rate.c +5 -2
index cfbd7d5..4c0a14d 100644
@@ -460,8 +460,11 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
 	 * the common case.
 	 */
 	mask = txrc->rate_idx_mask;
-	memcpy(mcs_mask, txrc->rate_idx_mcs_mask, sizeof(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))) {
+		memcpy(mcs_mask, txrc->rate_idx_mcs_mask, sizeof(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.10.GIT
#2 lore raw

Re: [PATCH 2/2] mac80211: fix the check for mcs rates masking

Quoted 22 lines · Karl Beldan

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 ht_cap.mcs.rx_mask, the copy of the rate_idx_mcs_mask is now done if the check succeeds. This results, when no pre-ht bitrates is disabled && an mcs idx is, to one more memcmp, otherwise the cost remains identical.

---
 net/mac80211/rate.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
net/mac80211/rate.c +0 -0
index cfbd7d5..4c0a14d 100644
@@ -460,8 +460,11 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
 	 * the common case.
 	 */

net/mac80211/rate.c void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, · line 469

Quoted 10 lines
net/mac80211/rate.c +5 -2
 	mask = txrc->rate_idx_mask;
-	memcpy(mcs_mask, txrc->rate_idx_mcs_mask, sizeof(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))) {
+		memcpy(mcs_mask, txrc->rate_idx_mcs_mask, sizeof(mcs_mask));
+
 		if (sta) {
 

I don't know why I refrained myself from getting rid of the copies of the masks altogether.

maintainer
#3 lore raw

Re: [PATCH 2/2] mac80211: fix the check for mcs rates masking

Quoted 5 lines · Karl Beldan
Quoted 5 lines
net/mac80211/rate.c +2 -2
 	mask = txrc->rate_idx_mask;
-	memcpy(mcs_mask, txrc->rate_idx_mcs_mask, sizeof(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,
Quoted 8 lines

net/mac80211/rate.c void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, · line 468

Quoted 5 lines
net/mac80211/rate.c +3 -0
+		       sizeof(txrc->rate_idx_mcs_mask))) {
+		memcpy(mcs_mask, txrc->rate_idx_mcs_mask, sizeof(mcs_mask));
+
 		if (sta) {

I don't know why I refrained myself from getting rid of the copies of the masks altogether.

Are you going to resend?

johannes

#4 lore raw

Re: [PATCH 2/2] mac80211: fix the check for mcs rates masking

Quoted 16 lines · Johannes Berg
Quoted 5 lines · Karl Beldan
Quoted 5 lines
net/mac80211/rate.c +2 -2
 	mask = txrc->rate_idx_mask;
-	memcpy(mcs_mask, txrc->rate_idx_mcs_mask, sizeof(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,
Quoted 8 lines

net/mac80211/rate.c void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, · line 468

Quoted 5 lines
net/mac80211/rate.c +3 -0
+		       sizeof(txrc->rate_idx_mcs_mask))) {
+		memcpy(mcs_mask, txrc->rate_idx_mcs_mask, sizeof(mcs_mask));
+
 		if (sta) {

I don't know why I refrained myself from getting rid of the copies of the masks altogether.

Quoted 2 lines

Are you going to resend?

Just did.