regex/mlx5: fix overrun on enqueueing
[dpdk.git] / drivers / regex / mlx5 / mlx5_regex_fastpath.c
index d8af2bf..2c6c9e1 100644 (file)
@@ -145,10 +145,7 @@ send_doorbell(struct mlx5dv_devx_uar *uar, struct mlx5_regex_sq *sq)
 
 static inline int
 can_send(struct mlx5_regex_sq *sq) {
-       return unlikely(sq->ci > sq->pi) ?
-                       MLX5_REGEX_MAX_WQE_INDEX + sq->pi - sq->ci <
-                       sq_size_get(sq) :
-                       sq->pi - sq->ci < sq_size_get(sq);
+       return ((uint16_t)(sq->pi - sq->ci) < sq_size_get(sq));
 }
 
 static inline uint32_t