patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] crypto/mlx5: fix crypto QP indexing
@ 2021-09-13 14:02 Tal Shnaiderman
  2021-09-24 17:47 ` [dpdk-stable] [EXT] [dpdk-dev] " Akhil Goyal
  0 siblings, 1 reply; 2+ messages in thread
From: Tal Shnaiderman @ 2021-09-13 14:02 UTC (permalink / raw)
  To: dev; +Cc: thomas, matan, rasland, asafp, suanmingm, stable

The crypto QP consumer (ci) and producer (pi) indexes are increased
with each successful enqueue/dequeue operations.

However the QP pi index is calculated with a wraparound the number
of elements while the QP ci does not.

This is causing incorrect engine calculation for encqueued WQ values
(wq->pi - wq->ci) and eventually the device stops accepting new enqueue
operations.

Fixed by removing the wraparound on QP pi and using a temp calculation
where wraparound values are needed.

Fixes: 8e196c08ab53 ("crypto/mlx5: support enqueue/dequeue operations")
Cc: stable@dpdk.org

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/crypto/mlx5/mlx5_crypto.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index b3d5200ca3..eeec554e6e 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -494,6 +494,7 @@ mlx5_crypto_enqueue_burst(void *queue_pair, struct rte_crypto_op **ops,
 	struct rte_crypto_op *op;
 	uint16_t mask = qp->entries_n - 1;
 	uint16_t remain = qp->entries_n - (qp->pi - qp->ci);
+	uint32_t idx;
 
 	if (remain < nb_ops)
 		nb_ops = remain;
@@ -502,8 +503,9 @@ mlx5_crypto_enqueue_burst(void *queue_pair, struct rte_crypto_op **ops,
 	if (unlikely(remain == 0))
 		return 0;
 	do {
+		idx = qp->pi & mask;
 		op = *ops++;
-		umr = RTE_PTR_ADD(qp->umem_buf, priv->wqe_set_size * qp->pi);
+		umr = RTE_PTR_ADD(qp->umem_buf, priv->wqe_set_size * idx);
 		if (unlikely(mlx5_crypto_wqe_set(priv, qp, op, umr) == 0)) {
 			qp->stats.enqueue_err_count++;
 			if (remain != nb_ops) {
@@ -512,8 +514,8 @@ mlx5_crypto_enqueue_burst(void *queue_pair, struct rte_crypto_op **ops,
 			}
 			return 0;
 		}
-		qp->ops[qp->pi] = op;
-		qp->pi = (qp->pi + 1) & mask;
+		qp->ops[idx] = op;
+		qp->pi++;
 	} while (--remain);
 	qp->stats.enqueued_count += nb_ops;
 	rte_io_wmb();
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-stable] [EXT] [dpdk-dev] [PATCH] crypto/mlx5: fix crypto QP indexing
  2021-09-13 14:02 [dpdk-stable] [PATCH] crypto/mlx5: fix crypto QP indexing Tal Shnaiderman
@ 2021-09-24 17:47 ` Akhil Goyal
  0 siblings, 0 replies; 2+ messages in thread
From: Akhil Goyal @ 2021-09-24 17:47 UTC (permalink / raw)
  To: Tal Shnaiderman, dev; +Cc: thomas, matan, rasland, asafp, suanmingm, stable

> The crypto QP consumer (ci) and producer (pi) indexes are increased
> with each successful enqueue/dequeue operations.
> 
> However the QP pi index is calculated with a wraparound the number
> of elements while the QP ci does not.
> 
> This is causing incorrect engine calculation for encqueued WQ values
> (wq->pi - wq->ci) and eventually the device stops accepting new enqueue
> operations.
> 
> Fixed by removing the wraparound on QP pi and using a temp calculation
> where wraparound values are needed.
> 
> Fixes: 8e196c08ab53 ("crypto/mlx5: support enqueue/dequeue operations")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
Applied to dpdk-next-crypto


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-24 17:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13 14:02 [dpdk-stable] [PATCH] crypto/mlx5: fix crypto QP indexing Tal Shnaiderman
2021-09-24 17:47 ` [dpdk-stable] [EXT] [dpdk-dev] " Akhil Goyal

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git