aboutsummaryrefslogtreecommitdiff
path: root/sys/net80211
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2021-06-06 21:14:28 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2021-10-22 09:55:54 +0000
commit9a6695532b3997e4e2bc3fe57481cc49be5e9e93 (patch)
tree57b48d9f79e92ea6d46e9cfdfb05fb110029993f /sys/net80211
parent30276ef12cbb47cdd302741096262041be30ec11 (diff)
downloadsrc-9a6695532b3997e4e2bc3fe57481cc49be5e9e93.tar.gz
src-9a6695532b3997e4e2bc3fe57481cc49be5e9e93.zip
net80211/drivers: improve ieee80211_rx_stats for band
While IEEE80211_R_BAND was defined, there was no place to store the band. Add a field for that, adjust ieee80211_lookup_channel_rxstatus() to require it, and update drivers passing "R_{FREQ|IEEE}" in already to provide the band as well. For the moment keep the fall-back code requiring all three fields. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D30662
Diffstat (limited to 'sys/net80211')
-rw-r--r--sys/net80211/_ieee80211.h3
-rw-r--r--sys/net80211/ieee80211.c17
2 files changed, 17 insertions, 3 deletions
diff --git a/sys/net80211/_ieee80211.h b/sys/net80211/_ieee80211.h
index dc6773afac09..754e4647e82f 100644
--- a/sys/net80211/_ieee80211.h
+++ b/sys/net80211/_ieee80211.h
@@ -612,6 +612,9 @@ struct ieee80211_rx_stats {
uint8_t c_ieee; /* Channel */
uint8_t c_width; /* channel width, FW flags above */
+ /* 32 bits */
+ uint32_t c_band; /* Band; XXX we do not have a real band. */
+
/* Force alignment to DWORD */
union {
uint8_t evm[IEEE80211_MAX_CHAINS][IEEE80211_MAX_EVM_PILOTS];
diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c
index 2e98e67edc47..35cf7abdbf3b 100644
--- a/sys/net80211/ieee80211.c
+++ b/sys/net80211/ieee80211.c
@@ -1818,6 +1818,8 @@ ieee80211_lookup_channel_rxstatus(struct ieee80211vap *vap,
return (NULL);
if ((rxs->r_flags & IEEE80211_R_IEEE) == 0)
return (NULL);
+ if ((rxs->r_flags & IEEE80211_R_BAND) == 0)
+ return (NULL);
/*
* If the rx status contains a valid ieee/freq, then
@@ -1828,11 +1830,20 @@ ieee80211_lookup_channel_rxstatus(struct ieee80211vap *vap,
*/
/* Determine a band */
- /* XXX should be done by the driver? */
- if (rxs->c_freq < 3000) {
+ switch (rxs->c_band) {
+ case IEEE80211_CHAN_2GHZ:
flags = IEEE80211_CHAN_G;
- } else {
+ break;
+ case IEEE80211_CHAN_5GHZ:
flags = IEEE80211_CHAN_A;
+ break;
+ default:
+ if (rxs->c_freq < 3000) {
+ flags = IEEE80211_CHAN_G;
+ } else {
+ flags = IEEE80211_CHAN_A;
+ }
+ break;
}
/* Channel lookup */