Skip to contentSkip to conversation

lib/librte_vhost: fix bugs

PATCH In review Fan Zhang 3 participants 20 messages Apr 9, 2018 – Apr 11, 2018

lore
Share & tools
lore

Fan Zhang

author
#0 lore raw

PATCH 1/1 lib/librte_vhost: fix bugs

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.

---
 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(-)
examples/vhost_crypto/main.c +0 -5
index bc867240d..860200e29 100644
@@ -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;
lib/librte_vhost/Makefile +2 -1
index 2cc65f95e..92c267475 100644
@@ -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 \
lib/librte_vhost/vhost_crypto.c +4 -4
index d84513e7f..2acfc908c 100644
@@ -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;
 			}
Signature · 1 line
2.13.6
author
#1 lore raw

PATCH 1/1 lib/librte_vhost: remove packet dump

This patch removes unnecessary packet dump for debugging.

---
 lib/librte_vhost/vhost_crypto.c | 36 ------------------------------------
 1 file changed, 36 deletions(-)
lib/librte_vhost/vhost_crypto.c +0 -36
index d84513e7f..d86af0532 100644
@@ -578,21 +578,12 @@ write_back_data(struct rte_crypto_op *op, struct vhost_crypto_data_req *vc_req)
 	left -= to_write;
 	src_data += to_write;
 
-#ifdef RTE_LIBRTE_VHOST_DEBUG
-	printf("desc addr %llu len %u:", desc->addr, desc->len);
-	rte_hexdump(stdout, "", dst, to_write);
-#endif
-
 	while ((desc->flags & VRING_DESC_F_NEXT) && left > 0) {
 		desc = &head[desc->next];
 		rte_prefetch0(&head[desc->next]);
 		to_write = RTE_MIN(desc->len, (uint32_t)left);
 		dst = GPA_TO_VVA(uint8_t *, mem, desc->addr);
 		rte_memcpy(dst, src_data, to_write);
-#ifdef RTE_LIBRTE_VHOST_DEBUG
-		printf("desc addr %llu len %u:", desc->addr, desc->len);
-		rte_hexdump(stdout, "DST:", dst, to_write);
-#endif
 		left -= to_write;
 		src_data += to_write;
 	}
@@ -626,10 +617,6 @@ prepare_sym_cipher_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op,
 		goto error_exit;
 	}
 
-#ifdef RTE_LIBRTE_VHOST_DEBUG
-	rte_hexdump(stdout, "IV:", iv_data, cipher->para.iv_len);
-#endif
-
 	m_src->data_len = cipher->para.src_data_len;
 
 	switch (vcrypto->option) {
@@ -664,11 +651,6 @@ prepare_sym_cipher_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op,
 		goto error_exit;
 	}
 
-#ifdef RTE_LIBRTE_VHOST_DEBUG
-	rte_hexdump(stdout, "SRC:", rte_pktmbuf_mtod(m_src, void *),
-			cipher->para.src_data_len);
-#endif
-
 	/* dst */
 	desc = find_write_desc(head, desc);
 	if (unlikely(!desc)) {
@@ -746,9 +728,6 @@ prepare_sym_chain_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op,
 		goto error_exit;
 	}
 
-#ifdef RTE_LIBRTE_VHOST_DEBUG
-	rte_hexdump(stdout, "IV:", iv_data, chain->para.iv_len);
-#endif
 	m_src->data_len = chain->para.src_data_len;
 	m_dst->data_len = chain->para.dst_data_len;
 
@@ -782,11 +761,6 @@ prepare_sym_chain_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op,
 		goto error_exit;
 	}
 
-#ifdef RTE_LIBRTE_VHOST_DEBUG
-	rte_hexdump(stdout, "SRC:", rte_pktmbuf_mtod(m_src, void *),
-			chain->para.src_data_len);
-#endif
-
 	/* dst */
 	desc = find_write_desc(head, desc);
 	if (unlikely(!desc)) {
@@ -846,11 +820,6 @@ prepare_sym_chain_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op,
 		goto error_exit;
 	}
 
-#ifdef RTE_LIBRTE_VHOST_DEBUG
-	rte_hexdump(stdout, "Digest:", op->sym->auth.digest.data,
-			chain->para.hash_result_len);
-#endif
-
 	/* record inhdr */
 	vc_req->inhdr = get_data_ptr(head, mem, &desc, INHDR_LEN);
 	if (unlikely(vc_req->inhdr == NULL)) {
@@ -1016,11 +985,6 @@ vhost_crypto_finalize_one_request(struct rte_crypto_op *op,
 		}
 	}
 
-#ifdef RTE_LIBRTE_VHOST_DEBUG
-	rte_hexdump(stdout, "DST:", rte_pktmbuf_mtod(op->sym->m_dst, uint8_t *),
-			m_dst->data_len);
-#endif
-
 	vc_req->vq->used->ring[desc_idx].id = desc_idx;
 	vc_req->vq->used->ring[desc_idx].len = vc_req->len;
 
Signature · 1 line
2.13.6
#3 lore raw

Re: [PATCH] lib/librte_vhost: remove packet dump

Quoted 10 lines · Maxime Coquelin
Quoted 7 lines · Fan Zhang

This patch removes unnecessary packet dump for debugging.

---
  lib/librte_vhost/vhost_crypto.c | 36
------------------------------------

  1 file changed, 36 deletions(-)
Quoted 4 lines

Thanks,
Maxime

Applied to dpdk-next-virtio/master

Thanks,
Maxime

#4 lore raw

Re: [PATCH] lib/librte_vhost: remove packet dump

Quoted 13 lines · Maxime Coquelin
Quoted 10 lines · Maxime Coquelin
Quoted 7 lines · Fan Zhang

This patch removes unnecessary packet dump for debugging.

---
  lib/librte_vhost/vhost_crypto.c | 36
------------------------------------

  1 file changed, 36 deletions(-)
Quoted 6 lines
Quoted 4 lines

Thanks,
Maxime

Applied to dpdk-next-virtio/master

Not to break bisection, I squashed the fix in offending commit.

Thanks,
Maxime

#5 lore raw
In reply to Fan Zhang

Hi Fan,

Quoted 4 lines · Fan Zhang
Fixes 256b132f41b2 ("vhost/crypto: add session message handler")
Fixes 7b5ad7beee17 ("vhost/crypto: update makefile")
Fixes 2ce5bd8c442d ("examples/vhost_crypto: add vhost crypto sample application")
Quoted 8 lines

This patch fixes the bugs introduced in the above patches.

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

Quoted 71 lines
examples/vhost_crypto/main.c +0 -5
index bc867240d..860200e29 100644
@@ -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;
lib/librte_vhost/Makefile +2 -1
index 2cc65f95e..92c267475 100644
@@ -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 \
lib/librte_vhost/vhost_crypto.c +4 -4
index d84513e7f..2acfc908c 100644
@@ -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;
  			}
#6 lore raw
In reply to Fan Zhang

Overall, please rename the commit title prefix to vhost/crypto.

Thanks,
Maxime

Quoted 84 lines · Fan Zhang
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.

---
  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(-)
examples/vhost_crypto/main.c +0 -5
index bc867240d..860200e29 100644
@@ -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;
lib/librte_vhost/Makefile +2 -1
index 2cc65f95e..92c267475 100644
@@ -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 \
lib/librte_vhost/vhost_crypto.c +4 -4
index d84513e7f..2acfc908c 100644
@@ -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;
  			}
author
#7 lore raw

PATCH v2 1/1 vhost/crypto: fix bugs

In reply to Fan Zhang
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.

---
v2:
- change from "%llu" to "%"PRIu64

 examples/vhost_crypto/main.c    |  5 -----
 lib/librte_vhost/Makefile       |  3 ++-
 lib/librte_vhost/vhost_crypto.c | 17 +++++++++--------
 3 files changed, 11 insertions(+), 14 deletions(-)
examples/vhost_crypto/main.c +0 -5
index bc867240d..860200e29 100644
@@ -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;
lib/librte_vhost/Makefile +2 -1
index 2cc65f95e..92c267475 100644
@@ -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 \
lib/librte_vhost/vhost_crypto.c +9 -8
index d84513e7f..b67b63cc1 100644
@@ -381,8 +381,8 @@ vhost_crypto_create_sess(struct vhost_crypto *vcrypto,
 		return;
 	}
 
-	VC_LOG_DBG("Session (key %lu, session %p) created.",
-			vcrypto->last_session_id, session);
+	VC_LOG_DBG("Session %"PRIu64" created for vid %i.",
+			vcrypto->last_session_id, vcrypto->dev->vid);
 
 	sess_param->session_id = vcrypto->last_session_id;
 	vcrypto->last_session_id++;
@@ -399,17 +399,18 @@ 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 %"PRIu64".",
+				session_id);
 		return -VIRTIO_CRYPTO_INVSESS;
 	}
 
 	if (rte_cryptodev_sym_session_clear(vcrypto->cid, session) < 0) {
-		VC_LOG_DBG("Failed to delete session");
+		VC_LOG_DBG("Failed to clear session");
 		return -VIRTIO_CRYPTO_ERR;
 	}
 
 	if (rte_cryptodev_sym_session_free(session) < 0) {
-		VC_LOG_DBG("Failed to delete session");
+		VC_LOG_DBG("Failed to free session");
 		return -VIRTIO_CRYPTO_ERR;
 	}
 
@@ -418,8 +419,8 @@ 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,
-			session);
+	VC_LOG_DBG("Session %"PRIu64" deleted for vid %i.", sess_id,
+			vcrypto->dev->vid);
 
 	return 0;
 }
@@ -932,7 +933,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 obtain session %"PRIu64,
 						session_id);
 				goto error_exit;
 			}
Signature · 1 line
2.13.6
author
#8 lore raw

PATCH 1/1 examples/vhost_crypto: fix parsing

Fixes 2ce5bd8c442d ("examples/vhost_crypto: add vhost crypto sample application")

This patch fixes the parsing of cryptodev id in the cmdline.

---
 examples/vhost_crypto/main.c | 5 -----
 1 file changed, 5 deletions(-)
examples/vhost_crypto/main.c +0 -5
index bc867240d..860200e29 100644
@@ -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;
Signature · 1 line
2.13.6
Acked-by on v1 1/1
#9 lore raw

Re: [PATCH] examples/vhost_crypto: fix parsing

Quoted 16 lines · Fan Zhang
Fixes 2ce5bd8c442d ("examples/vhost_crypto: add vhost crypto sample application")

This patch fixes the parsing of cryptodev id in the cmdline.

---
  examples/vhost_crypto/main.c | 5 -----
  1 file changed, 5 deletions(-)
examples/vhost_crypto/main.c +0 -0
index bc867240d..860200e29 100644
@@ -95,11 +95,6 @@ parse_cryptodev_id(const char *q_arg)
 

examples/vhost_crypto/main.c parse_cryptodev_id(const char *q_arg) · line 100

Quoted 10 lines
examples/vhost_crypto/main.c +0 -5
  	/* 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;

I'll squash it with faulty commit if not yet merged by Ferruh.

Thanks,
Maxime

author
#10 lore raw

PATCH 1/1 vhost/crypto: fix makefile

In reply to Fan Zhang
Fixes 7b5ad7beee17 ("vhost/crypto: update makefile")
---
 lib/librte_vhost/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/librte_vhost/Makefile +2 -1
index 2cc65f95e..92c267475 100644
@@ -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 \
Signature · 1 line
2.13.6
Acked-by on v1 1/1
#11 lore raw

Re: [PATCH] vhost/crypto: fix makefile

Quoted 13 lines · Fan Zhang
Fixes 7b5ad7beee17 ("vhost/crypto: update makefile")
---
  lib/librte_vhost/Makefile | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
lib/librte_vhost/Makefile +0 -0
index 2cc65f95e..92c267475 100644

lib/librte_vhost/Makefile LDLIBS += -lpthread · line 25

Quoted 9 lines
lib/librte_vhost/Makefile +2 -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 \

I'll squash it with faulty commit if not yet merged by Ferruh.

Thanks,
Maxime

author
#12 lore raw

PATCH 1/1 vhost/crypto: fix session id printf

In reply to Fan Zhang
Fixes 85a2d5cab96f ("vhost/crypto: add virtio-crypto user message structure")
---
 lib/librte_vhost/vhost_crypto.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
lib/librte_vhost/vhost_crypto.c +7 -7
index d84513e7f..06c0d3398 100644
@@ -381,8 +381,8 @@ vhost_crypto_create_sess(struct vhost_crypto *vcrypto,
 		return;
 	}
 
-	VC_LOG_DBG("Session (key %lu, session %p) created.",
-			vcrypto->last_session_id, session);
+	VC_LOG_INFO("Session %"PRIu64" created for vdev %i.",
+			vcrypto->last_session_id, vcrypto->dev->vid);
 
 	sess_param->session_id = vcrypto->last_session_id;
 	vcrypto->last_session_id++;
@@ -399,17 +399,17 @@ 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 %"PRIu64".", session_id);
 		return -VIRTIO_CRYPTO_INVSESS;
 	}
 
 	if (rte_cryptodev_sym_session_clear(vcrypto->cid, session) < 0) {
-		VC_LOG_DBG("Failed to delete session");
+		VC_LOG_DBG("Failed to clear session");
 		return -VIRTIO_CRYPTO_ERR;
 	}
 
 	if (rte_cryptodev_sym_session_free(session) < 0) {
-		VC_LOG_DBG("Failed to delete session");
+		VC_LOG_DBG("Failed to free session");
 		return -VIRTIO_CRYPTO_ERR;
 	}
 
@@ -418,8 +418,8 @@ 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,
-			session);
+	VC_LOG_INFO("Session %"PRIu64" deleted for vdev %i.", sess_id,
+			vcrypto->dev->vid);
 
 	return 0;
 }
Signature · 1 line
2.13.6
Acked-by on v1 1/1
#13 lore raw

Re: [PATCH] vhost/crypto: fix session id printf

Quoted 45 lines · Fan Zhang
Fixes 85a2d5cab96f ("vhost/crypto: add virtio-crypto user message structure")
---
  lib/librte_vhost/vhost_crypto.c | 14 +++++++-------
  1 file changed, 7 insertions(+), 7 deletions(-)
lib/librte_vhost/vhost_crypto.c +5 -5
index d84513e7f..06c0d3398 100644
@@ -381,8 +381,8 @@ vhost_crypto_create_sess(struct vhost_crypto *vcrypto,
  		return;
  	}
 
-	VC_LOG_DBG("Session (key %lu, session %p) created.",
-			vcrypto->last_session_id, session);
+	VC_LOG_INFO("Session %"PRIu64" created for vdev %i.",
+			vcrypto->last_session_id, vcrypto->dev->vid);
 
  	sess_param->session_id = vcrypto->last_session_id;
  	vcrypto->last_session_id++;
@@ -399,17 +399,17 @@ 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 %"PRIu64".", session_id);
  		return -VIRTIO_CRYPTO_INVSESS;
  	}
 
  	if (rte_cryptodev_sym_session_clear(vcrypto->cid, session) < 0) {
-		VC_LOG_DBG("Failed to delete session");
+		VC_LOG_DBG("Failed to clear session");
  		return -VIRTIO_CRYPTO_ERR;
  	}
 
  	if (rte_cryptodev_sym_session_free(session) < 0) {
-		VC_LOG_DBG("Failed to delete session");
+		VC_LOG_DBG("Failed to free session");
  		return -VIRTIO_CRYPTO_ERR;
  	}
 

lib/librte_vhost/vhost_crypto.c vhost_crypto_close_sess(struct vhost_crypto *vcrypto, uint64_t session_id) · line 425

Quoted 10 lines
lib/librte_vhost/vhost_crypto.c +2 -2
@@ -418,8 +418,8 @@ 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,
-			session);
+	VC_LOG_INFO("Session %"PRIu64" deleted for vdev %i.", sess_id,
+			vcrypto->dev->vid);
 
  	return 0;
  }

I'll squash it with faulty commit if not yet merged by Ferruh.

Thanks,
Maxime

author
#14 lore raw

PATCH 1/1 vhost/crypto: fix incorrect formatting

In reply to Fan Zhang
Fixes cd39f8e4fd2a ("vhost/crypto: add request handler")
---
 lib/librte_vhost/vhost_crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_vhost/vhost_crypto.c +1 -1
index 06c0d3398..ab75db0b1 100644
@@ -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 find session %"PRIu64,
 						session_id);
 				goto error_exit;
 			}
Signature · 1 line
2.13.6
#15 lore raw

Re: [PATCH] vhost/crypto: fix incorrect formatting

Quoted 13 lines · Fan Zhang
Fixes cd39f8e4fd2a ("vhost/crypto: add request handler")
---
  lib/librte_vhost/vhost_crypto.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_vhost/vhost_crypto.c +0 -0
index 06c0d3398..ab75db0b1 100644

lib/librte_vhost/vhost_crypto.c vhost_crypto_process_one_req(struct vhost_crypto *vcrypto, · line 938

Quoted 8 lines
lib/librte_vhost/vhost_crypto.c +1 -1
@@ -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 find session %"PRIu64,
  						session_id);
  				goto error_exit;
  			}

Squashed into offending commit.

Thanks!
Maxime

#16 lore raw
In reply to Fan Zhang

lib/librte_vhost/vhost_crypto.c vhost_crypto_create_sess(struct vhost_crypto · line 385

Quoted 13 lines
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c iotlb.c socket.c vhost.c \
lib/librte_vhost/vhost_crypto.c +1 -1
index d84513e7f..2acfc908c 100644
@@ -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

#17 lore raw

Hi Pawel,

Quoted 11 lines · PawelX
Quoted 11 lines
  # all source are stored in SRCS-y
  SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c iotlb.c socket.c vhost.c \
lib/librte_vhost/vhost_crypto.c +0 -0
index d84513e7f..2acfc908c 100644
@@ -381,7 +381,7 @@ vhost_crypto_create_sess(struct vhost_crypto
 *vcrypto,
  		return;
  	}
 
Quoted 4 lines

lib/librte_vhost/vhost_crypto.c vhost_crypto_create_sess(struct vhost_crypto *vcrypto, · line 384

Quoted 2 lines
lib/librte_vhost/vhost_crypto.c +1 -1
-	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

Quoted 2 lines

Pawel

#18 lore raw
Quoted 24 lines

-----Original Message-----
From: Maxime Coquelin [mailto:[email protected]]
Sent: Tuesday, April 10, 2018 9:44 AM
To: Wodkowski, PawelX <[email protected]>; Zhang, Roy Fan <[email protected]>; [email protected]
Cc: [email protected]; Tan, Jianfeng <[email protected]>
Subject: Re: [PATCH] lib/librte_vhost: fix bugs

Hi Pawel,

Quoted 2 lines · PawelX
Quoted 2 lines
  # all source are stored in SRCS-y
  SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c iotlb.c socket.c vhost.c

\

Quoted 1 line

Review

Quoted 1 line
(quoted diff) +0 -0

b/lib/librte_vhost/vhost_crypto.c

Quoted 8 lines
Quoted 8 lines

index d84513e7f..2acfc908c 100644

lib/librte_vhost/vhost_crypto.c +0 -0
@@ -381,7 +381,7 @@ vhost_crypto_create_sess(struct vhost_crypto
 *vcrypto,
  		return;
  	}
 
Quoted 9 lines
Quoted 4 lines

lib/librte_vhost/vhost_crypto.c vhost_crypto_create_sess(struct vhost_crypto *vcrypto, · line 384

Quoted 2 lines
lib/librte_vhost/vhost_crypto.c +1 -1
-	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 :)

Quoted 4 lines

Cheers,
Maxime

Quoted 2 lines

Pawel

Pawel

#19 lore raw
Quoted 29 lines · PawelX
Quoted 29 lines

-----Original Message-----
From: Maxime Coquelin [mailto:[email protected]]
Sent: Tuesday, April 10, 2018 9:44 AM
To: Wodkowski, PawelX <[email protected]>; Zhang, Roy Fan <[email protected]>; [email protected]
Cc: [email protected]; Tan, Jianfeng <[email protected]>
Subject: Re: [PATCH] lib/librte_vhost: fix bugs

Hi Pawel,

Quoted 2 lines · PawelX
Quoted 2 lines
   # all source are stored in SRCS-y
   SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c iotlb.c socket.c vhost.c

\

Quoted 1 line

Review

Quoted 1 line
(quoted diff) +0 -0

b/lib/librte_vhost/vhost_crypto.c

Quoted 12 lines

lib/librte_vhost/vhost_crypto.c vhost_crypto_create_sess(struct vhost_crypto · line 385

Quoted 10 lines

index d84513e7f..2acfc908c 100644

lib/librte_vhost/vhost_crypto.c +1 -1
@@ -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)?

Quoted 6 lines
Quoted 4 lines

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

Quoted 8 lines
Quoted 5 lines

Cheers,
Maxime

Quoted 2 lines

Pawel

Pawel