Commit ca8fe250 authored by Johannes Berg's avatar Johannes Berg

cfg80211: improve warnings in VHT rate calculation

Linus reported hitting the bandwidth warning, but it is indeed
pretty useless - improve it by printing the rate configuration
and make it only warn once, for both warnings here.
Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 9ad09803
...@@ -1217,8 +1217,8 @@ static u32 cfg80211_calculate_bitrate_vht(struct rate_info *rate) ...@@ -1217,8 +1217,8 @@ static u32 cfg80211_calculate_bitrate_vht(struct rate_info *rate)
u32 bitrate; u32 bitrate;
int idx; int idx;
if (WARN_ON_ONCE(rate->mcs > 9)) if (rate->mcs > 9)
return 0; goto warn;
switch (rate->bw) { switch (rate->bw) {
case RATE_INFO_BW_160: case RATE_INFO_BW_160:
...@@ -1233,8 +1233,7 @@ static u32 cfg80211_calculate_bitrate_vht(struct rate_info *rate) ...@@ -1233,8 +1233,7 @@ static u32 cfg80211_calculate_bitrate_vht(struct rate_info *rate)
case RATE_INFO_BW_5: case RATE_INFO_BW_5:
case RATE_INFO_BW_10: case RATE_INFO_BW_10:
default: default:
WARN_ON(1); goto warn;
/* fall through */
case RATE_INFO_BW_20: case RATE_INFO_BW_20:
idx = 0; idx = 0;
} }
...@@ -1247,6 +1246,10 @@ static u32 cfg80211_calculate_bitrate_vht(struct rate_info *rate) ...@@ -1247,6 +1246,10 @@ static u32 cfg80211_calculate_bitrate_vht(struct rate_info *rate)
/* do NOT round down here */ /* do NOT round down here */
return (bitrate + 50000) / 100000; return (bitrate + 50000) / 100000;
warn:
WARN_ONCE(1, "invalid rate bw=%d, mcs=%d, nss=%d\n",
rate->bw, rate->mcs, rate->nss);
return 0;
} }
u32 cfg80211_calculate_bitrate(struct rate_info *rate) u32 cfg80211_calculate_bitrate(struct rate_info *rate)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment