patches for DPDK stable branches
 help / color / mirror / Atom feed
* [v3 1/5] vhost: skip crypto op fetch before vring init
       [not found] <cover.1740156665.git.gmuthukrishn@marvell.com>
@ 2025-02-21 17:30 ` Gowrishankar Muthukrishnan
  2025-02-21 17:30 ` [v3 3/5] examples/vhost_crypto: fix user callbacks Gowrishankar Muthukrishnan
  1 sibling, 0 replies; 2+ messages in thread
From: Gowrishankar Muthukrishnan @ 2025-02-21 17:30 UTC (permalink / raw)
  To: dev, maxime.coquelin, Chenbo Xia, Fan Zhang, Jay Zhou
  Cc: anoobj, Akhil Goyal, Gowrishankar Muthukrishnan, stable

Until virtio avail ring is initialized (by VHOST_USER_SET_VRING_ADDR),
worker thread should not try to fetch crypto op, which would lead to
memory fault.

Fixes: 939066d9656 ("vhost/crypto: add public function implementation")
Cc: stable@dpdk.org

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
 lib/vhost/vhost_crypto.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index 3dc41a3bd5..55ea24710e 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -1580,6 +1580,16 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,
 
 	vq = dev->virtqueue[qid];
 
+	if (unlikely(vq == NULL)) {
+		VC_LOG_ERR("Invalid virtqueue %u", qid);
+		return 0;
+	}
+
+	if (unlikely(vq->avail == NULL)) {
+		VC_LOG_DBG("Virtqueue ring not yet initialized %u", qid);
+		return 0;
+	}
+
 	avail_idx = *((volatile uint16_t *)&vq->avail->idx);
 	start_idx = vq->last_used_idx;
 	count = avail_idx - start_idx;
-- 
2.25.1


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

* [v3 3/5] examples/vhost_crypto: fix user callbacks
       [not found] <cover.1740156665.git.gmuthukrishn@marvell.com>
  2025-02-21 17:30 ` [v3 1/5] vhost: skip crypto op fetch before vring init Gowrishankar Muthukrishnan
@ 2025-02-21 17:30 ` Gowrishankar Muthukrishnan
  1 sibling, 0 replies; 2+ messages in thread
From: Gowrishankar Muthukrishnan @ 2025-02-21 17:30 UTC (permalink / raw)
  To: dev, maxime.coquelin, Chenbo Xia, Fan Zhang, Jay Zhou
  Cc: anoobj, Akhil Goyal, Gowrishankar Muthukrishnan, stable

In order to handle new vhost user connection, use new_connection
and destroy_connection callbacks.

Fixes: f5188211c721 ("examples/vhost_crypto: add sample application")
Cc: stable@dpdk.org

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
v3:
 - decoupled from v2 single patch.
---
 examples/vhost_crypto/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
index 558c09a60f..b1fe4120b9 100644
--- a/examples/vhost_crypto/main.c
+++ b/examples/vhost_crypto/main.c
@@ -362,8 +362,8 @@ destroy_device(int vid)
 }
 
 static const struct rte_vhost_device_ops virtio_crypto_device_ops = {
-	.new_device =  new_device,
-	.destroy_device = destroy_device,
+	.new_connection =  new_device,
+	.destroy_connection = destroy_device,
 };
 
 static int
-- 
2.25.1


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

end of thread, other threads:[~2025-02-21 17:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1740156665.git.gmuthukrishn@marvell.com>
2025-02-21 17:30 ` [v3 1/5] vhost: skip crypto op fetch before vring init Gowrishankar Muthukrishnan
2025-02-21 17:30 ` [v3 3/5] examples/vhost_crypto: fix user callbacks Gowrishankar Muthukrishnan

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