From nobody Thu Oct 29 06:35:01 2026 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jFZGY72PRz6xt8p for ; Thu, 29 Oct 2026 06:35:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jFZGY56BVz57P5 for ; Thu, 29 Oct 2026 06:35:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793255701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kUXGIoMq6NK12DHuw/TOwzDXPyA5S+e4WV8USgtRfCU=; b=pMyoCQE0n/Lxp1eLIcGawvo7hfxOh7rEgDUAhgGE4vZlBOcXTpRUPULaPsFPsIqZYflZad xTfltAijJ1cn28L7oMUk1wAnBPC1nQWXzearsr+FcH9ZvDBXh+bGU+Y7AYaaU2MiB5dFdw LAe0YYYIpFq2ZQr0ZZ8wx6/ucwrnh6CW/F2YJZf8QCQlRxd0cfVGwPjElDj0NRSxYHkuH0 neGlmHmkEJd+xKJmw20nfIp435sU2JP+74JFctGrbsrrCidq+1OmBXfFIXqp3P4CVPjCOf YONY1IUCZZeTPUwYJw4oSdfi//RiYEWvm9zntY9kVO6pasXWszT3g5SG6do5lA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1793255701; b=GMI8TQXgm8FzSX2te+f+ybp/p6/OZzMevnq9aBE1yq05+L3Hy7C16qGfaHeZMwlfTzR5hV I3GYpbviyFVYcWcA8JoeHRLDRmCj7uNH1p6AMsbfn2v515DadDyIWi1DiZP/0+eXXQfdEn wDWCEzPMx4rfI+F655nf7MLs7QfHeu+dAo0Viai+jEANXeBILQ3ogCa/KyoLrBDBWrTIFj CkJ8IabHlqZi+LhwAC8yeGAsUibPpED1tLBzOGQNni2FN1raGbCth3seunCALfNDjYnXb7 m9td+Hj8R85FwHI9TMMoih+BEioqFuDjC+JarSawBP3VeU/sQ/fPp6sU17+c1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793255701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kUXGIoMq6NK12DHuw/TOwzDXPyA5S+e4WV8USgtRfCU=; b=LvcghVbGhrrHQGIq0Kd3Wm5/6b8lO9N/+6i3So5qEOJ2SNZYzWreRRLPJb5xMXjTqyzAwr BEpNU8FZ9jSMUQBDdpP+H4wpg1TPLWOVHbItK6rigzR2VGAUjQqVQpG182rhhrqrRuQv7j Vf1mr/kdYDjemH6aEpPL2x9BG9zeoY2m8pmvVZ6tBzVFFRGORZD/MEdh8N5vx2DE3yz4q1 9CqipOrf0OvI99ND6mTDPwfnkFs/plHLWHKwwDIYHNrtkj+6rh0iyY8EvKkRY8IwuBniry h8k19W3juU/HnWtwdWvZUZ9e+DrMBploFBg03sy5F7f5m065z3FJm+YcvSoWAg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jFZGY3hB0zRkN for ; Thu, 29 Oct 2026 06:35:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3c773 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 29 Oct 2026 06:35:01 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Andrew Gallatin From: Kevin Bowling Subject: git: f21f28402c60 - stable/15 - rss: Enable portions of RSS globally to enable symmetric hashing List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: Commits to the stable branches of the FreeBSD src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: f21f28402c602e9a32e05075e81862e02bcbd985 Auto-Submitted: auto-generated Date: Thu, 29 Oct 2026 06:35:01 +0000 Message-Id: <6ae2e915.3c773.34e95117@gitrepo.freebsd.org> The branch stable/15 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=f21f28402c602e9a32e05075e81862e02bcbd985 commit f21f28402c602e9a32e05075e81862e02bcbd985 Author: Andrew Gallatin AuthorDate: 2025-11-22 14:29:31 +0000 Commit: Kevin Bowling CommitDate: 2026-10-29 06:19:18 +0000 rss: Enable portions of RSS globally to enable symmetric hashing We use the fact that all NICs that support hashing are using the same hash algorithm and hash key to enable symmetic hashing in TCP, where a software version of the same hash is used to establish hashes on outgoing connections. Sponsored by: Netflix Reviewed by: adrian, zlei (both early version) Differential Revision: https://reviews.freebsd.org/D53089 (cherry picked from commit d9c55b2e8cd6b79f6926278e10a79f1bcca27a4b) --- sys/conf/files | 8 +++--- sys/net/rss_config.c | 66 +++++++++++++++++++++++++++++++------------------- sys/net/rss_config.h | 20 +++++++++------ sys/netinet/in_rss.c | 3 +++ sys/netinet6/in6_rss.c | 3 +++ 5 files changed, 63 insertions(+), 37 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 9328569f7977..616aae80c7f5 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4264,10 +4264,10 @@ net/route/route_rtentry.c standard net/route/route_subscription.c standard net/route/route_tables.c standard net/route/route_temporal.c standard -net/rss_config.c optional inet rss | inet6 rss +net/rss_config.c standard net/rtsock.c standard net/slcompress.c optional netgraph_vjc -net/toeplitz.c optional inet rss | inet6 rss | route_mpath +net/toeplitz.c optional inet | inet6 | route_mpath net/vnet.c optional vimage net80211/ieee80211.c optional wlan net80211/ieee80211_acl.c optional wlan wlan_acl @@ -4410,7 +4410,7 @@ netinet/in_pcb.c optional inet | inet6 netinet/in_prot.c optional inet | inet6 netinet/in_proto.c optional inet | inet6 netinet/in_rmx.c optional inet -netinet/in_rss.c optional inet rss +netinet/in_rss.c optional inet netinet/ip_divert.c optional ipdivert inet | ipdivert inet6 netinet/ip_ecn.c optional inet | inet6 netinet/ip_encap.c optional inet | inet6 @@ -4512,7 +4512,7 @@ netinet6/in6_mcast.c optional inet6 netinet6/in6_pcb.c optional inet6 netinet6/in6_proto.c optional inet6 netinet6/in6_rmx.c optional inet6 -netinet6/in6_rss.c optional inet6 rss +netinet6/in6_rss.c optional inet6 netinet6/in6_src.c optional inet6 netinet6/ip6_fastfwd.c optional inet6 netinet6/ip6_forward.c optional inet6 diff --git a/sys/net/rss_config.c b/sys/net/rss_config.c index 266ea57b2dc9..9e4120a4e9dd 100644 --- a/sys/net/rss_config.c +++ b/sys/net/rss_config.c @@ -29,6 +29,8 @@ #include "opt_inet6.h" +#include "opt_inet.h" +#include "opt_rss.h" #include #include @@ -72,6 +74,10 @@ * placement and pcbgroup expectations. */ +#if !defined(INET) && !defined(INET6) +#define _net_inet _net +#define _net_inet_rss _net_rss +#endif SYSCTL_DECL(_net_inet); SYSCTL_NODE(_net_inet, OID_AUTO, rss, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "Receive-side steering"); @@ -84,6 +90,7 @@ static u_int rss_hashalgo = RSS_HASH_TOEPLITZ; SYSCTL_INT(_net_inet_rss, OID_AUTO, hashalgo, CTLFLAG_RDTUN, &rss_hashalgo, 0, "RSS hash algorithm"); +#ifdef RSS /* * Size of the indirection table; at most 128 entries per the RSS spec. We * size it to at least 2 times the number of CPUs by default to allow useful @@ -132,6 +139,7 @@ static const u_int rss_basecpu; SYSCTL_INT(_net_inet_rss, OID_AUTO, basecpu, CTLFLAG_RD, __DECONST(int *, &rss_basecpu), 0, "RSS base CPU"); +#endif /* * Print verbose debugging messages. * 0 - disable @@ -159,6 +167,7 @@ static uint8_t rss_key[RSS_KEYSIZE] = { 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa, }; +#ifdef RSS /* * RSS hash->CPU table, which maps hashed packet headers to particular CPUs. * Drivers may supplement this table with a separate CPU<->queue table when @@ -168,13 +177,15 @@ struct rss_table_entry { uint8_t rte_cpu; /* CPU affinity of bucket. */ }; static struct rss_table_entry rss_table[RSS_TABLE_MAXLEN]; +#endif static void rss_init(__unused void *arg) { +#ifdef RSS u_int i; u_int cpuid; - +#endif /* * Validate tunables, coerce to sensible values. */ @@ -189,6 +200,7 @@ rss_init(__unused void *arg) rss_hashalgo = RSS_HASH_TOEPLITZ; } +#ifdef RSS /* * Count available CPUs. * @@ -248,7 +260,7 @@ rss_init(__unused void *arg) rss_table[i].rte_cpu = cpuid; cpuid = CPU_NEXT(cpuid); } - +#endif /* RSS */ /* * Randomize rrs_key. * @@ -292,6 +304,30 @@ rss_hash(u_int datalen, const uint8_t *data) } } +/* + * Query the current RSS key; likely to be used by device drivers when + * configuring hardware RSS. Caller must pass an array of size RSS_KEYSIZE. + * + * XXXRW: Perhaps we should do the accept-a-length-and-truncate thing? + */ +void +rss_getkey(uint8_t *key) +{ + + bcopy(rss_key, key, sizeof(rss_key)); +} + +/* + * Query the RSS hash algorithm. + */ +u_int +rss_gethashalgo(void) +{ + + return (rss_hashalgo); +} + +#ifdef RSS /* * Query the number of RSS bits in use. */ @@ -406,29 +442,6 @@ rss_m2bucket(struct mbuf *m, uint32_t *bucket_id) bucket_id)); } -/* - * Query the RSS hash algorithm. - */ -u_int -rss_gethashalgo(void) -{ - - return (rss_hashalgo); -} - -/* - * Query the current RSS key; likely to be used by device drivers when - * configuring hardware RSS. Caller must pass an array of size RSS_KEYSIZE. - * - * XXXRW: Perhaps we should do the accept-a-length-and-truncate thing? - */ -void -rss_getkey(uint8_t *key) -{ - - bcopy(rss_key, key, sizeof(rss_key)); -} - /* * Query the number of buckets; this may be used by both network device * drivers, which will need to populate hardware shadows of the software @@ -454,6 +467,7 @@ rss_getnumcpus(void) return (rss_ncpus); } +#endif /* * Return the supported RSS hash configuration. * @@ -517,6 +531,7 @@ SYSCTL_PROC(_net_inet_rss, OID_AUTO, key, CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, sysctl_rss_key, "", "RSS keying material"); +#ifdef RSS static int sysctl_rss_bucket_mapping(SYSCTL_HANDLER_ARGS) { @@ -544,3 +559,4 @@ sysctl_rss_bucket_mapping(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_net_inet_rss, OID_AUTO, bucket_mapping, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, sysctl_rss_bucket_mapping, "", "RSS bucket -> CPU mapping"); +#endif diff --git a/sys/net/rss_config.h b/sys/net/rss_config.h index 07c2d09b44c5..aaa282b12e72 100644 --- a/sys/net/rss_config.h +++ b/sys/net/rss_config.h @@ -104,6 +104,7 @@ extern int rss_debug; +#ifdef RSS /* * Device driver interfaces to query RSS properties that must be programmed * into hardware. @@ -112,16 +113,8 @@ u_int rss_getbits(void); u_int rss_getbucket(u_int hash); u_int rss_get_indirection_to_bucket(u_int index); u_int rss_getcpu(u_int bucket); -void rss_getkey(uint8_t *key); -u_int rss_gethashalgo(void); u_int rss_getnumbuckets(void); u_int rss_getnumcpus(void); -u_int rss_gethashconfig(void); - -/* - * Hash calculation functions. - */ -uint32_t rss_hash(u_int datalen, const uint8_t *data); /* * Network stack interface to query desired CPU affinity of a packet. @@ -132,4 +125,15 @@ int rss_hash2bucket(uint32_t hash_val, uint32_t hash_type, uint32_t *bucket_id); int rss_m2bucket(struct mbuf *m, uint32_t *bucket_id); +#endif /* RSS */ + +void rss_getkey(uint8_t *key); +u_int rss_gethashalgo(void); +u_int rss_gethashconfig(void); +/* + * Hash calculation functions. + */ +uint32_t rss_hash(u_int datalen, const uint8_t *data); + + #endif /* !_NET_RSS_CONFIG_H_ */ diff --git a/sys/netinet/in_rss.c b/sys/netinet/in_rss.c index f93a1d2bfd7b..4854265bd9f4 100644 --- a/sys/netinet/in_rss.c +++ b/sys/netinet/in_rss.c @@ -29,6 +29,7 @@ #include "opt_inet6.h" +#include "opt_rss.h" #include #include @@ -350,6 +351,7 @@ rss_mbuf_software_hash_v4(const struct mbuf *m, int dir, uint32_t *hashval, } } +#ifdef RSS /* * Similar to rss_m2cpuid, but designed to be used by the IP NETISR * on incoming frames. @@ -387,3 +389,4 @@ rss_soft_m2cpuid_v4(struct mbuf *m, uintptr_t source, u_int *cpuid) } return (m); } +#endif diff --git a/sys/netinet6/in6_rss.c b/sys/netinet6/in6_rss.c index 79c7bfa6e68c..3d98d0065d1e 100644 --- a/sys/netinet6/in6_rss.c +++ b/sys/netinet6/in6_rss.c @@ -29,6 +29,7 @@ #include "opt_inet6.h" +#include "opt_rss.h" #include #include @@ -375,6 +376,7 @@ rss_mbuf_software_hash_v6(const struct mbuf *m, int dir, uint32_t *hashval, } } +#ifdef RSS /* * Similar to rss_m2cpuid, but designed to be used by the IPv6 NETISR * on incoming frames. @@ -412,3 +414,4 @@ rss_soft_m2cpuid_v6(struct mbuf *m, uintptr_t source, u_int *cpuid) } return (m); } +#endif