Skip to content

Commit fea2993

Browse files
committed
eth: bnxt: move and rename reset helpers
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>
1 parent 59be3ba commit fea2993

1 file changed

Lines changed: 36 additions & 36 deletions

File tree

  • drivers/net/ethernet/broadcom/bnxt

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

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,38 @@ static void bnxt_db_cq(struct bnxt *bp, struct bnxt_db_info *db, u32 idx)
293293
BNXT_DB_CQ(db, idx);
294294
}
295295

296+
static void bnxt_queue_fw_reset_work(struct bnxt *bp, unsigned long delay)
297+
{
298+
if (!(test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)))
299+
return;
300+
301+
if (BNXT_PF(bp))
302+
queue_delayed_work(bnxt_pf_wq, &bp->fw_reset_task, delay);
303+
else
304+
schedule_delayed_work(&bp->fw_reset_task, delay);
305+
}
306+
307+
static void bnxt_queue_sp_work(struct bnxt *bp)
308+
{
309+
if (BNXT_PF(bp))
310+
queue_work(bnxt_pf_wq, &bp->sp_task);
311+
else
312+
schedule_work(&bp->sp_task);
313+
}
314+
315+
static void bnxt_sched_reset_rxr(struct bnxt *bp, struct bnxt_rx_ring_info *rxr)
316+
{
317+
if (!rxr->bnapi->in_reset) {
318+
rxr->bnapi->in_reset = true;
319+
if (bp->flags & BNXT_FLAG_CHIP_P5)
320+
set_bit(BNXT_RESET_TASK_SP_EVENT, &bp->sp_event);
321+
else
322+
set_bit(BNXT_RST_RING_SP_EVENT, &bp->sp_event);
323+
bnxt_queue_sp_work(bp);
324+
}
325+
rxr->rx_next_cons = 0xffff;
326+
}
327+
296328
const u16 bnxt_lhint_arr[] = {
297329
TX_BD_FLAGS_LHINT_512_AND_SMALLER,
298330
TX_BD_FLAGS_LHINT_512_TO_1023,
@@ -1234,38 +1266,6 @@ static int bnxt_discard_rx(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
12341266
return 0;
12351267
}
12361268

1237-
static void bnxt_queue_fw_reset_work(struct bnxt *bp, unsigned long delay)
1238-
{
1239-
if (!(test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)))
1240-
return;
1241-
1242-
if (BNXT_PF(bp))
1243-
queue_delayed_work(bnxt_pf_wq, &bp->fw_reset_task, delay);
1244-
else
1245-
schedule_delayed_work(&bp->fw_reset_task, delay);
1246-
}
1247-
1248-
static void bnxt_queue_sp_work(struct bnxt *bp)
1249-
{
1250-
if (BNXT_PF(bp))
1251-
queue_work(bnxt_pf_wq, &bp->sp_task);
1252-
else
1253-
schedule_work(&bp->sp_task);
1254-
}
1255-
1256-
static void bnxt_sched_reset(struct bnxt *bp, struct bnxt_rx_ring_info *rxr)
1257-
{
1258-
if (!rxr->bnapi->in_reset) {
1259-
rxr->bnapi->in_reset = true;
1260-
if (bp->flags & BNXT_FLAG_CHIP_P5)
1261-
set_bit(BNXT_RESET_TASK_SP_EVENT, &bp->sp_event);
1262-
else
1263-
set_bit(BNXT_RST_RING_SP_EVENT, &bp->sp_event);
1264-
bnxt_queue_sp_work(bp);
1265-
}
1266-
rxr->rx_next_cons = 0xffff;
1267-
}
1268-
12691269
static u16 bnxt_alloc_agg_idx(struct bnxt_rx_ring_info *rxr, u16 agg_id)
12701270
{
12711271
struct bnxt_tpa_idx_map *map = rxr->rx_tpa_idx_map;
@@ -1320,7 +1320,7 @@ static void bnxt_tpa_start(struct bnxt *bp, struct bnxt_rx_ring_info *rxr,
13201320
netdev_warn(bp->dev, "TPA cons %x, expected cons %x, error code %x\n",
13211321
cons, rxr->rx_next_cons,
13221322
TPA_START_ERROR_CODE(tpa_start1));
1323-
bnxt_sched_reset(bp, rxr);
1323+
bnxt_sched_reset_rxr(bp, rxr);
13241324
return;
13251325
}
13261326
/* Store cfa_code in tpa_info to use in tpa_end
@@ -1844,7 +1844,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
18441844
if (rxr->rx_next_cons != 0xffff)
18451845
netdev_warn(bp->dev, "RX cons %x != expected cons %x\n",
18461846
cons, rxr->rx_next_cons);
1847-
bnxt_sched_reset(bp, rxr);
1847+
bnxt_sched_reset_rxr(bp, rxr);
18481848
if (rc1)
18491849
return rc1;
18501850
goto next_rx_no_prod_no_len;
@@ -1882,7 +1882,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
18821882
!(bp->fw_cap & BNXT_FW_CAP_RING_MONITOR)) {
18831883
netdev_warn_once(bp->dev, "RX buffer error %x\n",
18841884
rx_err);
1885-
bnxt_sched_reset(bp, rxr);
1885+
bnxt_sched_reset_rxr(bp, rxr);
18861886
}
18871887
}
18881888
goto next_rx_no_len;
@@ -2329,7 +2329,7 @@ static int bnxt_async_event_process(struct bnxt *bp,
23292329
goto async_event_process_exit;
23302330
}
23312331
rxr = bp->bnapi[grp_idx]->rx_ring;
2332-
bnxt_sched_reset(bp, rxr);
2332+
bnxt_sched_reset_rxr(bp, rxr);
23332333
goto async_event_process_exit;
23342334
}
23352335
case ASYNC_EVENT_CMPL_EVENT_ID_ECHO_REQUEST: {

0 commit comments

Comments
 (0)