git: 349012757a04 - stable/15 - bxe(4): don't feed a zero page size to ilog2 during ILT init

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Fri, 30 Oct 2026 17:27:53 UTC
The branch stable/15 has been updated by kbowling:

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

commit 349012757a0410f35b1326ef5ad1949cf4fc68d6
Author:     Nick Price <nprice@FreeBSD.org>
AuthorDate: 2026-08-31 23:16:12 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-10-30 17:27:39 +0000

    bxe(4): don't feed a zero page size to ilog2 during ILT init
    
    FreeBSD's bxe hardwires CNIC_SUPPORT() to 0, so bxe_ilt_set_info()
    never enters the block that initializes the SRC and TM ILT clients.
    Those two clients are left zeroed (page_size 0, flags 0), yet
    ecore_ilt_init_page_size() calls ecore_ilt_init_client_psz() for all
    four clients unconditionally. For SRC and TM that evaluates
    ILOG2(page_size >> 12), i.e. ilog2(0). On an INVARIANTS kernel ilog2()
    asserts "ilog argument must be nonzero" and panics the machine the
    first time the interface is brought up (bxe_init -> bxe_nic_load ->
    bxe_init_hw -> ecore_ilt_init_page_size). On a non-INVARIANTS kernel
    it silently programs a bogus page-size register instead.
    
    Restore the else branch that upstream Linux bnx2x carries: when CNIC
    is not supported, mark the SRC and TM clients with ILT_CLIENT_SKIP_INIT
    and ILT_CLIENT_SKIP_MEM so ecore_ilt_init_client_psz() skips them.
    
    Root-caused from a crash dump on a BCM57810 (device 0x168e): the ILT
    clients showed CDU and QM populated and SRC and TM zeroed with no skip
    flag set.
    
    Reviewed by:    adrian
    Approved by:    adrian (mentor)
    Differential Revision:  https://reviews.freebsd.org/D58587
    Signed-off-by: Nick Price <nprice@FreeBSD.org>
    (cherry picked from commit 742c5498aca9a9a31a68eb9d5888edf36b7034dd)
---
 sys/dev/bxe/bxe.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/dev/bxe/bxe.c b/sys/dev/bxe/bxe.c
index 02d317775231..acc65ee1458a 100644
--- a/sys/dev/bxe/bxe.c
+++ b/sys/dev/bxe/bxe.c
@@ -5900,6 +5900,11 @@ bxe_ilt_set_info(struct bxe_softc *sc)
               ilt_client->start, ilt_client->end,
               ilt_client->page_size, ilt_client->flags,
               ilog2(ilt_client->page_size >> 12));
+    } else {
+        ilt->clients[ILT_CLIENT_SRC].flags =
+            (ILT_CLIENT_SKIP_INIT | ILT_CLIENT_SKIP_MEM);
+        ilt->clients[ILT_CLIENT_TM].flags =
+            (ILT_CLIENT_SKIP_INIT | ILT_CLIENT_SKIP_MEM);
     }
 
     KASSERT((line <= ILT_MAX_LINES), ("Invalid number of ILT lines!"));