mac80211: get the rates masks from the txrc in rate_control_get_rate
PATCH v2 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. This uses and updates the ad-hoc masks of the ieee80211_tx_rate_control instead of copying them.
--- net/mac80211/rate.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
net/mac80211/rate.c +8 -9
@@ -435,8 +435,8 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,struct ieee80211_sta *ista =NULL ;struct ieee80211_tx_info *info =IEEE80211_SKB_CB (txrc->skb);int i; -u32 mask; -u8 mcs_mask[IEEE80211_HT_MCS_MASK_LEN ]; +u32 *mask; +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)); -if (mask != (1 << txrc->sband->n_bitrates) -1 ) { + 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++) + *mask &= sta->sta.supp_rates[info->band]; +for (i =0 ; i <sizeof (txrc->rate_idx_mcs_mask); i++) mcs_mask[i] &= sta->sta.ht_cap.mcs.rx_mask[i]; }/*
@@ -479,7 +478,7 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,if (info->control.rates[i].idx <0 )break ;rate_idx_match_mask (&info->control.rates[i], txrc, - mask, mcs_mask); + *mask, mcs_mask); } }
Signature · 1 line
1.7.10.GIT
PATCH v2 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.
--- net/mac80211/rate.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
net/mac80211/rate.c +6 -4
@@ -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.10.GIT
Johannes Berg
maintainerRe: [PATCH v2 2/2] mac80211: fix the check for mcs rates masking
Quoted 23 lines · Karl Beldan
From: Karl Beldan <[email protected]>
Currently the mcs bitrates mask
rate_idx_mcs_maskis only applied when the pre-ht bitrates maskrate_idx_maskof the same band differs from the default mask.
Fix it by comparing therate_idx_mcs_maskwith the driver ht caps.Signed-off-by Karl Beldan <[email protected]>--- net/mac80211/rate.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)net/mac80211/rate.c +0
-3@@ -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.
net/mac80211/rate.c void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, · line 466
Quoted 10 lines
net/mac80211/rate.c +6
-1+* 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))) {
Please fix the indentation, the memcmp should be indented to just after the opening parenthesis of "if ("
johannes
Re: [PATCH v2 2/2] mac80211: fix the check for mcs rates masking
Quoted 29 lines · Johannes Berg
Quoted 28 lines · Karl Beldan
From: Karl Beldan <[email protected]>
Currently the mcs bitrates mask
rate_idx_mcs_maskis only applied when the pre-ht bitrates maskrate_idx_maskof the same band differs from the default mask.
Fix it by comparing therate_idx_mcs_maskwith the driver ht caps.Signed-off-by Karl Beldan <[email protected]>--- net/mac80211/rate.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)net/mac80211/rate.c +3
-3@@ -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;
Quoted 9 lines
net/mac80211/rate.c void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, · line 466
Quoted 5 lines
net/mac80211/rate.c +3
-1mcs_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))) {Please fix the indentation, the memcmp should be indented to just after the opening parenthesis of "if ("
Yes, sorry.
Karl
Johannes Berg
maintainerQuoted 4 lines · Karl Beldan
From: Karl Beldan <[email protected]>
Currently it gets it from the sdata. This uses and updates the ad-hoc masks of the
ieee80211_tx_rate_controlinstead of copying them.
Is there any need to update them?
The change for "mask" seems to make it less efficient since it could otherwise be put into a register.
johannes
Quoted 11 lines · Johannes Berg
Quoted 4 lines · Karl Beldan
From: Karl Beldan <[email protected]>
Currently it gets it from the sdata. This uses and updates the ad-hoc masks of the
ieee80211_tx_rate_controlinstead of copying them.Is there any need to update them?
The change for "mask" seems to make it less efficient since it could otherwise be put into a register.
Totally, this commit spares the 10bytes copy of mcs_mask but adds a less efficient indirection to mask.
I thought of it but kept the symmetry with mcs_mask. Apparently you wouldn't mind the dissymmetry so I will re-send using mask by value, plus I wrote "updates .." where it is more like "lets the ad-hoc masks get overwritten".
Karl
Quoted 12 lines · john
Quoted 11 lines · Johannes Berg
Quoted 4 lines · Karl Beldan
From: Karl Beldan <[email protected]>
Currently it gets it from the sdata. This uses and updates the ad-hoc masks of the
ieee80211_tx_rate_controlinstead of copying them.Is there any need to update them?
The change for "mask" seems to make it less efficient since it could otherwise be put into a register.
Quoted 6 lines
Totally, this commit spares the 10bytes copy of
mcs_maskbut adds a less efficient indirection to mask.
I thought of it but kept the symmetry withmcs_mask. Apparently you wouldn't mind the dissymmetry so I will re-send using mask by value, plus I wrote "updates .." where it is more like "lets the ad-hoc masks get overwritten".
It seems to me that all of this could be made more efficient by default if a mcs mask pointer is only passed to rate control if the user actually configured a MCS mask. Also, filtering out rates from the mask that the sta does not support seems a bit unnecessary, since the rate control usually looks at the HT capabilities and the sta's mcs rx mask anyway.
- Felix
Quoted 19 lines · Felix Fietkau
Quoted 12 lines · john
Quoted 11 lines · Johannes Berg
Quoted 4 lines · Karl Beldan
From: Karl Beldan <[email protected]>
Currently it gets it from the sdata. This uses and updates the ad-hoc masks of the
ieee80211_tx_rate_controlinstead of copying them.Is there any need to update them?
The change for "mask" seems to make it less efficient since it could otherwise be put into a register.
Quoted 6 lines
Totally, this commit spares the 10bytes copy of
mcs_maskbut adds a less efficient indirection to mask.
I thought of it but kept the symmetry withmcs_mask. Apparently you wouldn't mind the dissymmetry so I will re-send using mask by value, plus I wrote "updates .." where it is more like "lets the ad-hoc masks get overwritten".
Quoted 7 lines
It seems to me that all of this could be made more efficient by default if a mcs mask pointer is only passed to rate control if the user actually configured a MCS mask. Also, filtering out rates from the mask that the sta does not support seems a bit unnecessary, since the rate control usually looks at the HT capabilities and the sta's mcs rx mask anyway.
Yes, some things look a bit overkill in the masks logic.
Karl
Johannes Berg
maintainerQuoted 8 lines · Karl Beldan
Quoted 7 lines
It seems to me that all of this could be made more efficient by default if a mcs mask pointer is only passed to rate control if the user actually configured a MCS mask. Also, filtering out rates from the mask that the sta does not support seems a bit unnecessary, since the rate control usually looks at the HT capabilities and the sta's mcs rx mask anyway.
Yes, some things look a bit overkill in the masks logic.
Are you planning to send new patches to improve this?
johannes
Quoted 9 lines · Johannes Berg
Quoted 7 lines · Karl Beldan
Quoted 7 lines
It seems to me that all of this could be made more efficient by default if a mcs mask pointer is only passed to rate control if the user actually configured a MCS mask. Also, filtering out rates from the mask that the sta does not support seems a bit unnecessary, since the rate control usually looks at the HT capabilities and the sta's mcs rx mask anyway.
Quoted 4 lines
Quoted 1 line
Yes, some things look a bit overkill in the masks logic.
Are you planning to send new patches to improve this?
I'll see what I can come up with.
Karl
Quoted 10 lines · john
Quoted 9 lines · Johannes Berg
Quoted 7 lines · Karl Beldan
Quoted 7 lines
It seems to me that all of this could be made more efficient by default if a mcs mask pointer is only passed to rate control if the user actually configured a MCS mask. Also, filtering out rates from the mask that the sta does not support seems a bit unnecessary, since the rate control usually looks at the HT capabilities and the sta's mcs rx mask anyway.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Yes, some things look a bit overkill in the masks logic.
Are you planning to send new patches to improve this?
I'll see what I can come up with.
Now, FWIW, I was looking at how the masks are applied - the code tries to be thorough wrt the various RC flags - 2 things at least are missing:
handle basic rates with multicast, and protection when downgrading to pre-ht rates.
Karl
Quoted 19 lines · Felix Fietkau
Quoted 12 lines · john
Quoted 11 lines · Johannes Berg
Quoted 4 lines · Karl Beldan
From: Karl Beldan <[email protected]>
Currently it gets it from the sdata. This uses and updates the ad-hoc masks of the
ieee80211_tx_rate_controlinstead of copying them.Is there any need to update them?
The change for "mask" seems to make it less efficient since it could otherwise be put into a register.
Quoted 6 lines
Totally, this commit spares the 10bytes copy of
mcs_maskbut adds a less efficient indirection to mask.
I thought of it but kept the symmetry withmcs_mask. Apparently you wouldn't mind the dissymmetry so I will re-send using mask by value, plus I wrote "updates .." where it is more like "lets the ad-hoc masks get overwritten".
Quoted 7 lines
It seems to me that all of this could be made more efficient by default if a mcs mask pointer is only passed to rate control if the user actually configured a MCS mask. Also, filtering out rates from the mask that the sta does not support seems a bit unnecessary, since the rate control usually looks at the HT capabilities and the sta's mcs rx mask anyway.
Filtering is necessary to lookup alternative downgrade/upgrade rates.
Karl
Quoted 20 lines · Karl Beldan
Quoted 19 lines · Felix Fietkau
Quoted 18 lines · john
Quoted 11 lines · Johannes Berg
Quoted 4 lines · Karl Beldan
From: Karl Beldan <[email protected]>
Currently it gets it from the sdata. This uses and updates the ad-hoc masks of the
ieee80211_tx_rate_controlinstead of copying them.Is there any need to update them?
The change for "mask" seems to make it less efficient since it could otherwise be put into a register.
Totally, this commit spares the 10bytes copy of
mcs_maskbut adds a less efficient indirection to mask.
I thought of it but kept the symmetry withmcs_mask. Apparently you wouldn't mind the dissymmetry so I will re-send using mask by value, plus I wrote "updates .." where it is more like "lets the ad-hoc masks get overwritten".
Quoted 8 lines
Quoted 7 lines
It seems to me that all of this could be made more efficient by default if a mcs mask pointer is only passed to rate control if the user actually configured a MCS mask. Also, filtering out rates from the mask that the sta does not support seems a bit unnecessary, since the rate control usually looks at the HT capabilities and the sta's mcs rx mask anyway.
Filtering is necessary to lookup alternative downgrade/upgrade rates.
Right, but the code could be changed to only do the filtering if mac80211 needs to look up an alternative downgrade/upgrade rate.
- Felix
Quoted 28 lines · Felix Fietkau
Quoted 27 lines · Karl Beldan
Quoted 26 lines · Felix Fietkau
Quoted 12 lines · john
Quoted 11 lines · Johannes Berg
Quoted 4 lines · Karl Beldan
From: Karl Beldan <[email protected]>
Currently it gets it from the sdata. This uses and updates the ad-hoc masks of the
ieee80211_tx_rate_controlinstead of copying them.Is there any need to update them?
The change for "mask" seems to make it less efficient since it could otherwise be put into a register.
Quoted 6 lines
Totally, this commit spares the 10bytes copy of
mcs_maskbut adds a less efficient indirection to mask.
I thought of it but kept the symmetry withmcs_mask. Apparently you wouldn't mind the dissymmetry so I will re-send using mask by value, plus I wrote "updates .." where it is more like "lets the ad-hoc masks get overwritten".It seems to me that all of this could be made more efficient by default if a mcs mask pointer is only passed to rate control if the user actually configured a MCS mask. Also, filtering out rates from the mask that the sta does not support seems a bit unnecessary, since the rate control usually looks at the HT capabilities and the sta's mcs rx mask anyway.
Quoted 4 lines
Quoted 1 line
Filtering is necessary to lookup alternative downgrade/upgrade rates.
Right, but the code could be changed to only do the filtering if mac80211 needs to look up an alternative downgrade/upgrade rate.
With this I agree.
Do you have strong opinions wrt basic rates ? The current code might tx mc/bc with non-basic rates.
Karl
Quoted 29 lines · Karl Beldan
Quoted 28 lines · Felix Fietkau
Quoted 27 lines · Karl Beldan
Quoted 26 lines · Felix Fietkau
Quoted 12 lines · john
Quoted 11 lines · Johannes Berg
Quoted 4 lines · Karl Beldan
From: Karl Beldan <[email protected]>
Currently it gets it from the sdata. This uses and updates the ad-hoc masks of the
ieee80211_tx_rate_controlinstead of copying them.Is there any need to update them?
The change for "mask" seems to make it less efficient since it could otherwise be put into a register.
Quoted 6 lines
Totally, this commit spares the 10bytes copy of
mcs_maskbut adds a less efficient indirection to mask.
I thought of it but kept the symmetry withmcs_mask. Apparently you wouldn't mind the dissymmetry so I will re-send using mask by value, plus I wrote "updates .." where it is more like "lets the ad-hoc masks get overwritten".It seems to me that all of this could be made more efficient by default if a mcs mask pointer is only passed to rate control if the user actually configured a MCS mask. Also, filtering out rates from the mask that the sta does not support seems a bit unnecessary, since the rate control usually looks at the HT capabilities and the sta's mcs rx mask anyway.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Filtering is necessary to lookup alternative downgrade/upgrade rates.
Right, but the code could be changed to only do the filtering if mac80211 needs to look up an alternative downgrade/upgrade rate.
With this I agree.
Do you have strong opinions wrt basic rates ? The current code might tx mc/bc with non-basic rates.
The only strong opinion I have about the rate masking code is that it shouldn't waste precious CPU cycles in a hot path ;)
- Felix
Johannes Berg
maintainerQuoted 7 lines · Karl Beldan
Quoted 4 lines
Quoted 1 line
Filtering is necessary to lookup alternative downgrade/upgrade rates.
Right, but the code could be changed to only do the filtering if mac80211 needs to look up an alternative downgrade/upgrade rate.
With this I agree.
Do you have strong opinions wrt basic rates ? The current code might tx mc/bc with non-basic rates.
If the users want to shoot themselves in the foot I'd rather give them enough rope to hang themselves with ;-)
johannes