Date: Mon, 20 Jul 2026 22:50:17 +0000 From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 4a4bcdc6aa3e - main - net80211: update drivers to allocate sequence numbers in the raw path Message-ID: <6a5ea629.30afb.25737d95@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=4a4bcdc6aa3eb99948a369fe16f5cecf5828e1bb commit 4a4bcdc6aa3eb99948a369fe16f5cecf5828e1bb Author: Adrian Chadd <adrian@FreeBSD.org> AuthorDate: 2026-07-08 05:44:57 +0000 Commit: Adrian Chadd <adrian@FreeBSD.org> CommitDate: 2026-07-20 22:37:34 +0000 net80211: update drivers to allocate sequence numbers in the raw path A bunch of drivers weren't properly converted. I mistakenly put a call to ieee80211_output_seqno_assign() wherever the crypto header was added, which isn't exactly correct. There are plenty of drivers which don't share enough of their raw and normal transmit path code for that to hold true. So after some manual review, it looks like I've captured the places (outside of iwn(4) which I committed earlier) where I missed ieee80211_output_seqno_assign() calls. * For bwi(4) and bwn(4) I refactored it out into a place that is common enough and happens in the same lock hold window, so it's serialised. * For the rest, it's just plain missing from the raw path. Locally tested: * ural(4) * ral(4) * bwi(4) Differential Revision: https://reviews.freebsd.org/D58098 --- sys/dev/bwi/if_bwi.c | 16 +++++++++++++++- sys/dev/bwn/if_bwn.c | 9 ++++++++- sys/dev/ral/rt2560.c | 2 ++ sys/dev/ral/rt2860.c | 2 ++ sys/dev/usb/wlan/if_ural.c | 2 ++ 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/sys/dev/bwi/if_bwi.c b/sys/dev/bwi/if_bwi.c index 80fc5e9e47af..a39094e3af21 100644 --- a/sys/dev/bwi/if_bwi.c +++ b/sys/dev/bwi/if_bwi.c @@ -1364,7 +1364,6 @@ bwi_start_locked(struct bwi_softc *sc) (m = mbufq_dequeue(&sc->sc_snd)) != NULL) { ni = (struct ieee80211_node *) m->m_pkthdr.rcvif; wh = mtod(m, struct ieee80211_frame *); - ieee80211_output_seqno_assign(ni, -1, m); if ((wh->i_fc[1] & IEEE80211_FC1_PROTECTED) != 0 && ieee80211_crypto_encap(ni, m) == NULL) { if_inc_counter(ni->ni_vap->iv_ifp, @@ -2903,6 +2902,12 @@ bwi_plcp_header(const struct ieee80211_rate_table *rt, panic("unsupported modulation type %u\n", modtype); } +/* + * @brief Encapsulate a frame for transmit. + * + * Note that this must be called inside the same lock / path + * as the crypto encap call in the transmit path. + */ static int bwi_encap(struct bwi_softc *sc, int idx, struct mbuf *m, struct ieee80211_node *ni) @@ -2937,6 +2942,12 @@ bwi_encap(struct bwi_softc *sc, int idx, struct mbuf *m, /* Get 802.11 frame len before prepending TX header */ pkt_len = m->m_pkthdr.len + IEEE80211_CRC_LEN; + /* + * Assign sequence number - must be done in lock-step with + * cipher encap. + */ + ieee80211_output_seqno_assign(ni, -1, m); + /* * Find TX rate */ @@ -3117,6 +3128,9 @@ bwi_encap_raw(struct bwi_softc *sc, int idx, struct mbuf *m, /* Get 802.11 frame len before prepending TX header */ pkt_len = m->m_pkthdr.len + IEEE80211_CRC_LEN; + /* Assign sequence number. */ + ieee80211_output_seqno_assign(ni, -1, m); + /* * Find TX rate */ diff --git a/sys/dev/bwn/if_bwn.c b/sys/dev/bwn/if_bwn.c index ec9d56661034..0f840c0f3276 100644 --- a/sys/dev/bwn/if_bwn.c +++ b/sys/dev/bwn/if_bwn.c @@ -1000,7 +1000,6 @@ bwn_start(struct bwn_softc *sc) continue; } wh = mtod(m, struct ieee80211_frame *); - ieee80211_output_seqno_assign(ni, -1, m); if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { k = ieee80211_crypto_encap(ni, m); if (k == NULL) { @@ -1053,6 +1052,12 @@ full: return (1); } +/* + * @brief Queue the give frame for transmit. + * + * This must be called in the same lock/path as the crypto encap call + * to avoid reordering issues. + */ static int bwn_tx_start(struct bwn_softc *sc, struct ieee80211_node *ni, struct mbuf *m) { @@ -1066,6 +1071,8 @@ bwn_tx_start(struct bwn_softc *sc, struct ieee80211_node *ni, struct mbuf *m) return (ENXIO); } + ieee80211_output_seqno_assign(ni, -1, m); + error = (mac->mac_flags & BWN_MAC_FLAG_DMA) ? bwn_dma_tx_start(mac, ni, &m) : bwn_pio_tx_start(mac, ni, &m); if (error) { diff --git a/sys/dev/ral/rt2560.c b/sys/dev/ral/rt2560.c index 7feb324eb21d..8941d7c8772f 100644 --- a/sys/dev/ral/rt2560.c +++ b/sys/dev/ral/rt2560.c @@ -1675,6 +1675,8 @@ rt2560_tx_raw(struct rt2560_softc *sc, struct mbuf *m0, flags |= RT2560_TX_LONG_RETRY | RT2560_TX_IFS_SIFS; } + ieee80211_output_seqno_assign(ni, -1, m0); + error = bus_dmamap_load_mbuf_sg(sc->prioq.data_dmat, data->map, m0, segs, &nsegs, 0); if (error != 0) { diff --git a/sys/dev/ral/rt2860.c b/sys/dev/ral/rt2860.c index 76fe4652839d..004894125140 100644 --- a/sys/dev/ral/rt2860.c +++ b/sys/dev/ral/rt2860.c @@ -1755,6 +1755,8 @@ rt2860_tx_raw(struct rt2860_softc *sc, struct mbuf *m, return EINVAL; } + ieee80211_output_seqno_assign(ni, -1, m); + qid = params->ibp_pri & 3; ring = &sc->txq[qid]; diff --git a/sys/dev/usb/wlan/if_ural.c b/sys/dev/usb/wlan/if_ural.c index adef924a085c..61381ed740f4 100644 --- a/sys/dev/usb/wlan/if_ural.c +++ b/sys/dev/usb/wlan/if_ural.c @@ -1189,6 +1189,8 @@ ural_tx_raw(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni, STAILQ_REMOVE_HEAD(&sc->tx_free, next); sc->tx_nfree--; + ieee80211_output_seqno_assign(ni, -1, m0); + data->m = m0; data->ni = ni; data->rate = rate;home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a5ea629.30afb.25737d95>
