Skip to content

Commit e4bf81d

Browse files
Michael Chankuba-moo
authored andcommitted
bnxt_en: Don't assume XDP is never enabled in bnxt_init_dflt_ring_mode()
The original code made the assumption that when we set up the initial default ring mode, we must be just loading the driver and XDP cannot be enabled yet. This is not true when the FW goes through a resource or capability change. Resource reservations will be cancelled and reinitialized with XDP already enabled. devlink reload with XDP enabled will also have the same issue. This scenario will cause the ring arithmetic to be all wrong in the bnxt_init_dflt_ring_mode() path causing failure: bnxt_en 0000:a1:00.0 ens2f0np0: bnxt_setup_int_mode err: ffffffea bnxt_en 0000:a1:00.0 ens2f0np0: bnxt_request_irq err: ffffffea bnxt_en 0000:a1:00.0 ens2f0np0: nic open fail (rc: ffffffea) Fix it by properly accounting for XDP in the bnxt_init_dflt_ring_mode() path by using the refactored helper functions in the previous patch. Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com> Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com> Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Fixes: ec5d31e ("bnxt_en: Handle firmware reset status during IF_UP.") Fixes: 228ea8c ("bnxt_en: implement devlink dev reload driver_reinit") Signed-off-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20260331065138.948205-3-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent ceee35e commit e4bf81d

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

  • drivers/net/ethernet/broadcom/bnxt

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16547,6 +16547,10 @@ static void bnxt_adj_dflt_rings(struct bnxt *bp, bool sh)
1654716547
else
1654816548
bp->cp_nr_rings = bp->tx_nr_rings_per_tc + bp->rx_nr_rings;
1654916549
bp->tx_nr_rings = bnxt_tx_nr_rings(bp);
16550+
if (sh && READ_ONCE(bp->xdp_prog)) {
16551+
bnxt_set_xdp_tx_rings(bp);
16552+
bnxt_set_cp_rings(bp, true);
16553+
}
1655016554
}
1655116555

1655216556
static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh)
@@ -16588,16 +16592,17 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh)
1658816592
rc = __bnxt_reserve_rings(bp);
1658916593
if (rc && rc != -ENODEV)
1659016594
netdev_warn(bp->dev, "Unable to reserve tx rings\n");
16591-
bp->tx_nr_rings_per_tc = bnxt_tx_nr_rings_per_tc(bp);
16595+
16596+
bnxt_adj_tx_rings(bp);
1659216597
if (sh)
16593-
bnxt_trim_dflt_sh_rings(bp);
16598+
bnxt_adj_dflt_rings(bp, true);
1659416599

1659516600
/* Rings may have been trimmed, re-reserve the trimmed rings. */
1659616601
if (bnxt_need_reserve_rings(bp)) {
1659716602
rc = __bnxt_reserve_rings(bp);
1659816603
if (rc && rc != -ENODEV)
1659916604
netdev_warn(bp->dev, "2nd rings reservation failed.\n");
16600-
bp->tx_nr_rings_per_tc = bnxt_tx_nr_rings_per_tc(bp);
16605+
bnxt_adj_tx_rings(bp);
1660116606
}
1660216607
if (BNXT_CHIP_TYPE_NITRO_A0(bp)) {
1660316608
bp->rx_nr_rings++;
@@ -16631,7 +16636,7 @@ static int bnxt_init_dflt_ring_mode(struct bnxt *bp)
1663116636
if (rc)
1663216637
goto init_dflt_ring_err;
1663316638

16634-
bp->tx_nr_rings_per_tc = bnxt_tx_nr_rings_per_tc(bp);
16639+
bnxt_adj_tx_rings(bp);
1663516640

1663616641
bnxt_set_dflt_rfs(bp);
1663716642

0 commit comments

Comments
 (0)