git: 912c6b7f33db - stable/15 - cxgbe: use newly exposed RSS hash key API rather than ad-hoc hashing

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Thu, 29 Oct 2026 06:35:08 UTC
The branch stable/15 has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=912c6b7f33dbe1d2b49299645a6fb5c222fe1d21

commit 912c6b7f33dbe1d2b49299645a6fb5c222fe1d21
Author:     Andrew Gallatin <gallatin@FreeBSD.org>
AuthorDate: 2025-11-22 14:29:32 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-10-29 06:19:25 +0000

    cxgbe: use newly exposed RSS hash key API rather than ad-hoc hashing
    
    Differential Revision:  https://reviews.freebsd.org/D53092
    Reviewed by: np (outside of differential)
    Sponsored by: Netflix
    
    (cherry picked from commit d381a6b4a552305de48027c51919a7cf28d52d02)
---
 sys/dev/cxgbe/t4_main.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 92e5d5ffd8ed..ae0dbc731207 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -57,9 +57,7 @@
 #include <net/if_types.h>
 #include <net/if_dl.h>
 #include <net/if_vlan_var.h>
-#ifdef RSS
 #include <net/rss_config.h>
-#endif
 #include <netinet/in.h>
 #include <netinet/ip.h>
 #ifdef KERN_TLS
@@ -7017,7 +7015,6 @@ t4_setup_intr_handlers(struct adapter *sc)
 static void
 write_global_rss_key(struct adapter *sc)
 {
-#ifdef RSS
 	int i;
 	uint32_t raw_rss_key[RSS_KEYSIZE / sizeof(uint32_t)];
 	uint32_t rss_key[RSS_KEYSIZE / sizeof(uint32_t)];
@@ -7029,7 +7026,6 @@ write_global_rss_key(struct adapter *sc)
 		rss_key[i] = htobe32(raw_rss_key[nitems(rss_key) - 1 - i]);
 	}
 	t4_write_rss_key(sc, &rss_key[0], -1, 1);
-#endif
 }
 
 /*
@@ -7109,7 +7105,6 @@ adapter_full_uninit(struct adapter *sc)
 	sc->flags &= ~FULL_INIT_DONE;
 }
 
-#ifdef RSS
 #define SUPPORTED_RSS_HASHTYPES (RSS_HASHTYPE_RSS_IPV4 | \
     RSS_HASHTYPE_RSS_TCP_IPV4 | RSS_HASHTYPE_RSS_IPV6 | \
     RSS_HASHTYPE_RSS_TCP_IPV6 | RSS_HASHTYPE_RSS_UDP_IPV4 | \
@@ -7172,7 +7167,6 @@ hashen_to_hashconfig(int hashen)
 
 	return (hashconfig);
 }
-#endif
 
 /*
  * Idempotent.
@@ -7183,9 +7177,9 @@ vi_full_init(struct vi_info *vi)
 	struct adapter *sc = vi->adapter;
 	struct sge_rxq *rxq;
 	int rc, i, j;
+	int hashconfig = rss_gethashconfig();
 #ifdef RSS
 	int nbuckets = rss_getnumbuckets();
-	int hashconfig = rss_gethashconfig();
 	int extra;
 #endif
 
@@ -7241,9 +7235,9 @@ vi_full_init(struct vi_info *vi)
 		return (rc);
 	}
 
-#ifdef RSS
 	vi->hashen = hashconfig_to_hashen(hashconfig);
 
+#ifdef RSS
 	/*
 	 * We may have had to enable some hashes even though the global config
 	 * wants them disabled.  This is a potential problem that must be
@@ -7277,11 +7271,6 @@ vi_full_init(struct vi_info *vi)
 		CH_ALERT(vi, "UDP/IPv4 4-tuple hashing forced on.\n");
 	if (extra & RSS_HASHTYPE_RSS_UDP_IPV6)
 		CH_ALERT(vi, "UDP/IPv6 4-tuple hashing forced on.\n");
-#else
-	vi->hashen = F_FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN |
-	    F_FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN |
-	    F_FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN |
-	    F_FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN | F_FW_RSS_VI_CONFIG_CMD_UDPEN;
 #endif
 	rc = -t4_config_vi_rss(sc, sc->mbox, vi->viid, vi->hashen, vi->rss[0],
 	    0, 0);