1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-28 08:02:54 +00:00

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
This commit is contained in:
Michael Tuexen 2024-08-20 17:30:55 +02:00
parent 66aed7e348
commit aa6c490bf8

View File

@ -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));