The branch main has been updated by gallatin:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=8f94088bc5d3ee586b36f8f7b269223b420ac957

commit 8f94088bc5d3ee586b36f8f7b269223b420ac957
Author:     Andrew Gallatin <[email protected]>
AuthorDate: 2025-11-24 15:36:09 +0000
Commit:     Andrew Gallatin <[email protected]>
CommitDate: 2025-11-24 15:36:41 +0000

    mlx5: use newly exposed RSS hash key API rather than ad-hoc hashing
    
    Differential Revision:  https://reviews.freebsd.org/D53091
    Reviewed by: kib
    Sponsored by: Netflix
---
 sys/dev/mlx5/mlx5_en/en.h           |  2 --
 sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 30 +-----------------------------
 sys/dev/mlx5/mlx5_en/mlx5_en_rx.c   |  4 ----
 3 files changed, 1 insertion(+), 35 deletions(-)

diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h
index f59902be226a..768f58188220 100644
--- a/sys/dev/mlx5/mlx5_en/en.h
+++ b/sys/dev/mlx5/mlx5_en/en.h
@@ -53,10 +53,8 @@
 #include <sys/kthread.h>
 #include <sys/counter.h>
 
-#ifdef RSS
 #include <net/rss_config.h>
 #include <netinet/in_rss.h>
-#endif
 
 #include <machine/bus.h>
 
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c 
b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
index 4658bebb7845..daa98752c59b 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
@@ -2915,24 +2915,7 @@ err_modify:
 static void
 mlx5e_get_rss_key(void *key_ptr)
 {
-#ifdef RSS
        rss_getkey(key_ptr);
-#else
-       static const u32 rsskey[] = {
-           cpu_to_be32(0xD181C62C),
-           cpu_to_be32(0xF7F4DB5B),
-           cpu_to_be32(0x1983A2FC),
-           cpu_to_be32(0x943E1ADB),
-           cpu_to_be32(0xD9389E6B),
-           cpu_to_be32(0xD1039C2C),
-           cpu_to_be32(0xA74499AD),
-           cpu_to_be32(0x593D56D9),
-           cpu_to_be32(0xF3253C06),
-           cpu_to_be32(0x2ADC1FFC),
-       };
-       CTASSERT(sizeof(rsskey) == MLX5E_RSS_KEY_SIZE);
-       memcpy(key_ptr, rsskey, MLX5E_RSS_KEY_SIZE);
-#endif
 }
 
 static void
@@ -3044,15 +3027,12 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * 
tirc, int tt, bool inner_vxla
 
        CTASSERT(MLX5_FLD_SZ_BYTES(tirc, rx_hash_toeplitz_key) >=
                 MLX5E_RSS_KEY_SIZE);
-#ifdef RSS
+
        /*
         * The FreeBSD RSS implementation does currently not
         * support symmetric Toeplitz hashes:
         */
        MLX5_SET(tirc, tirc, rx_hash_symmetric, 0);
-#else
-       MLX5_SET(tirc, tirc, rx_hash_symmetric, 1);
-#endif
        mlx5e_get_rss_key(hkey);
 
        switch (tt) {
@@ -3061,12 +3041,10 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * 
tirc, int tt, bool inner_vxla
                    MLX5_L3_PROT_TYPE_IPV4);
                MLX5_SET(rx_hash_field_select, hfs, l4_prot_type,
                    MLX5_L4_PROT_TYPE_TCP);
-#ifdef RSS
                if (!(rss_gethashconfig() & RSS_HASHTYPE_RSS_TCP_IPV4)) {
                        MLX5_SET(rx_hash_field_select, hfs, selected_fields,
                            MLX5_HASH_IP);
                } else
-#endif
                MLX5_SET(rx_hash_field_select, hfs, selected_fields,
                    MLX5_HASH_ALL);
                break;
@@ -3076,12 +3054,10 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * 
tirc, int tt, bool inner_vxla
                    MLX5_L3_PROT_TYPE_IPV6);
                MLX5_SET(rx_hash_field_select, hfs, l4_prot_type,
                    MLX5_L4_PROT_TYPE_TCP);
-#ifdef RSS
                if (!(rss_gethashconfig() & RSS_HASHTYPE_RSS_TCP_IPV6)) {
                        MLX5_SET(rx_hash_field_select, hfs, selected_fields,
                            MLX5_HASH_IP);
                } else
-#endif
                MLX5_SET(rx_hash_field_select, hfs, selected_fields,
                    MLX5_HASH_ALL);
                break;
@@ -3091,12 +3067,10 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * 
tirc, int tt, bool inner_vxla
                    MLX5_L3_PROT_TYPE_IPV4);
                MLX5_SET(rx_hash_field_select, hfs, l4_prot_type,
                    MLX5_L4_PROT_TYPE_UDP);
-#ifdef RSS
                if (!(rss_gethashconfig() & RSS_HASHTYPE_RSS_UDP_IPV4)) {
                        MLX5_SET(rx_hash_field_select, hfs, selected_fields,
                            MLX5_HASH_IP);
                } else
-#endif
                MLX5_SET(rx_hash_field_select, hfs, selected_fields,
                    MLX5_HASH_ALL);
                break;
@@ -3106,12 +3080,10 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * 
tirc, int tt, bool inner_vxla
                    MLX5_L3_PROT_TYPE_IPV6);
                MLX5_SET(rx_hash_field_select, hfs, l4_prot_type,
                    MLX5_L4_PROT_TYPE_UDP);
-#ifdef RSS
                if (!(rss_gethashconfig() & RSS_HASHTYPE_RSS_UDP_IPV6)) {
                        MLX5_SET(rx_hash_field_select, hfs, selected_fields,
                            MLX5_HASH_IP);
                } else
-#endif
                MLX5_SET(rx_hash_field_select, hfs, selected_fields,
                    MLX5_HASH_ALL);
                break;
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c 
b/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
index eb569488631a..262558d529dc 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
@@ -358,7 +358,6 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe, struct mlx5e_rq 
*rq,
        /* check if a Toeplitz hash was computed */
        if (cqe->rss_hash_type != 0) {
                mb->m_pkthdr.flowid = be32_to_cpu(cqe->rss_hash_result);
-#ifdef RSS
                /* decode the RSS hash type */
                switch (cqe->rss_hash_type &
                    (CQE_RSS_DST_HTYPE_L4 | CQE_RSS_DST_HTYPE_IP)) {
@@ -386,9 +385,6 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe, struct mlx5e_rq 
*rq,
                        M_HASHTYPE_SET(mb, M_HASHTYPE_OPAQUE_HASH);
                        break;
                }
-#else
-               M_HASHTYPE_SET(mb, M_HASHTYPE_OPAQUE_HASH);
-#endif
 #ifdef M_HASHTYPE_SETINNER
                if (cqe_is_tunneled(cqe))
                        M_HASHTYPE_SETINNER(mb);

Reply via email to