Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Apr 2026 20:35:44 +0000
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 2d13620c6e1b - main - tcp lro: fix vnet handling
Message-ID:  <69dff6a0.20dad.6680d624@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by tuexen:

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

commit 2d13620c6e1be7f8136095f648a6b824158d0941
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2026-04-15 20:31:48 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2026-04-15 20:31:48 +0000

    tcp lro: fix vnet handling
    
    Reported by:            Shawn Webb
    Reviewed by:            glebius, rrs
    Fixes:                  f707cc00ed12 ("lro: move pkt rejection checks to leafs to avoid queueing")
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D56420
---
 sys/netinet/tcp_lro.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c
index 5819fb5ceae0..961a1fa2cb31 100644
--- a/sys/netinet/tcp_lro.c
+++ b/sys/netinet/tcp_lro.c
@@ -1422,15 +1422,20 @@ tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum)
 {
 	int error;
 
+	CURVNET_SET(lc->ifp->if_vnet);
 #ifdef INET
 	/* Quickly decide if packet cannot be LRO'ed */
-	if (__predict_false(V_ipforwarding != 0))
+	if (__predict_false(V_ipforwarding != 0)) {
+		CURVNET_RESTORE();
 		return (TCP_LRO_CANNOT);
+	}
 #endif
 #ifdef INET6
 	/* Quickly decide if packet cannot be LRO'ed */
-	if (__predict_false(V_ip6_forwarding != 0))
+	if (__predict_false(V_ip6_forwarding != 0)) {
+		CURVNET_RESTORE();
 		return (TCP_LRO_CANNOT);
+	}
 #endif
 
 	if (((m->m_pkthdr.csum_flags & (CSUM_DATA_VALID | CSUM_PSEUDO_HDR)) !=
@@ -1442,12 +1447,12 @@ tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum)
 		 * a packet.
 		 */
 		counter_u64_add(tcp_bad_csums, 1);
+		CURVNET_RESTORE();
 		return (TCP_LRO_CANNOT);
 	}
 
 	/* get current time */
 	binuptime(&lc->lro_last_queue_time);
-	CURVNET_SET(lc->ifp->if_vnet);
 	error = tcp_lro_rx_common(lc, m, csum, true);
 	if (__predict_false(error != 0)) {
 		/*
@@ -1474,10 +1479,12 @@ tcp_lro_queue_mbuf(struct lro_ctrl *lc, struct mbuf *mb)
 		return;
 	}
 
+	CURVNET_SET(lc->ifp->if_vnet);
 #ifdef INET
 	/* Quickly decide if packet cannot be LRO'ed */
 	if (__predict_false(V_ipforwarding != 0)) {
 		/* input packet to network layer */
+		CURVNET_RESTORE();
 		(*lc->ifp->if_input) (lc->ifp, mb);
 		return;
 	}
@@ -1486,10 +1493,12 @@ tcp_lro_queue_mbuf(struct lro_ctrl *lc, struct mbuf *mb)
 	/* Quickly decide if packet cannot be LRO'ed */
 	if (__predict_false(V_ip6_forwarding != 0)) {
 		/* input packet to network layer */
+		CURVNET_RESTORE();
 		(*lc->ifp->if_input) (lc->ifp, mb);
 		return;
 	}
 #endif
+	CURVNET_RESTORE();
 	/* check if packet is not LRO capable */
 	if (__predict_false((lc->ifp->if_capenable & IFCAP_LRO) == 0)) {
 		/* input packet to network layer */


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69dff6a0.20dad.6680d624>