From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id C60BE1B5A7 for ; Wed, 9 Jan 2019 23:56:22 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jan 2019 14:56:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,459,1539673200"; d="scan'208";a="265885181" Received: from silpixa00398673.ir.intel.com (HELO silpixa00398673.ger.corp.intel.com) ([10.237.223.54]) by orsmga004.jf.intel.com with ESMTP; 09 Jan 2019 14:56:21 -0800 From: Fan Zhang To: dev@dpdk.org Cc: akhil.goyal@nxp.com, pablo.de.lara.guarch@intel.com, fiona.trahe@intel.com Date: Wed, 9 Jan 2019 22:56:03 +0000 Message-Id: <20190109225609.20590-7-roy.fan.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190109225609.20590-1-roy.fan.zhang@intel.com> References: <20181221135550.80745-1-roy.fan.zhang@intel.com> <20190109225609.20590-1-roy.fan.zhang@intel.com> Subject: [dpdk-dev] [PATCH v4 06/12] vhost/crypto: use separate session mempools 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: Wed, 09 Jan 2019 22:56:23 -0000 This patch uses the two session mempool approach to vhost crypto. One mempool is for session header objects, and the other is for session private data. Signed-off-by: Fan Zhang Acked-by: Fiona Trahe --- lib/librte_vhost/rte_vhost_crypto.h | 9 ++++++--- lib/librte_vhost/vhost_crypto.c | 8 ++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/librte_vhost/rte_vhost_crypto.h b/lib/librte_vhost/rte_vhost_crypto.h index f9fbc0548..d08e0ffab 100644 --- a/lib/librte_vhost/rte_vhost_crypto.h +++ b/lib/librte_vhost/rte_vhost_crypto.h @@ -26,8 +26,9 @@ enum rte_vhost_crypto_zero_copy { * The identifier of DPDK Cryptodev, the same cryptodev_id can be assigned to * multiple Vhost-crypto devices. * @param sess_pool - * The pointer to the created cryptodev session pool with the private data size - * matches the target DPDK Cryptodev. + * The pointer to the created cryptodev session pool. + * @param sess_priv_pool + * The pointer to the created cryptodev session private data mempool. * @param socket_id * NUMA Socket ID to allocate resources on. * * @return @@ -36,7 +37,9 @@ enum rte_vhost_crypto_zero_copy { */ int __rte_experimental rte_vhost_crypto_create(int vid, uint8_t cryptodev_id, - struct rte_mempool *sess_pool, int socket_id); + struct rte_mempool *sess_pool, + struct rte_mempool *sess_priv_pool, + int socket_id); /** * Free the Vhost-crypto instance diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c index dd01afc08..598196fb7 100644 --- a/lib/librte_vhost/vhost_crypto.c +++ b/lib/librte_vhost/vhost_crypto.c @@ -198,6 +198,7 @@ struct vhost_crypto { struct rte_hash *session_map; struct rte_mempool *mbuf_pool; struct rte_mempool *sess_pool; + struct rte_mempool *sess_priv_pool; struct rte_mempool *wb_pool; /** DPDK cryptodev ID */ @@ -369,7 +370,7 @@ vhost_crypto_create_sess(struct vhost_crypto *vcrypto, } if (rte_cryptodev_sym_session_init(vcrypto->cid, session, &xform1, - vcrypto->sess_pool) < 0) { + vcrypto->sess_priv_pool) < 0) { VC_LOG_ERR("Failed to initialize session"); sess_param->session_id = -VIRTIO_CRYPTO_ERR; return; @@ -1293,7 +1294,9 @@ vhost_crypto_complete_one_vm_requests(struct rte_crypto_op **ops, int __rte_experimental rte_vhost_crypto_create(int vid, uint8_t cryptodev_id, - struct rte_mempool *sess_pool, int socket_id) + struct rte_mempool *sess_pool, + struct rte_mempool *sess_priv_pool, + int socket_id) { struct virtio_net *dev = get_device(vid); struct rte_hash_parameters params = {0}; @@ -1321,6 +1324,7 @@ rte_vhost_crypto_create(int vid, uint8_t cryptodev_id, } vcrypto->sess_pool = sess_pool; + vcrypto->sess_priv_pool = sess_priv_pool; vcrypto->cid = cryptodev_id; vcrypto->cache_session_id = UINT64_MAX; vcrypto->last_session_id = 1; -- 2.13.6