DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/test/ipsec: fix logic around dequeue burst
@ 2019-04-11 13:08 Bernard Iremonger
  2019-04-11 13:08 ` Bernard Iremonger
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Bernard Iremonger @ 2019-04-11 13:08 UTC (permalink / raw)
  To: dev, konstantin.ananyev, akhil.goyal; +Cc: Bernard Iremonger, stable

Call rte_crypto_dequeue_burst() in a loop with
a delay to ensure that all the  packets are dequeued
from the crtpto device.

Fixes: 59d7353b0df0 ("test/ipsec: fix test suite setup")
Cc: stable@dpdk.org
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 app/test/test_ipsec.c | 42 +++++++++++++++++++++++++++++++-----------
 1 file changed, 31 insertions(+), 11 deletions(-)

diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c
index 80a2d25..25a7df4 100644
--- a/app/test/test_ipsec.c
+++ b/app/test/test_ipsec.c
@@ -9,7 +9,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_pause.h>
+#include <rte_cycles.h>
 #include <rte_bus_vdev.h>
 #include <rte_ip.h>
 
@@ -42,6 +42,7 @@
 #define OUTBOUND_SPI	17
 #define BURST_SIZE		32
 #define REORDER_PKTS	1
+#define DEQUEUE_COUNT	1000
 
 struct user_params {
 	enum rte_crypto_sym_xform_type auth;
@@ -758,7 +759,9 @@ crypto_ipsec(uint16_t num_pkts)
 	struct ipsec_testsuite_params *ts_params = &testsuite_params;
 	struct ipsec_unitest_params *ut_params = &unittest_params;
 	uint32_t k, ng;
+	uint32_t pkt_cnt;
 	struct rte_ipsec_group grp[1];
+	int i;
 
 	/* call crypto prepare */
 	k = rte_ipsec_pkt_crypto_prepare(&ut_params->ss[0], ut_params->ibuf,
@@ -774,9 +777,15 @@ crypto_ipsec(uint16_t num_pkts)
 		return TEST_FAILED;
 	}
 
-	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
-		ut_params->cop, num_pkts);
-	if (k != num_pkts) {
+	for (i = 0, pkt_cnt = 0;
+		i < DEQUEUE_COUNT && pkt_cnt != num_pkts; i++) {
+		k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
+				&ut_params->cop[pkt_cnt], num_pkts - pkt_cnt);
+		pkt_cnt += k;
+		rte_delay_us(1);
+	}
+
+	if (pkt_cnt != num_pkts) {
 		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
 		return TEST_FAILED;
 	}
@@ -868,7 +877,7 @@ crypto_ipsec_2sa(void)
 	struct ipsec_testsuite_params *ts_params = &testsuite_params;
 	struct ipsec_unitest_params *ut_params = &unittest_params;
 	struct rte_ipsec_group grp[BURST_SIZE];
-
+	uint32_t pkt_cnt;
 	uint32_t k, ng, i, r;
 
 	for (i = 0; i < BURST_SIZE; i++) {
@@ -890,9 +899,14 @@ crypto_ipsec_2sa(void)
 		}
 	}
 
-	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
-		ut_params->cop, BURST_SIZE);
-	if (k != BURST_SIZE) {
+	for (i = 0, k = 0, pkt_cnt = 0;
+		i < DEQUEUE_COUNT && pkt_cnt != BURST_SIZE; i++) {
+		k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
+				&ut_params->cop[pkt_cnt], BURST_SIZE - pkt_cnt);
+		pkt_cnt += k;
+		rte_delay_us(1);
+	}
+	if (pkt_cnt != BURST_SIZE) {
 		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
 		return TEST_FAILED;
 	}
@@ -1007,6 +1021,7 @@ crypto_ipsec_2sa_4grp(void)
 	struct ipsec_unitest_params *ut_params = &unittest_params;
 	struct rte_ipsec_group grp[BURST_SIZE];
 	uint32_t k, ng, i, j;
+	uint32_t pkt_cnt;
 	uint32_t rc = 0;
 
 	for (i = 0; i < BURST_SIZE; i++) {
@@ -1029,9 +1044,14 @@ crypto_ipsec_2sa_4grp(void)
 		}
 	}
 
-	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
-		ut_params->cop, BURST_SIZE);
-	if (k != BURST_SIZE) {
+	for (i = 0, k = 0, pkt_cnt = 0;
+		i < DEQUEUE_COUNT && pkt_cnt != BURST_SIZE; i++) {
+		k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
+				&ut_params->cop[pkt_cnt], BURST_SIZE - pkt_cnt);
+		pkt_cnt += k;
+		rte_delay_us(1);
+	}
+	if (pkt_cnt != BURST_SIZE) {
 		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
 		return TEST_FAILED;
 	}
-- 
2.7.4

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

* [dpdk-dev] [PATCH] app/test/ipsec: fix logic around dequeue burst
  2019-04-11 13:08 [dpdk-dev] [PATCH] app/test/ipsec: fix logic around dequeue burst Bernard Iremonger
@ 2019-04-11 13:08 ` Bernard Iremonger
  2019-04-11 17:14 ` Trahe, Fiona
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Bernard Iremonger @ 2019-04-11 13:08 UTC (permalink / raw)
  To: dev, konstantin.ananyev, akhil.goyal; +Cc: Bernard Iremonger, stable

Call rte_crypto_dequeue_burst() in a loop with
a delay to ensure that all the  packets are dequeued
from the crtpto device.

Fixes: 59d7353b0df0 ("test/ipsec: fix test suite setup")
Cc: stable@dpdk.org
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 app/test/test_ipsec.c | 42 +++++++++++++++++++++++++++++++-----------
 1 file changed, 31 insertions(+), 11 deletions(-)

diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c
index 80a2d25..25a7df4 100644
--- a/app/test/test_ipsec.c
+++ b/app/test/test_ipsec.c
@@ -9,7 +9,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_pause.h>
+#include <rte_cycles.h>
 #include <rte_bus_vdev.h>
 #include <rte_ip.h>
 
@@ -42,6 +42,7 @@
 #define OUTBOUND_SPI	17
 #define BURST_SIZE		32
 #define REORDER_PKTS	1
+#define DEQUEUE_COUNT	1000
 
 struct user_params {
 	enum rte_crypto_sym_xform_type auth;
@@ -758,7 +759,9 @@ crypto_ipsec(uint16_t num_pkts)
 	struct ipsec_testsuite_params *ts_params = &testsuite_params;
 	struct ipsec_unitest_params *ut_params = &unittest_params;
 	uint32_t k, ng;
+	uint32_t pkt_cnt;
 	struct rte_ipsec_group grp[1];
+	int i;
 
 	/* call crypto prepare */
 	k = rte_ipsec_pkt_crypto_prepare(&ut_params->ss[0], ut_params->ibuf,
@@ -774,9 +777,15 @@ crypto_ipsec(uint16_t num_pkts)
 		return TEST_FAILED;
 	}
 
-	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
-		ut_params->cop, num_pkts);
-	if (k != num_pkts) {
+	for (i = 0, pkt_cnt = 0;
+		i < DEQUEUE_COUNT && pkt_cnt != num_pkts; i++) {
+		k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
+				&ut_params->cop[pkt_cnt], num_pkts - pkt_cnt);
+		pkt_cnt += k;
+		rte_delay_us(1);
+	}
+
+	if (pkt_cnt != num_pkts) {
 		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
 		return TEST_FAILED;
 	}
@@ -868,7 +877,7 @@ crypto_ipsec_2sa(void)
 	struct ipsec_testsuite_params *ts_params = &testsuite_params;
 	struct ipsec_unitest_params *ut_params = &unittest_params;
 	struct rte_ipsec_group grp[BURST_SIZE];
-
+	uint32_t pkt_cnt;
 	uint32_t k, ng, i, r;
 
 	for (i = 0; i < BURST_SIZE; i++) {
@@ -890,9 +899,14 @@ crypto_ipsec_2sa(void)
 		}
 	}
 
-	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
-		ut_params->cop, BURST_SIZE);
-	if (k != BURST_SIZE) {
+	for (i = 0, k = 0, pkt_cnt = 0;
+		i < DEQUEUE_COUNT && pkt_cnt != BURST_SIZE; i++) {
+		k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
+				&ut_params->cop[pkt_cnt], BURST_SIZE - pkt_cnt);
+		pkt_cnt += k;
+		rte_delay_us(1);
+	}
+	if (pkt_cnt != BURST_SIZE) {
 		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
 		return TEST_FAILED;
 	}
@@ -1007,6 +1021,7 @@ crypto_ipsec_2sa_4grp(void)
 	struct ipsec_unitest_params *ut_params = &unittest_params;
 	struct rte_ipsec_group grp[BURST_SIZE];
 	uint32_t k, ng, i, j;
+	uint32_t pkt_cnt;
 	uint32_t rc = 0;
 
 	for (i = 0; i < BURST_SIZE; i++) {
@@ -1029,9 +1044,14 @@ crypto_ipsec_2sa_4grp(void)
 		}
 	}
 
-	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
-		ut_params->cop, BURST_SIZE);
-	if (k != BURST_SIZE) {
+	for (i = 0, k = 0, pkt_cnt = 0;
+		i < DEQUEUE_COUNT && pkt_cnt != BURST_SIZE; i++) {
+		k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
+				&ut_params->cop[pkt_cnt], BURST_SIZE - pkt_cnt);
+		pkt_cnt += k;
+		rte_delay_us(1);
+	}
+	if (pkt_cnt != BURST_SIZE) {
 		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
 		return TEST_FAILED;
 	}
-- 
2.7.4


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

* Re: [dpdk-dev] [PATCH] app/test/ipsec: fix logic around dequeue burst
  2019-04-11 13:08 [dpdk-dev] [PATCH] app/test/ipsec: fix logic around dequeue burst Bernard Iremonger
  2019-04-11 13:08 ` Bernard Iremonger
@ 2019-04-11 17:14 ` Trahe, Fiona
  2019-04-11 17:14   ` Trahe, Fiona
  2019-04-12 10:31 ` Ananyev, Konstantin
  2019-04-12 14:08 ` [dpdk-dev] [PATCH v2] " Bernard Iremonger
  3 siblings, 1 reply; 10+ messages in thread
From: Trahe, Fiona @ 2019-04-11 17:14 UTC (permalink / raw)
  To: Iremonger, Bernard, dev, Ananyev, Konstantin, akhil.goyal
  Cc: Iremonger, Bernard, stable



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bernard Iremonger
> Sent: Thursday, April 11, 2019 2:08 PM
> To: dev@dpdk.org; Ananyev, Konstantin <konstantin.ananyev@intel.com>; akhil.goyal@nxp.com
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] app/test/ipsec: fix logic around dequeue burst
> 
> Call rte_crypto_dequeue_burst() in a loop with
> a delay to ensure that all the  packets are dequeued
> from the crtpto device.
> 
> Fixes: 59d7353b0df0 ("test/ipsec: fix test suite setup")
> Cc: stable@dpdk.org
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>

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

* Re: [dpdk-dev] [PATCH] app/test/ipsec: fix logic around dequeue burst
  2019-04-11 17:14 ` Trahe, Fiona
@ 2019-04-11 17:14   ` Trahe, Fiona
  0 siblings, 0 replies; 10+ messages in thread
From: Trahe, Fiona @ 2019-04-11 17:14 UTC (permalink / raw)
  To: Iremonger, Bernard, dev, Ananyev, Konstantin, akhil.goyal
  Cc: Iremonger, Bernard, stable



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bernard Iremonger
> Sent: Thursday, April 11, 2019 2:08 PM
> To: dev@dpdk.org; Ananyev, Konstantin <konstantin.ananyev@intel.com>; akhil.goyal@nxp.com
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] app/test/ipsec: fix logic around dequeue burst
> 
> Call rte_crypto_dequeue_burst() in a loop with
> a delay to ensure that all the  packets are dequeued
> from the crtpto device.
> 
> Fixes: 59d7353b0df0 ("test/ipsec: fix test suite setup")
> Cc: stable@dpdk.org
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>

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

* Re: [dpdk-dev] [PATCH] app/test/ipsec: fix logic around dequeue burst
  2019-04-11 13:08 [dpdk-dev] [PATCH] app/test/ipsec: fix logic around dequeue burst Bernard Iremonger
  2019-04-11 13:08 ` Bernard Iremonger
  2019-04-11 17:14 ` Trahe, Fiona
@ 2019-04-12 10:31 ` Ananyev, Konstantin
  2019-04-12 10:31   ` Ananyev, Konstantin
  2019-04-12 11:24   ` Iremonger, Bernard
  2019-04-12 14:08 ` [dpdk-dev] [PATCH v2] " Bernard Iremonger
  3 siblings, 2 replies; 10+ messages in thread
From: Ananyev, Konstantin @ 2019-04-12 10:31 UTC (permalink / raw)
  To: Iremonger, Bernard, dev, akhil.goyal; +Cc: stable

Hi Bernard,

/ipsec: fix logic around dequeue burst
> 
> Call rte_crypto_dequeue_burst() in a loop with
> a delay to ensure that all the  packets are dequeued
> from the crtpto device.
> 
> Fixes: 59d7353b0df0 ("test/ipsec: fix test suite setup")
> Cc: stable@dpdk.org
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> ---
>  app/test/test_ipsec.c | 42 +++++++++++++++++++++++++++++++-----------
>  1 file changed, 31 insertions(+), 11 deletions(-)
> 
> diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c
> index 80a2d25..25a7df4 100644
> --- a/app/test/test_ipsec.c
> +++ b/app/test/test_ipsec.c
> @@ -9,7 +9,7 @@
>  #include <rte_mbuf.h>
>  #include <rte_malloc.h>
>  #include <rte_memcpy.h>
> -#include <rte_pause.h>
> +#include <rte_cycles.h>
>  #include <rte_bus_vdev.h>
>  #include <rte_ip.h>
> 
> @@ -42,6 +42,7 @@
>  #define OUTBOUND_SPI	17
>  #define BURST_SIZE		32
>  #define REORDER_PKTS	1
> +#define DEQUEUE_COUNT	1000
> 
>  struct user_params {
>  	enum rte_crypto_sym_xform_type auth;
> @@ -758,7 +759,9 @@ crypto_ipsec(uint16_t num_pkts)
>  	struct ipsec_testsuite_params *ts_params = &testsuite_params;
>  	struct ipsec_unitest_params *ut_params = &unittest_params;
>  	uint32_t k, ng;
> +	uint32_t pkt_cnt;
>  	struct rte_ipsec_group grp[1];
> +	int i;
> 
>  	/* call crypto prepare */
>  	k = rte_ipsec_pkt_crypto_prepare(&ut_params->ss[0], ut_params->ibuf,
> @@ -774,9 +777,15 @@ crypto_ipsec(uint16_t num_pkts)
>  		return TEST_FAILED;
>  	}
> 
> -	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
> -		ut_params->cop, num_pkts);
> -	if (k != num_pkts) {
> +	for (i = 0, pkt_cnt = 0;
> +		i < DEQUEUE_COUNT && pkt_cnt != num_pkts; i++) {
> +		k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
> +				&ut_params->cop[pkt_cnt], num_pkts - pkt_cnt);
> +		pkt_cnt += k;
> +		rte_delay_us(1);
> +	}

Looks good to me.
My only suggestion would be to put that loop in a separate function
to avoid duplications.
Apart from that:
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> +
> +	if (pkt_cnt != num_pkts) {
>  		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
>  		return TEST_FAILED;
>  	}
> @@ -868,7 +877,7 @@ crypto_ipsec_2sa(void)
>  	struct ipsec_testsuite_params *ts_params = &testsuite_params;
>  	struct ipsec_unitest_params *ut_params = &unittest_params;
>  	struct rte_ipsec_group grp[BURST_SIZE];
> -
> +	uint32_t pkt_cnt;
>  	uint32_t k, ng, i, r;
> 
>  	for (i = 0; i < BURST_SIZE; i++) {
> @@ -890,9 +899,14 @@ crypto_ipsec_2sa(void)
>  		}
>  	}
> 
> -	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
> -		ut_params->cop, BURST_SIZE);
> -	if (k != BURST_SIZE) {
> +	for (i = 0, k = 0, pkt_cnt = 0;
> +		i < DEQUEUE_COUNT && pkt_cnt != BURST_SIZE; i++) {
> +		k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
> +				&ut_params->cop[pkt_cnt], BURST_SIZE - pkt_cnt);
> +		pkt_cnt += k;
> +		rte_delay_us(1);
> +	}
> +	if (pkt_cnt != BURST_SIZE) {
>  		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
>  		return TEST_FAILED;
>  	}
> @@ -1007,6 +1021,7 @@ crypto_ipsec_2sa_4grp(void)
>  	struct ipsec_unitest_params *ut_params = &unittest_params;
>  	struct rte_ipsec_group grp[BURST_SIZE];
>  	uint32_t k, ng, i, j;
> +	uint32_t pkt_cnt;
>  	uint32_t rc = 0;
> 
>  	for (i = 0; i < BURST_SIZE; i++) {
> @@ -1029,9 +1044,14 @@ crypto_ipsec_2sa_4grp(void)
>  		}
>  	}
> 
> -	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
> -		ut_params->cop, BURST_SIZE);
> -	if (k != BURST_SIZE) {
> +	for (i = 0, k = 0, pkt_cnt = 0;
> +		i < DEQUEUE_COUNT && pkt_cnt != BURST_SIZE; i++) {
> +		k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
> +				&ut_params->cop[pkt_cnt], BURST_SIZE - pkt_cnt);
> +		pkt_cnt += k;
> +		rte_delay_us(1);
> +	}
> +	if (pkt_cnt != BURST_SIZE) {
>  		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
>  		return TEST_FAILED;
>  	}
> --
> 2.7.4

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

* Re: [dpdk-dev] [PATCH] app/test/ipsec: fix logic around dequeue burst
  2019-04-12 10:31 ` Ananyev, Konstantin
@ 2019-04-12 10:31   ` Ananyev, Konstantin
  2019-04-12 11:24   ` Iremonger, Bernard
  1 sibling, 0 replies; 10+ messages in thread
From: Ananyev, Konstantin @ 2019-04-12 10:31 UTC (permalink / raw)
  To: Iremonger, Bernard, dev, akhil.goyal; +Cc: stable

Hi Bernard,

/ipsec: fix logic around dequeue burst
> 
> Call rte_crypto_dequeue_burst() in a loop with
> a delay to ensure that all the  packets are dequeued
> from the crtpto device.
> 
> Fixes: 59d7353b0df0 ("test/ipsec: fix test suite setup")
> Cc: stable@dpdk.org
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> ---
>  app/test/test_ipsec.c | 42 +++++++++++++++++++++++++++++++-----------
>  1 file changed, 31 insertions(+), 11 deletions(-)
> 
> diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c
> index 80a2d25..25a7df4 100644
> --- a/app/test/test_ipsec.c
> +++ b/app/test/test_ipsec.c
> @@ -9,7 +9,7 @@
>  #include <rte_mbuf.h>
>  #include <rte_malloc.h>
>  #include <rte_memcpy.h>
> -#include <rte_pause.h>
> +#include <rte_cycles.h>
>  #include <rte_bus_vdev.h>
>  #include <rte_ip.h>
> 
> @@ -42,6 +42,7 @@
>  #define OUTBOUND_SPI	17
>  #define BURST_SIZE		32
>  #define REORDER_PKTS	1
> +#define DEQUEUE_COUNT	1000
> 
>  struct user_params {
>  	enum rte_crypto_sym_xform_type auth;
> @@ -758,7 +759,9 @@ crypto_ipsec(uint16_t num_pkts)
>  	struct ipsec_testsuite_params *ts_params = &testsuite_params;
>  	struct ipsec_unitest_params *ut_params = &unittest_params;
>  	uint32_t k, ng;
> +	uint32_t pkt_cnt;
>  	struct rte_ipsec_group grp[1];
> +	int i;
> 
>  	/* call crypto prepare */
>  	k = rte_ipsec_pkt_crypto_prepare(&ut_params->ss[0], ut_params->ibuf,
> @@ -774,9 +777,15 @@ crypto_ipsec(uint16_t num_pkts)
>  		return TEST_FAILED;
>  	}
> 
> -	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
> -		ut_params->cop, num_pkts);
> -	if (k != num_pkts) {
> +	for (i = 0, pkt_cnt = 0;
> +		i < DEQUEUE_COUNT && pkt_cnt != num_pkts; i++) {
> +		k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
> +				&ut_params->cop[pkt_cnt], num_pkts - pkt_cnt);
> +		pkt_cnt += k;
> +		rte_delay_us(1);
> +	}

Looks good to me.
My only suggestion would be to put that loop in a separate function
to avoid duplications.
Apart from that:
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> +
> +	if (pkt_cnt != num_pkts) {
>  		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
>  		return TEST_FAILED;
>  	}
> @@ -868,7 +877,7 @@ crypto_ipsec_2sa(void)
>  	struct ipsec_testsuite_params *ts_params = &testsuite_params;
>  	struct ipsec_unitest_params *ut_params = &unittest_params;
>  	struct rte_ipsec_group grp[BURST_SIZE];
> -
> +	uint32_t pkt_cnt;
>  	uint32_t k, ng, i, r;
> 
>  	for (i = 0; i < BURST_SIZE; i++) {
> @@ -890,9 +899,14 @@ crypto_ipsec_2sa(void)
>  		}
>  	}
> 
> -	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
> -		ut_params->cop, BURST_SIZE);
> -	if (k != BURST_SIZE) {
> +	for (i = 0, k = 0, pkt_cnt = 0;
> +		i < DEQUEUE_COUNT && pkt_cnt != BURST_SIZE; i++) {
> +		k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
> +				&ut_params->cop[pkt_cnt], BURST_SIZE - pkt_cnt);
> +		pkt_cnt += k;
> +		rte_delay_us(1);
> +	}
> +	if (pkt_cnt != BURST_SIZE) {
>  		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
>  		return TEST_FAILED;
>  	}
> @@ -1007,6 +1021,7 @@ crypto_ipsec_2sa_4grp(void)
>  	struct ipsec_unitest_params *ut_params = &unittest_params;
>  	struct rte_ipsec_group grp[BURST_SIZE];
>  	uint32_t k, ng, i, j;
> +	uint32_t pkt_cnt;
>  	uint32_t rc = 0;
> 
>  	for (i = 0; i < BURST_SIZE; i++) {
> @@ -1029,9 +1044,14 @@ crypto_ipsec_2sa_4grp(void)
>  		}
>  	}
> 
> -	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
> -		ut_params->cop, BURST_SIZE);
> -	if (k != BURST_SIZE) {
> +	for (i = 0, k = 0, pkt_cnt = 0;
> +		i < DEQUEUE_COUNT && pkt_cnt != BURST_SIZE; i++) {
> +		k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
> +				&ut_params->cop[pkt_cnt], BURST_SIZE - pkt_cnt);
> +		pkt_cnt += k;
> +		rte_delay_us(1);
> +	}
> +	if (pkt_cnt != BURST_SIZE) {
>  		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
>  		return TEST_FAILED;
>  	}
> --
> 2.7.4


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

* Re: [dpdk-dev] [PATCH] app/test/ipsec: fix logic around dequeue burst
  2019-04-12 10:31 ` Ananyev, Konstantin
  2019-04-12 10:31   ` Ananyev, Konstantin
@ 2019-04-12 11:24   ` Iremonger, Bernard
  2019-04-12 11:24     ` Iremonger, Bernard
  1 sibling, 1 reply; 10+ messages in thread
From: Iremonger, Bernard @ 2019-04-12 11:24 UTC (permalink / raw)
  To: Ananyev, Konstantin, dev, akhil.goyal; +Cc: stable

Hi Konstantin,

<snip>
> > Call rte_crypto_dequeue_burst() in a loop with a delay to ensure that
> > all the  packets are dequeued from the crtpto device.
> >
> > Fixes: 59d7353b0df0 ("test/ipsec: fix test suite setup")
> > Cc: stable@dpdk.org
> > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> > ---
> >  app/test/test_ipsec.c | 42 +++++++++++++++++++++++++++++++-----------
> >  1 file changed, 31 insertions(+), 11 deletions(-)
> >
> > diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c index
> > 80a2d25..25a7df4 100644
> > --- a/app/test/test_ipsec.c
> > +++ b/app/test/test_ipsec.c
> > @@ -9,7 +9,7 @@
> >  #include <rte_mbuf.h>
> >  #include <rte_malloc.h>
> >  #include <rte_memcpy.h>
> > -#include <rte_pause.h>
> > +#include <rte_cycles.h>
> >  #include <rte_bus_vdev.h>
> >  #include <rte_ip.h>
> >
> > @@ -42,6 +42,7 @@
> >  #define OUTBOUND_SPI	17
> >  #define BURST_SIZE		32
> >  #define REORDER_PKTS	1
> > +#define DEQUEUE_COUNT	1000
> >
> >  struct user_params {
> >  	enum rte_crypto_sym_xform_type auth; @@ -758,7 +759,9 @@
> > crypto_ipsec(uint16_t num_pkts)
> >  	struct ipsec_testsuite_params *ts_params = &testsuite_params;
> >  	struct ipsec_unitest_params *ut_params = &unittest_params;
> >  	uint32_t k, ng;
> > +	uint32_t pkt_cnt;
> >  	struct rte_ipsec_group grp[1];
> > +	int i;
> >
> >  	/* call crypto prepare */
> >  	k = rte_ipsec_pkt_crypto_prepare(&ut_params->ss[0], ut_params->ibuf,
> > @@ -774,9 +777,15 @@ crypto_ipsec(uint16_t num_pkts)
> >  		return TEST_FAILED;
> >  	}
> >
> > -	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
> > -		ut_params->cop, num_pkts);
> > -	if (k != num_pkts) {
> > +	for (i = 0, pkt_cnt = 0;
> > +		i < DEQUEUE_COUNT && pkt_cnt != num_pkts; i++) {
> > +		k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
> > +				&ut_params->cop[pkt_cnt], num_pkts -
> pkt_cnt);
> > +		pkt_cnt += k;
> > +		rte_delay_us(1);
> > +	}
> 
> Looks good to me.
> My only suggestion would be to put that loop in a separate function to avoid
> duplications.
> Apart from that:
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

I will put that loop in a separate function and send v2

Regards,

Bernard.

snip

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

* Re: [dpdk-dev] [PATCH] app/test/ipsec: fix logic around dequeue burst
  2019-04-12 11:24   ` Iremonger, Bernard
@ 2019-04-12 11:24     ` Iremonger, Bernard
  0 siblings, 0 replies; 10+ messages in thread
From: Iremonger, Bernard @ 2019-04-12 11:24 UTC (permalink / raw)
  To: Ananyev, Konstantin, dev, akhil.goyal; +Cc: stable

Hi Konstantin,

<snip>
> > Call rte_crypto_dequeue_burst() in a loop with a delay to ensure that
> > all the  packets are dequeued from the crtpto device.
> >
> > Fixes: 59d7353b0df0 ("test/ipsec: fix test suite setup")
> > Cc: stable@dpdk.org
> > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> > ---
> >  app/test/test_ipsec.c | 42 +++++++++++++++++++++++++++++++-----------
> >  1 file changed, 31 insertions(+), 11 deletions(-)
> >
> > diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c index
> > 80a2d25..25a7df4 100644
> > --- a/app/test/test_ipsec.c
> > +++ b/app/test/test_ipsec.c
> > @@ -9,7 +9,7 @@
> >  #include <rte_mbuf.h>
> >  #include <rte_malloc.h>
> >  #include <rte_memcpy.h>
> > -#include <rte_pause.h>
> > +#include <rte_cycles.h>
> >  #include <rte_bus_vdev.h>
> >  #include <rte_ip.h>
> >
> > @@ -42,6 +42,7 @@
> >  #define OUTBOUND_SPI	17
> >  #define BURST_SIZE		32
> >  #define REORDER_PKTS	1
> > +#define DEQUEUE_COUNT	1000
> >
> >  struct user_params {
> >  	enum rte_crypto_sym_xform_type auth; @@ -758,7 +759,9 @@
> > crypto_ipsec(uint16_t num_pkts)
> >  	struct ipsec_testsuite_params *ts_params = &testsuite_params;
> >  	struct ipsec_unitest_params *ut_params = &unittest_params;
> >  	uint32_t k, ng;
> > +	uint32_t pkt_cnt;
> >  	struct rte_ipsec_group grp[1];
> > +	int i;
> >
> >  	/* call crypto prepare */
> >  	k = rte_ipsec_pkt_crypto_prepare(&ut_params->ss[0], ut_params->ibuf,
> > @@ -774,9 +777,15 @@ crypto_ipsec(uint16_t num_pkts)
> >  		return TEST_FAILED;
> >  	}
> >
> > -	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
> > -		ut_params->cop, num_pkts);
> > -	if (k != num_pkts) {
> > +	for (i = 0, pkt_cnt = 0;
> > +		i < DEQUEUE_COUNT && pkt_cnt != num_pkts; i++) {
> > +		k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
> > +				&ut_params->cop[pkt_cnt], num_pkts -
> pkt_cnt);
> > +		pkt_cnt += k;
> > +		rte_delay_us(1);
> > +	}
> 
> Looks good to me.
> My only suggestion would be to put that loop in a separate function to avoid
> duplications.
> Apart from that:
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

I will put that loop in a separate function and send v2

Regards,

Bernard.

snip

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

* [dpdk-dev] [PATCH v2] app/test/ipsec: fix logic around dequeue burst
  2019-04-11 13:08 [dpdk-dev] [PATCH] app/test/ipsec: fix logic around dequeue burst Bernard Iremonger
                   ` (2 preceding siblings ...)
  2019-04-12 10:31 ` Ananyev, Konstantin
@ 2019-04-12 14:08 ` Bernard Iremonger
  2019-04-12 14:08   ` Bernard Iremonger
  3 siblings, 1 reply; 10+ messages in thread
From: Bernard Iremonger @ 2019-04-12 14:08 UTC (permalink / raw)
  To: dev, konstantin.ananyev, akhil.goyal; +Cc: Bernard Iremonger, stable

Added crypto_dequeue_burst() function to call
rte_crypto_dequeue_burst() in a loop with a
delay to ensure that all the  packets are
dequeued from the crtpto device.

Fixes: 59d7353b0df0 ("test/ipsec: fix test suite setup")
Cc: stable@dpdk.org
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
Changes in v2:
Added crypto_dequeue_burst() function

 app/test/test_ipsec.c | 46 +++++++++++++++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 17 deletions(-)

diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c
index 80a2d25..d79fe11 100644
--- a/app/test/test_ipsec.c
+++ b/app/test/test_ipsec.c
@@ -9,7 +9,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_pause.h>
+#include <rte_cycles.h>
 #include <rte_bus_vdev.h>
 #include <rte_ip.h>
 
@@ -42,6 +42,7 @@
 #define OUTBOUND_SPI	17
 #define BURST_SIZE		32
 #define REORDER_PKTS	1
+#define DEQUEUE_COUNT	1000
 
 struct user_params {
 	enum rte_crypto_sym_xform_type auth;
@@ -753,6 +754,29 @@ create_sa(enum rte_security_session_action_type action_type,
 }
 
 static int
+crypto_dequeue_burst(uint16_t num_pkts)
+{
+	struct ipsec_testsuite_params *ts_params = &testsuite_params;
+	struct ipsec_unitest_params *ut_params = &unittest_params;
+	uint32_t pkt_cnt, k;
+	int i;
+
+	for (i = 0, pkt_cnt = 0;
+		i < DEQUEUE_COUNT && pkt_cnt != num_pkts; i++) {
+		k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
+			&ut_params->cop[pkt_cnt], num_pkts - pkt_cnt);
+		pkt_cnt += k;
+		rte_delay_us(1);
+	}
+
+	if (pkt_cnt != num_pkts) {
+		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
+		return TEST_FAILED;
+	}
+	return TEST_SUCCESS;
+}
+
+static int
 crypto_ipsec(uint16_t num_pkts)
 {
 	struct ipsec_testsuite_params *ts_params = &testsuite_params;
@@ -767,6 +791,7 @@ crypto_ipsec(uint16_t num_pkts)
 		RTE_LOG(ERR, USER1, "rte_ipsec_pkt_crypto_prepare fail\n");
 		return TEST_FAILED;
 	}
+
 	k = rte_cryptodev_enqueue_burst(ts_params->valid_dev, 0,
 		ut_params->cop, num_pkts);
 	if (k != num_pkts) {
@@ -774,12 +799,8 @@ crypto_ipsec(uint16_t num_pkts)
 		return TEST_FAILED;
 	}
 
-	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
-		ut_params->cop, num_pkts);
-	if (k != num_pkts) {
-		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
+	if (crypto_dequeue_burst(num_pkts) == TEST_FAILED)
 		return TEST_FAILED;
-	}
 
 	ng = rte_ipsec_pkt_crypto_group(
 		(const struct rte_crypto_op **)(uintptr_t)ut_params->cop,
@@ -868,7 +889,6 @@ crypto_ipsec_2sa(void)
 	struct ipsec_testsuite_params *ts_params = &testsuite_params;
 	struct ipsec_unitest_params *ut_params = &unittest_params;
 	struct rte_ipsec_group grp[BURST_SIZE];
-
 	uint32_t k, ng, i, r;
 
 	for (i = 0; i < BURST_SIZE; i++) {
@@ -890,12 +910,8 @@ crypto_ipsec_2sa(void)
 		}
 	}
 
-	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
-		ut_params->cop, BURST_SIZE);
-	if (k != BURST_SIZE) {
-		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
+	if (crypto_dequeue_burst(BURST_SIZE) == TEST_FAILED)
 		return TEST_FAILED;
-	}
 
 	ng = rte_ipsec_pkt_crypto_group(
 		(const struct rte_crypto_op **)(uintptr_t)ut_params->cop,
@@ -1029,12 +1045,8 @@ crypto_ipsec_2sa_4grp(void)
 		}
 	}
 
-	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
-		ut_params->cop, BURST_SIZE);
-	if (k != BURST_SIZE) {
-		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
+	if (crypto_dequeue_burst(BURST_SIZE) == TEST_FAILED)
 		return TEST_FAILED;
-	}
 
 	ng = rte_ipsec_pkt_crypto_group(
 		(const struct rte_crypto_op **)(uintptr_t)ut_params->cop,
-- 
2.7.4

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

* [dpdk-dev] [PATCH v2] app/test/ipsec: fix logic around dequeue burst
  2019-04-12 14:08 ` [dpdk-dev] [PATCH v2] " Bernard Iremonger
@ 2019-04-12 14:08   ` Bernard Iremonger
  0 siblings, 0 replies; 10+ messages in thread
From: Bernard Iremonger @ 2019-04-12 14:08 UTC (permalink / raw)
  To: dev, konstantin.ananyev, akhil.goyal; +Cc: Bernard Iremonger, stable

Added crypto_dequeue_burst() function to call
rte_crypto_dequeue_burst() in a loop with a
delay to ensure that all the  packets are
dequeued from the crtpto device.

Fixes: 59d7353b0df0 ("test/ipsec: fix test suite setup")
Cc: stable@dpdk.org
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
Changes in v2:
Added crypto_dequeue_burst() function

 app/test/test_ipsec.c | 46 +++++++++++++++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 17 deletions(-)

diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c
index 80a2d25..d79fe11 100644
--- a/app/test/test_ipsec.c
+++ b/app/test/test_ipsec.c
@@ -9,7 +9,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_pause.h>
+#include <rte_cycles.h>
 #include <rte_bus_vdev.h>
 #include <rte_ip.h>
 
@@ -42,6 +42,7 @@
 #define OUTBOUND_SPI	17
 #define BURST_SIZE		32
 #define REORDER_PKTS	1
+#define DEQUEUE_COUNT	1000
 
 struct user_params {
 	enum rte_crypto_sym_xform_type auth;
@@ -753,6 +754,29 @@ create_sa(enum rte_security_session_action_type action_type,
 }
 
 static int
+crypto_dequeue_burst(uint16_t num_pkts)
+{
+	struct ipsec_testsuite_params *ts_params = &testsuite_params;
+	struct ipsec_unitest_params *ut_params = &unittest_params;
+	uint32_t pkt_cnt, k;
+	int i;
+
+	for (i = 0, pkt_cnt = 0;
+		i < DEQUEUE_COUNT && pkt_cnt != num_pkts; i++) {
+		k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
+			&ut_params->cop[pkt_cnt], num_pkts - pkt_cnt);
+		pkt_cnt += k;
+		rte_delay_us(1);
+	}
+
+	if (pkt_cnt != num_pkts) {
+		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
+		return TEST_FAILED;
+	}
+	return TEST_SUCCESS;
+}
+
+static int
 crypto_ipsec(uint16_t num_pkts)
 {
 	struct ipsec_testsuite_params *ts_params = &testsuite_params;
@@ -767,6 +791,7 @@ crypto_ipsec(uint16_t num_pkts)
 		RTE_LOG(ERR, USER1, "rte_ipsec_pkt_crypto_prepare fail\n");
 		return TEST_FAILED;
 	}
+
 	k = rte_cryptodev_enqueue_burst(ts_params->valid_dev, 0,
 		ut_params->cop, num_pkts);
 	if (k != num_pkts) {
@@ -774,12 +799,8 @@ crypto_ipsec(uint16_t num_pkts)
 		return TEST_FAILED;
 	}
 
-	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
-		ut_params->cop, num_pkts);
-	if (k != num_pkts) {
-		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
+	if (crypto_dequeue_burst(num_pkts) == TEST_FAILED)
 		return TEST_FAILED;
-	}
 
 	ng = rte_ipsec_pkt_crypto_group(
 		(const struct rte_crypto_op **)(uintptr_t)ut_params->cop,
@@ -868,7 +889,6 @@ crypto_ipsec_2sa(void)
 	struct ipsec_testsuite_params *ts_params = &testsuite_params;
 	struct ipsec_unitest_params *ut_params = &unittest_params;
 	struct rte_ipsec_group grp[BURST_SIZE];
-
 	uint32_t k, ng, i, r;
 
 	for (i = 0; i < BURST_SIZE; i++) {
@@ -890,12 +910,8 @@ crypto_ipsec_2sa(void)
 		}
 	}
 
-	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
-		ut_params->cop, BURST_SIZE);
-	if (k != BURST_SIZE) {
-		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
+	if (crypto_dequeue_burst(BURST_SIZE) == TEST_FAILED)
 		return TEST_FAILED;
-	}
 
 	ng = rte_ipsec_pkt_crypto_group(
 		(const struct rte_crypto_op **)(uintptr_t)ut_params->cop,
@@ -1029,12 +1045,8 @@ crypto_ipsec_2sa_4grp(void)
 		}
 	}
 
-	k = rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0,
-		ut_params->cop, BURST_SIZE);
-	if (k != BURST_SIZE) {
-		RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n");
+	if (crypto_dequeue_burst(BURST_SIZE) == TEST_FAILED)
 		return TEST_FAILED;
-	}
 
 	ng = rte_ipsec_pkt_crypto_group(
 		(const struct rte_crypto_op **)(uintptr_t)ut_params->cop,
-- 
2.7.4


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

end of thread, other threads:[~2019-04-12 14:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-11 13:08 [dpdk-dev] [PATCH] app/test/ipsec: fix logic around dequeue burst Bernard Iremonger
2019-04-11 13:08 ` Bernard Iremonger
2019-04-11 17:14 ` Trahe, Fiona
2019-04-11 17:14   ` Trahe, Fiona
2019-04-12 10:31 ` Ananyev, Konstantin
2019-04-12 10:31   ` Ananyev, Konstantin
2019-04-12 11:24   ` Iremonger, Bernard
2019-04-12 11:24     ` Iremonger, Bernard
2019-04-12 14:08 ` [dpdk-dev] [PATCH v2] " Bernard Iremonger
2019-04-12 14:08   ` Bernard Iremonger

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