git: ce68b58217ed - main - qlnx: Derive the hardware RSS key from the common key

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Fri, 18 Sep 2026 23:03:37 UTC
The branch main has been updated by kbowling:

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

commit ce68b58217ed8a9bf45b1622d3d32ec26e9025d0
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-09-18 08:29:20 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-09-18 23:02:57 +0000

    qlnx: Derive the hardware RSS key from the common key
    
    Replace the embedded default key with rss_getkey().  Decode each group
    of four key bytes as a big-endian word; the shared code then serializes
    those host-order words as little-endian firmware fields.  This preserves
    the existing hardware representation for the common default and allows
    a configured common key to take effect.
    
    Keep the existing multi-queue gate, RSS hash selections, and indirection
    policy unchanged.
    
    Reviewed by:    gallatin
    MFC after:      2 weeks
    Sponsored by:   BBOX.io
    Differential Revision:  https://reviews.freebsd.org/D59800
---
 sys/dev/qlnx/qlnxe/qlnx_os.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/sys/dev/qlnx/qlnxe/qlnx_os.c b/sys/dev/qlnx/qlnxe/qlnx_os.c
index 215837968505..853bd4cb7108 100644
--- a/sys/dev/qlnx/qlnxe/qlnx_os.c
+++ b/sys/dev/qlnx/qlnxe/qlnx_os.c
@@ -32,6 +32,7 @@
 
 #include <sys/cdefs.h>
 #include "qlnx_os.h"
+#include <net/rss_config.h>
 #include "bcm_osal.h"
 #include "reg_addr.h"
 #include "ecore_gtt_reg_addr.h"
@@ -6481,21 +6482,10 @@ qlnx_update_rx_prod(struct ecore_hwfn *p_hwfn, struct qlnx_rx_queue *rxq)
 	return;
 }
 
-static uint32_t qlnx_hash_key[] = {
-                ((0x6d << 24)|(0x5a << 16)|(0x56 << 8)|0xda),
-                ((0x25 << 24)|(0x5b << 16)|(0x0e << 8)|0xc2),
-                ((0x41 << 24)|(0x67 << 16)|(0x25 << 8)|0x3d),
-                ((0x43 << 24)|(0xa3 << 16)|(0x8f << 8)|0xb0),
-                ((0xd0 << 24)|(0xca << 16)|(0x2b << 8)|0xcb),
-                ((0xae << 24)|(0x7b << 16)|(0x30 << 8)|0xb4),
-                ((0x77 << 24)|(0xcb << 16)|(0x2d << 8)|0xa3),
-                ((0x80 << 24)|(0x30 << 16)|(0xf2 << 8)|0x0c),
-                ((0x6a << 24)|(0x42 << 16)|(0xb7 << 8)|0x3b),
-                ((0xbe << 24)|(0xac << 16)|(0x01 << 8)|0xfa)};
-
 static int
 qlnx_start_queues(qlnx_host_t *ha)
 {
+        uint8_t                         rss_key[RSS_KEYSIZE];
         int				rc, tc, i, vport_id = 0,
 					drop_ttl0_flg = 1, vlan_removal_en = 1,
 					tx_switching = 0, hw_lro_enable = 0;
@@ -6637,8 +6627,13 @@ qlnx_start_queues(qlnx_host_t *ha)
                         rss_params->rss_ind_table[i] = fp->rxq->handle;
 		}
 
+                _Static_assert(sizeof(rss_params->rss_key) == RSS_KEYSIZE,
+                    "RSS key size mismatch");
+                rss_getkey(rss_key);
+                /* The shared code converts these host-order words to LE. */
                 for (i = 0; i < ECORE_RSS_KEY_SIZE; i++)
-			rss_params->rss_key[i] = (__le32)qlnx_hash_key[i];
+                        rss_params->rss_key[i] =
+                            be32dec(rss_key + i * sizeof(uint32_t));
 
         } else {
                 memset(rss_params, 0, sizeof(*rss_params));