]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
eth: bnxt: move and rename reset helpers
authorJakub Kicinski <kuba@kernel.org>
Thu, 20 Jul 2023 01:04:38 +0000 (18:04 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jan 2026 12:12:11 +0000 (13:12 +0100)
[ Upstream commit fea2993aecd74d5d11ede1ebbd60e478ebfed996 ]

Move the reset helpers, subsequent patches will need some
of them on the Tx path.

While at it rename bnxt_sched_reset(), on more recent chips
it schedules a queue reset, instead of a fuller reset.

Link: https://lore.kernel.org/r/20230720010440.1967136-2-kuba@kernel.org
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: ffeafa65b2b2 ("bnxt_en: Fix potential data corruption with HW GRO/LRO")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index 40c53404bccbb6f5fd51ff5e897b78d2138b9d0c..7fa215b320603661fcb99ecf2f721fc02019aa95 100644 (file)
@@ -330,6 +330,38 @@ static void bnxt_db_cq(struct bnxt *bp, struct bnxt_db_info *db, u32 idx)
                BNXT_DB_CQ(db, idx);
 }
 
+static void bnxt_queue_fw_reset_work(struct bnxt *bp, unsigned long delay)
+{
+       if (!(test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)))
+               return;
+
+       if (BNXT_PF(bp))
+               queue_delayed_work(bnxt_pf_wq, &bp->fw_reset_task, delay);
+       else
+               schedule_delayed_work(&bp->fw_reset_task, delay);
+}
+
+static void bnxt_queue_sp_work(struct bnxt *bp)
+{
+       if (BNXT_PF(bp))
+               queue_work(bnxt_pf_wq, &bp->sp_task);
+       else
+               schedule_work(&bp->sp_task);
+}
+
+static void bnxt_sched_reset_rxr(struct bnxt *bp, struct bnxt_rx_ring_info *rxr)
+{
+       if (!rxr->bnapi->in_reset) {
+               rxr->bnapi->in_reset = true;
+               if (bp->flags & BNXT_FLAG_CHIP_P5)
+                       set_bit(BNXT_RESET_TASK_SP_EVENT, &bp->sp_event);
+               else
+                       set_bit(BNXT_RST_RING_SP_EVENT, &bp->sp_event);
+               bnxt_queue_sp_work(bp);
+       }
+       rxr->rx_next_cons = 0xffff;
+}
+
 const u16 bnxt_lhint_arr[] = {
        TX_BD_FLAGS_LHINT_512_AND_SMALLER,
        TX_BD_FLAGS_LHINT_512_TO_1023,
@@ -1181,38 +1213,6 @@ static int bnxt_discard_rx(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
        return 0;
 }
 
-static void bnxt_queue_fw_reset_work(struct bnxt *bp, unsigned long delay)
-{
-       if (!(test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)))
-               return;
-
-       if (BNXT_PF(bp))
-               queue_delayed_work(bnxt_pf_wq, &bp->fw_reset_task, delay);
-       else
-               schedule_delayed_work(&bp->fw_reset_task, delay);
-}
-
-static void bnxt_queue_sp_work(struct bnxt *bp)
-{
-       if (BNXT_PF(bp))
-               queue_work(bnxt_pf_wq, &bp->sp_task);
-       else
-               schedule_work(&bp->sp_task);
-}
-
-static void bnxt_sched_reset(struct bnxt *bp, struct bnxt_rx_ring_info *rxr)
-{
-       if (!rxr->bnapi->in_reset) {
-               rxr->bnapi->in_reset = true;
-               if (bp->flags & BNXT_FLAG_CHIP_P5)
-                       set_bit(BNXT_RESET_TASK_SP_EVENT, &bp->sp_event);
-               else
-                       set_bit(BNXT_RST_RING_SP_EVENT, &bp->sp_event);
-               bnxt_queue_sp_work(bp);
-       }
-       rxr->rx_next_cons = 0xffff;
-}
-
 static u16 bnxt_alloc_agg_idx(struct bnxt_rx_ring_info *rxr, u16 agg_id)
 {
        struct bnxt_tpa_idx_map *map = rxr->rx_tpa_idx_map;
@@ -1267,7 +1267,7 @@ static void bnxt_tpa_start(struct bnxt *bp, struct bnxt_rx_ring_info *rxr,
                netdev_warn(bp->dev, "TPA cons %x, expected cons %x, error code %x\n",
                            cons, rxr->rx_next_cons,
                            TPA_START_ERROR_CODE(tpa_start1));
-               bnxt_sched_reset(bp, rxr);
+               bnxt_sched_reset_rxr(bp, rxr);
                return;
        }
        /* Store cfa_code in tpa_info to use in tpa_end
@@ -1785,7 +1785,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
                if (rxr->rx_next_cons != 0xffff)
                        netdev_warn(bp->dev, "RX cons %x != expected cons %x\n",
                                    cons, rxr->rx_next_cons);
-               bnxt_sched_reset(bp, rxr);
+               bnxt_sched_reset_rxr(bp, rxr);
                if (rc1)
                        return rc1;
                goto next_rx_no_prod_no_len;
@@ -1823,7 +1823,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
                            !(bp->fw_cap & BNXT_FW_CAP_RING_MONITOR)) {
                                netdev_warn_once(bp->dev, "RX buffer error %x\n",
                                                 rx_err);
-                               bnxt_sched_reset(bp, rxr);
+                               bnxt_sched_reset_rxr(bp, rxr);
                        }
                }
                goto next_rx_no_len;
@@ -2165,7 +2165,7 @@ static int bnxt_async_event_process(struct bnxt *bp,
                        goto async_event_process_exit;
                }
                rxr = bp->bnapi[grp_idx]->rx_ring;
-               bnxt_sched_reset(bp, rxr);
+               bnxt_sched_reset_rxr(bp, rxr);
                goto async_event_process_exit;
        }
        default: