git: 4ad740ad48e2 - main - qlxgb: Derive the firmware RSS key from the common key

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

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

commit 4ad740ad48e2b461637c85cad675202874e182e2
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-09-18 08:55:59 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-09-18 23:08:28 +0000

    qlxgb: Derive the firmware RSS key from the common key
    
    Replace the embedded key with rss_getkey().  Retain the reversed 64-bit
    word-pair order and low-word-first layout used by the existing firmware
    request, matching the qlxgbe conversion.
    
    The common default produces the same five firmware words as the old
    constants.  Leave hash selections, RSS enablement, and the indirection
    mask unchanged.
    
    Reviewed by:    gallatin
    MFC after:      2 weeks
    Sponsored by:   BBOX.io
    Differential Revision:  https://reviews.freebsd.org/D59803
---
 sys/dev/qlxgb/qla_hw.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/sys/dev/qlxgb/qla_hw.c b/sys/dev/qlxgb/qla_hw.c
index 6ea68e1b255c..4d15f6ecaaee 100644
--- a/sys/dev/qlxgb/qla_hw.c
+++ b/sys/dev/qlxgb/qla_hw.c
@@ -35,6 +35,7 @@
 
 #include <sys/cdefs.h>
 #include "qla_os.h"
+#include <net/rss_config.h>
 #include "qla_reg.h"
 #include "qla_hw.h"
 #include "qla_def.h"
@@ -529,13 +530,10 @@ qla_fw_cmd(qla_host_t *ha, void *fw_cmd, uint32_t size)
  * Name: qla_config_rss
  * Function: Configure RSS for the context/interface.
  */
-const uint64_t rss_key[] = { 0xbeac01fa6a42b73bULL, 0x8030f20c77cb2da3ULL,
-			0xae7b30b4d0ca2bcbULL, 0x43a38fb04167253dULL,
-			0x255b0ec26d5a56daULL };
-
 static int
 qla_config_rss(qla_host_t *ha, uint16_t cntxt_id)
 {
+	uint8_t rss_key[RSS_KEYSIZE];
 	qla_fw_cds_config_rss_t rss_config;
 	int ret, i;
 
@@ -551,8 +549,17 @@ qla_config_rss(qla_host_t *ha, uint16_t cntxt_id)
 
 	rss_config.ind_tbl_mask = 0x7;
 
-	for (i = 0; i < 5; i++)
-		rss_config.rss_key[i] = rss_key[i];
+	_Static_assert(sizeof(rss_config.rss_key) == RSS_KEYSIZE,
+	    "RSS key size mismatch");
+	rss_getkey(rss_key);
+	/* Reverse the word pairs, retaining low-word-first firmware ordering. */
+	for (i = 0; i < nitems(rss_config.rss_key); i++) {
+		const uint8_t *key = rss_key + sizeof(rss_key) -
+		    (i + 1) * sizeof(uint64_t);
+
+		rss_config.rss_key[i] = (uint64_t)be32dec(key + sizeof(uint32_t))
+		    << 32 | be32dec(key);
+	}
 
 	ret = qla_fw_cmd(ha, &rss_config, sizeof(qla_fw_cds_config_rss_t));