git: 30fdef26de87 - main - qlxgbe: Derive the mailbox RSS key from the common key

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

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

commit 30fdef26de87516dbdd1dd5e3031a57ba8759437
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-09-18 08:29:21 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-09-18 23:05:10 +0000

    qlxgbe: Derive the mailbox RSS key from the common key
    
    Replace the embedded key with rss_getkey(), retaining the firmware's
    reversed 64-bit word-pair order and low-word-first layout within each
    pair.  The common default produces the same mailbox key as the existing
    constants, while configured common keys no longer get ignored.
    
    Leave the RSS enable flags, hash types, and indirection policy unchanged.
    
    Reviewed by:    gallatin
    MFC after:      2 weeks
    Sponsored by:   BBOX.io
    Differential Revision:  https://reviews.freebsd.org/D59801
---
 sys/dev/qlxgbe/ql_hw.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/sys/dev/qlxgbe/ql_hw.c b/sys/dev/qlxgbe/ql_hw.c
index 92044822e99f..e5c4a611670f 100644
--- a/sys/dev/qlxgbe/ql_hw.c
+++ b/sys/dev/qlxgbe/ql_hw.c
@@ -35,6 +35,7 @@
 
 #include <sys/cdefs.h>
 #include "ql_os.h"
+#include <net/rss_config.h>
 #include "ql_hw.h"
 #include "ql_def.h"
 #include "ql_inline.h"
@@ -1612,14 +1613,10 @@ qla_config_intr_cntxt(qla_host_t *ha, uint32_t start_idx, uint32_t num_intrs,
  * Name: qla_config_rss
  * Function: Configure RSS for the context/interface.
  */
-static 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];
 	q80_config_rss_t	*c_rss;
 	q80_config_rss_rsp_t	*c_rss_rsp;
 	uint32_t		err, i;
@@ -1648,8 +1645,16 @@ qla_config_rss(qla_host_t *ha, uint16_t cntxt_id)
 
 	c_rss->cntxt_id = cntxt_id;
 
-	for (i = 0; i < 5; i++) {
-		c_rss->rss_key[i] = rss_key[i];
+	_Static_assert(sizeof(c_rss->rss_key) == RSS_KEYSIZE,
+	    "RSS key size mismatch");
+	rss_getkey(rss_key);
+	/* Reverse the word pairs, retaining low-word-first mailbox ordering. */
+	for (i = 0; i < nitems(c_rss->rss_key); i++) {
+		const uint8_t *key = rss_key + sizeof(rss_key) -
+		    (i + 1) * sizeof(uint64_t);
+
+		c_rss->rss_key[i] = (uint64_t)be32dec(key + sizeof(uint32_t))
+		    << 32 | be32dec(key);
 	}
 
 	if (qla_mbx_cmd(ha, (uint32_t *)c_rss,