git: e0bcb3aa4f07 - stable/14 - tcp: initialize the LRO hash table with correct size
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 30 Aug 2024 06:30:17 UTC
The branch stable/14 has been updated by tuexen:
URL: https://cgit.FreeBSD.org/src/commit/?id=e0bcb3aa4f07e3336ceec48a3b53ed0c74e03e93
commit e0bcb3aa4f07e3336ceec48a3b53ed0c74e03e93
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:29:50 +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 2811cf25a052..906e01257a04 100644
--- a/sys/netinet/tcp_lro.c
+++ b/sys/netinet/tcp_lro.c
@@ -175,7 +175,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;
@@ -190,11 +190,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));