The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=3f6a84ffbf39c0e5e7673e6f73cf439507799e5e
commit 3f6a84ffbf39c0e5e7673e6f73cf439507799e5e Author: Adrian Chadd <adr...@freebsd.org> AuthorDate: 2025-05-18 04:16:55 +0000 Commit: Adrian Chadd <adr...@freebsd.org> CommitDate: 2025-05-25 15:23:14 +0000 net80211: refactor the if_input call into ieee80211_vap_deliver_data() Refactor the two places where NET_EPOCH_ENTER; if_input; NET_EPOCH_EXIT are called into a single spot in ieee80211_freebsd.c. This removes both if_input references and puts all the NET_EPOCH stuff into ieee80211_freebsd.c. Differential Revision: https://reviews.freebsd.org/D50404 Reviewed by: bz --- sys/net80211/ieee80211_freebsd.c | 21 +++++++++++++++++++++ sys/net80211/ieee80211_freebsd.h | 1 + sys/net80211/ieee80211_hostap.c | 7 ++----- sys/net80211/ieee80211_input.c | 6 ++---- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/sys/net80211/ieee80211_freebsd.c b/sys/net80211/ieee80211_freebsd.c index 5098529beb47..0a51063e1d9a 100644 --- a/sys/net80211/ieee80211_freebsd.c +++ b/sys/net80211/ieee80211_freebsd.c @@ -1236,6 +1236,27 @@ ieee80211_vap_copy_mac_address(struct ieee80211vap *vap) NET_EPOCH_EXIT(et); } +/** + * @brief Deliver data into the upper ifp of the VAP interface + * + * This delivers an 802.3 frame from net80211 up to the operating + * system network interface layer. + * + * @param vap the current VAP + * @param m the 802.3 frame to pass up to the VAP interface + * + * Note: this API consumes the mbuf. + */ +void +ieee80211_vap_deliver_data(struct ieee80211vap *vap, struct mbuf *m) +{ + struct epoch_tracker et; + + NET_EPOCH_ENTER(et); + if_input(vap->iv_ifp, m); + NET_EPOCH_EXIT(et); +} + /* * Module glue. * diff --git a/sys/net80211/ieee80211_freebsd.h b/sys/net80211/ieee80211_freebsd.h index bdc78fe99d36..442c5edef52d 100644 --- a/sys/net80211/ieee80211_freebsd.h +++ b/sys/net80211/ieee80211_freebsd.h @@ -542,6 +542,7 @@ struct debugnet80211_methods { void ieee80211_vap_sync_mac_address(struct ieee80211vap *); void ieee80211_vap_copy_mac_address(struct ieee80211vap *); +void ieee80211_vap_deliver_data(struct ieee80211vap *, struct mbuf *); #endif /* _KERNEL */ diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c index 1573d83f4cb4..e9105f2e7505 100644 --- a/sys/net80211/ieee80211_hostap.c +++ b/sys/net80211/ieee80211_hostap.c @@ -416,8 +416,6 @@ 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. */ @@ -434,9 +432,8 @@ 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); + + ieee80211_vap_deliver_data(vap, m); } } diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c index 925918c872dc..7befff22bd6f 100644 --- a/sys/net80211/ieee80211_input.c +++ b/sys/net80211/ieee80211_input.c @@ -274,7 +274,6 @@ 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; @@ -305,9 +304,8 @@ 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); + + ieee80211_vap_deliver_data(vap, m); } struct mbuf *