diff options
author | Felix Fietkau <nbd@nbd.name> | 2021-01-27 06:57:30 +0100 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2021-02-12 08:56:28 +0100 |
commit | a42fa256f66c425021038f40d9255d377a2d1a8d (patch) | |
tree | da11b5497aaab95c653202b0fb066a1644351cdf /net/mac80211/rc80211_minstrel_ht.h | |
parent | cfg80211: initialize reg_rule in __freq_reg_info() (diff) | |
download | linux-a42fa256f66c425021038f40d9255d377a2d1a8d.tar.xz linux-a42fa256f66c425021038f40d9255d377a2d1a8d.zip |
mac80211: minstrel_ht: use bitfields to encode rate indexes
Get rid of a lot of divisions and modulo operations
Reduces code size and improves performance
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://lore.kernel.org/r/20210127055735.78599-1-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/rc80211_minstrel_ht.h')
-rw-r--r-- | net/mac80211/rc80211_minstrel_ht.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/net/mac80211/rc80211_minstrel_ht.h b/net/mac80211/rc80211_minstrel_ht.h index 7d6d0b720f6d..5912f7dc5267 100644 --- a/net/mac80211/rc80211_minstrel_ht.h +++ b/net/mac80211/rc80211_minstrel_ht.h @@ -6,6 +6,8 @@ #ifndef __RC_MINSTREL_HT_H #define __RC_MINSTREL_HT_H +#include <linux/bitfield.h> + /* number of highest throughput rates to consider*/ #define MAX_THR_RATES 4 #define SAMPLE_COLUMNS 10 /* number of columns in sample table */ @@ -57,6 +59,17 @@ #define MCS_GROUP_RATES 10 +#define MI_RATE_IDX_MASK GENMASK(3, 0) +#define MI_RATE_GROUP_MASK GENMASK(15, 4) + +#define MI_RATE(_group, _idx) \ + (FIELD_PREP(MI_RATE_GROUP_MASK, _group) | \ + FIELD_PREP(MI_RATE_IDX_MASK, _idx)) + +#define MI_RATE_IDX(_rate) FIELD_GET(MI_RATE_IDX_MASK, _rate) +#define MI_RATE_GROUP(_rate) FIELD_GET(MI_RATE_GROUP_MASK, _rate) + + struct minstrel_priv { struct ieee80211_hw *hw; bool has_mrr; |