DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] crypto/virtio: fix virtio desc flags virtq info
@ 2025-06-26  9:18 Rajesh Mudimadugula
  0 siblings, 0 replies; only message in thread
From: Rajesh Mudimadugula @ 2025-06-26  9:18 UTC (permalink / raw)
  To: dev; +Cc: jianjay.zhou, gakhil, Rajesh Mudimadugula

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-06-26  9:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-26  9:18 [PATCH] crypto/virtio: fix virtio desc flags virtq info Rajesh Mudimadugula

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).