From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id B8F785B2E; Fri, 12 Apr 2019 12:31:18 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Apr 2019 03:31:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,340,1549958400"; d="scan'208";a="290972426" Received: from irsmsx109.ger.corp.intel.com ([163.33.3.23]) by orsmga004.jf.intel.com with ESMTP; 12 Apr 2019 03:31:16 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.31]) by IRSMSX109.ger.corp.intel.com ([169.254.13.189]) with mapi id 14.03.0415.000; Fri, 12 Apr 2019 11:31:15 +0100 From: "Ananyev, Konstantin" To: "Iremonger, Bernard" , "dev@dpdk.org" , "akhil.goyal@nxp.com" CC: "stable@dpdk.org" Thread-Topic: [PATCH] app/test/ipsec: fix logic around dequeue burst Thread-Index: AQHU8GenGb4cjnzX2ECBuxrRgAr+XaY4VDSw Date: Fri, 12 Apr 2019 10:31:15 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772580148A969D8@irsmsx105.ger.corp.intel.com> References: <1554988097-18819-1-git-send-email-bernard.iremonger@intel.com> In-Reply-To: <1554988097-18819-1-git-send-email-bernard.iremonger@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzU3YmRkNjAtOGM1Mi00MjE5LWE2NjEtZjQ4ODUxMjg2NzBjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiVVRYTWdLWnNIRGhtZGg4bVNTdFpWd3VHQTZ2NWw2aTdOU01JQTkyMjZZaE5HaktCWm9RN3hueVk5WnhDTVZPNiJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] app/test/ipsec: fix logic around dequeue burst 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: Fri, 12 Apr 2019 10:31:20 -0000 Hi Bernard, /ipsec: fix logic around dequeue burst >=20 > Call rte_crypto_dequeue_burst() in a loop with > a delay to ensure that all the packets are dequeued > from the crtpto device. >=20 > Fixes: 59d7353b0df0 ("test/ipsec: fix test suite setup") > Cc: stable@dpdk.org > Signed-off-by: Bernard Iremonger > --- > app/test/test_ipsec.c | 42 +++++++++++++++++++++++++++++++----------- > 1 file changed, 31 insertions(+), 11 deletions(-) >=20 > 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 > #include > #include > -#include > +#include > #include > #include >=20 > @@ -42,6 +42,7 @@ > #define OUTBOUND_SPI 17 > #define BURST_SIZE 32 > #define REORDER_PKTS 1 > +#define DEQUEUE_COUNT 1000 >=20 > 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 =3D &testsuite_params; > struct ipsec_unitest_params *ut_params =3D &unittest_params; > uint32_t k, ng; > + uint32_t pkt_cnt; > struct rte_ipsec_group grp[1]; > + int i; >=20 > /* call crypto prepare */ > k =3D 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; > } >=20 > - k =3D rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0, > - ut_params->cop, num_pkts); > - if (k !=3D num_pkts) { > + for (i =3D 0, pkt_cnt =3D 0; > + i < DEQUEUE_COUNT && pkt_cnt !=3D num_pkts; i++) { > + k =3D rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0, > + &ut_params->cop[pkt_cnt], num_pkts - pkt_cnt); > + pkt_cnt +=3D 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 > + > + if (pkt_cnt !=3D 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 =3D &testsuite_params; > struct ipsec_unitest_params *ut_params =3D &unittest_params; > struct rte_ipsec_group grp[BURST_SIZE]; > - > + uint32_t pkt_cnt; > uint32_t k, ng, i, r; >=20 > for (i =3D 0; i < BURST_SIZE; i++) { > @@ -890,9 +899,14 @@ crypto_ipsec_2sa(void) > } > } >=20 > - k =3D rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0, > - ut_params->cop, BURST_SIZE); > - if (k !=3D BURST_SIZE) { > + for (i =3D 0, k =3D 0, pkt_cnt =3D 0; > + i < DEQUEUE_COUNT && pkt_cnt !=3D BURST_SIZE; i++) { > + k =3D rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0, > + &ut_params->cop[pkt_cnt], BURST_SIZE - pkt_cnt); > + pkt_cnt +=3D k; > + rte_delay_us(1); > + } > + if (pkt_cnt !=3D 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 =3D &unittest_params; > struct rte_ipsec_group grp[BURST_SIZE]; > uint32_t k, ng, i, j; > + uint32_t pkt_cnt; > uint32_t rc =3D 0; >=20 > for (i =3D 0; i < BURST_SIZE; i++) { > @@ -1029,9 +1044,14 @@ crypto_ipsec_2sa_4grp(void) > } > } >=20 > - k =3D rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0, > - ut_params->cop, BURST_SIZE); > - if (k !=3D BURST_SIZE) { > + for (i =3D 0, k =3D 0, pkt_cnt =3D 0; > + i < DEQUEUE_COUNT && pkt_cnt !=3D BURST_SIZE; i++) { > + k =3D rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0, > + &ut_params->cop[pkt_cnt], BURST_SIZE - pkt_cnt); > + pkt_cnt +=3D k; > + rte_delay_us(1); > + } > + if (pkt_cnt !=3D BURST_SIZE) { > RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n"); > return TEST_FAILED; > } > -- > 2.7.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 8DBFEA0096 for ; Fri, 12 Apr 2019 12:31:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0CCDA5B3E; Fri, 12 Apr 2019 12:31:22 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id B8F785B2E; Fri, 12 Apr 2019 12:31:18 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Apr 2019 03:31:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,340,1549958400"; d="scan'208";a="290972426" Received: from irsmsx109.ger.corp.intel.com ([163.33.3.23]) by orsmga004.jf.intel.com with ESMTP; 12 Apr 2019 03:31:16 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.31]) by IRSMSX109.ger.corp.intel.com ([169.254.13.189]) with mapi id 14.03.0415.000; Fri, 12 Apr 2019 11:31:15 +0100 From: "Ananyev, Konstantin" To: "Iremonger, Bernard" , "dev@dpdk.org" , "akhil.goyal@nxp.com" CC: "stable@dpdk.org" Thread-Topic: [PATCH] app/test/ipsec: fix logic around dequeue burst Thread-Index: AQHU8GenGb4cjnzX2ECBuxrRgAr+XaY4VDSw Date: Fri, 12 Apr 2019 10:31:15 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772580148A969D8@irsmsx105.ger.corp.intel.com> References: <1554988097-18819-1-git-send-email-bernard.iremonger@intel.com> In-Reply-To: <1554988097-18819-1-git-send-email-bernard.iremonger@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzU3YmRkNjAtOGM1Mi00MjE5LWE2NjEtZjQ4ODUxMjg2NzBjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiVVRYTWdLWnNIRGhtZGg4bVNTdFpWd3VHQTZ2NWw2aTdOU01JQTkyMjZZaE5HaktCWm9RN3hueVk5WnhDTVZPNiJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] app/test/ipsec: fix logic around dequeue burst 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190412103115.VAKVtBF86x-4DEHPymHYGAaLq3ZvLqZCz41OPPlRvew@z> Hi Bernard, /ipsec: fix logic around dequeue burst >=20 > Call rte_crypto_dequeue_burst() in a loop with > a delay to ensure that all the packets are dequeued > from the crtpto device. >=20 > Fixes: 59d7353b0df0 ("test/ipsec: fix test suite setup") > Cc: stable@dpdk.org > Signed-off-by: Bernard Iremonger > --- > app/test/test_ipsec.c | 42 +++++++++++++++++++++++++++++++----------- > 1 file changed, 31 insertions(+), 11 deletions(-) >=20 > 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 > #include > #include > -#include > +#include > #include > #include >=20 > @@ -42,6 +42,7 @@ > #define OUTBOUND_SPI 17 > #define BURST_SIZE 32 > #define REORDER_PKTS 1 > +#define DEQUEUE_COUNT 1000 >=20 > 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 =3D &testsuite_params; > struct ipsec_unitest_params *ut_params =3D &unittest_params; > uint32_t k, ng; > + uint32_t pkt_cnt; > struct rte_ipsec_group grp[1]; > + int i; >=20 > /* call crypto prepare */ > k =3D 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; > } >=20 > - k =3D rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0, > - ut_params->cop, num_pkts); > - if (k !=3D num_pkts) { > + for (i =3D 0, pkt_cnt =3D 0; > + i < DEQUEUE_COUNT && pkt_cnt !=3D num_pkts; i++) { > + k =3D rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0, > + &ut_params->cop[pkt_cnt], num_pkts - pkt_cnt); > + pkt_cnt +=3D 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 > + > + if (pkt_cnt !=3D 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 =3D &testsuite_params; > struct ipsec_unitest_params *ut_params =3D &unittest_params; > struct rte_ipsec_group grp[BURST_SIZE]; > - > + uint32_t pkt_cnt; > uint32_t k, ng, i, r; >=20 > for (i =3D 0; i < BURST_SIZE; i++) { > @@ -890,9 +899,14 @@ crypto_ipsec_2sa(void) > } > } >=20 > - k =3D rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0, > - ut_params->cop, BURST_SIZE); > - if (k !=3D BURST_SIZE) { > + for (i =3D 0, k =3D 0, pkt_cnt =3D 0; > + i < DEQUEUE_COUNT && pkt_cnt !=3D BURST_SIZE; i++) { > + k =3D rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0, > + &ut_params->cop[pkt_cnt], BURST_SIZE - pkt_cnt); > + pkt_cnt +=3D k; > + rte_delay_us(1); > + } > + if (pkt_cnt !=3D 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 =3D &unittest_params; > struct rte_ipsec_group grp[BURST_SIZE]; > uint32_t k, ng, i, j; > + uint32_t pkt_cnt; > uint32_t rc =3D 0; >=20 > for (i =3D 0; i < BURST_SIZE; i++) { > @@ -1029,9 +1044,14 @@ crypto_ipsec_2sa_4grp(void) > } > } >=20 > - k =3D rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0, > - ut_params->cop, BURST_SIZE); > - if (k !=3D BURST_SIZE) { > + for (i =3D 0, k =3D 0, pkt_cnt =3D 0; > + i < DEQUEUE_COUNT && pkt_cnt !=3D BURST_SIZE; i++) { > + k =3D rte_cryptodev_dequeue_burst(ts_params->valid_dev, 0, > + &ut_params->cop[pkt_cnt], BURST_SIZE - pkt_cnt); > + pkt_cnt +=3D k; > + rte_delay_us(1); > + } > + if (pkt_cnt !=3D BURST_SIZE) { > RTE_LOG(ERR, USER1, "rte_cryptodev_dequeue_burst fail\n"); > return TEST_FAILED; > } > -- > 2.7.4