Skip to content

Commit

Permalink
net/mlx5: fix error packets drop in regular Rx
Browse files Browse the repository at this point in the history
[ upstream commit ef296e8f6140ea469b50c7bfe73501b1c9ef86e1 ]

When packet gets received with error it is reported in CQE
structure and PMD analyzes the error syndrome and provides
two options - either reset the entire queue for the critical
errors, or just ignore the packet.

The non-vectorized rx_burst did not ignore the non-critical
error packets, and in case of packet length exceeding the
mbuf data buffer length it took the next element in the queue
WQE ring, resulting in CQE/WQE consume indices synchronization
lost.

Fixes: aa67ed308458 ("net/mlx5: ignore non-critical syndromes for Rx queue")

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
  • Loading branch information
viacheslavo authored and kevintraynor committed Mar 8, 2024
1 parent 411422b commit c52e6e0
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions drivers/net/mlx5/mlx5_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,8 @@ mlx5_rx_err_handle(struct mlx5_rxq_data *rxq, uint8_t vec,
* @param mprq
* Indication if it is called from MPRQ.
* @return
* 0 in case of empty CQE, MLX5_REGULAR_ERROR_CQE_RET in case of error CQE,
* 0 in case of empty CQE,
* MLX5_REGULAR_ERROR_CQE_RET in case of error CQE,
* MLX5_CRITICAL_ERROR_CQE_RET in case of error CQE lead to Rx queue reset,
* otherwise the packet size in regular RxQ,
* and striding byte count format in mprq case.
Expand Down Expand Up @@ -657,6 +658,11 @@ mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cqe,
if (ret == MLX5_RECOVERY_ERROR_RET ||
ret == MLX5_RECOVERY_COMPLETED_RET)
return MLX5_CRITICAL_ERROR_CQE_RET;
if (!mprq && ret == MLX5_RECOVERY_IGNORE_RET) {
*skip_cnt = 1;
++rxq->cq_ci;
return MLX5_ERROR_CQE_MASK;
}
} else {
return 0;
}
Expand Down Expand Up @@ -910,19 +916,18 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
cqe = &(*rxq->cqes)[rxq->cq_ci & cqe_cnt];
len = mlx5_rx_poll_len(rxq, cqe, cqe_cnt, &mcqe, &skip_cnt, false);
if (unlikely(len & MLX5_ERROR_CQE_MASK)) {
/* We drop packets with non-critical errors */
rte_mbuf_raw_free(rep);
if (len == MLX5_CRITICAL_ERROR_CQE_RET) {
rte_mbuf_raw_free(rep);
rq_ci = rxq->rq_ci << sges_n;
break;
}
/* Skip specified amount of error CQEs packets */
rq_ci >>= sges_n;
rq_ci += skip_cnt;
rq_ci <<= sges_n;
idx = rq_ci & wqe_cnt;
wqe = &((volatile struct mlx5_wqe_data_seg *)rxq->wqes)[idx];
seg = (*rxq->elts)[idx];
cqe = &(*rxq->cqes)[rxq->cq_ci & cqe_cnt];
len = len & ~MLX5_ERROR_CQE_MASK;
MLX5_ASSERT(!pkt);
continue;
}
if (len == 0) {
rte_mbuf_raw_free(rep);
Expand Down

0 comments on commit c52e6e0

Please sign in to comment.