LinuxKPI: 802.11: get rid of lkpi_ic_getradiocaps warnings

Users are seeing warnings about 2 channels (1 per band)
triggered by an ioctl from wpa_supplicant usually:
	lkpi_ic_getradiocaps: Adding chan ... returned error 55
This was an early FAQ.

Check the current number of channels against maxchans and the return
code from net80211. In case net80211 reports that we reached the limit
do not print the warning and do not try to add further channels.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
This commit is contained in:
Bjoern A. Zeeb 2022-02-14 22:29:38 +00:00
parent 24360d8375
commit cee56e77d7

View file

@ -2579,7 +2579,7 @@ lkpi_ic_getradiocaps(struct ieee80211com *ic, int maxchan,
#endif
channels = hw->wiphy->bands[NL80211_BAND_2GHZ]->channels;
for (i = 0; i < nchans; i++) {
for (i = 0; i < nchans && *n < maxchan; i++) {
uint32_t nflags = 0;
int cflags = chan_flags;
@ -2606,14 +2606,15 @@ lkpi_ic_getradiocaps(struct ieee80211com *ic, int maxchan,
channels[i].hw_value, channels[i].center_freq,
channels[i].max_power,
nflags, bands, chan_flags);
if (error != 0) {
/* net80211::ENOBUFS: *n >= maxchans */
if (error != 0 && error != ENOBUFS)
printf("%s: %s: Adding chan %u/%u/%#x/%#x/%#x/%#x "
"returned error %d\n", ic->ic_name,
__func__, channels[i].hw_value,
channels[i].center_freq, channels[i].flags,
nflags, chan_flags, cflags, error);
if (error != 0)
break;
}
}
}
@ -2648,7 +2649,7 @@ lkpi_ic_getradiocaps(struct ieee80211com *ic, int maxchan,
#endif
channels = hw->wiphy->bands[NL80211_BAND_5GHZ]->channels;
for (i = 0; i < nchans; i++) {
for (i = 0; i < nchans && *n < maxchan; i++) {
uint32_t nflags = 0;
int cflags = chan_flags;
@ -2675,14 +2676,15 @@ lkpi_ic_getradiocaps(struct ieee80211com *ic, int maxchan,
channels[i].hw_value, channels[i].center_freq,
channels[i].max_power,
nflags, bands, chan_flags);
if (error != 0) {
/* net80211::ENOBUFS: *n >= maxchans */
if (error != 0 && error != ENOBUFS)
printf("%s: %s: Adding chan %u/%u/%#x/%#x/%#x/%#x "
"returned error %d\n", ic->ic_name,
__func__, channels[i].hw_value,
channels[i].center_freq, channels[i].flags,
nflags, chan_flags, cflags, error);
if (error != 0)
break;
}
}
}
}