summaryrefslogtreecommitdiff
path: root/net/mac80211/rate.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-04-16 11:38:42 (GMT)
committerJohannes Berg <johannes.berg@intel.com>2013-04-16 21:42:29 (GMT)
commit2ffbe6d333664a089f17b13aa79eefe38f794bb7 (patch)
tree29927d762aff0f9d8a8eea57784fb0067fb58ca7 /net/mac80211/rate.c
parentdad6330d034a24a22008ee28b8ec447cbb0961c9 (diff)
downloadlinux-2ffbe6d333664a089f17b13aa79eefe38f794bb7.tar.xz
mac80211: fix and optimize MCS mask handling
Currently the code always copies the configured MCS mask (even if it is set to default), but only uses it if legacy rates were also masked out. Fix this by adding a flag that tracks whether the configured MCS mask is set to default or not. Optimize the code further by storing a pointer to the configured rate mask in txrc instead of using memcpy. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/rate.c')
-rw-r--r--net/mac80211/rate.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index dd88381..5d545dd 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -460,9 +460,12 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
* 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) {
+ if (mask != (1 << txrc->sband->n_bitrates) - 1 || txrc->rate_idx_mcs_mask) {
+ if (txrc->rate_idx_mcs_mask)
+ memcpy(mcs_mask, txrc->rate_idx_mcs_mask, sizeof(mcs_mask));
+ else
+ memset(mcs_mask, 0xff, sizeof(mcs_mask));
+
if (sta) {
/* Filter out rates that the STA does not support */
mask &= sta->sta.supp_rates[info->band];