example/vhost_crypto: fix incorrect fetch size
PATCH 1/1 example/vhost_crypto: fix incorrect fetch size
Coverity issue: 343401
--- examples/vhost_crypto/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
examples/vhost_crypto/main.c +1 -1
@@ -387,7 +387,7 @@ vhost_crypto_worker(void *arg)continue ;for (j =0 ; j <NB_VIRTIO_QUEUES ; j++) { - to_fetch =RTE_MIN (burst_size, + to_fetch =RTE_MAX (burst_size, (NB_CRYPTO_DESCRIPTORS - info->nb_inflight_ops)); fetched = rte_vhost_crypto_fetch_requests(
Signature · 1 line
2.20.1
Hi Fan,
Quoted 16 lines · Fan Zhang
Coverity issue: 343401
Fixes f5188211c721 ("examples/vhost_crypto: add sample application")Signed-off-by Fan Zhang <[email protected]>--- examples/vhost_crypto/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)examples/vhost_crypto/main.c +0
-0
examples/vhost_crypto/main.c vhost_crypto_worker(void *arg) · line 393
Quoted 8 lines
examples/vhost_crypto/main.c +1
-1@@ -387,7 +387,7 @@ vhost_crypto_worker(void *arg)continue ;for (j =0 ; j <NB_VIRTIO_QUEUES ; j++) { - to_fetch =RTE_MIN (burst_size, + to_fetch =RTE_MAX (burst_size, (NB_CRYPTO_DESCRIPTORS - info->nb_inflight_ops)); fetched = rte_vhost_crypto_fetch_requests(
Could you please add a commit message to explain the change? With just the patch context, this fix looks weird.
Thanks!
Maxime
Hi Maxime,
Sorry for the late reply.
This patch is incorrect. I have sent the correct version http://patchwork.dpdk.org/patch/65302/
Regards,
Fan
Quoted 40 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, January 14, 2020 9:30 AM
To: Zhang, Roy Fan <[email protected]>; [email protected]
Subject: Re: [PATCH] example/vhost_crypto: fix incorrect fetch sizeHi Fan,
Quoted 15 lines · Fan Zhang
Coverity issue: 343401
Fixes f5188211c721 ("examples/vhost_crypto: add sample application")Signed-off-by Fan Zhang <[email protected]>--- examples/vhost_crypto/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/examples/vhost_crypto/main.cindex1d7ba9419..5d80bcaca100644examples/vhost_crypto/main.c vhost_crypto_worker(void *arg) · line 391
Quoted 6 lines
examples/vhost_crypto/main.c +1
-1@@ -387,7 +387,7 @@ vhost_crypto_worker(void *arg)continue ;for (j =0 ; j <NB_VIRTIO_QUEUES ; j++) { - to_fetch = RTE_MIN(burst_size, + to_fetch = RTE_MAX(burst_size, (NB_CRYPTO_DESCRIPTORS-
examples/vhost_crypto/main.c vhost_crypto_worker(void *arg) · line 393
Quoted 3 lines
examples/vhost_crypto/main.c +0
-0info->nb_inflight_ops)); fetched = rte_vhost_crypto_fetch_requests(Could you please add a commit message to explain the change? With just the patch context, this fix looks weird.
Thanks!
Maxime
PATCH 1/1 vhost/crypto: fix missed user protocol flag
In reply to Fan ZhangThis patch fixes the vhost crypto missed "VHOST_USER_PROTOCOL_F_CONFIG" flag problem during initialization. Newer Qemu version requires this feature enabled.
--- lib/librte_vhost/rte_vhost.h | 5 +++++ lib/librte_vhost/vhost_crypto.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-)
lib/librte_vhost/rte_vhost.h +5 -0
@@ -68,6 +68,10 @@ extern "C" {#define VHOST_USER_PROTOCOL_F_PAGEFAULT 8#endif +#ifndef VHOST_USER_PROTOCOL_F_CONFIG +#define VHOST_USER_PROTOCOL_F_CONFIG 9 +#endif +#ifndef VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD #define VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD 10#endif
@@ -85,6 +89,7 @@ extern "C" {#define VHOST_USER_F_PROTOCOL_FEATURES 30#endif +/** * Information relating to memory regions including offsets to * addresses in QEMUs memory file.
lib/librte_vhost/vhost_crypto.c +2 -1
@@ -40,7 +40,8 @@ (1 << VIRTIO_RING_F_EVENT_IDX) | \ (1 << VIRTIO_CRYPTO_SERVICE_CIPHER) | \ (1 << VIRTIO_CRYPTO_SERVICE_MAC) | \ - (1 << VIRTIO_NET_F_CTRL_VQ)) + (1 << VIRTIO_NET_F_CTRL_VQ) | \ + (1 << VHOST_USER_PROTOCOL_F_CONFIG))#define IOVA_TO_VVA (t, r, a, l, p) \ ((t)(uintptr_t)vhost_iova_to_vva(r->dev, r->vq, a, l, p))
Signature · 1 line
2.20.1
Re: [dpdk-dev] [PATCH] vhost/crypto: fix missed user protocol flag
Quoted 7 lines · Fan Zhang
Fixes 939066d96563 ("vhost/crypto: add public function implementation")This patch fixes the vhost crypto missed "
VHOST_USER_PROTOCOL_F_CONFIG" flag problem during initialization. Newer Qemu version requires this feature enabled.
Quoted 6 lines
Signed-off-by Fan Zhang <[email protected]>--- lib/librte_vhost/rte_vhost.h | 5 +++++ lib/librte_vhost/vhost_crypto.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-)
Thanks,
Maxime
Maxime Coquelin
AppliedRe: [dpdk-dev] [PATCH] vhost/crypto: fix missed user protocol flag
In reply to Fan ZhangQuoted 7 lines · Fan Zhang
Fixes 939066d96563 ("vhost/crypto: add public function implementation")This patch fixes the vhost crypto missed "
VHOST_USER_PROTOCOL_F_CONFIG" flag problem during initialization. Newer Qemu version requires this feature enabled.
Quoted 5 lines
Signed-off-by Fan Zhang <[email protected]>--- lib/librte_vhost/rte_vhost.h | 5 +++++ lib/librte_vhost/vhost_crypto.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-)
Applied to dpdk-next-virtio/master.
Thanks,
Maxime
PATCH 1/1 vhost/crypto: fix incorrect fetch size
In reply to Fan ZhangCoverity issue: 343401
This patch fixes the incorrect rte_vhost_crypto_fetch_requests return value.
--- lib/librte_vhost/vhost_crypto.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
lib/librte_vhost/vhost_crypto.c +5 -5
@@ -1539,18 +1539,18 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,if (unlikely (dev ==NULL )) {VC_LOG_ERR ("Invalid vid %i" , vid); -return -EINVAL ; +return 0 ; }if (unlikely (qid >=VHOST_MAX_QUEUE_PAIRS )) {VC_LOG_ERR ("Invalid qid %u" , qid); -return -EINVAL ; +return 0 ; } vcrypto = (struct vhost_crypto *)dev->extern_data;if (unlikely (vcrypto ==NULL )) {VC_LOG_ERR ("Cannot find required data, is it initialized?" ); -return -ENOENT ; +return 0 ; } vq = dev->virtqueue[qid];
@@ -1572,7 +1572,7 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,if (unlikely (rte_mempool_get_bulk (vcrypto->mbuf_pool, (void **)mbufs, count *2 ) <0 )) {VC_LOG_ERR ("Insufficient memory" ); -return -ENOMEM ; +return 0 ; }for (i =0 ; i < count; i++) {
@@ -1602,7 +1602,7 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,if (unlikely (rte_mempool_get_bulk (vcrypto->mbuf_pool, (void **)mbufs, count) <0 )) {VC_LOG_ERR ("Insufficient memory" ); -return -ENOMEM ; +return 0 ; }for (i =0 ; i < count; i++) {
Signature · 1 line
2.20.1
Re: [dpdk-dev] [PATCH] vhost/crypto: fix incorrect fetch size
Quoted 5 lines · Fan Zhang
Coverity issue: 343401
This patch fixes the incorrect
rte_vhost_crypto_fetch_requestsreturn value.
Quoted 9 lines
Signed-off-by Fan Zhang <[email protected]>--- lib/librte_vhost/vhost_crypto.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Thanks,
Maxime
Maxime Coquelin
AppliedRe: [dpdk-dev] [PATCH] vhost/crypto: fix incorrect fetch size
In reply to Fan ZhangQuoted 5 lines · Fan Zhang
Coverity issue: 343401
This patch fixes the incorrect
rte_vhost_crypto_fetch_requestsreturn value.
Quoted 8 lines
Signed-off-by Fan Zhang <[email protected]>--- lib/librte_vhost/vhost_crypto.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Applied to dpdk-next-virtio tree.
Thanks,
Maxime