git: de607e3c230b - main - net80211: move net_epoch into net80211

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Fri, 01 Dec 2023 00:56:00 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=de607e3c230be88f6232b9c9fd6c37199648dc8c

commit de607e3c230be88f6232b9c9fd6c37199648dc8c
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-10-29 14:25:23 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-12-01 00:46:10 +0000

    net80211: move net_epoch into net80211
    
    Move the net_epoch into net80211 around the if_input calls and out of
    the driver (in this first case LinuxKPI).  This reduces coverage but
    also allows us to alloc in calls like (*ampdu_rx_start) which do not
    actually pass data up the stack.
    
    The follow-up commits will revert b65f813c1ab99448278961c5ca80dc422b1eae29,
    21c4082de9e2cf9a0fd81a9a981ab06022956847,
    17c328b6aebfa03cd1c2cbfbbc617e3b341bf1e4,
    af2441fbc7fa9e522e7f8697e5a181bdd4ff9e00,
    and 6c3e93cb5a4aa4b8a2d8d4d326f2a7c34d3a4458 for ath.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
    Tested by:      few (rtwn, ath, iwlwifi, ...)
    Reviewed by:    adrian
    Differential Revision: https://reviews.freebsd.org/D42427
---
 sys/compat/linuxkpi/common/src/linux_80211.c | 3 ---
 sys/net80211/ieee80211_hostap.c              | 4 ++++
 sys/net80211/ieee80211_input.c               | 3 +++
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 458a5825639a..448f417d1224 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -4154,7 +4154,6 @@ linuxkpi_ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
     struct ieee80211_sta *sta, struct napi_struct *napi __unused,
     struct list_head *list __unused)
 {
-	struct epoch_tracker et;
 	struct lkpi_hw *lhw;
 	struct ieee80211com *ic;
 	struct mbuf *m;
@@ -4371,7 +4370,6 @@ skip_device_ts:
 	}
 #endif
 
-	NET_EPOCH_ENTER(et);
 	if (ni != NULL) {
 		ok = ieee80211_input_mimo(ni, m);
 		ieee80211_free_node(ni);
@@ -4381,7 +4379,6 @@ skip_device_ts:
 		ok = ieee80211_input_mimo_all(ic, m);
 		/* mbuf got consumed. */
 	}
-	NET_EPOCH_EXIT(et);
 
 #ifdef LINUXKPI_DEBUG_80211
 	if (linuxkpi_debug_80211 & D80211_TRACE_RX)
diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c
index f738c97076ca..c1196961ad54 100644
--- a/sys/net80211/ieee80211_hostap.c
+++ b/sys/net80211/ieee80211_hostap.c
@@ -419,6 +419,8 @@ hostap_deliver_data(struct ieee80211vap *vap,
 			(void) ieee80211_vap_xmitpkt(vap, mcopy);
 	}
 	if (m != NULL) {
+		struct epoch_tracker et;
+
 		/*
 		 * Mark frame as coming from vap's interface.
 		 */
@@ -435,7 +437,9 @@ hostap_deliver_data(struct ieee80211vap *vap,
 			m->m_pkthdr.ether_vtag = ni->ni_vlan;
 			m->m_flags |= M_VLANTAG;
 		}
+		NET_EPOCH_ENTER(et);
 		ifp->if_input(ifp, m);
+		NET_EPOCH_EXIT(et);
 	}
 }
 
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c
index 0cc6902ae28e..a4bfe49bd8c4 100644
--- a/sys/net80211/ieee80211_input.c
+++ b/sys/net80211/ieee80211_input.c
@@ -274,6 +274,7 @@ void
 ieee80211_deliver_data(struct ieee80211vap *vap,
 	struct ieee80211_node *ni, struct mbuf *m)
 {
+	struct epoch_tracker et;
 	struct ether_header *eh = mtod(m, struct ether_header *);
 	struct ifnet *ifp = vap->iv_ifp;
 
@@ -304,7 +305,9 @@ ieee80211_deliver_data(struct ieee80211vap *vap,
 		m->m_pkthdr.ether_vtag = ni->ni_vlan;
 		m->m_flags |= M_VLANTAG;
 	}
+	NET_EPOCH_ENTER(et);
 	ifp->if_input(ifp, m);
+	NET_EPOCH_EXIT(et);
 }
 
 struct mbuf *