From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <akhil.goyal@nxp.com>
Received: from EUR01-HE1-obe.outbound.protection.outlook.com
 (mail-eopbgr130042.outbound.protection.outlook.com [40.107.13.42])
 by dpdk.org (Postfix) with ESMTP id 6B3161B1E3
 for <dev@dpdk.org>; Wed, 27 Mar 2019 12:47:45 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; 
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=4VAor6Nght8O9zdKApP8JLh1NROXakeDIVBNj7ne1EA=;
 b=jiBLhCdlOUZcAkwYHTJJ/K1lPUGdFIKTG9F0Y9XmSEZAbKhU6kaLiBpwnOwIkaAn/454kk84k2nUcwqTqoerV85zzlUQJo1b1aKsC0+SN4xb6vKxPyne7vWK0nJd6XfgfYJhvxkXujEXXjxeBCwtDxMZoAsGrVuFXXBrWF+PN6o=
Received: from VI1PR04MB4893.eurprd04.prod.outlook.com (20.177.49.154) by
 VI1PR04MB3072.eurprd04.prod.outlook.com (10.170.228.158) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.1730.19; Wed, 27 Mar 2019 11:47:44 +0000
Received: from VI1PR04MB4893.eurprd04.prod.outlook.com
 ([fe80::d81a:c2cb:6bce:30bb]) by VI1PR04MB4893.eurprd04.prod.outlook.com
 ([fe80::d81a:c2cb:6bce:30bb%4]) with mapi id 15.20.1750.014; Wed, 27 Mar 2019
 11:47:44 +0000
From: Akhil Goyal <akhil.goyal@nxp.com>
To: "dev@dpdk.org" <dev@dpdk.org>
CC: "declan.doherty@intel.com" <declan.doherty@intel.com>, Akhil Goyal
 <akhil.goyal@nxp.com>
Thread-Topic: [PATCH] app/test-crypto-perf: improve dequeue logic
Thread-Index: AQHU5JLk4oLoEw6av0KMpJVh9+yHtQ==
Date: Wed, 27 Mar 2019 11:47:44 +0000
Message-ID: <20190327113823.13481-1-akhil.goyal@nxp.com>
Accept-Language: en-IN, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-clientproxiedby: BM1PR0101CA0029.INDPRD01.PROD.OUTLOOK.COM
 (2603:1096:b00:1a::15) To VI1PR04MB4893.eurprd04.prod.outlook.com
 (2603:10a6:803:56::26)
x-mailer: git-send-email 2.17.1
authentication-results: spf=none (sender IP is )
 smtp.mailfrom=akhil.goyal@nxp.com; 
x-ms-exchange-messagesentrepresentingtype: 1
x-originating-ip: [92.120.1.68]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 1ce519df-e7ec-4f7c-12cd-08d6b2aa0664
x-ms-office365-filtering-ht: Tenant
x-microsoft-antispam: BCL:0; PCL:0;
 RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);
 SRVR:VI1PR04MB3072; 
x-ms-traffictypediagnostic: VI1PR04MB3072:
x-microsoft-antispam-prvs: <VI1PR04MB30721322FA4626961452C1CDE6580@VI1PR04MB3072.eurprd04.prod.outlook.com>
x-forefront-prvs: 0989A7979C
x-forefront-antispam-report: SFV:NSPM;
 SFS:(10009020)(366004)(376002)(396003)(346002)(39860400002)(136003)(189003)(199004)(478600001)(52116002)(186003)(50226002)(1076003)(99286004)(6486002)(2501003)(14454004)(6116002)(3846002)(6916009)(44832011)(6512007)(6436002)(2906002)(7736002)(36756003)(305945005)(102836004)(97736004)(8676002)(26005)(386003)(105586002)(256004)(2351001)(106356001)(71200400001)(25786009)(71190400001)(5660300002)(14444005)(6506007)(86362001)(2616005)(316002)(8936002)(476003)(486006)(5640700003)(66066001)(1730700003)(4326008)(81156014)(53936002)(81166006)(54906003)(68736007);
 DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB3072;
 H:VI1PR04MB4893.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en;
 PTR:InfoNoRecords; MX:1; A:1; 
received-spf: None (protection.outlook.com: nxp.com does not designate
 permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info: 57Fx2LuOPAKsxg/KELOHHfCb2w3qDbNtjjCGPwfOOddRvGD/wAXXhvcJ44YHuoIJGJJK08VmPa2j5yobJzj1UdCTlA6AUS6K2hFi0p5duIAFH1avyL5i7j41UQN76iqcIWTTme4suIsqgFYkwzfwiocoTxcpvGlQZ2CmvUct4qQwQmojgyy9/Em6ah3ljGP1WBxwt+UDLCsyCDqQP/AC13segqJo3pjbqEPT+AdnPZOuFJrWrBfSlxZ8cmByeFpCB/hpXRq4WvKEK47JLdzUIDIxEah0Rh42yLkk/gUM4HMLD1MeoT3n/7l0jflIkzJVZN3Me6w0cWKaXzbNXmWrSbux1neZsH9hTCmrdbXHW170nF11s5R0oqVFrDLCkzre0r7PLj84XNCdAEQUWeUkr4QQ4/f/GxOk3oIOnLwDxw8=
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 1ce519df-e7ec-4f7c-12cd-08d6b2aa0664
X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Mar 2019 11:47:44.3381 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3072
Subject: [dpdk-dev] [PATCH] app/test-crypto-perf: improve dequeue logic
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 27 Mar 2019 11:47:45 -0000

In case of hardware PMDs (which may take a longer duration
for processing the packets), there may be a case when the
number of enqueued packets are more than the dequeued.

So if the difference is more than 8 times the burst size,
more dequeue operations should be performed otherwise all
the buffers will be blocked in hardware.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
---
 app/test-crypto-perf/cperf_test_throughput.c | 40 +++++++++++---------
 1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto=
-perf/cperf_test_throughput.c
index 2767f4ea8..d24a6dda0 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -208,23 +208,29 @@ cperf_throughput_test_runner(void *test_ctx)
=20
=20
 			/* Dequeue processed burst of ops from crypto device */
-			ops_deqd =3D rte_cryptodev_dequeue_burst(ctx->dev_id, ctx->qp_id,
-					ops_processed, test_burst_size);
-
-			if (likely(ops_deqd))  {
-				/* Free crypto ops so they can be reused. */
-				rte_mempool_put_bulk(ctx->pool,
-						(void **)ops_processed, ops_deqd);
-
-				ops_deqd_total +=3D ops_deqd;
-			} else {
-				/**
-				 * Count dequeue polls which didn't return any
-				 * processed operations. This statistic is mainly
-				 * relevant to hw accelerators.
-				 */
-				ops_deqd_failed++;
-			}
+			do {
+				ops_deqd =3D rte_cryptodev_dequeue_burst(
+						ctx->dev_id, ctx->qp_id,
+						ops_processed, test_burst_size);
+
+				if (likely(ops_deqd))  {
+					/* Free crypto ops for reuse */
+					rte_mempool_put_bulk(ctx->pool,
+							(void **)ops_processed,
+							ops_deqd);
+
+					ops_deqd_total +=3D ops_deqd;
+				} else {
+					/**
+					 * Count dequeue polls which didn't
+					 * return any processed operations.
+					 * This statistic is mainly relevant
+					 * to hw accelerators.
+					 */
+					ops_deqd_failed++;
+				}
+			} while (ops_enqd_total - ops_deqd_total >
+					test_burst_size * 8);
=20
 		}
=20
--=20
2.17.1

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id 1723FA05D3
	for <public@inbox.dpdk.org>; Wed, 27 Mar 2019 12:47:47 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id E0CFA1B1E9;
	Wed, 27 Mar 2019 12:47:46 +0100 (CET)
Received: from EUR01-HE1-obe.outbound.protection.outlook.com
 (mail-eopbgr130042.outbound.protection.outlook.com [40.107.13.42])
 by dpdk.org (Postfix) with ESMTP id 6B3161B1E3
 for <dev@dpdk.org>; Wed, 27 Mar 2019 12:47:45 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; 
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=4VAor6Nght8O9zdKApP8JLh1NROXakeDIVBNj7ne1EA=;
 b=jiBLhCdlOUZcAkwYHTJJ/K1lPUGdFIKTG9F0Y9XmSEZAbKhU6kaLiBpwnOwIkaAn/454kk84k2nUcwqTqoerV85zzlUQJo1b1aKsC0+SN4xb6vKxPyne7vWK0nJd6XfgfYJhvxkXujEXXjxeBCwtDxMZoAsGrVuFXXBrWF+PN6o=
Received: from VI1PR04MB4893.eurprd04.prod.outlook.com (20.177.49.154) by
 VI1PR04MB3072.eurprd04.prod.outlook.com (10.170.228.158) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.1730.19; Wed, 27 Mar 2019 11:47:44 +0000
Received: from VI1PR04MB4893.eurprd04.prod.outlook.com
 ([fe80::d81a:c2cb:6bce:30bb]) by VI1PR04MB4893.eurprd04.prod.outlook.com
 ([fe80::d81a:c2cb:6bce:30bb%4]) with mapi id 15.20.1750.014; Wed, 27 Mar 2019
 11:47:44 +0000
From: Akhil Goyal <akhil.goyal@nxp.com>
To: "dev@dpdk.org" <dev@dpdk.org>
CC: "declan.doherty@intel.com" <declan.doherty@intel.com>, Akhil Goyal
 <akhil.goyal@nxp.com>
Thread-Topic: [PATCH] app/test-crypto-perf: improve dequeue logic
Thread-Index: AQHU5JLk4oLoEw6av0KMpJVh9+yHtQ==
Date: Wed, 27 Mar 2019 11:47:44 +0000
Message-ID: <20190327113823.13481-1-akhil.goyal@nxp.com>
Accept-Language: en-IN, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-clientproxiedby: BM1PR0101CA0029.INDPRD01.PROD.OUTLOOK.COM
 (2603:1096:b00:1a::15) To VI1PR04MB4893.eurprd04.prod.outlook.com
 (2603:10a6:803:56::26)
x-mailer: git-send-email 2.17.1
authentication-results: spf=none (sender IP is )
 smtp.mailfrom=akhil.goyal@nxp.com; 
x-ms-exchange-messagesentrepresentingtype: 1
x-originating-ip: [92.120.1.68]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 1ce519df-e7ec-4f7c-12cd-08d6b2aa0664
x-ms-office365-filtering-ht: Tenant
x-microsoft-antispam: BCL:0; PCL:0;
 RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);
 SRVR:VI1PR04MB3072; 
x-ms-traffictypediagnostic: VI1PR04MB3072:
x-microsoft-antispam-prvs: <VI1PR04MB30721322FA4626961452C1CDE6580@VI1PR04MB3072.eurprd04.prod.outlook.com>
x-forefront-prvs: 0989A7979C
x-forefront-antispam-report: SFV:NSPM;
 SFS:(10009020)(366004)(376002)(396003)(346002)(39860400002)(136003)(189003)(199004)(478600001)(52116002)(186003)(50226002)(1076003)(99286004)(6486002)(2501003)(14454004)(6116002)(3846002)(6916009)(44832011)(6512007)(6436002)(2906002)(7736002)(36756003)(305945005)(102836004)(97736004)(8676002)(26005)(386003)(105586002)(256004)(2351001)(106356001)(71200400001)(25786009)(71190400001)(5660300002)(14444005)(6506007)(86362001)(2616005)(316002)(8936002)(476003)(486006)(5640700003)(66066001)(1730700003)(4326008)(81156014)(53936002)(81166006)(54906003)(68736007);
 DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB3072;
 H:VI1PR04MB4893.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en;
 PTR:InfoNoRecords; MX:1; A:1; 
received-spf: None (protection.outlook.com: nxp.com does not designate
 permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info: 57Fx2LuOPAKsxg/KELOHHfCb2w3qDbNtjjCGPwfOOddRvGD/wAXXhvcJ44YHuoIJGJJK08VmPa2j5yobJzj1UdCTlA6AUS6K2hFi0p5duIAFH1avyL5i7j41UQN76iqcIWTTme4suIsqgFYkwzfwiocoTxcpvGlQZ2CmvUct4qQwQmojgyy9/Em6ah3ljGP1WBxwt+UDLCsyCDqQP/AC13segqJo3pjbqEPT+AdnPZOuFJrWrBfSlxZ8cmByeFpCB/hpXRq4WvKEK47JLdzUIDIxEah0Rh42yLkk/gUM4HMLD1MeoT3n/7l0jflIkzJVZN3Me6w0cWKaXzbNXmWrSbux1neZsH9hTCmrdbXHW170nF11s5R0oqVFrDLCkzre0r7PLj84XNCdAEQUWeUkr4QQ4/f/GxOk3oIOnLwDxw8=
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 1ce519df-e7ec-4f7c-12cd-08d6b2aa0664
X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Mar 2019 11:47:44.3381 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3072
Subject: [dpdk-dev] [PATCH] app/test-crypto-perf: improve dequeue logic
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>
Message-ID: <20190327114744.pKwQCJwaksE1Fvr-km6O4dxyswLGO5NcMfnOW3iA3AI@z>

In case of hardware PMDs (which may take a longer duration
for processing the packets), there may be a case when the
number of enqueued packets are more than the dequeued.

So if the difference is more than 8 times the burst size,
more dequeue operations should be performed otherwise all
the buffers will be blocked in hardware.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
---
 app/test-crypto-perf/cperf_test_throughput.c | 40 +++++++++++---------
 1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto=
-perf/cperf_test_throughput.c
index 2767f4ea8..d24a6dda0 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -208,23 +208,29 @@ cperf_throughput_test_runner(void *test_ctx)
=20
=20
 			/* Dequeue processed burst of ops from crypto device */
-			ops_deqd =3D rte_cryptodev_dequeue_burst(ctx->dev_id, ctx->qp_id,
-					ops_processed, test_burst_size);
-
-			if (likely(ops_deqd))  {
-				/* Free crypto ops so they can be reused. */
-				rte_mempool_put_bulk(ctx->pool,
-						(void **)ops_processed, ops_deqd);
-
-				ops_deqd_total +=3D ops_deqd;
-			} else {
-				/**
-				 * Count dequeue polls which didn't return any
-				 * processed operations. This statistic is mainly
-				 * relevant to hw accelerators.
-				 */
-				ops_deqd_failed++;
-			}
+			do {
+				ops_deqd =3D rte_cryptodev_dequeue_burst(
+						ctx->dev_id, ctx->qp_id,
+						ops_processed, test_burst_size);
+
+				if (likely(ops_deqd))  {
+					/* Free crypto ops for reuse */
+					rte_mempool_put_bulk(ctx->pool,
+							(void **)ops_processed,
+							ops_deqd);
+
+					ops_deqd_total +=3D ops_deqd;
+				} else {
+					/**
+					 * Count dequeue polls which didn't
+					 * return any processed operations.
+					 * This statistic is mainly relevant
+					 * to hw accelerators.
+					 */
+					ops_deqd_failed++;
+				}
+			} while (ops_enqd_total - ops_deqd_total >
+					test_burst_size * 8);
=20
 		}
=20
--=20
2.17.1