[PATCH] net/mlx5/hws: fix send sync drain empty queue check
Alex Vesker
valex at nvidia.com
Thu Mar 23 13:34:15 CET 2023
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 <valex at nvidia.com>
Reviewed-by: Erez Shitrit <erezsh at nvidia.com>
Acked-by: Matan Azrad matan at nvidia.com
---
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
More information about the dev
mailing list