patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] examples/ipsec-secgw: limit inflight packets count
@ 2018-04-04 12:18 Radu Nicolau
  2018-04-30 13:37 ` Luca Boccassi
  0 siblings, 1 reply; 4+ messages in thread
From: Radu Nicolau @ 2018-04-04 12:18 UTC (permalink / raw)
  To: stable
  Cc: akhil.goyal, declan.doherty, pablo.de.lara.guarch, roy.fan.zhang,
	Radu Nicolau

Revert previous patch that introduce a performance
degradation in certain scenarios and add a configurable
limit for number inflight packets.

Revert
commit 84d4b5e4ec48 ("examples/ipsec-secgw: improve IPsec dequeue logic")

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 examples/ipsec-secgw/ipsec.c | 31 ++++++++++++++-----------------
 examples/ipsec-secgw/ipsec.h |  1 +
 2 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index 5fb5bc1..1b16b29 100644
--- a/examples/ipsec-secgw/ipsec.c
+++ b/examples/ipsec-secgw/ipsec.c
@@ -345,13 +345,18 @@ create_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa)
 static inline void
 enqueue_cop(struct cdev_qp *cqp, struct rte_crypto_op *cop)
 {
-	int32_t ret, i;
+	int32_t ret = 0, i;
 
 	cqp->buf[cqp->len++] = cop;
 
 	if (cqp->len == MAX_PKT_BURST) {
-		ret = rte_cryptodev_enqueue_burst(cqp->id, cqp->qp,
-				cqp->buf, cqp->len);
+		int enq_size = cqp->len;
+		if (cqp->in_flight >= MAX_INFLIGHT)
+			enq_size -= (int)(cqp->in_flight - MAX_INFLIGHT);
+
+		if (enq_size > 0)
+			ret = rte_cryptodev_enqueue_burst(cqp->id, cqp->qp,
+					cqp->buf, enq_size);
 		if (ret < cqp->len) {
 			RTE_LOG_DP(DEBUG, IPSEC, "Cryptodev %u queue %u:"
 					" enqueued %u crypto ops out of %u\n",
@@ -486,9 +491,12 @@ 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;) {
+	for (i = 0; i < ipsec_ctx->nb_qps && nb_pkts < max_pkts; i++) {
 		struct cdev_qp *cqp;
-		cqp = &ipsec_ctx->tbl[ipsec_ctx->last_qp];
+
+		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;
 
 		while (ipsec_ctx->ol_pkts_cnt > 0 && nb_pkts < max_pkts) {
 			pkt = ipsec_ctx->ol_pkts[--ipsec_ctx->ol_pkts_cnt];
@@ -503,13 +511,8 @@ ipsec_dequeue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx,
 			pkts[nb_pkts++] = pkt;
 		}
 
-		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++;
+		if (cqp->in_flight == 0)
 			continue;
-		}
 
 		nb_cops = rte_cryptodev_dequeue_burst(cqp->id, cqp->qp,
 				cops, max_pkts - nb_pkts);
@@ -533,12 +536,6 @@ 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++;
-			}
 		}
 	}
 
diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h
index 6059f6c..9ce912e 100644
--- a/examples/ipsec-secgw/ipsec.h
+++ b/examples/ipsec-secgw/ipsec.h
@@ -17,6 +17,7 @@
 #define RTE_LOGTYPE_IPSEC_IPIP  RTE_LOGTYPE_USER3
 
 #define MAX_PKT_BURST 32
+#define MAX_INFLIGHT 128
 #define MAX_QP_PER_LCORE 256
 
 #define MAX_DIGEST_SIZE 32 /* Bytes -- 256 bits */
-- 
2.7.5

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

* Re: [dpdk-stable] [PATCH] examples/ipsec-secgw: limit inflight packets count
  2018-04-04 12:18 [dpdk-stable] [PATCH] examples/ipsec-secgw: limit inflight packets count Radu Nicolau
@ 2018-04-30 13:37 ` Luca Boccassi
  2018-04-30 14:09   ` Radu Nicolau
  0 siblings, 1 reply; 4+ messages in thread
From: Luca Boccassi @ 2018-04-30 13:37 UTC (permalink / raw)
  To: Radu Nicolau, stable
  Cc: akhil.goyal, declan.doherty, pablo.de.lara.guarch, roy.fan.zhang

On Wed, 2018-04-04 at 13:18 +0100, Radu Nicolau wrote:
> Revert previous patch that introduce a performance
> degradation in certain scenarios and add a configurable
> limit for number inflight packets.
> 
> Revert
> commit 84d4b5e4ec48 ("examples/ipsec-secgw: improve IPsec dequeue
> logic")
> 
> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
> ---
>  examples/ipsec-secgw/ipsec.c | 31 ++++++++++++++-----------------
>  examples/ipsec-secgw/ipsec.h |  1 +
>  2 files changed, 15 insertions(+), 17 deletions(-)

Has this, or a version of this, been committed in mainline? I cannot
find it

-- 
Kind regards,
Luca Boccassi

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

* Re: [dpdk-stable] [PATCH] examples/ipsec-secgw: limit inflight packets count
  2018-04-30 13:37 ` Luca Boccassi
@ 2018-04-30 14:09   ` Radu Nicolau
  0 siblings, 0 replies; 4+ messages in thread
From: Radu Nicolau @ 2018-04-30 14:09 UTC (permalink / raw)
  To: Luca Boccassi, stable
  Cc: akhil.goyal, declan.doherty, pablo.de.lara.guarch, roy.fan.zhang



On 4/30/2018 2:37 PM, Luca Boccassi wrote:
> On Wed, 2018-04-04 at 13:18 +0100, Radu Nicolau wrote:
>> Revert previous patch that introduce a performance
>> degradation in certain scenarios and add a configurable
>> limit for number inflight packets.
>>
>> Revert
>> commit 84d4b5e4ec48 ("examples/ipsec-secgw: improve IPsec dequeue
>> logic")
>>
>> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
>> ---
>>   examples/ipsec-secgw/ipsec.c | 31 ++++++++++++++-----------------
>>   examples/ipsec-secgw/ipsec.h |  1 +
>>   2 files changed, 15 insertions(+), 17 deletions(-)
> Has this, or a version of this, been committed in mainline? I cannot
> find it
>
I originally sent the patch for the master branch, but after feedback I 
marked it as NA and resent the patch for the stable only; but the patch 
in patchwork remains marked as NA.
https://dpdk.org/dev/patchwork/patch/36937/
The patch can be applied to the stable release, at least that was the 
consensus at that time between Akhil and myself.

@Akhil: can we restart the discussion about having this in the master as 
well, for this release?

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

* [dpdk-stable] [PATCH] examples/ipsec-secgw: limit inflight packets count
@ 2018-04-03 11:07 Radu Nicolau
  0 siblings, 0 replies; 4+ messages in thread
From: Radu Nicolau @ 2018-04-03 11:07 UTC (permalink / raw)
  To: dev
  Cc: akhil.goyal, declan.doherty, pablo.de.lara.guarch, roy.fan.zhang,
	Radu Nicolau, stable

Revert previous patch that introduce a performance
degradation in certain scenarios and add a configurable
limit for number inflight packets.

Revert
commit 84d4b5e4ec48 ("examples/ipsec-secgw: improve IPsec dequeue logic")
Cc: stable@dpdk.org

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 examples/ipsec-secgw/ipsec.c | 31 ++++++++++++++-----------------
 examples/ipsec-secgw/ipsec.h |  1 +
 2 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index 5fb5bc1..1b16b29 100644
--- a/examples/ipsec-secgw/ipsec.c
+++ b/examples/ipsec-secgw/ipsec.c
@@ -345,13 +345,18 @@ create_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa)
 static inline void
 enqueue_cop(struct cdev_qp *cqp, struct rte_crypto_op *cop)
 {
-	int32_t ret, i;
+	int32_t ret = 0, i;
 
 	cqp->buf[cqp->len++] = cop;
 
 	if (cqp->len == MAX_PKT_BURST) {
-		ret = rte_cryptodev_enqueue_burst(cqp->id, cqp->qp,
-				cqp->buf, cqp->len);
+		int enq_size = cqp->len;
+		if (cqp->in_flight >= MAX_INFLIGHT)
+			enq_size -= (int)(cqp->in_flight - MAX_INFLIGHT);
+
+		if (enq_size > 0)
+			ret = rte_cryptodev_enqueue_burst(cqp->id, cqp->qp,
+					cqp->buf, enq_size);
 		if (ret < cqp->len) {
 			RTE_LOG_DP(DEBUG, IPSEC, "Cryptodev %u queue %u:"
 					" enqueued %u crypto ops out of %u\n",
@@ -486,9 +491,12 @@ 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;) {
+	for (i = 0; i < ipsec_ctx->nb_qps && nb_pkts < max_pkts; i++) {
 		struct cdev_qp *cqp;
-		cqp = &ipsec_ctx->tbl[ipsec_ctx->last_qp];
+
+		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;
 
 		while (ipsec_ctx->ol_pkts_cnt > 0 && nb_pkts < max_pkts) {
 			pkt = ipsec_ctx->ol_pkts[--ipsec_ctx->ol_pkts_cnt];
@@ -503,13 +511,8 @@ ipsec_dequeue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx,
 			pkts[nb_pkts++] = pkt;
 		}
 
-		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++;
+		if (cqp->in_flight == 0)
 			continue;
-		}
 
 		nb_cops = rte_cryptodev_dequeue_burst(cqp->id, cqp->qp,
 				cops, max_pkts - nb_pkts);
@@ -533,12 +536,6 @@ 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++;
-			}
 		}
 	}
 
diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h
index 6059f6c..9ce912e 100644
--- a/examples/ipsec-secgw/ipsec.h
+++ b/examples/ipsec-secgw/ipsec.h
@@ -17,6 +17,7 @@
 #define RTE_LOGTYPE_IPSEC_IPIP  RTE_LOGTYPE_USER3
 
 #define MAX_PKT_BURST 32
+#define MAX_INFLIGHT 128
 #define MAX_QP_PER_LCORE 256
 
 #define MAX_DIGEST_SIZE 32 /* Bytes -- 256 bits */
-- 
2.7.5

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

end of thread, other threads:[~2018-04-30 14:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-04 12:18 [dpdk-stable] [PATCH] examples/ipsec-secgw: limit inflight packets count Radu Nicolau
2018-04-30 13:37 ` Luca Boccassi
2018-04-30 14:09   ` Radu Nicolau
  -- strict thread matches above, loose matches on Subject: below --
2018-04-03 11:07 Radu Nicolau

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