net80211: convert all ieee80211_input_mimo*() consumers

to ieee80211_add_rx_params() + drop last (ieee80211_rx_stats) parameter

Note: there is an additional check for ieee80211_get_rx_params()
return value (which does not exist in the original diff).

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D8207
This commit is contained in:
Andriy Voskoboinyk 2016-10-12 20:50:13 +00:00
parent 4d6fa8848f
commit bdc7291ec9
5 changed files with 28 additions and 32 deletions

View File

@ -2977,6 +2977,8 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc,
/* rssi is in 1/2db units */ /* rssi is in 1/2db units */
rxs.c_rssi = rssi * 2; rxs.c_rssi = rssi * 2;
rxs.c_nf = sc->sc_noise; rxs.c_nf = sc->sc_noise;
if (ieee80211_add_rx_params(m, &rxs) == 0)
goto fail;
if (ieee80211_radiotap_active_vap(vap)) { if (ieee80211_radiotap_active_vap(vap)) {
struct iwm_rx_radiotap_header *tap = &sc->sc_rxtap; struct iwm_rx_radiotap_header *tap = &sc->sc_rxtap;
@ -3013,11 +3015,11 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc,
IWM_UNLOCK(sc); IWM_UNLOCK(sc);
if (ni != NULL) { if (ni != NULL) {
IWM_DPRINTF(sc, IWM_DEBUG_RECV, "input m %p\n", m); IWM_DPRINTF(sc, IWM_DEBUG_RECV, "input m %p\n", m);
ieee80211_input_mimo(ni, m, &rxs); ieee80211_input_mimo(ni, m);
ieee80211_free_node(ni); ieee80211_free_node(ni);
} else { } else {
IWM_DPRINTF(sc, IWM_DEBUG_RECV, "inputall m %p\n", m); IWM_DPRINTF(sc, IWM_DEBUG_RECV, "inputall m %p\n", m);
ieee80211_input_mimo_all(ic, m, &rxs); ieee80211_input_mimo_all(ic, m);
} }
IWM_LOCK(sc); IWM_LOCK(sc);

View File

@ -1713,7 +1713,10 @@ otus_sub_rxeof(struct otus_softc *sc, uint8_t *buf, int len, struct mbufq *rxq)
rxs.c_nf = sc->sc_nf[0]; /* XXX chain 0 != combined rssi/nf */ rxs.c_nf = sc->sc_nf[0]; /* XXX chain 0 != combined rssi/nf */
rxs.c_rssi = tail->rssi; rxs.c_rssi = tail->rssi;
/* XXX TODO: add MIMO RSSI/NF as well */ /* XXX TODO: add MIMO RSSI/NF as well */
ieee80211_add_rx_params(m, &rxs); if (ieee80211_add_rx_params(m, &rxs) == 0) {
counter_u64_add(ic->ic_ierrors, 1);
return;
}
/* XXX make a method */ /* XXX make a method */
STAILQ_INSERT_TAIL(&rxq->mq_head, m, m_stailqpkt); STAILQ_INSERT_TAIL(&rxq->mq_head, m, m_stailqpkt);
@ -1826,10 +1829,10 @@ otus_bulk_rx_callback(struct usb_xfer *xfer, usb_error_t error)
if (ni != NULL) { if (ni != NULL) {
if (ni->ni_flags & IEEE80211_NODE_HT) if (ni->ni_flags & IEEE80211_NODE_HT)
m->m_flags |= M_AMPDU; m->m_flags |= M_AMPDU;
(void)ieee80211_input_mimo(ni, m, NULL); (void)ieee80211_input_mimo(ni, m);
ieee80211_free_node(ni); ieee80211_free_node(ni);
} else } else
(void)ieee80211_input_mimo_all(ic, m, NULL); (void)ieee80211_input_mimo_all(ic, m);
} }
#ifdef IEEE80211_SUPPORT_SUPERG #ifdef IEEE80211_SUPPORT_SUPERG
ieee80211_ff_age_all(ic, 100); ieee80211_ff_age_all(ic, 100);

View File

@ -1536,10 +1536,12 @@ rsu_event_survey(struct rsu_softc *sc, uint8_t *buf, int len)
/* This is a number from 0..100; so let's just divide it down a bit */ /* 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_rssi = le32toh(bss->rssi) / 2;
rxs.c_nf = -96; rxs.c_nf = -96;
if (ieee80211_add_rx_params(m, &rxs) == 0)
return;
/* XXX avoid a LOR */ /* XXX avoid a LOR */
RSU_UNLOCK(sc); RSU_UNLOCK(sc);
ieee80211_input_mimo_all(ic, m, &rxs); ieee80211_input_mimo_all(ic, m);
RSU_LOCK(sc); RSU_LOCK(sc);
} }

View File

@ -83,18 +83,14 @@ ieee80211_process_mimo(struct ieee80211_node *ni, struct ieee80211_rx_stats *rx)
} }
int int
ieee80211_input_mimo(struct ieee80211_node *ni, struct mbuf *m, ieee80211_input_mimo(struct ieee80211_node *ni, struct mbuf *m)
struct ieee80211_rx_stats *rx)
{ {
struct ieee80211_rx_stats rxs; struct ieee80211_rx_stats rxs;
if (rx) { /* try to read stats from mbuf */
memcpy(&rxs, rx, sizeof(*rx)); bzero(&rxs, sizeof(rxs));
} else { if (ieee80211_get_rx_params(m, &rxs) != 0)
/* try to read from mbuf */ return (-1);
bzero(&rxs, sizeof(rxs));
ieee80211_get_rx_params(m, &rxs);
}
/* XXX should assert IEEE80211_R_NF and IEEE80211_R_RSSI are set */ /* XXX should assert IEEE80211_R_NF and IEEE80211_R_RSSI are set */
ieee80211_process_mimo(ni, &rxs); ieee80211_process_mimo(ni, &rxs);
@ -111,27 +107,21 @@ ieee80211_input_all(struct ieee80211com *ic, struct mbuf *m, int rssi, int nf)
rx.r_flags = IEEE80211_R_NF | IEEE80211_R_RSSI; rx.r_flags = IEEE80211_R_NF | IEEE80211_R_RSSI;
rx.c_nf = nf; rx.c_nf = nf;
rx.c_rssi = rssi; rx.c_rssi = rssi;
return ieee80211_input_mimo_all(ic, m, &rx);
if (!ieee80211_add_rx_params(m, &rx))
return (-1);
return ieee80211_input_mimo_all(ic, m);
} }
int int
ieee80211_input_mimo_all(struct ieee80211com *ic, struct mbuf *m, ieee80211_input_mimo_all(struct ieee80211com *ic, struct mbuf *m)
struct ieee80211_rx_stats *rx)
{ {
struct ieee80211_rx_stats rxs;
struct ieee80211vap *vap; struct ieee80211vap *vap;
int type = -1; int type = -1;
m->m_flags |= M_BCAST; /* NB: mark for bpf tap'ing */ m->m_flags |= M_BCAST; /* NB: mark for bpf tap'ing */
if (rx) {
memcpy(&rxs, rx, sizeof(*rx));
} else {
/* try to read from mbuf */
bzero(&rxs, sizeof(rxs));
ieee80211_get_rx_params(m, &rxs);
}
/* XXX locking */ /* XXX locking */
TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
struct ieee80211_node *ni; struct ieee80211_node *ni;
@ -152,6 +142,7 @@ ieee80211_input_mimo_all(struct ieee80211com *ic, struct mbuf *m,
/* /*
* Packet contents are changed by ieee80211_decap * Packet contents are changed by ieee80211_decap
* so do a deep copy of the packet. * so do a deep copy of the packet.
* NB: tags are copied too.
*/ */
mcopy = m_dup(m, M_NOWAIT); mcopy = m_dup(m, M_NOWAIT);
if (mcopy == NULL) { if (mcopy == NULL) {
@ -163,7 +154,7 @@ ieee80211_input_mimo_all(struct ieee80211com *ic, struct mbuf *m,
m = NULL; m = NULL;
} }
ni = ieee80211_ref_node(vap->iv_bss); ni = ieee80211_ref_node(vap->iv_bss);
type = ieee80211_input_mimo(ni, mcopy, &rxs); type = ieee80211_input_mimo(ni, mcopy);
ieee80211_free_node(ni); ieee80211_free_node(ni);
} }
if (m != NULL) /* no vaps, reclaim mbuf */ if (m != NULL) /* no vaps, reclaim mbuf */

View File

@ -83,10 +83,8 @@ void ieee80211_syncflag_ext(struct ieee80211vap *, int flag);
((ni)->ni_vap->iv_input(ni, m, NULL, rssi, nf)) ((ni)->ni_vap->iv_input(ni, m, NULL, rssi, nf))
int ieee80211_input_all(struct ieee80211com *, struct mbuf *, int, int); int ieee80211_input_all(struct ieee80211com *, struct mbuf *, int, int);
int ieee80211_input_mimo(struct ieee80211_node *, struct mbuf *, int ieee80211_input_mimo(struct ieee80211_node *, struct mbuf *);
struct ieee80211_rx_stats *); int ieee80211_input_mimo_all(struct ieee80211com *, struct mbuf *);
int ieee80211_input_mimo_all(struct ieee80211com *, struct mbuf *,
struct ieee80211_rx_stats *);
struct ieee80211_bpf_params; struct ieee80211_bpf_params;
int ieee80211_mgmt_output(struct ieee80211_node *, struct mbuf *, int, int ieee80211_mgmt_output(struct ieee80211_node *, struct mbuf *, int,