DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rajesh Mudimadugula <rmudimadugul@marvell.com>
To: <dev@dpdk.org>
Cc: <jianjay.zhou@huawei.com>, <gakhil@marvell.com>,
	Rajesh Mudimadugula <rmudimadugul@marvell.com>
Subject: [PATCH] crypto/virtio: fix virtio desc flags virtq info
Date: Thu, 26 Jun 2025 09:18:42 +0000	[thread overview]
Message-ID: <20250626091842.159016-1-rmudimadugul@marvell.com> (raw)

This patch corrects virtio descriptor flags and updates
virtqueue metadata.

Fixes: 796429e72a6d ("crypto/virtio: add packed ring support")

Signed-off-by: Rajesh Mudimadugula <rmudimadugul@marvell.com>
---
 drivers/crypto/virtio/virtio_rxtx.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/virtio/virtio_rxtx.c b/drivers/crypto/virtio/virtio_rxtx.c
index 00988e18b1..4204e1f77e 100644
--- a/drivers/crypto/virtio/virtio_rxtx.c
+++ b/drivers/crypto/virtio/virtio_rxtx.c
@@ -479,6 +479,7 @@ virtqueue_crypto_sym_enqueue_xmit_packed(
 		struct rte_crypto_op *cop)
 {
 	uint16_t idx = 0;
+	uint16_t num_entry;
 	uint16_t needed = 1;
 	uint16_t head_idx;
 	struct vq_desc_extra *dxp;
@@ -598,13 +599,20 @@ virtqueue_crypto_sym_enqueue_xmit_packed(
 	/* packed vring: last part, status returned */
 	desc[idx].addr = op_data_req_phys_addr + req_data_len;
 	desc[idx].len = sizeof(struct virtio_crypto_inhdr);
-	desc[idx++].flags = flags | VRING_DESC_F_WRITE;
+	desc[idx++].flags = txvq->vq_packed.cached_flags | VRING_DESC_F_WRITE;
+
+	num_entry = idx;
+	txvq->vq_avail_idx += num_entry;
+	if (txvq->vq_avail_idx >= txvq->vq_nentries) {
+		txvq->vq_avail_idx -= txvq->vq_nentries;
+		txvq->vq_packed.cached_flags ^= VRING_PACKED_DESC_F_AVAIL_USED;
+	}
 
 	/* save the infos to use when receiving packets */
 	dxp->crypto_op = (void *)cop;
 	dxp->ndescs = needed;
 
-	txvq->vq_desc_head_idx += idx & (txvq->vq_nentries - 1);
+	txvq->vq_desc_head_idx = (txvq->vq_desc_head_idx + idx) & (txvq->vq_nentries - 1);
 	if (txvq->vq_desc_head_idx == VQ_RING_DESC_CHAIN_END)
 		txvq->vq_desc_tail_idx = idx;
 	txvq->vq_free_cnt = (uint16_t)(txvq->vq_free_cnt - needed);
-- 
2.34.1


             reply	other threads:[~2025-06-26  9:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-26  9:18 Rajesh Mudimadugula [this message]
2025-07-08 19:44 ` Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250626091842.159016-1-rmudimadugul@marvell.com \
    --to=rmudimadugul@marvell.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=jianjay.zhou@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).