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
This commit is contained in:
parent
30276ef12c
commit
9a6695532b
@ -3303,12 +3303,15 @@ iwm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset,
|
||||
*/
|
||||
bzero(&rxs, sizeof(rxs));
|
||||
rxs.r_flags |= IEEE80211_R_IEEE | IEEE80211_R_FREQ;
|
||||
rxs.r_flags |= IEEE80211_R_BAND;
|
||||
rxs.r_flags |= IEEE80211_R_NF | IEEE80211_R_RSSI;
|
||||
rxs.c_ieee = le16toh(phy_info->channel);
|
||||
if (le16toh(phy_info->phy_flags & IWM_RX_RES_PHY_FLAGS_BAND_24)) {
|
||||
rxs.c_freq = ieee80211_ieee2mhz(rxs.c_ieee, IEEE80211_CHAN_2GHZ);
|
||||
rxs.c_band = IEEE80211_CHAN_2GHZ;
|
||||
} else {
|
||||
rxs.c_freq = ieee80211_ieee2mhz(rxs.c_ieee, IEEE80211_CHAN_5GHZ);
|
||||
rxs.c_band = IEEE80211_CHAN_5GHZ;
|
||||
}
|
||||
|
||||
/* rssi is in 1/2db units */
|
||||
@ -3414,10 +3417,12 @@ iwm_rx_mpdu_mq(struct iwm_softc *sc, struct mbuf *m, uint32_t offset,
|
||||
*/
|
||||
bzero(&rxs, sizeof(rxs));
|
||||
rxs.r_flags |= IEEE80211_R_IEEE | IEEE80211_R_FREQ;
|
||||
rxs.r_flags |= IEEE80211_R_BAND;
|
||||
rxs.r_flags |= IEEE80211_R_NF | IEEE80211_R_RSSI;
|
||||
rxs.c_ieee = channel;
|
||||
rxs.c_freq = ieee80211_ieee2mhz(rxs.c_ieee,
|
||||
channel <= 14 ? IEEE80211_CHAN_2GHZ : IEEE80211_CHAN_5GHZ);
|
||||
rxs.c_band = channel <= 14 ? IEEE80211_CHAN_2GHZ : IEEE80211_CHAN_5GHZ;
|
||||
|
||||
/* rssi is in 1/2db units */
|
||||
rxs.c_rssi = rssi * 2;
|
||||
|
@ -240,8 +240,10 @@ r88e_get_rx_stats(struct rtwn_softc *sc, struct ieee80211_rx_stats *rxs,
|
||||
|
||||
if (!sc->sc_ht40) { /* XXX center channel */
|
||||
rxs->r_flags |= IEEE80211_R_IEEE | IEEE80211_R_FREQ;
|
||||
rxs->r_flags |= IEEE80211_R_BAND;
|
||||
rxs->c_ieee = physt->chan;
|
||||
rxs->c_freq = ieee80211_ieee2mhz(rxs->c_ieee,
|
||||
IEEE80211_CHAN_2GHZ);
|
||||
rxs->c_band = IEEE80211_CHAN_2GHZ;
|
||||
}
|
||||
}
|
||||
|
@ -321,8 +321,10 @@ r12a_get_rx_stats(struct rtwn_softc *sc, struct ieee80211_rx_stats *rxs,
|
||||
*/
|
||||
#if 0
|
||||
rxs->r_flags |= IEEE80211_R_IEEE | IEEE80211_R_FREQ;
|
||||
rxs->r_flags |= IEEE80211_R_BAND;
|
||||
rxs->c_ieee = MS(le16toh(physt->phyw1), R12A_PHYW1_CHAN);
|
||||
rxs->c_freq = ieee80211_ieee2mhz(rxs->c_ieee,
|
||||
(rxs->c_ieee < 36) ? IEEE80211_CHAN_2GHZ : IEEE80211_CHAN_5GHZ);
|
||||
rxs->c_band = (rxs->c_ieee < 36) ? IEEE80211_CHAN_2GHZ : IEEE80211_CHAN_5GHZ;
|
||||
#endif
|
||||
}
|
||||
|
@ -2081,9 +2081,11 @@ rsu_event_survey(struct rsu_softc *sc, uint8_t *buf, int len)
|
||||
/* Set channel flags for input path */
|
||||
bzero(&rxs, sizeof(rxs));
|
||||
rxs.r_flags |= IEEE80211_R_IEEE | IEEE80211_R_FREQ;
|
||||
rxs.r_flags |= IEEE80211_R_BAND;
|
||||
rxs.r_flags |= IEEE80211_R_NF | IEEE80211_R_RSSI;
|
||||
rxs.c_ieee = le32toh(bss->config.dsconfig);
|
||||
rxs.c_freq = ieee80211_ieee2mhz(rxs.c_ieee, IEEE80211_CHAN_2GHZ);
|
||||
rxs.c_band = IEEE80211_CHAN_2GHZ;
|
||||
/* This is a number from 0..100; so let's just divide it down a bit */
|
||||
rxs.c_rssi = le32toh(bss->rssi) / 2;
|
||||
rxs.c_nf = -96;
|
||||
|
@ -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];
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user