diff options
author | Adrian Chadd <adrian@FreeBSD.org> | 2021-03-22 16:47:43 +0000 |
---|---|---|
committer | Adrian Chadd <adrian@FreeBSD.org> | 2021-03-26 01:26:09 +0000 |
commit | b6fd00791f2b9690b0a5d8670fc03f74eda96da2 (patch) | |
tree | 0a446b6d160245a09fb0126508a9fc4499cd24fe /sys/dev/iwn | |
parent | b9f803b7d4b7ee3799ab94f66c02c3b6e58c153a (diff) |
[iwn] Flip over to use VAP flags rather than ic flags for things
net80211 changed a while back to support per-VAP config for things
rather than it being global. This is to support firmware NICs that
support per-VAP flags and configuration where the firmware will figure
out how to combine them.
However, it introduced a fun timing issue - those changes used to happen
to the shared ic state before newstate() was called, but now they're
also tasks and they can happen /after/.
This isn't a problem for ath(4), but it exposed some interesting
timing and config bugs here. Notably, I saw short slot NOT being
configured in 5GHz mode during some associations, so 5GHz stuff
would hang or behave poorly. Other times the follow-up auth has
the right config, so it didn't hang.
So for now, just flip this over to using the per-VAP flags which
are correct when newstate() is called. net80211 should also have
those flags synch'ed to the global ic state before newstate() runs
and that can come in a subsequent commit.
Whilst here also fix plcp to be consistently logged as a hex value.
Tested:
* iwn(4) Intel 6205, STA mode, both 2GHz and 5GHz
Differential Revision: https://reviews.freebsd.org/D29379
Reviewed by: bz
Diffstat (limited to 'sys/dev/iwn')
-rw-r--r-- | sys/dev/iwn/if_iwn.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c index 2121a15bad6e..b07b52cbea7c 100644 --- a/sys/dev/iwn/if_iwn.c +++ b/sys/dev/iwn/if_iwn.c @@ -4450,7 +4450,7 @@ iwn_check_rate_needs_protection(struct iwn_softc *sc, /* * 11bg protection not enabled? Then don't use it. */ - if ((ic->ic_flags & IEEE80211_F_USEPROT) == 0) + if ((vap->iv_flags & IEEE80211_F_USEPROT) == 0) return (0); /* @@ -4936,7 +4936,7 @@ iwn_tx_cmd(struct iwn_softc *sc, struct mbuf *m, struct ieee80211_node *ni, data->ni = ni; DPRINTF(sc, IWN_DEBUG_XMIT, "%s: qid %d idx %d len %d nsegs %d " - "plcp %d\n", + "plcp 0x%x\n", __func__, ring->qid, ring->cur, totlen, nsegs, tx->rate); /* Fill TX descriptor. */ @@ -6654,18 +6654,18 @@ iwn5000_runtime_calib(struct iwn_softc *sc) } static uint32_t -iwn_get_rxon_ht_flags(struct iwn_softc *sc, struct ieee80211_channel *c) +iwn_get_rxon_ht_flags(struct iwn_softc *sc, struct ieee80211vap *vap, + struct ieee80211_channel *c) { - struct ieee80211com *ic = &sc->sc_ic; uint32_t htflags = 0; if (! IEEE80211_IS_CHAN_HT(c)) return (0); - htflags |= IWN_RXON_HT_PROTMODE(ic->ic_curhtprotmode); + htflags |= IWN_RXON_HT_PROTMODE(vap->iv_curhtprotmode); if (IEEE80211_IS_CHAN_HT40(c)) { - switch (ic->ic_curhtprotmode) { + switch (vap->iv_curhtprotmode) { case IEEE80211_HTINFO_OPMODE_HT20PR: htflags |= IWN_RXON_HT_MODEPURE40; break; @@ -6912,7 +6912,7 @@ iwn_config(struct iwn_softc *sc) sc->rxchainmask, sc->nrxchains); - sc->rxon->flags |= htole32(iwn_get_rxon_ht_flags(sc, ic->ic_curchan)); + sc->rxon->flags |= htole32(iwn_get_rxon_ht_flags(sc, vap, ic->ic_curchan)); DPRINTF(sc, IWN_DEBUG_RESET, "%s: setting configuration; flags=0x%08x\n", @@ -7285,9 +7285,17 @@ iwn_auth(struct iwn_softc *sc, struct ieee80211vap *vap) sc->rxon->flags = htole32(IWN_RXON_TSF | IWN_RXON_CTS_TO_SELF); if (IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) sc->rxon->flags |= htole32(IWN_RXON_AUTO | IWN_RXON_24GHZ); - if (ic->ic_flags & IEEE80211_F_SHSLOT) + + /* + * We always set short slot on 5GHz channels. + * We optionally set it for 2.4GHz channels. + */ + if (IEEE80211_IS_CHAN_5GHZ(ni->ni_chan)) + sc->rxon->flags |= htole32(IWN_RXON_SHSLOT); + else if (vap->iv_flags & IEEE80211_F_SHSLOT) sc->rxon->flags |= htole32(IWN_RXON_SHSLOT); - if (ic->ic_flags & IEEE80211_F_SHPREAMBLE) + + if (vap->iv_flags & IEEE80211_F_SHPREAMBLE) sc->rxon->flags |= htole32(IWN_RXON_SHPREAMBLE); if (IEEE80211_IS_CHAN_A(ni->ni_chan)) { sc->rxon->cck_mask = 0; @@ -7302,7 +7310,7 @@ iwn_auth(struct iwn_softc *sc, struct ieee80211vap *vap) } /* try HT */ - sc->rxon->flags |= htole32(iwn_get_rxon_ht_flags(sc, ic->ic_curchan)); + sc->rxon->flags |= htole32(iwn_get_rxon_ht_flags(sc, vap, ic->ic_curchan)); DPRINTF(sc, IWN_DEBUG_STATE, "rxon chan %d flags %x cck %x ofdm %x\n", sc->rxon->chan, sc->rxon->flags, sc->rxon->cck_mask, @@ -7349,9 +7357,14 @@ iwn_run(struct iwn_softc *sc, struct ieee80211vap *vap) sc->rxon->flags = htole32(IWN_RXON_TSF | IWN_RXON_CTS_TO_SELF); if (IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) sc->rxon->flags |= htole32(IWN_RXON_AUTO | IWN_RXON_24GHZ); - if (ic->ic_flags & IEEE80211_F_SHSLOT) + + /* As previously - short slot only on 5GHz */ + if (IEEE80211_IS_CHAN_5GHZ(ni->ni_chan)) sc->rxon->flags |= htole32(IWN_RXON_SHSLOT); - if (ic->ic_flags & IEEE80211_F_SHPREAMBLE) + else if (vap->iv_flags & IEEE80211_F_SHSLOT) + sc->rxon->flags |= htole32(IWN_RXON_SHSLOT); + + if (vap->iv_flags & IEEE80211_F_SHPREAMBLE) sc->rxon->flags |= htole32(IWN_RXON_SHPREAMBLE); if (IEEE80211_IS_CHAN_A(ni->ni_chan)) { sc->rxon->cck_mask = 0; @@ -7365,10 +7378,10 @@ iwn_run(struct iwn_softc *sc, struct ieee80211vap *vap) sc->rxon->ofdm_mask = 0x15; } /* try HT */ - sc->rxon->flags |= htole32(iwn_get_rxon_ht_flags(sc, ni->ni_chan)); + sc->rxon->flags |= htole32(iwn_get_rxon_ht_flags(sc, vap, ni->ni_chan)); sc->rxon->filter |= htole32(IWN_FILTER_BSS); DPRINTF(sc, IWN_DEBUG_STATE, "rxon chan %d flags %x, curhtprotmode=%d\n", - sc->rxon->chan, le32toh(sc->rxon->flags), ic->ic_curhtprotmode); + sc->rxon->chan, le32toh(sc->rxon->flags), vap->iv_curhtprotmode); if ((error = iwn_send_rxon(sc, 0, 1)) != 0) { device_printf(sc->sc_dev, "%s: could not send RXON\n", |