DPDK patches and discussions
 help / color / mirror / Atom feed
From: <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>, <bruce.richardson@intel.com>,
	<akhil.goyal@nxp.com>,
	 Marko Kovacevic <marko.kovacevic@intel.com>,
	Ori Kam <orika@mellanox.com>,
	Radu Nicolau <radu.nicolau@intel.com>,
	Tomasz Kantecki <tomasz.kantecki@intel.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	"Pavan Nikhilesh" <pbhagavatula@marvell.com>
Cc: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH v4 03/10] examples/l2fwd-event: add infra to split eventdev framework
Date: Tue, 24 Sep 2019 15:12:02 +0530	[thread overview]
Message-ID: <20190924094209.3827-4-pbhagavatula@marvell.com> (raw)
In-Reply-To: <20190924094209.3827-1-pbhagavatula@marvell.com>

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Add infra to split eventdev framework based on event Tx adapter
capability.
If event Tx adapter has internal port capability then we use
`rte_event_eth_tx_adapter_enqueue` to transmitting packets else
we use a SINGLE_LINK event queue to enqueue packets to a service
core which is responsible for transmitting packets.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 examples/l2fwd-event/Makefile                 |  2 ++
 examples/l2fwd-event/l2fwd_eventdev.c         | 29 +++++++++++++++++++
 examples/l2fwd-event/l2fwd_eventdev.h         | 20 +++++++++++++
 examples/l2fwd-event/l2fwd_eventdev_generic.c | 24 +++++++++++++++
 .../l2fwd_eventdev_internal_port.c            | 24 +++++++++++++++
 examples/l2fwd-event/meson.build              |  4 ++-
 6 files changed, 102 insertions(+), 1 deletion(-)
 create mode 100644 examples/l2fwd-event/l2fwd_eventdev_generic.c
 create mode 100644 examples/l2fwd-event/l2fwd_eventdev_internal_port.c

diff --git a/examples/l2fwd-event/Makefile b/examples/l2fwd-event/Makefile
index bfe0058a2..c1f700a65 100644
--- a/examples/l2fwd-event/Makefile
+++ b/examples/l2fwd-event/Makefile
@@ -8,6 +8,8 @@ APP = l2fwd-event
 # all source are stored in SRCS-y
 SRCS-y := main.c
 SRCS-y += l2fwd_eventdev.c
+SRCS-y += l2fwd_eventdev_internal_port.c
+SRCS-y += l2fwd_eventdev_generic.c
 
 # Build using pkg-config variables if possible
 ifeq ($(shell pkg-config --exists libdpdk && echo 0),0)
diff --git a/examples/l2fwd-event/l2fwd_eventdev.c b/examples/l2fwd-event/l2fwd_eventdev.c
index 19efb6d1e..df76f1c1f 100644
--- a/examples/l2fwd-event/l2fwd_eventdev.c
+++ b/examples/l2fwd-event/l2fwd_eventdev.c
@@ -76,6 +76,31 @@ parse_eventdev_args(char **argv, int argc)
 	return 0;
 }
 
+static void
+eventdev_capability_setup(void)
+{
+	struct eventdev_resources *eventdev_rsrc = get_eventdev_rsrc();
+	uint32_t caps = 0;
+	uint16_t i;
+	int ret;
+
+	RTE_ETH_FOREACH_DEV(i) {
+		ret = rte_event_eth_tx_adapter_caps_get(0, i, &caps);
+		if (ret)
+			rte_exit(EXIT_FAILURE,
+				 "Invalid capability for Tx adptr port %d\n",
+				 i);
+
+		eventdev_rsrc->tx_mode_q |= !(caps &
+				   RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT);
+	}
+
+	if (eventdev_rsrc->tx_mode_q)
+		eventdev_set_generic_ops(&eventdev_rsrc->ops);
+	else
+		eventdev_set_internal_port_ops(&eventdev_rsrc->ops);
+}
+
 void
 eventdev_resource_setup(void)
 {
@@ -90,6 +115,10 @@ eventdev_resource_setup(void)
 
 	if (!rte_event_dev_count())
 		rte_exit(EXIT_FAILURE, "No Eventdev found");
+
+	/* Setup eventdev capability callbacks */
+	eventdev_capability_setup();
+
 	/* Start event device service */
 	ret = rte_event_dev_service_id_get(eventdev_rsrc->event_d_id,
 			&service_id);
diff --git a/examples/l2fwd-event/l2fwd_eventdev.h b/examples/l2fwd-event/l2fwd_eventdev.h
index 2e8d95e67..8b6606b4c 100644
--- a/examples/l2fwd-event/l2fwd_eventdev.h
+++ b/examples/l2fwd-event/l2fwd_eventdev.h
@@ -18,8 +18,26 @@ enum {
 	CMD_LINE_OPT_EVENTQ_SYNC_NUM,
 };
 
+typedef void (*event_queue_setup_cb)(uint16_t ethdev_count,
+				     uint32_t event_queue_cfg);
+typedef uint32_t (*eventdev_setup_cb)(uint16_t ethdev_count);
+typedef void (*adapter_setup_cb)(uint16_t ethdev_count);
+typedef void (*event_port_setup_cb)(void);
+typedef void (*service_setup_cb)(void);
+typedef void (*event_loop_cb)(void);
+
+struct eventdev_setup_ops {
+	event_queue_setup_cb event_queue_setup;
+	event_port_setup_cb event_port_setup;
+	eventdev_setup_cb eventdev_setup;
+	adapter_setup_cb adapter_setup;
+	service_setup_cb service_setup;
+	event_loop_cb l2fwd_event_loop;
+};
+
 struct eventdev_resources {
 	struct l2fwd_port_statistics *stats;
+	struct eventdev_setup_ops ops;
 	struct rte_mempool *pkt_pool;
 	uint64_t timer_period;
 	uint32_t *dst_ports;
@@ -58,5 +76,7 @@ get_eventdev_rsrc(void)
 }
 
 void eventdev_resource_setup(void);
+void eventdev_set_generic_ops(struct eventdev_setup_ops *ops);
+void eventdev_set_internal_port_ops(struct eventdev_setup_ops *ops);
 
 #endif /* __L2FWD_EVENTDEV_H__ */
diff --git a/examples/l2fwd-event/l2fwd_eventdev_generic.c b/examples/l2fwd-event/l2fwd_eventdev_generic.c
new file mode 100644
index 000000000..e3990f8b0
--- /dev/null
+++ b/examples/l2fwd-event/l2fwd_eventdev_generic.c
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#include <stdbool.h>
+#include <getopt.h>
+
+#include <rte_cycles.h>
+#include <rte_ethdev.h>
+#include <rte_eventdev.h>
+#include <rte_event_eth_rx_adapter.h>
+#include <rte_event_eth_tx_adapter.h>
+#include <rte_lcore.h>
+#include <rte_log.h>
+#include <rte_spinlock.h>
+
+#include "l2fwd_common.h"
+#include "l2fwd_eventdev.h"
+
+void
+eventdev_set_generic_ops(struct eventdev_setup_ops *ops)
+{
+	RTE_SET_USED(ops);
+}
diff --git a/examples/l2fwd-event/l2fwd_eventdev_internal_port.c b/examples/l2fwd-event/l2fwd_eventdev_internal_port.c
new file mode 100644
index 000000000..a0d2111f9
--- /dev/null
+++ b/examples/l2fwd-event/l2fwd_eventdev_internal_port.c
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#include <stdbool.h>
+#include <getopt.h>
+
+#include <rte_cycles.h>
+#include <rte_ethdev.h>
+#include <rte_eventdev.h>
+#include <rte_event_eth_rx_adapter.h>
+#include <rte_event_eth_tx_adapter.h>
+#include <rte_lcore.h>
+#include <rte_log.h>
+#include <rte_spinlock.h>
+
+#include "l2fwd_common.h"
+#include "l2fwd_eventdev.h"
+
+void
+eventdev_set_internal_port_ops(struct eventdev_setup_ops *ops)
+{
+	RTE_SET_USED(ops);
+}
diff --git a/examples/l2fwd-event/meson.build b/examples/l2fwd-event/meson.build
index b1ad48cc5..38560840c 100644
--- a/examples/l2fwd-event/meson.build
+++ b/examples/l2fwd-event/meson.build
@@ -9,5 +9,7 @@
 
 sources = files(
 	'main.c',
-	'l2fwd_eventdev.c'
+	'l2fwd_eventdev.c',
+	'l2fwd_eventdev_internal_port.c',
+	'l2fwd_eventdev_generic.c'
 )
-- 
2.17.1


  parent reply	other threads:[~2019-09-24  9:42 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-19  9:25 [dpdk-dev] [PATCH v2 00/10] example/l2fwd-event: introduce l2fwd-event example pbhagavatula
2019-09-19  9:25 ` [dpdk-dev] [PATCH v2 01/10] examples/l2fwd-event: add default poll mode routines pbhagavatula
2019-09-19  9:43   ` Sunil Kumar Kori
2019-09-19 10:13   ` [dpdk-dev] [PATCH v3 00/10] example/l2fwd-event: introduce l2fwd-event example pbhagavatula
2019-09-19 10:13     ` [dpdk-dev] [PATCH v3 01/10] examples/l2fwd-event: add default poll mode routines pbhagavatula
2019-09-19 10:13     ` [dpdk-dev] [PATCH v3 02/10] examples/l2fwd-event: add infra for eventdev pbhagavatula
2019-09-19 10:13     ` [dpdk-dev] [PATCH v3 03/10] examples/l2fwd-event: add infra to split eventdev framework pbhagavatula
2019-09-19 10:13     ` [dpdk-dev] [PATCH v3 04/10] examples/l2fwd-event: add eth port setup for eventdev pbhagavatula
2019-09-19 10:13     ` [dpdk-dev] [PATCH v3 05/10] examples/l2fwd-event: add eventdev queue and port setup pbhagavatula
2019-09-19 10:35       ` Sunil Kumar Kori
2019-09-19 10:13     ` [dpdk-dev] [PATCH v3 06/10] examples/l2fwd-event: add event Rx/Tx adapter setup pbhagavatula
2019-09-19 10:13     ` [dpdk-dev] [PATCH v3 07/10] examples/l2fwd-event: add service core setup pbhagavatula
2019-09-19 10:13     ` [dpdk-dev] [PATCH v3 08/10] examples/l2fwd-event: add eventdev main loop pbhagavatula
2019-09-19 10:13     ` [dpdk-dev] [PATCH v3 09/10] examples/l2fwd-event: add graceful teardown pbhagavatula
2019-09-19 10:13     ` [dpdk-dev] [PATCH v3 10/10] doc: add application usage guide for l2fwd-event pbhagavatula
2019-09-24  9:41     ` [dpdk-dev] [PATCH v4 00/10] example/l2fwd-event: introduce l2fwd-event example pbhagavatula
2019-09-24  9:42       ` [dpdk-dev] [PATCH v4 01/10] examples/l2fwd-event: add default poll mode routines pbhagavatula
2019-09-26 17:28         ` Jerin Jacob
2019-09-24  9:42       ` [dpdk-dev] [PATCH v4 02/10] examples/l2fwd-event: add infra for eventdev pbhagavatula
2019-09-26 17:33         ` Jerin Jacob
2019-09-27 13:08         ` Nipun Gupta
2019-09-24  9:42       ` pbhagavatula [this message]
2019-09-24  9:42       ` [dpdk-dev] [PATCH v4 04/10] examples/l2fwd-event: add eth port setup " pbhagavatula
2019-09-27 13:15         ` Nipun Gupta
2019-09-27 14:45           ` Pavan Nikhilesh Bhagavatula
2019-09-24  9:42       ` [dpdk-dev] [PATCH v4 05/10] examples/l2fwd-event: add eventdev queue and port setup pbhagavatula
2019-09-27 13:22         ` Nipun Gupta
2019-09-27 14:43           ` Pavan Nikhilesh Bhagavatula
2019-09-24  9:42       ` [dpdk-dev] [PATCH v4 06/10] examples/l2fwd-event: add event Rx/Tx adapter setup pbhagavatula
2019-09-24  9:42       ` [dpdk-dev] [PATCH v4 07/10] examples/l2fwd-event: add service core setup pbhagavatula
2019-09-24  9:42       ` [dpdk-dev] [PATCH v4 08/10] examples/l2fwd-event: add eventdev main loop pbhagavatula
2019-09-27 13:28         ` Nipun Gupta
2019-09-27 14:35           ` Pavan Nikhilesh Bhagavatula
2019-09-30  5:38             ` Nipun Gupta
2019-09-30  6:38               ` Jerin Jacob
2019-09-30  7:46                 ` Nipun Gupta
2019-09-30  8:09                   ` Pavan Nikhilesh Bhagavatula
2019-09-30 17:50                     ` Nipun Gupta
2019-10-01  5:59                       ` Pavan Nikhilesh Bhagavatula
2019-09-24  9:42       ` [dpdk-dev] [PATCH v4 09/10] examples/l2fwd-event: add graceful teardown pbhagavatula
2019-09-24  9:42       ` [dpdk-dev] [PATCH v4 10/10] doc: add application usage guide for l2fwd-event pbhagavatula
2019-09-26 17:42         ` Jerin Jacob
2019-10-02 20:57       ` [dpdk-dev] [PATCH v5 00/10] example/l2fwd-event: introduce l2fwd-event example pbhagavatula
2019-10-02 20:57         ` [dpdk-dev] [PATCH v5 01/10] examples/l2fwd-event: add default poll mode routines pbhagavatula
2019-10-11 14:41           ` Jerin Jacob
2019-10-02 20:57         ` [dpdk-dev] [PATCH v5 02/10] examples/l2fwd-event: add infra for eventdev pbhagavatula
2019-10-04 12:30           ` Nipun Gupta
2019-10-02 20:57         ` [dpdk-dev] [PATCH v5 03/10] examples/l2fwd-event: add infra to split eventdev framework pbhagavatula
2019-10-02 20:57         ` [dpdk-dev] [PATCH v5 04/10] examples/l2fwd-event: add event device setup pbhagavatula
2019-10-02 20:57         ` [dpdk-dev] [PATCH v5 05/10] examples/l2fwd-event: add eventdev queue and port setup pbhagavatula
2019-10-02 20:57         ` [dpdk-dev] [PATCH v5 06/10] examples/l2fwd-event: add event Rx/Tx adapter setup pbhagavatula
2019-10-02 20:57         ` [dpdk-dev] [PATCH v5 07/10] examples/l2fwd-event: add service core setup pbhagavatula
2019-10-02 20:57         ` [dpdk-dev] [PATCH v5 08/10] examples/l2fwd-event: add eventdev main loop pbhagavatula
2019-10-11 14:52           ` Jerin Jacob
2019-10-02 20:57         ` [dpdk-dev] [PATCH v5 09/10] examples/l2fwd-event: add graceful teardown pbhagavatula
2019-10-02 20:57         ` [dpdk-dev] [PATCH v5 10/10] doc: add application usage guide for l2fwd-event pbhagavatula
2019-10-11 14:11           ` Jerin Jacob
2019-10-03 10:33         ` [dpdk-dev] [PATCH v5 00/10] example/l2fwd-event: introduce l2fwd-event example Jerin Jacob
2019-10-03 12:40           ` Hemant Agrawal
2019-10-03 12:47             ` Jerin Jacob
2019-10-09  7:50         ` Nipun Gupta
2019-10-14 18:22         ` [dpdk-dev] [PATCH v6 " pbhagavatula
2019-10-14 18:22           ` [dpdk-dev] [PATCH v6 01/10] examples/l2fwd-event: add default poll mode routines pbhagavatula
2019-10-16 19:07             ` Stephen Hemminger
2019-10-21  3:29             ` Varghese, Vipin
2019-10-14 18:22           ` [dpdk-dev] [PATCH v6 02/10] examples/l2fwd-event: add infra for eventdev pbhagavatula
2019-10-14 18:22           ` [dpdk-dev] [PATCH v6 03/10] examples/l2fwd-event: add infra to split eventdev framework pbhagavatula
2019-10-14 18:22           ` [dpdk-dev] [PATCH v6 04/10] examples/l2fwd-event: add event device setup pbhagavatula
2019-10-14 18:22           ` [dpdk-dev] [PATCH v6 05/10] examples/l2fwd-event: add eventdev queue and port setup pbhagavatula
2019-10-14 18:22           ` [dpdk-dev] [PATCH v6 06/10] examples/l2fwd-event: add event Rx/Tx adapter setup pbhagavatula
2019-10-14 18:22           ` [dpdk-dev] [PATCH v6 07/10] examples/l2fwd-event: add service core setup pbhagavatula
2019-10-14 18:22           ` [dpdk-dev] [PATCH v6 08/10] examples/l2fwd-event: add eventdev main loop pbhagavatula
2019-10-21  3:19             ` Varghese, Vipin
2019-10-21 16:53               ` Pavan Nikhilesh Bhagavatula
2019-10-22  3:13                 ` Varghese, Vipin
2019-10-22 17:02                   ` Pavan Nikhilesh Bhagavatula
2019-10-14 18:22           ` [dpdk-dev] [PATCH v6 09/10] examples/l2fwd-event: add graceful teardown pbhagavatula
2019-10-21  3:12             ` Varghese, Vipin
2019-10-21 16:56               ` Pavan Nikhilesh Bhagavatula
2019-10-22  2:48                 ` Varghese, Vipin
2019-10-14 18:22           ` [dpdk-dev] [PATCH v6 10/10] doc: add application usage guide for l2fwd-event pbhagavatula
2019-10-16 12:38           ` [dpdk-dev] [PATCH v6 00/10] example/l2fwd-event: introduce l2fwd-event example Jerin Jacob
2019-10-21  3:25           ` Varghese, Vipin
2019-10-21 17:02             ` Pavan Nikhilesh Bhagavatula
2019-10-22  2:57               ` Varghese, Vipin
2019-10-22 15:55                 ` Pavan Nikhilesh Bhagavatula
2019-10-26 11:10           ` [dpdk-dev] [PATCH v7 " pbhagavatula
2019-10-26 11:10             ` [dpdk-dev] [PATCH v7 01/10] examples/l2fwd-event: add default poll mode routines pbhagavatula
2019-10-26 11:10             ` [dpdk-dev] [PATCH v7 02/10] examples/l2fwd-event: add infra for eventdev pbhagavatula
2019-10-26 11:10             ` [dpdk-dev] [PATCH v7 03/10] examples/l2fwd-event: add infra to split eventdev framework pbhagavatula
2019-10-26 11:10             ` [dpdk-dev] [PATCH v7 04/10] examples/l2fwd-event: add event device setup pbhagavatula
2019-10-26 11:10             ` [dpdk-dev] [PATCH v7 05/10] examples/l2fwd-event: add eventdev queue and port setup pbhagavatula
2019-10-26 11:10             ` [dpdk-dev] [PATCH v7 06/10] examples/l2fwd-event: add event Rx/Tx adapter setup pbhagavatula
2019-10-26 11:10             ` [dpdk-dev] [PATCH v7 07/10] examples/l2fwd-event: add service core setup pbhagavatula
2019-10-26 11:10             ` [dpdk-dev] [PATCH v7 08/10] examples/l2fwd-event: add eventdev main loop pbhagavatula
2019-10-26 11:10             ` [dpdk-dev] [PATCH v7 09/10] examples/l2fwd-event: add graceful teardown pbhagavatula
2019-10-26 11:10             ` [dpdk-dev] [PATCH v7 10/10] doc: add application usage guide for l2fwd-event pbhagavatula
2019-10-30 13:19               ` Jerin Jacob
2019-10-30 12:58             ` [dpdk-dev] [PATCH v7 00/10] example/l2fwd-event: introduce l2fwd-event example Jerin Jacob
2019-09-19  9:25 ` [dpdk-dev] [PATCH v2 02/10] examples/l2fwd-event: add infra for eventdev pbhagavatula
2019-09-19  9:25 ` [dpdk-dev] [PATCH v2 03/10] examples/l2fwd-event: add infra to split eventdev framework pbhagavatula
2019-09-19  9:25 ` [dpdk-dev] [PATCH v2 04/10] examples/l2fwd-event: add eth port setup for eventdev pbhagavatula
2019-09-19  9:25 ` [dpdk-dev] [PATCH v2 05/10] examples/l2fwd-event: add eventdev queue and port setup pbhagavatula
2019-09-19  9:26 ` [dpdk-dev] [PATCH v2 06/10] examples/l2fwd-event: add event Rx/Tx adapter setup pbhagavatula
2019-09-19  9:26 ` [dpdk-dev] [PATCH v2 07/10] examples/l2fwd-event: add service core setup pbhagavatula
2019-09-19  9:26 ` [dpdk-dev] [PATCH v2 08/10] examples/l2fwd-event: add eventdev main loop pbhagavatula
2019-09-19  9:26 ` [dpdk-dev] [PATCH v2 09/10] examples/l2fwd-event: add graceful teardown pbhagavatula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190924094209.3827-4-pbhagavatula@marvell.com \
    --to=pbhagavatula@marvell.com \
    --cc=akhil.goyal@nxp.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=marko.kovacevic@intel.com \
    --cc=orika@mellanox.com \
    --cc=radu.nicolau@intel.com \
    --cc=skori@marvell.com \
    --cc=tomasz.kantecki@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).