Date: Sat, 22 Nov 2025 14:31:05 +0000 From: Andrew Gallatin <gallatin@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: dd0e6bb996dc - main - tcp: Enable symmetric hashing by setting hash on outgoing conns Message-ID: <6921c929.2e6e9.3918242d@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=dd0e6bb996dc46e1d91f3d9aef87979716479465 commit dd0e6bb996dc46e1d91f3d9aef87979716479465 Author: Andrew Gallatin <gallatin@FreeBSD.org> AuthorDate: 2025-11-22 14:29:35 +0000 Commit: Andrew Gallatin <gallatin@FreeBSD.org> CommitDate: 2025-11-22 14:29:35 +0000 tcp: Enable symmetric hashing by setting hash on outgoing conns Now that we can trust NICs to supply an identical hash result to software, we can setup the inpcb hash on outgoing connections. This gives us symmetric hashing, meaning packets should enter and leave on the same NIC queue. Differential Revision: https://reviews.freebsd.org/D53104 Reviewed by: adrian, cc, kbowling, tuexen, zlei Sponsored by: Netflix --- sys/netinet/tcp_usrreq.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 4d1a6455d09e..aeb28cd6a144 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -75,6 +75,7 @@ #include <netinet/in.h> #include <netinet/in_kdtrace.h> #include <netinet/in_pcb.h> +#include <netinet/in_rss.h> #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> @@ -82,6 +83,7 @@ #ifdef INET6 #include <netinet/ip6.h> #include <netinet6/in6_pcb.h> +#include <netinet6/in6_rss.h> #include <netinet6/ip6_var.h> #include <netinet6/scope6_var.h> #endif @@ -1487,6 +1489,10 @@ tcp_connect(struct tcpcb *tp, struct sockaddr_in *sin, struct thread *td) if (error != 0) return (error); + /* set the hash on the connection */ + rss_proto_software_hash_v4(inp->inp_faddr, inp->inp_laddr, + inp->inp_fport, inp->inp_lport, IPPROTO_TCP, + &inp->inp_flowid, &inp->inp_flowtype); /* * Compute window scaling to request: * Scale to fit into sweet spot. See tcp_syncache.c. @@ -1532,6 +1538,10 @@ tcp6_connect(struct tcpcb *tp, struct sockaddr_in6 *sin6, struct thread *td) if (error != 0) return (error); + /* set the hash on the connection */ + rss_proto_software_hash_v6(&inp->in6p_faddr, + &inp->in6p_laddr, inp->inp_fport, inp->inp_lport, IPPROTO_TCP, + &inp->inp_flowid, &inp->inp_flowtype); /* Compute window scaling to request. */ while (tp->request_r_scale < TCP_MAX_WINSHIFT && (TCP_MAXWIN << tp->request_r_scale) < sb_max)help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6921c929.2e6e9.3918242d>
