aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/wireless/util.c')
-rw-r--r--net/wireless/util.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 1d2fcfad06cc..97c744eeac4f 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -1073,10 +1073,24 @@ static u32 cfg80211_calculate_bitrate_vht(struct rate_info *rate)
1073 if (WARN_ON_ONCE(rate->mcs > 9)) 1073 if (WARN_ON_ONCE(rate->mcs > 9))
1074 return 0; 1074 return 0;
1075 1075
1076 idx = rate->flags & (RATE_INFO_FLAGS_160_MHZ_WIDTH | 1076 switch (rate->bw) {
1077 RATE_INFO_FLAGS_80P80_MHZ_WIDTH) ? 3 : 1077 case RATE_INFO_BW_160:
1078 rate->flags & RATE_INFO_FLAGS_80_MHZ_WIDTH ? 2 : 1078 idx = 3;
1079 rate->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH ? 1 : 0; 1079 break;
1080 case RATE_INFO_BW_80:
1081 idx = 2;
1082 break;
1083 case RATE_INFO_BW_40:
1084 idx = 1;
1085 break;
1086 case RATE_INFO_BW_5:
1087 case RATE_INFO_BW_10:
1088 default:
1089 WARN_ON(1);
1090 /* fall through */
1091 case RATE_INFO_BW_20:
1092 idx = 0;
1093 }
1080 1094
1081 bitrate = base[idx][rate->mcs]; 1095 bitrate = base[idx][rate->mcs];
1082 bitrate *= rate->nss; 1096 bitrate *= rate->nss;
@@ -1107,8 +1121,7 @@ u32 cfg80211_calculate_bitrate(struct rate_info *rate)
1107 modulation = rate->mcs & 7; 1121 modulation = rate->mcs & 7;
1108 streams = (rate->mcs >> 3) + 1; 1122 streams = (rate->mcs >> 3) + 1;
1109 1123
1110 bitrate = (rate->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH) ? 1124 bitrate = (rate->bw == RATE_INFO_BW_40) ? 13500000 : 6500000;
1111 13500000 : 6500000;
1112 1125
1113 if (modulation < 4) 1126 if (modulation < 4)
1114 bitrate *= (modulation + 1); 1127 bitrate *= (modulation + 1);