DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/ipsec-secgw: improve ipsec dequeue logic
@ 2017-12-14  7:19 Akhil Goyal
  2018-01-16 16:12 ` Nicolau, Radu
  0 siblings, 1 reply; 3+ messages in thread
From: Akhil Goyal @ 2017-12-14  7:19 UTC (permalink / raw)
  To: dev
  Cc: pablo.de.lara.guarch, hemant.agrawal, sergio.gonzalez.monroy,
	radu.nicolau, Akhil Goyal

Since the processing of crypto operations may take time
due to hardware offload, all the packets may not be available
in the single dequeue command.
So it may happen that there is leakage of cops, and there is
nobody to dequeue the packets because dequeue of crypto ops is
done only once for a particular queue pair even if it has more
packets in flight.

This patch dequeue the packets again if the inflight packets are
more than the max packet burst.

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

diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index 70ed227..69ffc3b 100644
--- a/examples/ipsec-secgw/ipsec.c
+++ b/examples/ipsec-secgw/ipsec.c
@@ -369,12 +369,10 @@ ipsec_dequeue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx,
 	struct ipsec_sa *sa;
 	struct rte_mbuf *pkt;
 
-	for (i = 0; i < ipsec_ctx->nb_qps && nb_pkts < max_pkts; i++) {
+	for (i = 0; i < ipsec_ctx->nb_qps && nb_pkts < max_pkts;) {
 		struct cdev_qp *cqp;
 
-		cqp = &ipsec_ctx->tbl[ipsec_ctx->last_qp++];
-		if (ipsec_ctx->last_qp == ipsec_ctx->nb_qps)
-			ipsec_ctx->last_qp %= ipsec_ctx->nb_qps;
+		cqp = &ipsec_ctx->tbl[ipsec_ctx->last_qp];
 
 		while (cqp->ol_pkts_cnt > 0 && nb_pkts < max_pkts) {
 			pkt = cqp->ol_pkts[--cqp->ol_pkts_cnt];
@@ -389,8 +387,13 @@ ipsec_dequeue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx,
 			pkts[nb_pkts++] = pkt;
 		}
 
-		if (cqp->in_flight == 0)
+		if (cqp->in_flight == 0) {
+			ipsec_ctx->last_qp++;
+			if (ipsec_ctx->last_qp == ipsec_ctx->nb_qps)
+				ipsec_ctx->last_qp %= ipsec_ctx->nb_qps;
+			i++;
 			continue;
+		}
 
 		nb_cops = rte_cryptodev_dequeue_burst(cqp->id, cqp->qp,
 				cops, max_pkts - nb_pkts);
@@ -414,6 +417,12 @@ ipsec_dequeue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx,
 				}
 			}
 			pkts[nb_pkts++] = pkt;
+			if (cqp->in_flight < max_pkts) {
+				ipsec_ctx->last_qp++;
+				if (ipsec_ctx->last_qp == ipsec_ctx->nb_qps)
+					ipsec_ctx->last_qp %= ipsec_ctx->nb_qps;
+				i++;
+			}
 		}
 	}
 
-- 
2.9.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/ipsec-secgw: improve ipsec dequeue logic
  2017-12-14  7:19 [dpdk-dev] [PATCH] examples/ipsec-secgw: improve ipsec dequeue logic Akhil Goyal
@ 2018-01-16 16:12 ` Nicolau, Radu
  2018-01-17 16:54   ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolau, Radu @ 2018-01-16 16:12 UTC (permalink / raw)
  To: Akhil Goyal, dev
  Cc: De Lara Guarch, Pablo, hemant.agrawal, Gonzalez Monroy, Sergio


> -----Original Message-----
> From: Akhil Goyal [mailto:akhil.goyal@nxp.com]
> Sent: Thursday, December 14, 2017 7:19 AM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>;
> hemant.agrawal@nxp.com; Gonzalez Monroy, Sergio
> <sergio.gonzalez.monroy@intel.com>; Nicolau, Radu
> <radu.nicolau@intel.com>; Akhil Goyal <akhil.goyal@nxp.com>
> Subject: [PATCH] examples/ipsec-secgw: improve ipsec dequeue logic
> 
> Since the processing of crypto operations may take time due to hardware
> offload, all the packets may not be available in the single dequeue command.
> So it may happen that there is leakage of cops, and there is nobody to
> dequeue the packets because dequeue of crypto ops is done only once for a
> particular queue pair even if it has more packets in flight.
> 
> This patch dequeue the packets again if the inflight packets are more than
> the max packet burst.
> 
> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>

Acked-by: Radu Nicolau <radu.nicolau@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/ipsec-secgw: improve ipsec dequeue logic
  2018-01-16 16:12 ` Nicolau, Radu
@ 2018-01-17 16:54   ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 3+ messages in thread
From: De Lara Guarch, Pablo @ 2018-01-17 16:54 UTC (permalink / raw)
  To: Nicolau, Radu, Akhil Goyal, dev; +Cc: hemant.agrawal, Gonzalez Monroy, Sergio



> -----Original Message-----
> From: Nicolau, Radu
> Sent: Tuesday, January 16, 2018 4:13 PM
> To: Akhil Goyal <akhil.goyal@nxp.com>; dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>;
> hemant.agrawal@nxp.com; Gonzalez Monroy, Sergio
> <sergio.gonzalez.monroy@intel.com>
> Subject: RE: [PATCH] examples/ipsec-secgw: improve ipsec dequeue logic
> 
> 
> > -----Original Message-----
> > From: Akhil Goyal [mailto:akhil.goyal@nxp.com]
> > Sent: Thursday, December 14, 2017 7:19 AM
> > To: dev@dpdk.org
> > Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>;
> > hemant.agrawal@nxp.com; Gonzalez Monroy, Sergio
> > <sergio.gonzalez.monroy@intel.com>; Nicolau, Radu
> > <radu.nicolau@intel.com>; Akhil Goyal <akhil.goyal@nxp.com>
> > Subject: [PATCH] examples/ipsec-secgw: improve ipsec dequeue logic
> >
> > Since the processing of crypto operations may take time due to
> > hardware offload, all the packets may not be available in the single
> dequeue command.
> > So it may happen that there is leakage of cops, and there is nobody to
> > dequeue the packets because dequeue of crypto ops is done only once
> > for a particular queue pair even if it has more packets in flight.
> >
> > This patch dequeue the packets again if the inflight packets are more
> > than the max packet burst.
> >
> > Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
> 
> Acked-by: Radu Nicolau <radu.nicolau@intel.com>

Applied to dpdk-next-crypto.
Thanks,

Pablo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-17 16:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-14  7:19 [dpdk-dev] [PATCH] examples/ipsec-secgw: improve ipsec dequeue logic Akhil Goyal
2018-01-16 16:12 ` Nicolau, Radu
2018-01-17 16:54   ` De Lara Guarch, Pablo

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).