Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Aug 2024 06:45:02 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: 5420e4f56389 - stable/13 - tcp: initialize the LRO hash table with correct size
Message-ID:  <202408300645.47U6j2Nb074704@gitrepo.freebsd.org>

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

URL: https://cgit.FreeBSD.org/src/commit/?id=5420e4f56389c841322f1bf4aad1cf288a9a6482

commit 5420e4f56389c841322f1bf4aad1cf288a9a6482
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-08-20 15:30:55 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-08-30 06:44:35 +0000

    tcp: initialize the LRO hash table with correct size
    
    There will at most lro_entries entries in the LRO hash table. So no
    need to take lro_mbufs into account, which only results in the
    LRO hash table being too large and therefore wasting memory.
    
    Reviewed by:            rrs
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D46378
    
    (cherry picked from commit aa6c490bf80fcef15cfc0d3f562fae19ef2375aa)
---
 sys/netinet/tcp_lro.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c
index 83b730b15558..7f54da48c5f6 100644
--- a/sys/netinet/tcp_lro.c
+++ b/sys/netinet/tcp_lro.c
@@ -168,7 +168,7 @@ tcp_lro_init_args(struct lro_ctrl *lc, struct ifnet *ifp,
 {
 	struct lro_entry *le;
 	size_t size;
-	unsigned i, elements;
+	unsigned i;
 
 	lc->lro_bad_csum = 0;
 	lc->lro_queued = 0;
@@ -183,11 +183,7 @@ tcp_lro_init_args(struct lro_ctrl *lc, struct ifnet *ifp,
 	LIST_INIT(&lc->lro_active);
 
 	/* create hash table to accelerate entry lookup */
-	if (lro_entries > lro_mbufs)
-		elements = lro_entries;
-	else
-		elements = lro_mbufs;
-	lc->lro_hash = phashinit_flags(elements, M_LRO, &lc->lro_hashsz,
+	lc->lro_hash = phashinit_flags(lro_entries, M_LRO, &lc->lro_hashsz,
 	    HASH_NOWAIT);
 	if (lc->lro_hash == NULL) {
 		memset(lc, 0, sizeof(*lc));



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