git: 0fa5636966c9 - main - Revert "netisr: serialize/restore m_pkthdr.rcvif when queueing mbufs"

From: Marko Zec <zec_at_FreeBSD.org>
Date: Tue, 03 May 2022 17:28:55 UTC
The branch main has been updated by zec:

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

commit 0fa5636966c9033ac5a987e1361820a7e15a01a4
Author:     Marko Zec <zec@FreeBSD.org>
AuthorDate: 2022-05-03 14:54:50 +0000
Commit:     Marko Zec <zec@FreeBSD.org>
CommitDate: 2022-05-03 17:11:39 +0000

    Revert "netisr: serialize/restore m_pkthdr.rcvif when queueing mbufs"
    
    This reverts commit 6871de9363e559fef6765f0e49acc47f77544999.
    
    Obtained from: github.com/glebius/FreeBSD/commits/backout-ifindex
---
 sys/net/netisr.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/sys/net/netisr.c b/sys/net/netisr.c
index 4d0bce3bedfc..e4abea317440 100644
--- a/sys/net/netisr.c
+++ b/sys/net/netisr.c
@@ -700,11 +700,9 @@ netisr_register_vnet(const struct netisr_handler *nhp)
 static void
 netisr_drain_proto_vnet(struct vnet *vnet, u_int proto)
 {
-	struct epoch_tracker et;
 	struct netisr_workstream *nwsp;
 	struct netisr_work *npwp;
 	struct mbuf *m, *mp, *n, *ne;
-	struct ifnet *ifp;
 	u_int i;
 
 	KASSERT(vnet != NULL, ("%s: vnet is NULL", __func__));
@@ -725,14 +723,11 @@ netisr_drain_proto_vnet(struct vnet *vnet, u_int proto)
 		 */
 		m = npwp->nw_head;
 		n = ne = NULL;
-		NET_EPOCH_ENTER(et);
 		while (m != NULL) {
 			mp = m;
 			m = m->m_nextpkt;
 			mp->m_nextpkt = NULL;
-			if ((ifp = ifnet_byindexgen(mp->m_pkthdr.rcvidx,
-			    mp->m_pkthdr.rcvgen)) != NULL &&
-			    ifp->if_vnet != vnet) {
+			if (mp->m_pkthdr.rcvif->if_vnet != vnet) {
 				if (n == NULL) {
 					n = ne = mp;
 				} else {
@@ -741,12 +736,10 @@ netisr_drain_proto_vnet(struct vnet *vnet, u_int proto)
 				}
 				continue;
 			}
-			/* This is a packet in the selected vnet, or belongs
-			   to destroyed interface. Free it. */
+			/* This is a packet in the selected vnet. Free it. */
 			npwp->nw_len--;
 			m_freem(mp);
 		}
-		NET_EPOCH_EXIT(et);
 		npwp->nw_head = n;
 		npwp->nw_tail = ne;
 		NWS_UNLOCK(nwsp);
@@ -920,10 +913,8 @@ netisr_process_workstream_proto(struct netisr_workstream *nwsp, u_int proto)
 		if (local_npw.nw_head == NULL)
 			local_npw.nw_tail = NULL;
 		local_npw.nw_len--;
-		if (__predict_false(m_rcvif_restore(m) == NULL)) {
-			m_freem(m);
-			continue;
-		}
+		VNET_ASSERT(m->m_pkthdr.rcvif != NULL,
+		    ("%s:%d rcvif == NULL: m=%p", __func__, __LINE__, m));
 		CURVNET_SET(m->m_pkthdr.rcvif->if_vnet);
 		netisr_proto[proto].np_handler(m);
 		CURVNET_RESTORE();
@@ -995,7 +986,6 @@ netisr_queue_workstream(struct netisr_workstream *nwsp, u_int proto,
 
 	*dosignalp = 0;
 	if (npwp->nw_len < npwp->nw_qlimit) {
-		m_rcvif_serialize(m);
 		m->m_nextpkt = NULL;
 		if (npwp->nw_head == NULL) {
 			npwp->nw_head = m;