The function that checks if the queue is empty used on queue
action for SYNC and ASYNC drain didn't function correctly
since cur_post is a free running value and not cyclic.
The fix is bitwise AND cur_post to get the real value.
Fixes: 90488887ee33 ("net/mlx5/hws: support synchronous drain")
Signed-off-by: Alex Vesker <[email protected]>
Reviewed-by: Erez Shitrit <[email protected]>
Acked-by: Matan Azrad [email protected]
---
drivers/net/mlx5/hws/mlx5dr_send.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_send.h
b/drivers/net/mlx5/hws/mlx5dr_send.h
index d0977ec851..c1e8616f7e 100644
--- a/drivers/net/mlx5/hws/mlx5dr_send.h
+++ b/drivers/net/mlx5/hws/mlx5dr_send.h
@@ -255,7 +255,10 @@ void mlx5dr_send_engine_flush_queue(struct
mlx5dr_send_engine *queue);
static inline bool mlx5dr_send_engine_empty(struct mlx5dr_send_engine *queue)
{
- return (queue->send_ring->send_sq.cur_post ==
queue->send_ring->send_cq.poll_wqe);
+ struct mlx5dr_send_ring_sq *send_sq = &queue->send_ring->send_sq;
+ struct mlx5dr_send_ring_cq *send_cq = &queue->send_ring->send_cq;
+
+ return ((send_sq->cur_post & send_sq->buf_mask) == send_cq->poll_wqe);
}
static inline bool mlx5dr_send_engine_full(struct mlx5dr_send_engine *queue)
--
2.18.1