From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id B993D1B478 for ; Tue, 10 Jul 2018 10:42:47 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jul 2018 01:42:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,333,1526367600"; d="scan'208";a="55358970" Received: from silpixa00399466.ir.intel.com (HELO silpixa00399466.ger.corp.intel.com) ([10.237.223.220]) by orsmga007.jf.intel.com with ESMTP; 10 Jul 2018 01:42:44 -0700 From: Pablo de Lara To: declan.doherty@intel.com, akhil.goyal@nxp.com, shally.verma@caviumnetworks.com, ravi1.kumar@amd.com, jerin.jacob@caviumnetworks.com, roy.fan.zhang@intel.com, fiona.trahe@intel.com, tdu@semihalf.com, jianjay.zhou@huawei.com Cc: dev@dpdk.org, Pablo de Lara Date: Tue, 10 Jul 2018 01:36:23 +0100 Message-Id: <20180710003623.1463-17-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180710003623.1463-1-pablo.de.lara.guarch@intel.com> References: <20180608220234.10170-1-pablo.de.lara.guarch@intel.com> <20180710003623.1463-1-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v6 16/16] cryptodev: check if symmetric sessions are supported 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: Tue, 10 Jul 2018 08:42:48 -0000 Since asymmetric functionality will be implemented soon, not all PMDs must support symmetric sessions. Therefore, a check is added if a device does not implement the symmetric functions, meaning that the device does not support symmetric operations. Signed-off-by: Pablo de Lara Acked-by: Akhil Goyal --- lib/librte_cryptodev/rte_cryptodev.c | 4 ++++ lib/librte_cryptodev/rte_cryptodev.h | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index 9292f93bb..0b20f3f70 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -1063,6 +1063,8 @@ rte_cryptodev_sym_session_init(uint8_t dev_id, index = dev->driver_id; + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_configure, -ENOTSUP); + if (sess->sess_private_data[index] == NULL) { ret = dev->dev_ops->sym_session_configure(dev, xforms, sess, mp); @@ -1107,6 +1109,8 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id, if (dev == NULL || sess == NULL) return -EINVAL; + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_clear, -ENOTSUP); + dev->dev_ops->sym_session_clear(dev, sess); return 0; diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index 8fd304524..94d4b2684 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -891,7 +891,8 @@ rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess); * @return * - On success, zero. * - -EINVAL if input parameters are invalid. - * - -ENOTSUP if crypto device does not support the crypto transform. + * - -ENOTSUP if crypto device does not support the crypto transform or + * does not support symmetric operations. * - -ENOMEM if the private session could not be allocated. */ int @@ -912,6 +913,7 @@ rte_cryptodev_sym_session_init(uint8_t dev_id, * @return * - 0 if successful. * - -EINVAL if device is invalid or session is NULL. + * - -ENOTSUP if crypto device does not support symmetric operations. */ int rte_cryptodev_sym_session_clear(uint8_t dev_id, -- 2.14.4