git: f086acca042e - stable/14 - LinuxKPI: 802.11: avoid using an mbuf tag for now
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 18 Apr 2025 14:37:30 UTC
The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=f086acca042ecd91b636aa84f33db198a2e6a961 commit f086acca042ecd91b636aa84f33db198a2e6a961 Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2025-04-13 21:53:44 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2025-04-18 14:36:03 +0000 LinuxKPI: 802.11: avoid using an mbuf tag for now We are using an mbuf tag to carry the ni reference in the TX path from the TX function past the taskq along with the mbuf. Contrary to initial assumptions we only need the ni and no other data so attach the ni to m->m_pkthdr.PH_loc.ptr avoiding the extra allcation. Sponsored by: The FreeBSD Foundation (cherry picked from commit dbae3dcff72f53abe6874466baea78f552b3a316) --- sys/compat/linuxkpi/common/src/linux_80211.c | 22 ++++++++++++++++++++++ sys/compat/linuxkpi/common/src/linux_80211.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 98e0b28d9ef2..85c0945cb9d3 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -5650,6 +5650,7 @@ linuxkpi_ieee80211_iffree(struct ieee80211_hw *hw) /* Flush mbufq (make sure to release ni refs!). */ m = mbufq_dequeue(&lhw->rxq); while (m != NULL) { +#ifdef LKPI_80211_USE_MTAG struct m_tag *mtag; mtag = m_tag_locate(m, MTAG_ABI_LKPI80211, LKPI80211_TAG_RXNI, NULL); @@ -5659,6 +5660,14 @@ linuxkpi_ieee80211_iffree(struct ieee80211_hw *hw) rxni = (struct lkpi_80211_tag_rxni *)(mtag + 1); ieee80211_free_node(rxni->ni); } +#else + if (m->m_pkthdr.PH_loc.ptr != NULL) { + struct ieee80211_node *ni; + + ni = m->m_pkthdr.PH_loc.ptr; + ieee80211_free_node(ni); + } +#endif m_freem(m); m = mbufq_dequeue(&lhw->rxq); } @@ -6226,10 +6235,13 @@ static void lkpi_80211_lhw_rxq_rx_one(struct lkpi_hw *lhw, struct mbuf *m) { struct ieee80211_node *ni; +#ifdef LKPI_80211_USE_MTAG struct m_tag *mtag; +#endif int ok; ni = NULL; +#ifdef LKPI_80211_USE_MTAG mtag = m_tag_locate(m, MTAG_ABI_LKPI80211, LKPI80211_TAG_RXNI, NULL); if (mtag != NULL) { struct lkpi_80211_tag_rxni *rxni; @@ -6237,6 +6249,12 @@ lkpi_80211_lhw_rxq_rx_one(struct lkpi_hw *lhw, struct mbuf *m) rxni = (struct lkpi_80211_tag_rxni *)(mtag + 1); ni = rxni->ni; } +#else + if (m->m_pkthdr.PH_loc.ptr != NULL) { + ni = m->m_pkthdr.PH_loc.ptr; + m->m_pkthdr.PH_loc.ptr = NULL; + } +#endif if (ni != NULL) { ok = ieee80211_input_mimo(ni, m); @@ -6674,6 +6692,7 @@ skip_device_ts: /* Attach meta-information to the mbuf for the deferred RX path. */ if (ni != NULL) { +#ifdef LKPI_80211_USE_MTAG struct m_tag *mtag; struct lkpi_80211_tag_rxni *rxni; @@ -6687,6 +6706,9 @@ skip_device_ts: rxni = (struct lkpi_80211_tag_rxni *)(mtag + 1); rxni->ni = ni; /* We hold a reference. */ m_tag_prepend(m, mtag); +#else + m->m_pkthdr.PH_loc.ptr = ni; /* We hold a reference. */ +#endif } LKPI_80211_LHW_RXQ_LOCK(lhw); diff --git a/sys/compat/linuxkpi/common/src/linux_80211.h b/sys/compat/linuxkpi/common/src/linux_80211.h index e9c0d01af1bb..a5c052c78db0 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.h +++ b/sys/compat/linuxkpi/common/src/linux_80211.h @@ -86,6 +86,7 @@ #define MTAG_ABI_LKPI80211 1707696513 /* LinuxKPI 802.11 KBI */ +#ifdef LKPI_80211_USE_MTAG /* * Deferred RX path. * We need to pass *ni along (and possibly more in the future so @@ -95,6 +96,7 @@ struct lkpi_80211_tag_rxni { struct ieee80211_node *ni; /* MUST hold a reference to it. */ }; +#endif struct lkpi_radiotap_tx_hdr { struct ieee80211_radiotap_header wt_ihdr;