DPDK patches and discussions
 help / color / mirror / Atom feed
From: <akhil.goyal@nxp.com>
To: <dev@dpdk.org>
Cc: <sergio.gonzalez.monroy@intel.com>, <declan.doherty@intel.com>,
	<pablo.de.lara.guarch@intel.com>, <fiona.trahe@intel.com>,
	<hemant.agrawal@nxp.com>, Akhil Goyal <akhil.goyal@nxp.com>
Subject: [dpdk-dev] [PATCH v2 2/2] examples/ipsec-secgw: attach session-qp
Date: Thu, 23 Mar 2017 13:36:48 +0530	[thread overview]
Message-ID: <20170323080648.7149-2-akhil.goyal@nxp.com> (raw)
In-Reply-To: <20170323080648.7149-1-akhil.goyal@nxp.com>

From: Akhil Goyal <akhil.goyal@nxp.com>

adding support for attaching session to queue pairs.
This is required as underlying crypto driver may only
support limited number of sessions per queue pair
if max_nb_sessions_per_qp > 0, session should be
attached to a particular qp.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
---
 examples/ipsec-secgw/ipsec.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index 144f0aa..b35b30f 100644
--- a/examples/ipsec-secgw/ipsec.c
+++ b/examples/ipsec-secgw/ipsec.c
@@ -47,6 +47,7 @@
 static inline int
 create_session(struct ipsec_ctx *ipsec_ctx __rte_unused, struct ipsec_sa *sa)
 {
+	struct rte_cryptodev_info cdev_info;
 	unsigned long cdev_id_qp = 0;
 	int32_t ret;
 	struct cdev_key key = { 0 };
@@ -73,6 +74,17 @@ create_session(struct ipsec_ctx *ipsec_ctx __rte_unused, struct ipsec_sa *sa)
 	sa->crypto_session = rte_cryptodev_sym_session_create(
 			ipsec_ctx->tbl[cdev_id_qp].id, sa->xforms);
 
+	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].qp,
+				sa->crypto_session);
+		if (ret < 0) {
+			RTE_LOG(ERR, IPSEC, "Session cannot be attached"
+				" to qp %u ", ipsec_ctx->tbl[cdev_id_qp].qp);
+			return -1;
+		}
+	}
 	sa->cdev_id_qp = cdev_id_qp;
 
 	return 0;
-- 
2.9.3

  reply	other threads:[~2017-03-23  8:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-17  8:45 [dpdk-dev] [PATCH 1/2] cryptodev: add api for attach-detach session with queue pair akhil.goyal
2017-03-17  8:45 ` [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: attach session-qp akhil.goyal
2017-03-20 16:26 ` [dpdk-dev] [PATCH 1/2] cryptodev: add api for attach-detach session with queue pair Trahe, Fiona
2017-03-21  5:31   ` Akhil Goyal
2017-03-23  8:06 ` [dpdk-dev] [PATCH v2 " akhil.goyal
2017-03-23  8:06   ` akhil.goyal [this message]
2017-03-23 10:30     ` [dpdk-dev] [PATCH v2 2/2] examples/ipsec-secgw: attach session-qp Sergio Gonzalez Monroy
2017-03-23 10:38       ` Akhil Goyal
2017-03-23 10:43         ` Sergio Gonzalez Monroy
2017-03-23 12:18           ` Akhil Goyal
2017-03-23 14:37   ` [dpdk-dev] [PATCH v2 1/2] cryptodev: add api for attach-detach session with queue pair Trahe, Fiona
2017-03-24  9:29   ` [dpdk-dev] [PATCH v3 " akhil.goyal
2017-03-24  9:29     ` [dpdk-dev] [PATCH v3 2/2] examples/ipsec-secgw: attach session-qp akhil.goyal
2017-03-28 12:58       ` De Lara Guarch, Pablo
2017-03-28 12:58     ` [dpdk-dev] [PATCH v3 1/2] cryptodev: add api for attach-detach session with queue pair 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=20170323080648.7149-2-akhil.goyal@nxp.com \
    --to=akhil.goyal@nxp.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=sergio.gonzalez.monroy@intel.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).