git: 9b374ad2b3f3 - main - bxe: Program the common RSS key in searcher byte order

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

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

commit 9b374ad2b3f3b0f4e6c9d4e78859a429b6b282d6
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-09-18 08:29:18 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-09-18 22:56:01 +0000

    bxe: Program the common RSS key in searcher byte order
    
    Use the common RSS key instead of generating private random words.
    Reverse the bytes before passing the key to the shared code, which copies
    the supplied bytes directly into the firmware request.  The searcher
    consumes this array in reverse order; a raw copy of the common key would
    not produce matching Toeplitz hashes.
    
    The hardware ordering is documented by Linux commit
    d682d2bdc30650a5c7ce9908ab83ab674b658744 ("bnx2x: byte swap rss_key to
    comply to Toeplitz specs").  Keep the conversion in the FreeBSD caller
    rather than changing the shared-code interface.
    
    Preserve the config_hash gate, including the PMF-only key programming
    on 57710/57711, and leave hash types and indirection policy unchanged.
    
    Reviewed by:    gallatin
    MFC after:      2 weeks
    Sponsored by:   BBOX.io
    Differential Revision:  https://reviews.freebsd.org/D59796
---
 sys/dev/bxe/bxe.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/sys/dev/bxe/bxe.c b/sys/dev/bxe/bxe.c
index b6364c3909bb..acc65ee1458a 100644
--- a/sys/dev/bxe/bxe.c
+++ b/sys/dev/bxe/bxe.c
@@ -30,6 +30,7 @@
 #define BXE_DRIVER_VERSION "1.78.91"
 
 #include "bxe.h"
+#include <net/rss_config.h>
 #include "ecore_sp.h"
 #include "ecore_init.h"
 #include "ecore_init_ops.h"
@@ -11483,7 +11484,6 @@ bxe_config_rss_pf(struct bxe_softc            *sc,
                   uint8_t                     config_hash)
 {
     struct ecore_config_rss_params params = { NULL };
-    int i;
 
     /*
      * Although RSS is meaningless when there is a single HW queue we
@@ -11514,10 +11514,15 @@ bxe_config_rss_pf(struct bxe_softc            *sc,
     memcpy(params.ind_table, rss_obj->ind_table, sizeof(params.ind_table));
 
     if (config_hash) {
-        /* RSS keys */
-        for (i = 0; i < sizeof(params.rss_key) / 4; i++) {
-            params.rss_key[i] = arc4random();
-        }
+        uint8_t key[RSS_KEYSIZE];
+        unsigned int i;
+
+        /* The searcher consumes the key in reverse byte order. */
+        _Static_assert(sizeof(params.rss_key) == RSS_KEYSIZE,
+            "RSS key size mismatch");
+        rss_getkey(key);
+        for (i = 0; i < sizeof(key); i++)
+            ((uint8_t *)params.rss_key)[sizeof(key) - 1 - i] = key[i];
 
         bxe_set_bit(ECORE_RSS_SET_SRCH, &params.rss_flags);
     }