DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
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 <slawomirx.mrozowicz@intel.com>,
	Pablo de Lara <pablo.de.lara.guarch@intel.com>
Subject: [dpdk-dev] [PATCH v3 05/12] cryptodev: change attach session to queue pair API
Date: Sun,  2 Jul 2017 16:57:12 +0100	[thread overview]
Message-ID: <20170702155719.66530-6-pablo.de.lara.guarch@intel.com> (raw)
In-Reply-To: <20170702155719.66530-1-pablo.de.lara.guarch@intel.com>

From: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>

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 <slawomirx.mrozowicz@intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 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 8cc01b2..c7e58c6 100644
--- a/doc/guides/rel_notes/release_17_08.rst
+++ b/doc/guides/rel_notes/release_17_08.rst
@@ -160,6 +160,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 edca5f0..048e441 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 dd10b99..477e28f 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -1075,23 +1075,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;
 	}
 
@@ -1099,23 +1099,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 1afd2d8..d3d2794 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -867,7 +867,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*.
  *
@@ -876,13 +877,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*.
  *
@@ -891,7 +893,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

  parent reply	other threads:[~2017-07-02 23:57 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-26 18:45 [dpdk-dev] [PATCH] cryptodev: make crypto session device independent Michal Jastrzebski
2017-06-30 17:09 ` [dpdk-dev] [PATCH v2 00/11] Device independent crypto sessions Pablo de Lara
2017-06-30 17:09   ` [dpdk-dev] [PATCH v2 01/11] cryptodev: remove unused cryptodev session structure Pablo de Lara
2017-06-30 17:09   ` [dpdk-dev] [PATCH v2 02/11] cryptodev: move session init out of session pool creation Pablo de Lara
2017-06-30 17:09   ` [dpdk-dev] [PATCH v2 03/11] cryptodev: add private session size retrieval function Pablo de Lara
2017-06-30 17:09   ` [dpdk-dev] [PATCH v2 04/11] cryptodev: do not create session mempool internally Pablo de Lara
2017-06-30 17:09   ` [dpdk-dev] [PATCH v2 05/11] cryptodev: change attach session to queue pair API Pablo de Lara
2017-06-30 17:09   ` [dpdk-dev] [PATCH v2 06/11] cryptodev: remove dev_id from crypto session Pablo de Lara
2017-06-30 17:09   ` [dpdk-dev] [PATCH v2 07/11] cryptodev: remove driver id from session Pablo de Lara
2017-06-30 17:09   ` [dpdk-dev] [PATCH v2 08/11] cryptodev: remove mempool " Pablo de Lara
2017-06-30 17:09   ` [dpdk-dev] [PATCH v2 09/11] cryptodev: support device independent sessions Pablo de Lara
2017-06-30 17:09   ` [dpdk-dev] [PATCH v2 10/11] cryptodev: add mempool pointer in queue pair setup Pablo de Lara
2017-06-30 17:09   ` [dpdk-dev] [PATCH v2 11/11] doc: add new crypto session information Pablo de Lara
2017-07-02 20:15     ` Mcnamara, John
2017-07-02 15:57   ` [dpdk-dev] [PATCH v3 00/12] Device independent crypto sessions Pablo de Lara
2017-07-02 15:57     ` [dpdk-dev] [PATCH v3 01/12] cryptodev: remove unused cryptodev session structure Pablo de Lara
2017-07-02 15:57     ` [dpdk-dev] [PATCH v3 02/12] cryptodev: move session init out of session pool creation Pablo de Lara
2017-07-02 15:57     ` [dpdk-dev] [PATCH v3 03/12] cryptodev: add private session size retrieval function Pablo de Lara
2017-07-02 15:57     ` [dpdk-dev] [PATCH v3 04/12] cryptodev: do not create session mempool internally Pablo de Lara
2017-07-02 15:57     ` Pablo de Lara [this message]
2017-07-02 15:57     ` [dpdk-dev] [PATCH v3 06/12] cryptodev: remove device id from crypto session Pablo de Lara
2017-07-02 15:57     ` [dpdk-dev] [PATCH v3 07/12] cryptodev: remove driver id from session Pablo de Lara
2017-07-02 15:57     ` [dpdk-dev] [PATCH v3 08/12] cryptodev: remove mempool " Pablo de Lara
2017-07-02 15:57     ` [dpdk-dev] [PATCH v3 09/12] cryptodev: support device independent sessions Pablo de Lara
2017-07-02 15:57     ` [dpdk-dev] [PATCH v3 10/12] cryptodev: add mempool pointer in queue pair setup Pablo de Lara
2017-07-02 15:57     ` [dpdk-dev] [PATCH v3 11/12] cryptodev: remove session init internal function Pablo de Lara
2017-07-02 15:57     ` [dpdk-dev] [PATCH v3 12/12] doc: add new crypto session information Pablo de Lara
2017-07-03 11:18       ` Mcnamara, John
2017-07-05  5:26     ` [dpdk-dev] [PATCH v4 00/12] Device independent crypto sessions Pablo de Lara
2017-07-05  5:26       ` [dpdk-dev] [PATCH v4 01/12] cryptodev: remove unused cryptodev session structure Pablo de Lara
2017-07-05  5:26       ` [dpdk-dev] [PATCH v4 02/12] cryptodev: move session init out of session pool creation Pablo de Lara
2017-07-05  5:26       ` [dpdk-dev] [PATCH v4 03/12] cryptodev: add private session size retrieval function Pablo de Lara
2017-07-05  5:26       ` [dpdk-dev] [PATCH v4 04/12] cryptodev: do not create session mempool internally Pablo de Lara
2017-07-05  5:26       ` [dpdk-dev] [PATCH v4 05/12] cryptodev: change attach session to queue pair API Pablo de Lara
2017-07-05  5:26       ` [dpdk-dev] [PATCH v4 06/12] cryptodev: remove device id from crypto session Pablo de Lara
2017-07-05  5:26       ` [dpdk-dev] [PATCH v4 07/12] cryptodev: remove driver id from session Pablo de Lara
2017-07-05  5:26       ` [dpdk-dev] [PATCH v4 08/12] cryptodev: remove mempool " Pablo de Lara
2017-07-05  5:26       ` [dpdk-dev] [PATCH v4 09/12] cryptodev: support device independent sessions Pablo de Lara
2017-07-05  5:26       ` [dpdk-dev] [PATCH v4 10/12] cryptodev: add mempool pointer in queue pair setup Pablo de Lara
2017-07-05  5:26       ` [dpdk-dev] [PATCH v4 11/12] cryptodev: remove session init internal function Pablo de Lara
2017-07-05  5:26       ` [dpdk-dev] [PATCH v4 12/12] doc: add new crypto session information Pablo de Lara
2017-07-05 15:21       ` [dpdk-dev] [PATCH v4 00/12] Device independent crypto sessions Declan Doherty
2017-07-05 16:26       ` Akhil Goyal
2017-07-06 11:05       ` De Lara Guarch, Pablo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170702155719.66530-6-pablo.de.lara.guarch@intel.com \
    --to=pablo.de.lara.guarch@intel.com \
    --cc=akhil.goyal@nxp.com \
    --cc=declan.doherty@intel.com \
    --cc=deepak.k.jain@intel.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=john.griffin@intel.com \
    --cc=slawomirx.mrozowicz@intel.com \
    --cc=zbigniew.bodek@caviumnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).