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 85AA358F6 for ; Wed, 5 Jul 2017 15:27:13 +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:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,312,1496127600"; d="scan'208";a="988933424" 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:10 -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:13 +0100 Message-Id: <20170705052620.34223-6-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 05/12] cryptodev: change attach session to queue pair API 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:14 -0000 From: Slawomir Mrozowicz Device id is going to be removed from session, as the session will be device independent. Therefore, the functions that attach/dettach a session to a queue pair need to be updated, to accept the device id as a parameter, apart from the queue pair id and the session. Signed-off-by: Slawomir Mrozowicz Signed-off-by: Pablo de Lara --- doc/guides/rel_notes/release_17_08.rst | 3 +++ examples/ipsec-secgw/ipsec.c | 1 + lib/librte_cryptodev/rte_cryptodev.c | 20 ++++++++++---------- lib/librte_cryptodev/rte_cryptodev.h | 10 ++++++---- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/doc/guides/rel_notes/release_17_08.rst b/doc/guides/rel_notes/release_17_08.rst index 06c5e4e..9b0b4d4 100644 --- a/doc/guides/rel_notes/release_17_08.rst +++ b/doc/guides/rel_notes/release_17_08.rst @@ -205,6 +205,9 @@ API Changes * ``rte_cryptodev_configure()`` does not create the session mempool for the device anymore. * Removed ``session_mp`` from ``rte_cryptodev_config``. + * ``rte_cryptodev_queue_pair_attach_sym_session()`` and + ``rte_cryptodev_queue_pair_dettach_sym_session()`` functions require + the new parameter ``device id``. ABI Changes diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c index ecfd4e8..f09dce9 100644 --- a/examples/ipsec-secgw/ipsec.c +++ b/examples/ipsec-secgw/ipsec.c @@ -77,6 +77,7 @@ create_session(struct ipsec_ctx *ipsec_ctx __rte_unused, struct ipsec_sa *sa) rte_cryptodev_info_get(ipsec_ctx->tbl[cdev_id_qp].id, &cdev_info); if (cdev_info.sym.max_nb_sessions_per_qp > 0) { ret = rte_cryptodev_queue_pair_attach_sym_session( + ipsec_ctx->tbl[cdev_id_qp].id, ipsec_ctx->tbl[cdev_id_qp].qp, sa->crypto_session); if (ret < 0) { diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index 0778d5f..078e26b 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -1136,23 +1136,23 @@ rte_cryptodev_sym_session_create(uint8_t dev_id, } int -rte_cryptodev_queue_pair_attach_sym_session(uint16_t qp_id, +rte_cryptodev_queue_pair_attach_sym_session(uint8_t dev_id, uint16_t qp_id, struct rte_cryptodev_sym_session *sess) { struct rte_cryptodev *dev; - if (!rte_cryptodev_pmd_is_valid_dev(sess->dev_id)) { - CDEV_LOG_ERR("Invalid dev_id=%d", sess->dev_id); + if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) { + CDEV_LOG_ERR("Invalid dev_id=%d", dev_id); return -EINVAL; } - dev = &rte_crypto_devices[sess->dev_id]; + dev = &rte_crypto_devices[dev_id]; /* The API is optional, not returning error if driver do not suuport */ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->qp_attach_session, 0); if (dev->dev_ops->qp_attach_session(dev, qp_id, sess->_private)) { CDEV_LOG_ERR("dev_id %d failed to attach qp: %d with session", - sess->dev_id, qp_id); + dev_id, qp_id); return -EPERM; } @@ -1160,23 +1160,23 @@ rte_cryptodev_queue_pair_attach_sym_session(uint16_t qp_id, } int -rte_cryptodev_queue_pair_detach_sym_session(uint16_t qp_id, +rte_cryptodev_queue_pair_detach_sym_session(uint8_t dev_id, uint16_t qp_id, struct rte_cryptodev_sym_session *sess) { struct rte_cryptodev *dev; - if (!rte_cryptodev_pmd_is_valid_dev(sess->dev_id)) { - CDEV_LOG_ERR("Invalid dev_id=%d", sess->dev_id); + if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) { + CDEV_LOG_ERR("Invalid dev_id=%d", dev_id); return -EINVAL; } - dev = &rte_crypto_devices[sess->dev_id]; + dev = &rte_crypto_devices[dev_id]; /* The API is optional, not returning error if driver do not suuport */ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->qp_detach_session, 0); if (dev->dev_ops->qp_detach_session(dev, qp_id, sess->_private)) { CDEV_LOG_ERR("dev_id %d failed to detach qp: %d from session", - sess->dev_id, qp_id); + dev_id, qp_id); return -EPERM; } diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index 33842f9..0ade05e 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -953,7 +953,8 @@ 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. + * @param dev_id Device to which the session will be attached. + * @param qp_id Queue pair to which the session will be attached. * @param session Session pointer previously allocated by * *rte_cryptodev_sym_session_create*. * @@ -962,13 +963,14 @@ rte_cryptodev_get_private_session_size(uint8_t dev_id); * - On failure, a negative value. */ int -rte_cryptodev_queue_pair_attach_sym_session(uint16_t qp_id, +rte_cryptodev_queue_pair_attach_sym_session(uint8_t dev_id, uint16_t qp_id, struct rte_cryptodev_sym_session *session); /** * Detach queue pair with sym session. * - * @param qp_id Queue pair to which session is attached. + * @param dev_id Device to which the session is attached. + * @param qp_id Queue pair to which the session is attached. * @param session Session pointer previously allocated by * *rte_cryptodev_sym_session_create*. * @@ -977,7 +979,7 @@ rte_cryptodev_queue_pair_attach_sym_session(uint16_t qp_id, * - On failure, a negative value. */ int -rte_cryptodev_queue_pair_detach_sym_session(uint16_t qp_id, +rte_cryptodev_queue_pair_detach_sym_session(uint8_t dev_id, uint16_t qp_id, struct rte_cryptodev_sym_session *session); /** -- 2.9.4