Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

+7 -4
+7 -4
net/wireless/util.c
··· 1217 1217 u32 bitrate; 1218 1218 int idx; 1219 1219 1220 - if (WARN_ON_ONCE(rate->mcs > 9)) 1221 - return 0; 1220 + if (rate->mcs > 9) 1221 + goto warn; 1222 1222 1223 1223 switch (rate->bw) { 1224 1224 case RATE_INFO_BW_160: ··· 1233 1233 case RATE_INFO_BW_5: 1234 1234 case RATE_INFO_BW_10: 1235 1235 default: 1236 - WARN_ON(1); 1237 - /* fall through */ 1236 + goto warn; 1238 1237 case RATE_INFO_BW_20: 1239 1238 idx = 0; 1240 1239 } ··· 1246 1247 1247 1248 /* do NOT round down here */ 1248 1249 return (bitrate + 50000) / 100000; 1250 + warn: 1251 + WARN_ONCE(1, "invalid rate bw=%d, mcs=%d, nss=%d\n", 1252 + rate->bw, rate->mcs, rate->nss); 1253 + return 0; 1249 1254 } 1250 1255 1251 1256 u32 cfg80211_calculate_bitrate(struct rate_info *rate)