Skip to content

Commit

Permalink
common/mlx5: use just sufficient barrier for Arm
Browse files Browse the repository at this point in the history
[ upstream commit 7be74edb90e3b8f272857001907d460f49524e41 ]

cqe->op_own indicates if the CQE is owned by the NIC.
The rest of the fields in CQE should be read only after op_own is read.
On Arm platforms using "dmb ishld" is sufficient to enforce this.

Fixes: 88c0733 ("net/mlx5: extend Rx completion with error handling")

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
  • Loading branch information
nagarahalli authored and bluca committed Mar 21, 2023
1 parent d865e79 commit 5ab007c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/common/mlx5/mlx5_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,12 @@ check_cqe(volatile struct mlx5_cqe *cqe, const uint16_t cqes_n,

if (unlikely((op_owner != (!!(idx))) || (op_code == MLX5_CQE_INVALID)))
return MLX5_CQE_STATUS_HW_OWN;
rte_io_rmb();

/* Prevent speculative reading of other fields in CQE until
* CQE is valid.
*/
rte_atomic_thread_fence(__ATOMIC_ACQUIRE);

if (unlikely(op_code == MLX5_CQE_RESP_ERR ||
op_code == MLX5_CQE_REQ_ERR))
return MLX5_CQE_STATUS_ERR;
Expand Down

0 comments on commit 5ab007c

Please sign in to comment.