path: root/drivers/net/mlx5/mlx5_rxtx_vec.c
diff options
authorYongseok Koh <>2018-01-09 09:38:50 -0800
committerFerruh Yigit <>2018-01-16 18:47:49 +0100
commitd27fb0de2f2ae072f2dbdb236c1d10bd2b19b28f (patch)
treeb53a0ac9c725adac8fda4dcfb90c82930aea446c /drivers/net/mlx5/mlx5_rxtx_vec.c
parent2ebf5f7e925a184b3936b546a3b81ef2b873f95e (diff)
net/mlx5: fix overwriting bit-fields in SW Rx queue
Bit-fields in mlx5_rxq_data can be changed on the fly by a control plane - e.g. rxq->mark. However, vectorized Rx uses a bit-field to mark pending errors. Even if one bit is written, consequence is to write the whole integer and this can cause a synchronization issue - two entities write to a same block without locking. As the pending_err bit is entirely internal use for the datapath, this can be replaced with a local variable. Fixes: 6cb559d67b83 ("net/mlx5: add vectorized Rx/Tx burst for x86") Fixes: 570acdb1da8a ("net/mlx5: add vectorized Rx/Tx burst for ARM") Cc: Signed-off-by: Yongseok Koh <>
Diffstat (limited to 'drivers/net/mlx5/mlx5_rxtx_vec.c')
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec.c b/drivers/net/mlx5/mlx5_rxtx_vec.c
index 8d23dae..01edcaf 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec.c
+++ b/drivers/net/mlx5/mlx5_rxtx_vec.c
@@ -219,7 +219,6 @@ rxq_handle_pending_error(struct mlx5_rxq_data *rxq, struct rte_mbuf **pkts,
rxq->stats.ipackets -= (pkts_n - n);
rxq->stats.ibytes -= err_bytes;
- rxq->pending_err = 0;
return n;
@@ -241,9 +240,10 @@ mlx5_rx_burst_vec(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
struct mlx5_rxq_data *rxq = dpdk_rxq;
uint16_t nb_rx;
+ uint64_t err = 0;
- nb_rx = rxq_burst_v(rxq, pkts, pkts_n);
- if (unlikely(rxq->pending_err))
+ nb_rx = rxq_burst_v(rxq, pkts, pkts_n, &err);
+ if (unlikely(err))
nb_rx = rxq_handle_pending_error(rxq, pkts, nb_rx);
return nb_rx;