git: aa6c490bf80f - main - tcp: initialize the LRO hash table with correct size
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 20 Aug 2024 15:35:03 UTC
The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=aa6c490bf80fcef15cfc0d3f562fae19ef2375aa commit aa6c490bf80fcef15cfc0d3f562fae19ef2375aa Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2024-08-20 15:30:55 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2024-08-20 15:30:55 +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 MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D46378 --- 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 921d28f82517..2603815f9e61 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));