From: Yongseok Koh Date: Wed, 2 Aug 2017 17:25:54 +0000 (-0700) Subject: net/mlx5: fix error statistics in SSE Rx X-Git-Tag: spdx-start~2239 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9807f113354419a799a8f20fb8e187959feb5f05;p=dpdk.git net/mlx5: fix error statistics in SSE Rx If there's a Rx completion with error (e.g, MTU mismatch), it is handled later out of main burst loop as a slow path for performance reason. Statistics should be corrected by subtracting counters of errored packets. Also, the last entry of mlx5_ptype_table[] must be RTE_PTYPE_ALL_MASK to mark error in completion. Fixes: ea16068c0064 ("net/mlx5: fix L4 packet type support") Fixes: 6cb559d67b83 ("net/mlx5: add vectorized Rx/Tx burst for x86") Signed-off-by: Yongseok Koh Acked-by: Nelio Laranjeiro --- diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 2572a1652d..b07bcd118c 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -94,7 +94,8 @@ mlx5_set_ptype_table(void) unsigned int i; uint32_t (*p)[RTE_DIM(mlx5_ptype_table)] = &mlx5_ptype_table; - for (i = 0; i < RTE_DIM(mlx5_ptype_table); ++i) + /* Last entry must not be overwritten, reserved for errored packet. */ + for (i = 0; i < RTE_DIM(mlx5_ptype_table) - 1; ++i) (*p)[i] = RTE_PTYPE_UNKNOWN; /* * The index to the array should have: diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.c b/drivers/net/mlx5/mlx5_rxtx_vec_sse.c index 8a8d94c17b..a5e1868037 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.c +++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.c @@ -887,16 +887,28 @@ rxq_handle_pending_error(struct rxq *rxq, struct rte_mbuf **pkts, { uint16_t n = 0; unsigned int i; +#ifdef MLX5_PMD_SOFT_COUNTERS + uint32_t err_bytes = 0; +#endif for (i = 0; i < pkts_n; ++i) { struct rte_mbuf *pkt = pkts[i]; - if (pkt->packet_type == RTE_PTYPE_ALL_MASK) + if (pkt->packet_type == RTE_PTYPE_ALL_MASK) { +#ifdef MLX5_PMD_SOFT_COUNTERS + err_bytes += PKT_LEN(pkt); +#endif rte_pktmbuf_free_seg(pkt); - else + } else { pkts[n++] = pkt; + } } rxq->stats.idropped += (pkts_n - n); +#ifdef MLX5_PMD_SOFT_COUNTERS + /* Correct counters of errored completions. */ + rxq->stats.ipackets -= (pkts_n - n); + rxq->stats.ibytes -= err_bytes; +#endif rxq->pending_err = 0; return n; }