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 inbox.dpdk.org (Postfix) with ESMTP id D8B62A0350;
	Wed,  1 Jul 2020 08:07:13 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id A0C511C01F;
	Wed,  1 Jul 2020 08:06:45 +0200 (CEST)
Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21])
 by dpdk.org (Postfix) with ESMTP id 8ADD91BFB4;
 Wed,  1 Jul 2020 08:06:40 +0200 (CEST)
Received: from inva021.nxp.com (localhost [127.0.0.1])
 by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 6D2B0200416;
 Wed,  1 Jul 2020 08:06:40 +0200 (CEST)
Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com
 [165.114.16.14])
 by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id BCDED20041D;
 Wed,  1 Jul 2020 08:06:36 +0200 (CEST)
Received: from lsv03186.swis.in-blr01.nxp.com (lsv03186.swis.in-blr01.nxp.com
 [92.120.146.182])
 by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id BD302402EE;
 Wed,  1 Jul 2020 14:06:32 +0800 (SGT)
From: Apeksha Gupta <apeksha.gupta@nxp.com>
To: jerin.jacob@caviumnetworks.com
Cc: dev@dpdk.org, thomas@monjalon.net, hemant.agrawal@nxp.com,
 nipun.gupta@nxp.com, akhil.goyal@nxp.com,
 Apeksha Gupta <apeksha.gupta@nxp.com>, stable@dpdk.org
Date: Wed,  1 Jul 2020 11:36:25 +0530
Message-Id: <20200701060626.28627-5-apeksha.gupta@nxp.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200701060626.28627-1-apeksha.gupta@nxp.com>
References: <20200701060626.28627-1-apeksha.gupta@nxp.com>
X-Virus-Scanned: ClamAV using ClamSMTP
Subject: [dpdk-dev] [PATCH 5/6] app/test-eventdev: Enhancing perf-atq packet
	flow
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>

The event ethernet Tx adapter provides data path for the ethernet transmit
stage. Enqueue a burst of events objects supplied on an event device.

Fixes: 1eb10ad8db8 ("app/testeventdev: add perf all types queue worker")
Cc: stable@dpdk.org

Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
---
 app/test-eventdev/test_perf_atq.c    | 43 ++++++++++++++++++++--------
 app/test-eventdev/test_perf_common.h |  4 +++
 2 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/app/test-eventdev/test_perf_atq.c b/app/test-eventdev/test_perf_atq.c
index d0241ec4ae..23e9ad4a29 100644
--- a/app/test-eventdev/test_perf_atq.c
+++ b/app/test-eventdev/test_perf_atq.c
@@ -70,10 +70,12 @@ perf_atq_worker(void *arg, const int enable_fwd_latency)
 }
 
 static int
-perf_atq_worker_burst(void *arg, const int enable_fwd_latency)
+perf_atq_worker_burst(void *arg, const int enable_fwd_latency,
+					const uint32_t flags)
 {
 	PERF_WORKER_INIT;
 	uint16_t i;
+	uint16_t nb_tx;
 	/* +1 to avoid prefetch out of array check */
 	struct rte_event ev[BURST_SIZE + 1];
 
@@ -110,13 +112,21 @@ perf_atq_worker_burst(void *arg, const int enable_fwd_latency)
 						nb_stages);
 			}
 		}
+		if (flags == TEST_PERF_EVENT_TX_DIRECT) {
+			nb_tx = rte_event_eth_tx_adapter_enqueue(dev, port,
+						ev, nb_rx, 0);
+			while (nb_tx < nb_rx && !t->done)
+				nb_tx += rte_event_eth_tx_adapter_enqueue(dev,
+						port, ev + nb_tx,
+						nb_rx - nb_tx, 0);
+		} else {
+			uint16_t enq;
 
-		uint16_t enq;
-
-		enq = rte_event_enqueue_burst(dev, port, ev, nb_rx);
-		while (enq < nb_rx) {
-			enq += rte_event_enqueue_burst(dev, port,
+			enq = rte_event_enqueue_burst(dev, port, ev, nb_rx);
+			while (enq < nb_rx) {
+				enq += rte_event_enqueue_burst(dev, port,
 							ev + enq, nb_rx - enq);
+			}
 		}
 	}
 	return 0;
@@ -127,20 +137,29 @@ worker_wrapper(void *arg)
 {
 	struct worker_data *w  = arg;
 	struct evt_options *opt = w->t->opt;
-
+	const bool internal_port = w->t->internal_port;
 	const bool burst = evt_has_burst_mode(w->dev_id);
 	const int fwd_latency = opt->fwd_latency;
+	uint32_t flags;
 
 	/* allow compiler to optimize */
 	if (!burst && !fwd_latency)
 		return perf_atq_worker(arg, 0);
 	else if (!burst && fwd_latency)
 		return perf_atq_worker(arg, 1);
-	else if (burst && !fwd_latency)
-		return perf_atq_worker_burst(arg, 0);
-	else if (burst && fwd_latency)
-		return perf_atq_worker_burst(arg, 1);
-
+	else if (burst && !fwd_latency && internal_port) {
+		flags = TEST_PERF_EVENT_TX_DIRECT;
+		return perf_atq_worker_burst(arg, 0, flags);
+	} else if (burst && !fwd_latency && !internal_port) {
+		flags = TEST_PERF_EVENT_TX_ENQ;
+		return perf_atq_worker_burst(arg, 1, flags);
+	} else if (burst && fwd_latency && internal_port) {
+		flags = TEST_PERF_EVENT_TX_DIRECT;
+		return perf_atq_worker_burst(arg, 0, flags);
+	} else if (burst && fwd_latency && !internal_port) {
+		flags = TEST_PERF_EVENT_TX_ENQ;
+		return perf_atq_worker_burst(arg, 1, flags);
+	}
 	rte_panic("invalid worker\n");
 }
 
diff --git a/app/test-eventdev/test_perf_common.h b/app/test-eventdev/test_perf_common.h
index 716199d8c9..c86be385ad 100644
--- a/app/test-eventdev/test_perf_common.h
+++ b/app/test-eventdev/test_perf_common.h
@@ -13,6 +13,7 @@
 #include <rte_ethdev.h>
 #include <rte_eventdev.h>
 #include <rte_event_eth_rx_adapter.h>
+#include <rte_event_eth_tx_adapter.h>
 #include <rte_event_timer_adapter.h>
 #include <rte_lcore.h>
 #include <rte_malloc.h>
@@ -23,6 +24,9 @@
 #include "evt_options.h"
 #include "evt_test.h"
 
+#define TEST_PERF_EVENT_TX_ENQ		0x1
+#define TEST_PERF_EVENT_TX_DIRECT	0X2
+
 struct test_perf;
 
 struct worker_data {
-- 
2.17.1