diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2021-01-25 03:40:48 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2021-01-25 03:40:48 +0000 |
commit | a8cba88b182fb9442c86999c100950727ed8071e (patch) | |
tree | 5a3995d69d8999cf01277d5a291891eef0c1f545 /sys/netinet/in_pcb.c | |
parent | 0b9e212cd27d66ee4fb81b17f11a54dc08234ba7 (diff) |
if stoeplitz is enabled, use it to provide a flowid for tcp packets.
drivers that implement rss and multiple rings depend on the symmetric
toeplitz code, and use it to generate a key that decides with rx
ring a packet lands on. if the toeplitz code is enabled, this diff
has the pcb and tcp layer use the toeplitz code to generate a flowid
for packets they send, which in turn is used to pick a tx ring.
because the nic and the stack use the same key, the tx and rx sides
end up with the same hash/flowid. at the very least this means that
the same rx and tx queue pair on a particular nic are used for both
sides of the connection. as the stack becomes more parallel, it
will also help keep both sides of the tcp connection processing in
the one place.
Diffstat (limited to 'sys/netinet/in_pcb.c')
-rw-r--r-- | sys/netinet/in_pcb.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 12ed205c858..99402c98425 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.252 2020/11/07 09:51:40 denis Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.253 2021/01/25 03:40:46 dlg Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -95,6 +95,11 @@ #include <netinet/ip_esp.h> #endif /* IPSEC */ +#include "stoeplitz.h" +#if NSTOEPLITZ > 0 +#include <net/toeplitz.h> +#endif + const struct in_addr zeroin_addr; union { @@ -516,6 +521,10 @@ in_pcbconnect(struct inpcb *inp, struct mbuf *nam) inp->inp_faddr = sin->sin_addr; inp->inp_fport = sin->sin_port; in_pcbrehash(inp); +#if NSTOEPLITZ > 0 + inp->inp_flowid = stoeplitz_ip4port(inp->inp_laddr.s_addr, + inp->inp_faddr.s_addr, inp->inp_lport, inp->inp_fport); +#endif #ifdef IPSEC { /* Cause an IPsec SA to be established. */ @@ -549,6 +558,7 @@ in_pcbdisconnect(struct inpcb *inp) } inp->inp_fport = 0; + inp->inp_flowid = 0; in_pcbrehash(inp); if (inp->inp_socket->so_state & SS_NOFDREF) in_pcbdetach(inp); |