nl80211/cfg80211: add VHT MCS support
Add support for reporting and calculating VHT MCSes. Note that I'm not completely sure that the bitrate calculations are correct, nor that they can't be simplified. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
4bf88530be
commit
db9c64cf8d
4 changed files with 144 additions and 24 deletions
|
@ -944,14 +944,86 @@ static u32 cfg80211_calculate_bitrate_60g(struct rate_info *rate)
|
|||
return __mcs2bitrate[rate->mcs];
|
||||
}
|
||||
|
||||
static u32 cfg80211_calculate_bitrate_vht(struct rate_info *rate)
|
||||
{
|
||||
static const u32 base[4][10] = {
|
||||
{ 6500000,
|
||||
13000000,
|
||||
19500000,
|
||||
26000000,
|
||||
39000000,
|
||||
52000000,
|
||||
58500000,
|
||||
65000000,
|
||||
78000000,
|
||||
0,
|
||||
},
|
||||
{ 13500000,
|
||||
27000000,
|
||||
40500000,
|
||||
54000000,
|
||||
81000000,
|
||||
108000000,
|
||||
121500000,
|
||||
135000000,
|
||||
162000000,
|
||||
180000000,
|
||||
},
|
||||
{ 29300000,
|
||||
58500000,
|
||||
87800000,
|
||||
117000000,
|
||||
175500000,
|
||||
234000000,
|
||||
263300000,
|
||||
292500000,
|
||||
351000000,
|
||||
390000000,
|
||||
},
|
||||
{ 58500000,
|
||||
117000000,
|
||||
175500000,
|
||||
234000000,
|
||||
351000000,
|
||||
468000000,
|
||||
526500000,
|
||||
585000000,
|
||||
702000000,
|
||||
780000000,
|
||||
},
|
||||
};
|
||||
u32 bitrate;
|
||||
int idx;
|
||||
|
||||
if (WARN_ON_ONCE(rate->mcs > 9))
|
||||
return 0;
|
||||
|
||||
idx = rate->flags & (RATE_INFO_FLAGS_160_MHZ_WIDTH |
|
||||
RATE_INFO_FLAGS_80P80_MHZ_WIDTH) ? 3 :
|
||||
rate->flags & RATE_INFO_FLAGS_80_MHZ_WIDTH ? 2 :
|
||||
rate->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH ? 1 : 0;
|
||||
|
||||
bitrate = base[idx][rate->mcs];
|
||||
bitrate *= rate->nss;
|
||||
|
||||
if (rate->flags & RATE_INFO_FLAGS_SHORT_GI)
|
||||
bitrate = (bitrate / 9) * 10;
|
||||
|
||||
/* do NOT round down here */
|
||||
return (bitrate + 50000) / 100000;
|
||||
}
|
||||
|
||||
u32 cfg80211_calculate_bitrate(struct rate_info *rate)
|
||||
{
|
||||
int modulation, streams, bitrate;
|
||||
|
||||
if (!(rate->flags & RATE_INFO_FLAGS_MCS))
|
||||
if (!(rate->flags & RATE_INFO_FLAGS_MCS) &&
|
||||
!(rate->flags & RATE_INFO_FLAGS_VHT_MCS))
|
||||
return rate->legacy;
|
||||
if (rate->flags & RATE_INFO_FLAGS_60G)
|
||||
return cfg80211_calculate_bitrate_60g(rate);
|
||||
if (rate->flags & RATE_INFO_FLAGS_VHT_MCS)
|
||||
return cfg80211_calculate_bitrate_vht(rate);
|
||||
|
||||
/* the formula below does only work for MCS values smaller than 32 */
|
||||
if (WARN_ON_ONCE(rate->mcs >= 32))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue