git: 894c574ed2f2 - main - Revert "dummynet: use m_rcvif_serialize/restore when queueing packets"

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

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

commit 894c574ed2f2a7f842a891e8f38ec62dec014466
Author:     Marko Zec <zec@FreeBSD.org>
AuthorDate: 2022-05-03 14:55:56 +0000
Commit:     Marko Zec <zec@FreeBSD.org>
CommitDate: 2022-05-03 17:11:40 +0000

    Revert "dummynet: use m_rcvif_serialize/restore when queueing packets"
    
    This reverts commit 165746f4e4bf54c5902a103c2d4a3455e651c58f.
    
    Obtained from: github.com/glebius/FreeBSD/commits/backout-ifindex
---
 sys/netpfil/ipfw/dn_aqm_codel.c      |  8 +-------
 sys/netpfil/ipfw/dn_aqm_pie.c        |  8 +-------
 sys/netpfil/ipfw/dn_sched.h          | 10 +---------
 sys/netpfil/ipfw/dn_sched_fq_codel.h |  9 ++-------
 sys/netpfil/ipfw/dn_sched_fq_pie.c   |  8 +-------
 sys/netpfil/ipfw/ip_dn_io.c          | 10 +---------
 6 files changed, 7 insertions(+), 46 deletions(-)

diff --git a/sys/netpfil/ipfw/dn_aqm_codel.c b/sys/netpfil/ipfw/dn_aqm_codel.c
index 2f6d145485c6..79c6afd8b635 100644
--- a/sys/netpfil/ipfw/dn_aqm_codel.c
+++ b/sys/netpfil/ipfw/dn_aqm_codel.c
@@ -192,9 +192,8 @@ struct mbuf *
 codel_extract_head(struct dn_queue *q, aqm_time_t *pkt_ts)
 {
 	struct m_tag *mtag;
-	struct mbuf *m;
+	struct mbuf *m = q->mq.head;
 
-next:	m = q->mq.head;
 	if (m == NULL)
 		return m;
 	q->mq.head = m->m_nextpkt;
@@ -214,11 +213,6 @@ next:	m = q->mq.head;
 		*pkt_ts = *(aqm_time_t *)(mtag + 1);
 		m_tag_delete(m,mtag); 
 	}
-	if (m->m_pkthdr.rcvif != NULL &&
-	    __predict_false(m_rcvif_restore(m) == NULL)) {
-		m_freem(m);
-		goto next;
-	}
 
 	return m;
 }
diff --git a/sys/netpfil/ipfw/dn_aqm_pie.c b/sys/netpfil/ipfw/dn_aqm_pie.c
index 5c97568b751e..3b80d6e94d38 100644
--- a/sys/netpfil/ipfw/dn_aqm_pie.c
+++ b/sys/netpfil/ipfw/dn_aqm_pie.c
@@ -328,9 +328,8 @@ static struct mbuf *
 pie_extract_head(struct dn_queue *q, aqm_time_t *pkt_ts, int getts)
 {
 	struct m_tag *mtag;
-	struct mbuf *m;
+	struct mbuf *m = q->mq.head;
 
-next:	m = q->mq.head;
 	if (m == NULL)
 		return m;
 	q->mq.head = m->m_nextpkt;
@@ -352,11 +351,6 @@ next:	m = q->mq.head;
 			m_tag_delete(m,mtag); 
 		}
 	}
-	if (m->m_pkthdr.rcvif != NULL &&
-	    __predict_false(m_rcvif_restore(m) == NULL)) {
-		m_freem(m);
-		goto next;
-	}
 	return m;
 }
 
diff --git a/sys/netpfil/ipfw/dn_sched.h b/sys/netpfil/ipfw/dn_sched.h
index ef7242cd7355..5c506c1d30ac 100644
--- a/sys/netpfil/ipfw/dn_sched.h
+++ b/sys/netpfil/ipfw/dn_sched.h
@@ -170,10 +170,7 @@ int ipdn_bound_var(int *v, int dflt, int lo, int hi, const char *msg);
 static __inline struct mbuf*
 dn_dequeue(struct dn_queue *q)
 {
-	struct mbuf *m;
-
-next:
-	m = q->mq.head;
+	struct mbuf *m = q->mq.head;
 	if (m == NULL)
 		return NULL;
 #ifdef NEW_AQM
@@ -193,11 +190,6 @@ next:
 	}
 	if (q->ni.length == 0) /* queue is now idle */
 		q->q_time = V_dn_cfg.curr_time;
-	if (m->m_pkthdr.rcvif != NULL &&
-	    __predict_false(m_rcvif_restore(m) == NULL)) {
-		m_freem(m);
-		goto next;
-	}
 	return m;
 }
 
diff --git a/sys/netpfil/ipfw/dn_sched_fq_codel.h b/sys/netpfil/ipfw/dn_sched_fq_codel.h
index b84dfe7579fb..2f82a63ca093 100644
--- a/sys/netpfil/ipfw/dn_sched_fq_codel.h
+++ b/sys/netpfil/ipfw/dn_sched_fq_codel.h
@@ -138,9 +138,8 @@ fq_update_stats(struct fq_codel_flow *q, struct fq_codel_si *si, int len,
 __inline static struct mbuf *
 fq_codel_extract_head(struct fq_codel_flow *q, aqm_time_t *pkt_ts, struct fq_codel_si *si)
 {
-	struct mbuf *m;
+	struct mbuf *m = q->mq.head;
 
-next:	m = q->mq.head;
 	if (m == NULL)
 		return m;
 	q->mq.head = m->m_nextpkt;
@@ -160,11 +159,7 @@ next:	m = q->mq.head;
 		*pkt_ts = *(aqm_time_t *)(mtag + 1);
 		m_tag_delete(m,mtag); 
 	}
-	if (m->m_pkthdr.rcvif != NULL &&
-	    __predict_false(m_rcvif_restore(m) == NULL)) {
-		m_freem(m);
-		goto next;
-	}
+
 	return m;
 }
 
diff --git a/sys/netpfil/ipfw/dn_sched_fq_pie.c b/sys/netpfil/ipfw/dn_sched_fq_pie.c
index f6bb4b6fe6de..65a6dd74b92f 100644
--- a/sys/netpfil/ipfw/dn_sched_fq_pie.c
+++ b/sys/netpfil/ipfw/dn_sched_fq_pie.c
@@ -338,9 +338,8 @@ __inline static struct mbuf *
 fq_pie_extract_head(struct fq_pie_flow *q, aqm_time_t *pkt_ts,
 	struct fq_pie_si *si, int getts)
 {
-	struct mbuf *m;
+	struct mbuf *m = q->mq.head;
 
-next:	m = q->mq.head;
 	if (m == NULL)
 		return m;
 	q->mq.head = m->m_nextpkt;
@@ -362,11 +361,6 @@ next:	m = q->mq.head;
 			m_tag_delete(m,mtag); 
 		}
 	}
-	if (m->m_pkthdr.rcvif != NULL &&
-	    __predict_false(m_rcvif_restore(m) == NULL)) {
-		m_freem(m);
-		goto next;
-	}
 	return m;
 }
 
diff --git a/sys/netpfil/ipfw/ip_dn_io.c b/sys/netpfil/ipfw/ip_dn_io.c
index 824e7450fb8f..11ad498505f4 100644
--- a/sys/netpfil/ipfw/ip_dn_io.c
+++ b/sys/netpfil/ipfw/ip_dn_io.c
@@ -500,8 +500,6 @@ dn_enqueue(struct dn_queue *q, struct mbuf* m, int drop)
 		goto drop;
 	if (f->plr && random() < f->plr)
 		goto drop;
-	if (m->m_pkthdr.rcvif != NULL)
-		m_rcvif_serialize(m);
 #ifdef NEW_AQM
 	/* Call AQM enqueue function */
 	if (q->fs->aqmfp)
@@ -550,11 +548,7 @@ transmit_event(struct mq *q, struct delay_line *dline, uint64_t now)
 			break;
 		dline->mq.head = m->m_nextpkt;
 		dline->mq.count--;
-		if (m->m_pkthdr.rcvif != NULL &&
-		  __predict_false(m_rcvif_restore(m) == NULL))
-			m_freem(m);
-		else
-			mq_append(q, m);
+		mq_append(q, m);
 	}
 	if (m != NULL) {
 		dline->oid.subtype = 1; /* in heap */
@@ -623,8 +617,6 @@ serve_sched(struct mq *q, struct dn_sch_inst *si, uint64_t now)
 		si->credit -= len_scaled;
 		/* Move packet in the delay line */
 		dn_tag_get(m)->output_time = V_dn_cfg.curr_time + s->link.delay ;
-		if (m->m_pkthdr.rcvif != NULL)
-			m_rcvif_serialize(m);
 		mq_append(&si->dline.mq, m);
 	}