net/mlx5/hws: fix send sync drain empty queue check

Message ID 20230323123416.26636-2-valex@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5/hws: fix send sync drain empty queue check |

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-unit-testing success Testing PASS

Commit Message

Alex Vesker March 23, 2023, 12:34 p.m. UTC
  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

Raslan Darawsheh March 23, 2023, 7:42 p.m. UTC | #1
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
  

Patch

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)