DPDK patches and discussions
 help / color / mirror / Atom feed
From: <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>, Marko Kovacevic <marko.kovacevic@intel.com>,
	Ori Kam <orika@mellanox.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	"Radu Nicolau" <radu.nicolau@intel.com>,
	Akhil Goyal <akhil.goyal@nxp.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 v8 03/10] examples/l2fwd-event: add infra to split eventdev framework
Date: Wed, 30 Oct 2019 21:56:44 +0530	[thread overview]
Message-ID: <20191030162651.3001-4-pbhagavatula@marvell.com> (raw)
In-Reply-To: <20191030162651.3001-1-pbhagavatula@marvell.com>

From: Sunil Kumar Kori <skori@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_event.c            | 26 +++++++++++++++++++
 examples/l2fwd-event/l2fwd_event.h            |  7 +++++
 examples/l2fwd-event/l2fwd_event_generic.c    | 23 ++++++++++++++++
 .../l2fwd-event/l2fwd_event_internal_port.c   | 23 ++++++++++++++++
 examples/l2fwd-event/meson.build              |  2 ++
 6 files changed, 83 insertions(+)
 create mode 100644 examples/l2fwd-event/l2fwd_event_generic.c
 create mode 100644 examples/l2fwd-event/l2fwd_event_internal_port.c

diff --git a/examples/l2fwd-event/Makefile b/examples/l2fwd-event/Makefile
index 08ba1835d..6f4176882 100644
--- a/examples/l2fwd-event/Makefile
+++ b/examples/l2fwd-event/Makefile
@@ -10,6 +10,8 @@ SRCS-y := main.c
 SRCS-y += l2fwd_poll.c
 SRCS-y += l2fwd_event.c
 SRCS-y += l2fwd_common.c
+SRCS-y += l2fwd_event_generic.c
+SRCS-y += l2fwd_event_internal_port.c
 
 # Build using pkg-config variables if possible
 ifeq ($(shell pkg-config --exists libdpdk && echo 0),0)
diff --git a/examples/l2fwd-event/l2fwd_event.c b/examples/l2fwd-event/l2fwd_event.c
index 48d32d718..7f90e6311 100644
--- a/examples/l2fwd-event/l2fwd_event.c
+++ b/examples/l2fwd-event/l2fwd_event.c
@@ -17,6 +17,29 @@
 
 #include "l2fwd_event.h"
 
+static void
+l2fwd_event_capability_setup(struct l2fwd_event_resources *evt_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_panic("Invalid capability for Tx adptr port %d\n",
+				  i);
+
+		evt_rsrc->tx_mode_q |= !(caps &
+				   RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT);
+	}
+
+	if (evt_rsrc->tx_mode_q)
+		l2fwd_event_set_generic_ops(&evt_rsrc->ops);
+	else
+		l2fwd_event_set_internal_port_ops(&evt_rsrc->ops);
+}
+
 void
 l2fwd_event_resource_setup(struct l2fwd_resources *rsrc)
 {
@@ -31,4 +54,7 @@ l2fwd_event_resource_setup(struct l2fwd_resources *rsrc)
 		rte_panic("Failed to allocate memory\n");
 
 	rsrc->evt_rsrc = evt_rsrc;
+
+	/* Setup eventdev capability callbacks */
+	l2fwd_event_capability_setup(evt_rsrc);
 }
diff --git a/examples/l2fwd-event/l2fwd_event.h b/examples/l2fwd-event/l2fwd_event.h
index 9a1bb1612..b7aaa39f9 100644
--- a/examples/l2fwd-event/l2fwd_event.h
+++ b/examples/l2fwd-event/l2fwd_event.h
@@ -13,9 +13,16 @@
 
 #include "l2fwd_common.h"
 
+struct event_setup_ops {
+};
+
 struct l2fwd_event_resources {
+	uint8_t tx_mode_q;
+	struct event_setup_ops ops;
 };
 
 void l2fwd_event_resource_setup(struct l2fwd_resources *rsrc);
+void l2fwd_event_set_generic_ops(struct event_setup_ops *ops);
+void l2fwd_event_set_internal_port_ops(struct event_setup_ops *ops);
 
 #endif /* __L2FWD_EVENT_H__ */
diff --git a/examples/l2fwd-event/l2fwd_event_generic.c b/examples/l2fwd-event/l2fwd_event_generic.c
new file mode 100644
index 000000000..9afade7d2
--- /dev/null
+++ b/examples/l2fwd-event/l2fwd_event_generic.c
@@ -0,0 +1,23 @@
+/* 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_spinlock.h>
+
+#include "l2fwd_common.h"
+#include "l2fwd_event.h"
+
+void
+l2fwd_event_set_generic_ops(struct event_setup_ops *ops)
+{
+	RTE_SET_USED(ops);
+}
diff --git a/examples/l2fwd-event/l2fwd_event_internal_port.c b/examples/l2fwd-event/l2fwd_event_internal_port.c
new file mode 100644
index 000000000..ce95b8e6d
--- /dev/null
+++ b/examples/l2fwd-event/l2fwd_event_internal_port.c
@@ -0,0 +1,23 @@
+/* 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_spinlock.h>
+
+#include "l2fwd_common.h"
+#include "l2fwd_event.h"
+
+void
+l2fwd_event_set_internal_port_ops(struct event_setup_ops *ops)
+{
+	RTE_SET_USED(ops);
+}
diff --git a/examples/l2fwd-event/meson.build b/examples/l2fwd-event/meson.build
index c1ae2037c..4e9a069d6 100644
--- a/examples/l2fwd-event/meson.build
+++ b/examples/l2fwd-event/meson.build
@@ -13,4 +13,6 @@ sources = files(
 	'l2fwd_poll.c',
 	'l2fwd_common.c',
 	'l2fwd_event.c',
+	'l2fwd_event_internal_port.c',
+	'l2fwd_event_generic.c'
 )
-- 
2.17.1


  parent reply	other threads:[~2019-10-30 16:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-30 16:26 [dpdk-dev] [PATCH v8 00/10] example/l2fwd-event: introduce l2fwd-event example pbhagavatula
2019-10-30 16:26 ` [dpdk-dev] [PATCH v8 01/10] examples/l2fwd-event: add default poll mode routines pbhagavatula
2019-10-30 16:26 ` [dpdk-dev] [PATCH v8 02/10] examples/l2fwd-event: add infra for eventdev pbhagavatula
2019-10-30 16:26 ` pbhagavatula [this message]
2019-10-30 16:26 ` [dpdk-dev] [PATCH v8 04/10] examples/l2fwd-event: add event device setup pbhagavatula
2019-10-30 16:26 ` [dpdk-dev] [PATCH v8 05/10] examples/l2fwd-event: add eventdev queue and port setup pbhagavatula
2019-10-30 16:26 ` [dpdk-dev] [PATCH v8 06/10] examples/l2fwd-event: add event Rx/Tx adapter setup pbhagavatula
2019-10-30 16:26 ` [dpdk-dev] [PATCH v8 07/10] examples/l2fwd-event: add service core setup pbhagavatula
2019-10-30 16:26 ` [dpdk-dev] [PATCH v8 08/10] examples/l2fwd-event: add eventdev main loop pbhagavatula
2019-10-30 16:26 ` [dpdk-dev] [PATCH v8 09/10] examples/l2fwd-event: add graceful teardown pbhagavatula
2019-10-30 17:03 ` [dpdk-dev] [PATCH v8 10/10] doc: add application usage guide for l2fwd-event pbhagavatula
2019-10-30 18:17 ` [dpdk-dev] [PATCH v8 00/10] example/l2fwd-event: introduce l2fwd-event example Jerin Jacob
2019-11-04 17:11   ` Jerin Jacob

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