git: 0abea942d6d0 - stable/15 - bxe: Program the common RSS key in searcher byte order

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Thu, 29 Oct 2026 06:48:58 UTC
The branch stable/15 has been updated by kbowling:

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

commit 0abea942d6d0c7b5200d063a85206b98b2a5505c
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-09-18 08:29:18 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-10-29 06:46:36 +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
    Sponsored by:   BBOX.io
    Differential Revision:  https://reviews.freebsd.org/D59796
    
    (cherry picked from commit 9b374ad2b3f3b0f4e6c9d4e78859a429b6b282d6)
---
 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 3e7120a42a90..02d317775231 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"
@@ -11478,7 +11479,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
@@ -11509,10 +11509,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);
     }