Skip to content

Commit 1de0306

Browse files
ayalevin123Saeed Mahameed
authored andcommitted
net/mlx5e: Enhance ICOSQ WQE info fields
Add number of WQEBBs (WQE's Basic Block) to WQE info struct. Set the number of WQEBBs on WQE post, and increment the consumer counter (cc) on completion. In case of error completions, the cc was mistakenly not incremented, keeping a gap between cc and pc (producer counter). This failed the recovery flow on the ICOSQ from a CQE error which timed-out waiting for the cc and pc to meet. Fixes: be5323c ("net/mlx5e: Report and recover from CQE error on ICOSQ") Signed-off-by: Aya Levin <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 306f354 commit 1de0306

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ enum {
371371

372372
struct mlx5e_sq_wqe_info {
373373
u8 opcode;
374+
u8 num_wqebbs;
374375

375376
/* Auxiliary data for different opcodes. */
376377
union {

drivers/net/ethernet/mellanox/mlx5/core/en_rx.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ static inline void mlx5e_fill_icosq_frag_edge(struct mlx5e_icosq *sq,
477477
/* fill sq frag edge with nops to avoid wqe wrapping two pages */
478478
for (; wi < edge_wi; wi++) {
479479
wi->opcode = MLX5_OPCODE_NOP;
480+
wi->num_wqebbs = 1;
480481
mlx5e_post_nop(wq, sq->sqn, &sq->pc);
481482
}
482483
}
@@ -525,6 +526,7 @@ static int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix)
525526
umr_wqe->uctrl.xlt_offset = cpu_to_be16(xlt_offset);
526527

527528
sq->db.ico_wqe[pi].opcode = MLX5_OPCODE_UMR;
529+
sq->db.ico_wqe[pi].num_wqebbs = MLX5E_UMR_WQEBBS;
528530
sq->db.ico_wqe[pi].umr.rq = rq;
529531
sq->pc += MLX5E_UMR_WQEBBS;
530532

@@ -621,6 +623,7 @@ void mlx5e_poll_ico_cq(struct mlx5e_cq *cq)
621623

622624
ci = mlx5_wq_cyc_ctr2ix(&sq->wq, sqcc);
623625
wi = &sq->db.ico_wqe[ci];
626+
sqcc += wi->num_wqebbs;
624627

625628
if (last_wqe && unlikely(get_cqe_opcode(cqe) != MLX5_CQE_REQ)) {
626629
netdev_WARN_ONCE(cq->channel->netdev,
@@ -631,16 +634,12 @@ void mlx5e_poll_ico_cq(struct mlx5e_cq *cq)
631634
break;
632635
}
633636

634-
if (likely(wi->opcode == MLX5_OPCODE_UMR)) {
635-
sqcc += MLX5E_UMR_WQEBBS;
637+
if (likely(wi->opcode == MLX5_OPCODE_UMR))
636638
wi->umr.rq->mpwqe.umr_completed++;
637-
} else if (likely(wi->opcode == MLX5_OPCODE_NOP)) {
638-
sqcc++;
639-
} else {
639+
else if (unlikely(wi->opcode != MLX5_OPCODE_NOP))
640640
netdev_WARN_ONCE(cq->channel->netdev,
641641
"Bad OPCODE in ICOSQ WQE info: 0x%x\n",
642642
wi->opcode);
643-
}
644643

645644
} while (!last_wqe);
646645

drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ void mlx5e_trigger_irq(struct mlx5e_icosq *sq)
7878
u16 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);
7979

8080
sq->db.ico_wqe[pi].opcode = MLX5_OPCODE_NOP;
81+
sq->db.ico_wqe[pi].num_wqebbs = 1;
8182
nopwqe = mlx5e_post_nop(wq, sq->sqn, &sq->pc);
8283
mlx5e_notify_hw(wq, sq->pc, sq->uar_map, &nopwqe->ctrl);
8384
}

0 commit comments

Comments
 (0)