[dpdk-dev] lib/librte_vhost: fix bugs
Checks
Commit Message
Fixes: 256b132f41b2 ("vhost/crypto: add session message handler")
Fixes: 7b5ad7beee17 ("vhost/crypto: update makefile")
Fixes: 2ce5bd8c442d ("examples/vhost_crypto: add vhost crypto sample application")
This patch fixes the bugs introduced in the above patches.
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
examples/vhost_crypto/main.c | 5 -----
lib/librte_vhost/Makefile | 3 ++-
lib/librte_vhost/vhost_crypto.c | 8 ++++----
3 files changed, 6 insertions(+), 10 deletions(-)
Comments
Hi Fan,
On 04/09/2018 05:34 PM, Fan Zhang wrote:
> Fixes: 256b132f41b2 ("vhost/crypto: add session message handler")
> Fixes: 7b5ad7beee17 ("vhost/crypto: update makefile")
> Fixes: 2ce5bd8c442d ("examples/vhost_crypto: add vhost crypto sample application")
>
> This patch fixes the bugs introduced in the above patches.
>
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---
> examples/vhost_crypto/main.c | 5 -----
> lib/librte_vhost/Makefile | 3 ++-
> lib/librte_vhost/vhost_crypto.c | 8 ++++----
> 3 files changed, 6 insertions(+), 10 deletions(-)
Can you please split the patch in 3 parts, one for each patches it
fixes?
As my branch hasn't been picked yest y Ferruh, I can squash them
directly.
Thanks,
Maxime
> diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
> index bc867240d..860200e29 100644
> --- a/examples/vhost_crypto/main.c
> +++ b/examples/vhost_crypto/main.c
> @@ -95,11 +95,6 @@ parse_cryptodev_id(const char *q_arg)
>
> /* parse decimal string */
> pm = strtoul(q_arg, &end, 10);
> - if ((pm == '\0') || (end == NULL) || (*end != '\0')) {
> - RTE_LOG(ERR, USER1, "Invalid Cryptodev ID %s\n", q_arg);
> - return -1;
> - }
> -
> if (pm > rte_cryptodev_count()) {
> RTE_LOG(ERR, USER1, "Invalid Cryptodev ID %s\n", q_arg);
> return -1;
> diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile
> index 2cc65f95e..92c267475 100644
> --- a/lib/librte_vhost/Makefile
> +++ b/lib/librte_vhost/Makefile
> @@ -18,7 +18,8 @@ LDLIBS += -lpthread
> ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
> LDLIBS += -lnuma
> endif
> -LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_ethdev -lrte_net
> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_ethdev -lrte_net \
> + -lrte_cryptodev -lrte_hash
>
> # all source are stored in SRCS-y
> SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c iotlb.c socket.c vhost.c \
> diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c
> index d84513e7f..2acfc908c 100644
> --- a/lib/librte_vhost/vhost_crypto.c
> +++ b/lib/librte_vhost/vhost_crypto.c
> @@ -381,7 +381,7 @@ vhost_crypto_create_sess(struct vhost_crypto *vcrypto,
> return;
> }
>
> - VC_LOG_DBG("Session (key %lu, session %p) created.",
> + VC_LOG_DBG("Session (key %llu, session %p) created.",
> vcrypto->last_session_id, session);
>
> sess_param->session_id = vcrypto->last_session_id;
> @@ -399,7 +399,7 @@ vhost_crypto_close_sess(struct vhost_crypto *vcrypto, uint64_t session_id)
> (void **)&session);
>
> if (unlikely(ret < 0)) {
> - VC_LOG_ERR("Failed to delete session (key %lu).", session_id);
> + VC_LOG_ERR("Failed to delete session (key %llu).", session_id);
> return -VIRTIO_CRYPTO_INVSESS;
> }
>
> @@ -418,7 +418,7 @@ vhost_crypto_close_sess(struct vhost_crypto *vcrypto, uint64_t session_id)
> return -VIRTIO_CRYPTO_ERR;
> }
>
> - VC_LOG_DBG("Session (key %lu, session %p) deleted.", sess_id,
> + VC_LOG_DBG("Session (key %llu, session %p) deleted.", sess_id,
> session);
>
> return 0;
> @@ -932,7 +932,7 @@ vhost_crypto_process_one_req(struct vhost_crypto *vcrypto,
> &session_id, (void **)&session);
> if (unlikely(err < 0)) {
> err = VIRTIO_CRYPTO_ERR;
> - VC_LOG_ERR("Failed to retrieve session id %lu",
> + VC_LOG_ERR("Failed to retrieve session id %llu",
> session_id);
> goto error_exit;
> }
>
Overall, please rename the commit title prefix to vhost/crypto.
Thanks,
Maxime
On 04/09/2018 05:34 PM, Fan Zhang wrote:
> Fixes: 256b132f41b2 ("vhost/crypto: add session message handler")
> Fixes: 7b5ad7beee17 ("vhost/crypto: update makefile")
> Fixes: 2ce5bd8c442d ("examples/vhost_crypto: add vhost crypto sample application")
>
> This patch fixes the bugs introduced in the above patches.
>
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---
> examples/vhost_crypto/main.c | 5 -----
> lib/librte_vhost/Makefile | 3 ++-
> lib/librte_vhost/vhost_crypto.c | 8 ++++----
> 3 files changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
> index bc867240d..860200e29 100644
> --- a/examples/vhost_crypto/main.c
> +++ b/examples/vhost_crypto/main.c
> @@ -95,11 +95,6 @@ parse_cryptodev_id(const char *q_arg)
>
> /* parse decimal string */
> pm = strtoul(q_arg, &end, 10);
> - if ((pm == '\0') || (end == NULL) || (*end != '\0')) {
> - RTE_LOG(ERR, USER1, "Invalid Cryptodev ID %s\n", q_arg);
> - return -1;
> - }
> -
> if (pm > rte_cryptodev_count()) {
> RTE_LOG(ERR, USER1, "Invalid Cryptodev ID %s\n", q_arg);
> return -1;
> diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile
> index 2cc65f95e..92c267475 100644
> --- a/lib/librte_vhost/Makefile
> +++ b/lib/librte_vhost/Makefile
> @@ -18,7 +18,8 @@ LDLIBS += -lpthread
> ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
> LDLIBS += -lnuma
> endif
> -LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_ethdev -lrte_net
> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_ethdev -lrte_net \
> + -lrte_cryptodev -lrte_hash
>
> # all source are stored in SRCS-y
> SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c iotlb.c socket.c vhost.c \
> diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c
> index d84513e7f..2acfc908c 100644
> --- a/lib/librte_vhost/vhost_crypto.c
> +++ b/lib/librte_vhost/vhost_crypto.c
> @@ -381,7 +381,7 @@ vhost_crypto_create_sess(struct vhost_crypto *vcrypto,
> return;
> }
>
> - VC_LOG_DBG("Session (key %lu, session %p) created.",
> + VC_LOG_DBG("Session (key %llu, session %p) created.",
> vcrypto->last_session_id, session);
>
> sess_param->session_id = vcrypto->last_session_id;
> @@ -399,7 +399,7 @@ vhost_crypto_close_sess(struct vhost_crypto *vcrypto, uint64_t session_id)
> (void **)&session);
>
> if (unlikely(ret < 0)) {
> - VC_LOG_ERR("Failed to delete session (key %lu).", session_id);
> + VC_LOG_ERR("Failed to delete session (key %llu).", session_id);
> return -VIRTIO_CRYPTO_INVSESS;
> }
>
> @@ -418,7 +418,7 @@ vhost_crypto_close_sess(struct vhost_crypto *vcrypto, uint64_t session_id)
> return -VIRTIO_CRYPTO_ERR;
> }
>
> - VC_LOG_DBG("Session (key %lu, session %p) deleted.", sess_id,
> + VC_LOG_DBG("Session (key %llu, session %p) deleted.", sess_id,
> session);
>
> return 0;
> @@ -932,7 +932,7 @@ vhost_crypto_process_one_req(struct vhost_crypto *vcrypto,
> &session_id, (void **)&session);
> if (unlikely(err < 0)) {
> err = VIRTIO_CRYPTO_ERR;
> - VC_LOG_ERR("Failed to retrieve session id %lu",
> + VC_LOG_ERR("Failed to retrieve session id %llu",
> session_id);
> goto error_exit;
> }
>
> # all source are stored in SRCS-y
> SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c iotlb.c socket.c vhost.c \
> diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c
> index d84513e7f..2acfc908c 100644
> --- a/lib/librte_vhost/vhost_crypto.c
> +++ b/lib/librte_vhost/vhost_crypto.c
> @@ -381,7 +381,7 @@ vhost_crypto_create_sess(struct vhost_crypto
> *vcrypto,
> return;
> }
>
> - VC_LOG_DBG("Session (key %lu, session %p) created.",
> + VC_LOG_DBG("Session (key %llu, session %p) created.",
Why 'llu' instead of PRIu64 (here and there)?
Pawel
Hi Pawel,
On 04/10/2018 09:32 AM, Wodkowski, PawelX wrote:
>> # all source are stored in SRCS-y
>> SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c iotlb.c socket.c vhost.c \
>> diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c
>> index d84513e7f..2acfc908c 100644
>> --- a/lib/librte_vhost/vhost_crypto.c
>> +++ b/lib/librte_vhost/vhost_crypto.c
>> @@ -381,7 +381,7 @@ vhost_crypto_create_sess(struct vhost_crypto
>> *vcrypto,
>> return;
>> }
>>
>> - VC_LOG_DBG("Session (key %lu, session %p) created.",
>> + VC_LOG_DBG("Session (key %llu, session %p) created.",
>
> Why 'llu' instead of PRIu64 (here and there)?
You are right, but Fan actually fixed it in updated version (the initial
patch has been split in 3):
[PATCH] vhost/crypto: fix session id printf
Cheers,
Maxime
> Pawel
>
> -----Original Message-----
> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
> Sent: Tuesday, April 10, 2018 9:44 AM
> To: Wodkowski, PawelX <pawelx.wodkowski@intel.com>; Zhang, Roy Fan
> <roy.fan.zhang@intel.com>; dev@dpdk.org
> Cc: jianjay.zhou@huawei.com; Tan, Jianfeng <jianfeng.tan@intel.com>
> Subject: Re: [PATCH] lib/librte_vhost: fix bugs
>
> Hi Pawel,
>
> On 04/10/2018 09:32 AM, Wodkowski, PawelX wrote:
> >> # all source are stored in SRCS-y
> >> SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c iotlb.c socket.c vhost.c
> \
> >> diff --git a/lib/librte_vhost/vhost_crypto.c
> b/lib/librte_vhost/vhost_crypto.c
> >> index d84513e7f..2acfc908c 100644
> >> --- a/lib/librte_vhost/vhost_crypto.c
> >> +++ b/lib/librte_vhost/vhost_crypto.c
> >> @@ -381,7 +381,7 @@ vhost_crypto_create_sess(struct vhost_crypto
> >> *vcrypto,
> >> return;
> >> }
> >>
> >> - VC_LOG_DBG("Session (key %lu, session %p) created.",
> >> + VC_LOG_DBG("Session (key %llu, session %p) created.",
> >
> > Why 'llu' instead of PRIu64 (here and there)?
>
> You are right, but Fan actually fixed it in updated version (the initial
> patch has been split in 3):
> [PATCH] vhost/crypto: fix session id printf
>
Ohh, sorry. I need more coffee before starting review :)
> Cheers,
> Maxime
> > Pawel
> >
Pawel
On 04/10/2018 09:47 AM, Wodkowski, PawelX wrote:
>> -----Original Message-----
>> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
>> Sent: Tuesday, April 10, 2018 9:44 AM
>> To: Wodkowski, PawelX <pawelx.wodkowski@intel.com>; Zhang, Roy Fan
>> <roy.fan.zhang@intel.com>; dev@dpdk.org
>> Cc: jianjay.zhou@huawei.com; Tan, Jianfeng <jianfeng.tan@intel.com>
>> Subject: Re: [PATCH] lib/librte_vhost: fix bugs
>>
>> Hi Pawel,
>>
>> On 04/10/2018 09:32 AM, Wodkowski, PawelX wrote:
>>>> # all source are stored in SRCS-y
>>>> SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c iotlb.c socket.c vhost.c
>> \
>>>> diff --git a/lib/librte_vhost/vhost_crypto.c
>> b/lib/librte_vhost/vhost_crypto.c
>>>> index d84513e7f..2acfc908c 100644
>>>> --- a/lib/librte_vhost/vhost_crypto.c
>>>> +++ b/lib/librte_vhost/vhost_crypto.c
>>>> @@ -381,7 +381,7 @@ vhost_crypto_create_sess(struct vhost_crypto
>>>> *vcrypto,
>>>> return;
>>>> }
>>>>
>>>> - VC_LOG_DBG("Session (key %lu, session %p) created.",
>>>> + VC_LOG_DBG("Session (key %llu, session %p) created.",
>>>
>>> Why 'llu' instead of PRIu64 (here and there)?
>>
>> You are right, but Fan actually fixed it in updated version (the initial
>> patch has been split in 3):
>> [PATCH] vhost/crypto: fix session id printf
>>
>
> Ohh, sorry. I need more coffee before starting review :)
No problem, that wans't obvious that these 3 patches superseded this
one.
Your reviews are welcome!
Maxime
>
>> Cheers,
>> Maxime
>>> Pawel
>>>
>
> Pawel
>
@@ -95,11 +95,6 @@ parse_cryptodev_id(const char *q_arg)
/* parse decimal string */
pm = strtoul(q_arg, &end, 10);
- if ((pm == '\0') || (end == NULL) || (*end != '\0')) {
- RTE_LOG(ERR, USER1, "Invalid Cryptodev ID %s\n", q_arg);
- return -1;
- }
-
if (pm > rte_cryptodev_count()) {
RTE_LOG(ERR, USER1, "Invalid Cryptodev ID %s\n", q_arg);
return -1;
@@ -18,7 +18,8 @@ LDLIBS += -lpthread
ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
LDLIBS += -lnuma
endif
-LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_ethdev -lrte_net
+LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_ethdev -lrte_net \
+ -lrte_cryptodev -lrte_hash
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c iotlb.c socket.c vhost.c \
@@ -381,7 +381,7 @@ vhost_crypto_create_sess(struct vhost_crypto *vcrypto,
return;
}
- VC_LOG_DBG("Session (key %lu, session %p) created.",
+ VC_LOG_DBG("Session (key %llu, session %p) created.",
vcrypto->last_session_id, session);
sess_param->session_id = vcrypto->last_session_id;
@@ -399,7 +399,7 @@ vhost_crypto_close_sess(struct vhost_crypto *vcrypto, uint64_t session_id)
(void **)&session);
if (unlikely(ret < 0)) {
- VC_LOG_ERR("Failed to delete session (key %lu).", session_id);
+ VC_LOG_ERR("Failed to delete session (key %llu).", session_id);
return -VIRTIO_CRYPTO_INVSESS;
}
@@ -418,7 +418,7 @@ vhost_crypto_close_sess(struct vhost_crypto *vcrypto, uint64_t session_id)
return -VIRTIO_CRYPTO_ERR;
}
- VC_LOG_DBG("Session (key %lu, session %p) deleted.", sess_id,
+ VC_LOG_DBG("Session (key %llu, session %p) deleted.", sess_id,
session);
return 0;
@@ -932,7 +932,7 @@ vhost_crypto_process_one_req(struct vhost_crypto *vcrypto,
&session_id, (void **)&session);
if (unlikely(err < 0)) {
err = VIRTIO_CRYPTO_ERR;
- VC_LOG_ERR("Failed to retrieve session id %lu",
+ VC_LOG_ERR("Failed to retrieve session id %llu",
session_id);
goto error_exit;
}