From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id ACF3358CD for ; Wed, 5 Jul 2017 15:27:07 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jul 2017 06:27:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,312,1496127600"; d="scan'208";a="988933377" Received: from silpixa00399464.ir.intel.com (HELO silpixa00399464.ger.corp.intel.com) ([10.237.222.157]) by orsmga003.jf.intel.com with ESMTP; 05 Jul 2017 06:27:04 -0700 From: Pablo de Lara To: declan.doherty@intel.com, zbigniew.bodek@caviumnetworks.com, jerin.jacob@caviumnetworks.com, akhil.goyal@nxp.com, hemant.agrawal@nxp.com, fiona.trahe@intel.com, john.griffin@intel.com, deepak.k.jain@intel.com Cc: dev@dpdk.org, Slawomir Mrozowicz , Pablo de Lara Date: Wed, 5 Jul 2017 06:26:11 +0100 Message-Id: <20170705052620.34223-4-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170705052620.34223-1-pablo.de.lara.guarch@intel.com> References: <20170702155719.66530-1-pablo.de.lara.guarch@intel.com> <20170705052620.34223-1-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v4 03/12] cryptodev: add private session size retrieval function 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, 05 Jul 2017 13:27:08 -0000 From: Slawomir Mrozowicz Provide a function to get the private session size of any crypto device (specifically, to its crypto driver). This will be useful once the session mempool is created outside the library. Signed-off-by: Slawomir Mrozowicz Signed-off-by: Pablo de Lara --- lib/librte_cryptodev/rte_cryptodev.c | 20 ++++++++++++++++++++ lib/librte_cryptodev/rte_cryptodev.h | 12 ++++++++++++ lib/librte_cryptodev/rte_cryptodev_version.map | 1 + 3 files changed, 33 insertions(+) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index cf444c0..5e9f823 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -1278,6 +1278,26 @@ rte_cryptodev_sym_session_free(uint8_t dev_id, return NULL; } +unsigned int +rte_cryptodev_get_private_session_size(uint8_t dev_id) +{ + struct rte_cryptodev *dev; + unsigned int priv_sess_size; + + if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) + return 0; + + dev = rte_cryptodev_pmd_get_dev(dev_id); + + if (*dev->dev_ops->session_get_size == NULL) + return 0; + + priv_sess_size = (*dev->dev_ops->session_get_size)(dev); + + return priv_sess_size; + +} + /** Initialise rte_crypto_op mempool element */ static void rte_crypto_op_init(struct rte_mempool *mempool, diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index 972a308..f7d248b 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -942,6 +942,18 @@ rte_cryptodev_sym_session_free(uint8_t dev_id, struct rte_cryptodev_sym_session *session); /** + * Get the size of the private session data for a device. + * + * @param dev_id The device identifier. + * + * @return + * - Size of the private data, if successful + * - 0 if device is invalid or does not have private session + */ +unsigned int +rte_cryptodev_get_private_session_size(uint8_t dev_id); + +/** * Attach queue pair with sym session. * * @param qp_id Queue pair to which session will be attached. diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map index 3ad7581..d817421 100644 --- a/lib/librte_cryptodev/rte_cryptodev_version.map +++ b/lib/librte_cryptodev/rte_cryptodev_version.map @@ -66,6 +66,7 @@ DPDK_17.08 { rte_cryptodev_driver_id_get; rte_cryptodev_driver_name_get; rte_cryptodev_get_aead_algo_enum; + rte_cryptodev_get_private_session_size; rte_cryptodev_pci_generic_probe; rte_cryptodev_pci_generic_remove; rte_cryptodev_sym_capability_check_aead; -- 2.9.4