]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
bnxt_en: Fix stats context reservation logic
authorMichael Chan <michael.chan@broadcom.com>
Mon, 25 Aug 2025 17:59:27 +0000 (10:59 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Sep 2025 14:55:39 +0000 (16:55 +0200)
[ Upstream commit b4fc8faacfea2538184a1dbd616ae9447a361f3d ]

The HW resource reservation logic allows the L2 driver to use the
RoCE resources if the RoCE driver is not registered.  When calculating
the stats contexts available for L2, we should not blindly subtract
the stats contexts reserved for RoCE unless the RoCE driver is
registered.  This bug may cause the L2 rings to be less than the
number requested when we are close to running out of stats contexts.

Fixes: 2e4592dc9bee ("bnxt_en: Change MSIX/NQs allocation policy")
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/20250825175927.459987-4-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index 5360c42ad409c96ce1ce3b1f0d40641e3f3845cb..cb76ab78904fc195fd8ea7c307bc39ebac476fdb 100644 (file)
@@ -8009,7 +8009,8 @@ static int __bnxt_reserve_rings(struct bnxt *bp)
        }
        rx_rings = min_t(int, rx_rings, hwr.grp);
        hwr.cp = min_t(int, hwr.cp, bp->cp_nr_rings);
-       if (hwr.stat > bnxt_get_ulp_stat_ctxs(bp))
+       if (bnxt_ulp_registered(bp->edev) &&
+           hwr.stat > bnxt_get_ulp_stat_ctxs(bp))
                hwr.stat -= bnxt_get_ulp_stat_ctxs(bp);
        hwr.cp = min_t(int, hwr.cp, hwr.stat);
        rc = bnxt_trim_rings(bp, &rx_rings, &hwr.tx, hwr.cp, sh);