Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153063293
D56177.id175358.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D56177.id175358.diff
View Options
diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c
--- a/sys/netinet/tcp_lro.c
+++ b/sys/netinet/tcp_lro.c
@@ -44,6 +44,7 @@
#include <sys/socketvar.h>
#include <sys/sockbuf.h>
#include <sys/sysctl.h>
+#include <sys/hash.h>
#include <net/if.h>
#include <net/if_var.h>
@@ -190,13 +191,19 @@
LIST_INIT(&lc->lro_free);
LIST_INIT(&lc->lro_active);
- /* create hash table to accelerate entry lookup */
- lc->lro_hash = phashinit_flags(lro_entries, M_LRO, &lc->lro_hashsz,
- HASH_NOWAIT);
+ /* Create hash table to accelerate entry lookup. */
+ struct hashalloc_args ha = {
+ .size = lro_entries,
+ .mtype = M_LRO,
+ .mflags = M_NOWAIT,
+ .type = HASH_TYPE_PRIME,
+ };
+ lc->lro_hash = hashalloc(&ha);
if (lc->lro_hash == NULL) {
memset(lc, 0, sizeof(*lc));
return (ENOMEM);
}
+ lc->lro_hashsz = ha.size;
/* compute size to allocate */
size = (lro_mbufs * sizeof(struct lro_mbuf_sort)) +
@@ -206,7 +213,11 @@
/* check for out of memory */
if (lc->lro_mbuf_data == NULL) {
- free(lc->lro_hash, M_LRO);
+ struct hashalloc_args ha = {
+ .size = lc->lro_hashsz,
+ .mtype = M_LRO,
+ };
+ hashfree(lc->lro_hash, &ha);
memset(lc, 0, sizeof(*lc));
return (ENOMEM);
}
@@ -503,8 +514,11 @@
lro_free_mbuf_chain(le->m_head);
}
- /* free hash table */
- free(lc->lro_hash, M_LRO);
+ struct hashalloc_args ha = {
+ .size = lc->lro_hashsz,
+ .mtype = M_LRO,
+ };
+ hashfree(lc->lro_hash, &ha);
lc->lro_hash = NULL;
lc->lro_hashsz = 0;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 19, 10:06 PM (4 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30659971
Default Alt Text
D56177.id175358.diff (1 KB)
Attached To
Mode
D56177: tcp lro: use hashalloc(9)
Attached
Detach File
Event Timeline
Log In to Comment