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
This commit is contained in:
Andrew Gallatin
2025-11-22 09:29:32 -05:00
parent d9c55b2e8c
commit d381a6b4a5
+2 -13
View File
@@ -57,9 +57,7 @@
#include <net/if_types.h> #include <net/if_types.h>
#include <net/if_dl.h> #include <net/if_dl.h>
#include <net/if_vlan_var.h> #include <net/if_vlan_var.h>
#ifdef RSS
#include <net/rss_config.h> #include <net/rss_config.h>
#endif
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/ip.h> #include <netinet/ip.h>
#ifdef KERN_TLS #ifdef KERN_TLS
@@ -7035,7 +7033,6 @@ t4_setup_intr_handlers(struct adapter *sc)
static void static void
write_global_rss_key(struct adapter *sc) write_global_rss_key(struct adapter *sc)
{ {
#ifdef RSS
int i; int i;
uint32_t raw_rss_key[RSS_KEYSIZE / sizeof(uint32_t)]; uint32_t raw_rss_key[RSS_KEYSIZE / sizeof(uint32_t)];
uint32_t rss_key[RSS_KEYSIZE / sizeof(uint32_t)]; uint32_t rss_key[RSS_KEYSIZE / sizeof(uint32_t)];
@@ -7047,7 +7044,6 @@ write_global_rss_key(struct adapter *sc)
rss_key[i] = htobe32(raw_rss_key[nitems(rss_key) - 1 - i]); rss_key[i] = htobe32(raw_rss_key[nitems(rss_key) - 1 - i]);
} }
t4_write_rss_key(sc, &rss_key[0], -1, 1); t4_write_rss_key(sc, &rss_key[0], -1, 1);
#endif
} }
/* /*
@@ -7127,7 +7123,6 @@ adapter_full_uninit(struct adapter *sc)
sc->flags &= ~FULL_INIT_DONE; sc->flags &= ~FULL_INIT_DONE;
} }
#ifdef RSS
#define SUPPORTED_RSS_HASHTYPES (RSS_HASHTYPE_RSS_IPV4 | \ #define SUPPORTED_RSS_HASHTYPES (RSS_HASHTYPE_RSS_IPV4 | \
RSS_HASHTYPE_RSS_TCP_IPV4 | RSS_HASHTYPE_RSS_IPV6 | \ RSS_HASHTYPE_RSS_TCP_IPV4 | RSS_HASHTYPE_RSS_IPV6 | \
RSS_HASHTYPE_RSS_TCP_IPV6 | RSS_HASHTYPE_RSS_UDP_IPV4 | \ RSS_HASHTYPE_RSS_TCP_IPV6 | RSS_HASHTYPE_RSS_UDP_IPV4 | \
@@ -7190,7 +7185,6 @@ hashen_to_hashconfig(int hashen)
return (hashconfig); return (hashconfig);
} }
#endif
/* /*
* Idempotent. * Idempotent.
@@ -7201,9 +7195,9 @@ vi_full_init(struct vi_info *vi)
struct adapter *sc = vi->adapter; struct adapter *sc = vi->adapter;
struct sge_rxq *rxq; struct sge_rxq *rxq;
int rc, i, j; int rc, i, j;
int hashconfig = rss_gethashconfig();
#ifdef RSS #ifdef RSS
int nbuckets = rss_getnumbuckets(); int nbuckets = rss_getnumbuckets();
int hashconfig = rss_gethashconfig();
int extra; int extra;
#endif #endif
@@ -7259,9 +7253,9 @@ vi_full_init(struct vi_info *vi)
return (rc); return (rc);
} }
#ifdef RSS
vi->hashen = hashconfig_to_hashen(hashconfig); vi->hashen = hashconfig_to_hashen(hashconfig);
#ifdef RSS
/* /*
* We may have had to enable some hashes even though the global config * We may have had to enable some hashes even though the global config
* wants them disabled. This is a potential problem that must be * wants them disabled. This is a potential problem that must be
@@ -7295,11 +7289,6 @@ vi_full_init(struct vi_info *vi)
CH_ALERT(vi, "UDP/IPv4 4-tuple hashing forced on.\n"); CH_ALERT(vi, "UDP/IPv4 4-tuple hashing forced on.\n");
if (extra & RSS_HASHTYPE_RSS_UDP_IPV6) if (extra & RSS_HASHTYPE_RSS_UDP_IPV6)
CH_ALERT(vi, "UDP/IPv6 4-tuple hashing forced on.\n"); 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 #endif
rc = -t4_config_vi_rss(sc, sc->mbox, vi->viid, vi->hashen, vi->rss[0], rc = -t4_config_vi_rss(sc, sc->mbox, vi->viid, vi->hashen, vi->rss[0],
0, 0); 0, 0);