Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Oct 2025 13:11:11 GMT
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 4774687d4087 - stable/15 - tcp lro: use the flowid only when it has hash properties
Message-ID:  <202510091311.599DBBpX041879@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/15 has been updated by tuexen:

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

commit 4774687d4087cf40e46939f29473f7cb8c269ad5
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2025-10-09 12:37:11 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2025-10-09 12:53:09 +0000

    tcp lro: use the flowid only when it has hash properties
    
    When a packet is provided to LRO using tcp_lro_queue_mbuf(), a
    sequence number is computed based on the m_pkthdr.flowid provided
    by he driver. The implicit assumption is that the m_pkthdr.flowid
    has hash properties.
    The recent use of tcp_lro_queue_mbuf() in iflib exposed a bug in at
    least one driver (igc) , which
    * reports always that is uses M_HASHTYPE_OPAQUE.
    * sets in some cases m_pkthdr.flowid not consistently for packets
      belonging to the same TCP connection.
    This results in severe performance problems for the base TCP stack,
    since it handles the packets in the wrong sequence, although they were
    received in the correct sequence.
    To protect against such misbehaving drivers, just take the
    m_pkthdr.flowid only into account, if it has hash properties.
    The performance problems were observed by gallatin@ and analyzed
    together with rrs@.
    
    Reviewed by:            gallatin
    Tested by:              gallatin
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D52989
    
    (cherry picked from commit 73f56fa542ecf6ea6819c9e17fc60962eeb726d8)
---
 sys/netinet/tcp_lro.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c
index 64efa4bf060f..9b5baf115855 100644
--- a/sys/netinet/tcp_lro.c
+++ b/sys/netinet/tcp_lro.c
@@ -1475,10 +1475,11 @@ tcp_lro_queue_mbuf(struct lro_ctrl *lc, struct mbuf *mb)
  	}
 
 	/* create sequence number */
-	lc->lro_mbuf_data[lc->lro_mbuf_count].seq =
-	    (((uint64_t)M_HASHTYPE_GET(mb)) << 56) |
-	    (((uint64_t)mb->m_pkthdr.flowid) << 24) |
-	    ((uint64_t)lc->lro_mbuf_count);
+	lc->lro_mbuf_data[lc->lro_mbuf_count].seq = lc->lro_mbuf_count;
+	if (M_HASHTYPE_ISHASH(mb))
+		lc->lro_mbuf_data[lc->lro_mbuf_count].seq |=
+		    (((uint64_t)M_HASHTYPE_GET(mb)) << 56) |
+		    (((uint64_t)mb->m_pkthdr.flowid) << 24);
 
 	/* enter mbuf */
 	lc->lro_mbuf_data[lc->lro_mbuf_count].mb = mb;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202510091311.599DBBpX041879>