From mboxrd@z Thu Jan 1 00:00:00 1970 From: Subject: [PATCH 2/2] examples/ipsec-secgw: attach session-qp Date: Fri, 17 Mar 2017 14:15:10 +0530 Message-ID: <20170317084510.2120-2-akhil.goyal@nxp.com> References: <20170317084510.2120-1-akhil.goyal@nxp.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , , , Akhil Goyal To: Return-path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0060.outbound.protection.outlook.com [104.47.42.60]) by dpdk.org (Postfix) with ESMTP id 524FF5911 for ; Fri, 17 Mar 2017 09:45:34 +0100 (CET) In-Reply-To: <20170317084510.2120-1-akhil.goyal@nxp.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Akhil Goyal 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 --- examples/ipsec-secgw/ipsec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c index 144f0aa..817ff07 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,11 @@ 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) + rte_cryptodev_queue_pair_attach_sym_session( + ipsec_ctx->tbl[cdev_id_qp].qp, + sa->crypto_session); sa->cdev_id_qp = cdev_id_qp; return 0; -- 2.9.3