* [v4 1/5] vhost: skip crypto op fetch before vring init
[not found] <cover.1740212213.git.gmuthukrishn@marvell.com>
@ 2025-02-22 8:38 ` Gowrishankar Muthukrishnan
2025-02-24 7:13 ` Akhil Goyal
2025-02-22 8:38 ` [v4 3/5] examples/vhost_crypto: fix user callbacks Gowrishankar Muthukrishnan
1 sibling, 1 reply; 4+ messages in thread
From: Gowrishankar Muthukrishnan @ 2025-02-22 8:38 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: 939066d96563 ("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] 4+ messages in thread
* [v4 3/5] examples/vhost_crypto: fix user callbacks
[not found] <cover.1740212213.git.gmuthukrishn@marvell.com>
2025-02-22 8:38 ` [v4 1/5] vhost: skip crypto op fetch before vring init Gowrishankar Muthukrishnan
@ 2025-02-22 8:38 ` Gowrishankar Muthukrishnan
2025-02-24 7:15 ` Akhil Goyal
1 sibling, 1 reply; 4+ messages in thread
From: Gowrishankar Muthukrishnan @ 2025-02-22 8:38 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>
---
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] 4+ messages in thread
* RE: [v4 1/5] vhost: skip crypto op fetch before vring init
2025-02-22 8:38 ` [v4 1/5] vhost: skip crypto op fetch before vring init Gowrishankar Muthukrishnan
@ 2025-02-24 7:13 ` Akhil Goyal
0 siblings, 0 replies; 4+ messages in thread
From: Akhil Goyal @ 2025-02-24 7:13 UTC (permalink / raw)
To: Gowrishankar Muthukrishnan, dev, maxime.coquelin, Chenbo Xia,
Fan Zhang, Jay Zhou
Cc: Anoob Joseph, Gowrishankar Muthukrishnan, stable
[-- Attachment #1: Type: text/plain, Size: 457 bytes --]
> Subject: [v4 1/5] vhost: skip crypto op fetch before vring init
>
> 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: 939066d96563 ("vhost/crypto: add public function implementation")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 15019 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [v4 3/5] examples/vhost_crypto: fix user callbacks
2025-02-22 8:38 ` [v4 3/5] examples/vhost_crypto: fix user callbacks Gowrishankar Muthukrishnan
@ 2025-02-24 7:15 ` Akhil Goyal
0 siblings, 0 replies; 4+ messages in thread
From: Akhil Goyal @ 2025-02-24 7:15 UTC (permalink / raw)
To: Gowrishankar Muthukrishnan, dev, maxime.coquelin, Chenbo Xia,
Fan Zhang, Jay Zhou
Cc: Anoob Joseph, Gowrishankar Muthukrishnan, stable
[-- Attachment #1: Type: text/plain, Size: 392 bytes --]
> Subject: [v4 3/5] examples/vhost_crypto: fix user callbacks
>
> 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>
Acked-by: Akhil Goyal <gakhil@marvell.com>
[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 14891 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-02-24 7:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <cover.1740212213.git.gmuthukrishn@marvell.com>
2025-02-22 8:38 ` [v4 1/5] vhost: skip crypto op fetch before vring init Gowrishankar Muthukrishnan
2025-02-24 7:13 ` Akhil Goyal
2025-02-22 8:38 ` [v4 3/5] examples/vhost_crypto: fix user callbacks Gowrishankar Muthukrishnan
2025-02-24 7:15 ` Akhil Goyal
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).