From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 0AA4D1B53 for ; Thu, 23 Mar 2017 11:30:43 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP; 23 Mar 2017 03:30:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,209,1486454400"; d="scan'208";a="947371872" Received: from smonroyx-mobl.ger.corp.intel.com (HELO [10.237.221.23]) ([10.237.221.23]) by orsmga003.jf.intel.com with ESMTP; 23 Mar 2017 03:30:41 -0700 To: akhil.goyal@nxp.com, dev@dpdk.org References: <20170317084510.2120-1-akhil.goyal@nxp.com> <20170323080648.7149-1-akhil.goyal@nxp.com> <20170323080648.7149-2-akhil.goyal@nxp.com> Cc: declan.doherty@intel.com, pablo.de.lara.guarch@intel.com, fiona.trahe@intel.com, hemant.agrawal@nxp.com From: Sergio Gonzalez Monroy Message-ID: <1db2a8d1-e59c-b4ae-7496-6b59e28adba3@intel.com> Date: Thu, 23 Mar 2017 10:30:40 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20170323080648.7149-2-akhil.goyal@nxp.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2 2/2] examples/ipsec-secgw: attach session-qp 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: Thu, 23 Mar 2017 10:30:44 -0000 That was simpler than I thought. For some reason I understood that the device will support thousands of queues and single session per queue which would have needed more app changes. On 23/03/2017 08:06, akhil.goyal@nxp.com wrote: > 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 | 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); Guideline is to keep error strings in single line to facilitate grep. Other than that: Acked-by: Sergio Gonzalez Monroy > + return -1; > + } > + } > sa->cdev_id_qp = cdev_id_qp; > > return 0;