From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 0B0381B84D for ; Mon, 9 Apr 2018 18:46:13 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Apr 2018 09:46:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,427,1517904000"; d="scan'208";a="32872413" Received: from silpixa00398673.ir.intel.com (HELO silpixa00398673.ger.corp.intel.com) ([10.237.223.54]) by orsmga006.jf.intel.com with ESMTP; 09 Apr 2018 09:46:11 -0700 From: Fan Zhang To: dev@dpdk.org Cc: roy.fan.zhang@intel.com, maxime.coquelin@redhat.com, ferruh.yigit@intel.com Date: Mon, 9 Apr 2018 17:38:32 +0100 Message-Id: <20180409163832.85611-1-roy.fan.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180409153429.20123-1-roy.fan.zhang@intel.com> References: <20180409153429.20123-1-roy.fan.zhang@intel.com> Subject: [dpdk-dev] [PATCH v2] vhost/crypto: fix bugs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Apr 2018 16:46:15 -0000 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 --- 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(-) 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..b67b63cc1 100644 --- a/lib/librte_vhost/vhost_crypto.c +++ b/lib/librte_vhost/vhost_crypto.c @@ -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; } -- 2.13.6