net/mlx5/hws: fix send sync drain empty queue check
Checks
Commit Message
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@nvidia.com>
Reviewed-by: Erez Shitrit <erezsh@nvidia.com>
Acked-by: Matan Azrad matan@nvidia.com
---
drivers/net/mlx5/hws/mlx5dr_send.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Comments
Hi,
> -----Original Message-----
> From: Alex Vesker <valex@nvidia.com>
> Sent: Thursday, March 23, 2023 2:34 PM
> To: Alex Vesker <valex@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; NBU-Contact-Thomas Monjalon (EXTERNAL)
> <thomas@monjalon.net>; Suanming Mou <suanmingm@nvidia.com>; Matan
> Azrad <matan@nvidia.com>
> Cc: dev@dpdk.org; Ori Kam <orika@nvidia.com>
> Subject: [PATCH] net/mlx5/hws: fix send sync drain empty queue check
>
> 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@nvidia.com>
> Reviewed-by: Erez Shitrit <erezsh@nvidia.com>
> Acked-by: Matan Azrad matan@nvidia.com
Fixed Acked-by tag,
Patch applied to next-net-mlx,
Kindest regards
Raslan Darawsheh
@@ -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)