]> 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 13:31:49 +0000 (15:31 +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 b8c6087a5c31e981c454084e4884aee43811260f..08886c3a28c61cf267e7e308b821a1391802dc27 100644 (file)
@@ -7780,7 +7780,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);