* [dpdk-dev] [PATCH 00/20] add eventmode helper functions
@ 2018-06-08 17:23 Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper Anoob Joseph
` (20 more replies)
0 siblings, 21 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:23 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
This patchset adds common initialization code required for using
applications in event mode. The APIs exposed, abstracts the complex
configuration options exposed by eventdev, ethdev & eth rx adapter.
Also, this enables the usage of multiple workers fine tuned for the
features of the underlying hardware.
With these APIs, existing poll mode applications can be made event
driven easily, and the applications can better leverage the event
mode's capabilities.
L2fwd application has been made event-driven to demonstrate the usage
of helper APIs. Tested with nicvf eth PMD and event_octeontx event
PMD on Cavium's CN83XX platform.
Parts of this patchset is inspired by an RFC send by
Sunil Kumar Kori <sunil.kori@nxp.com>
Anoob Joseph (20):
eventdev: add files for eventmode helper
eventdev: add routines for logging eventmode helper
eventdev: add eventmode CL options framework
eventdev: allow application to set ethernet portmask
eventdev: add framework for eventmode conf
eventdev: add common initialize routine for eventmode devs
eventdev: add eventdevice init for eventmode
eventdev: add eventdev port-lcore link
eventdev: add option to specify schedule mode for app stage
eventdev: add placeholder for ethdev init
eventdev: add Rx adapter init in eventmode
eventdev: add routine to validate conf
eventdev: add default conf for event devs field in conf
eventdev: add default conf for Rx adapter conf
eventdev: add default conf for event port-lcore link
eventdev: add routines to display the eventmode conf
eventdev: add routine to access eventmode link info
eventdev: add routine to access event queue for eth Tx
eventdev: add routine to launch eventmode workers
examples/l2fwd: add eventmode for l2fwd
config/common_base | 1 +
examples/l2fwd/l2fwd_worker.c | 815 +++++++++++-
examples/l2fwd/main.c | 64 +-
lib/librte_eal/common/eal_common_log.c | 1 +
lib/librte_eal/common/include/rte_log.h | 1 +
lib/librte_eventdev/Makefile | 3 +
lib/librte_eventdev/rte_eventmode_helper.c | 1293 ++++++++++++++++++++
lib/librte_eventdev/rte_eventmode_helper.h | 213 ++++
.../rte_eventmode_helper_internal.h | 130 ++
lib/librte_eventdev/rte_eventmode_helper_prints.c | 161 +++
10 files changed, 2667 insertions(+), 15 deletions(-)
create mode 100644 lib/librte_eventdev/rte_eventmode_helper.c
create mode 100644 lib/librte_eventdev/rte_eventmode_helper.h
create mode 100644 lib/librte_eventdev/rte_eventmode_helper_internal.h
create mode 100644 lib/librte_eventdev/rte_eventmode_helper_prints.c
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-27 6:20 ` Sunil Kumar Kori
2018-06-08 17:24 ` [dpdk-dev] [PATCH 02/20] eventdev: add routines for logging " Anoob Joseph
` (19 subsequent siblings)
20 siblings, 1 reply; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
lib/librte_eventdev/Makefile | 2 ++
lib/librte_eventdev/rte_eventmode_helper.c | 7 +++++++
lib/librte_eventdev/rte_eventmode_helper.h | 6 ++++++
lib/librte_eventdev/rte_eventmode_helper_internal.h | 6 ++++++
4 files changed, 21 insertions(+)
create mode 100644 lib/librte_eventdev/rte_eventmode_helper.c
create mode 100644 lib/librte_eventdev/rte_eventmode_helper.h
create mode 100644 lib/librte_eventdev/rte_eventmode_helper_internal.h
diff --git a/lib/librte_eventdev/Makefile b/lib/librte_eventdev/Makefile
index b3e2546..80a5830 100644
--- a/lib/librte_eventdev/Makefile
+++ b/lib/librte_eventdev/Makefile
@@ -19,6 +19,7 @@ LDLIBS += -lrte_mbuf -lrte_cryptodev
# library source files
SRCS-y += rte_eventdev.c
+SRCS-y += rte_eventmode_helper.c
SRCS-y += rte_event_ring.c
SRCS-y += rte_event_eth_rx_adapter.c
SRCS-y += rte_event_timer_adapter.c
@@ -29,6 +30,7 @@ SYMLINK-y-include += rte_eventdev.h
SYMLINK-y-include += rte_eventdev_pmd.h
SYMLINK-y-include += rte_eventdev_pmd_pci.h
SYMLINK-y-include += rte_eventdev_pmd_vdev.h
+SYMLINK-y-include += rte_eventmode_helper.h
SYMLINK-y-include += rte_event_ring.h
SYMLINK-y-include += rte_event_eth_rx_adapter.h
SYMLINK-y-include += rte_event_timer_adapter.h
diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
new file mode 100644
index 0000000..b7ff056
--- /dev/null
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Cavium, Inc
+ */
+
+#include <rte_eventmode_helper.h>
+
+#include "rte_eventmode_helper_internal.h"
diff --git a/lib/librte_eventdev/rte_eventmode_helper.h b/lib/librte_eventdev/rte_eventmode_helper.h
new file mode 100644
index 0000000..5d39bd3
--- /dev/null
+++ b/lib/librte_eventdev/rte_eventmode_helper.h
@@ -0,0 +1,6 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Cavium, Inc
+ */
+#ifndef _RTE_EVENTMODE_HELPER_H_
+#define _RTE_EVENTMODE_HELPER_H_
+#endif /* _RTE_EVENTMODE_HELPER_H_ */
diff --git a/lib/librte_eventdev/rte_eventmode_helper_internal.h b/lib/librte_eventdev/rte_eventmode_helper_internal.h
new file mode 100644
index 0000000..5b08582
--- /dev/null
+++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h
@@ -0,0 +1,6 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Cavium, Inc
+ */
+#ifndef _RTE_EVENTMODE_HELPER_INTERNAL_H_
+#define _RTE_EVENTMODE_HELPER_INTERNAL_H_
+#endif /* _RTE_EVENTMODE_HELPER_INTERNAL_H_ */
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 02/20] eventdev: add routines for logging eventmode helper
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 03/20] eventdev: add eventmode CL options framework Anoob Joseph
` (18 subsequent siblings)
20 siblings, 0 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
config/common_base | 1 +
lib/librte_eal/common/eal_common_log.c | 1 +
lib/librte_eal/common/include/rte_log.h | 1 +
.../rte_eventmode_helper_internal.h | 24 ++++++++++++++++++++++
4 files changed, 27 insertions(+)
diff --git a/config/common_base b/config/common_base
index 6b0d1cb..21da7d4 100644
--- a/config/common_base
+++ b/config/common_base
@@ -594,6 +594,7 @@ CONFIG_RTE_LIBRTE_PMD_ISAL=n
#
CONFIG_RTE_LIBRTE_EVENTDEV=y
CONFIG_RTE_LIBRTE_EVENTDEV_DEBUG=n
+CONFIG_RTE_LIBRTE_EVENTMODE_HELPER_DEBUG=n
CONFIG_RTE_EVENT_MAX_DEVS=16
CONFIG_RTE_EVENT_MAX_QUEUES_PER_DEV=64
CONFIG_RTE_EVENT_TIMER_ADAPTER_NUM_MAX=32
diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c
index 8181189..ee85705 100644
--- a/lib/librte_eal/common/eal_common_log.c
+++ b/lib/librte_eal/common/eal_common_log.c
@@ -324,6 +324,7 @@ static const struct logtype logtype_strings[] = {
{RTE_LOGTYPE_EFD, "lib.efd"},
{RTE_LOGTYPE_EVENTDEV, "lib.eventdev"},
{RTE_LOGTYPE_GSO, "lib.gso"},
+ {RTE_LOGTYPE_EVENTMODE, "lib.eventmode"},
{RTE_LOGTYPE_USER1, "user1"},
{RTE_LOGTYPE_USER2, "user2"},
{RTE_LOGTYPE_USER3, "user3"},
diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h
index 2f789cb..e7ffc54 100644
--- a/lib/librte_eal/common/include/rte_log.h
+++ b/lib/librte_eal/common/include/rte_log.h
@@ -61,6 +61,7 @@ extern struct rte_logs rte_logs;
#define RTE_LOGTYPE_EFD 18 /**< Log related to EFD. */
#define RTE_LOGTYPE_EVENTDEV 19 /**< Log related to eventdev. */
#define RTE_LOGTYPE_GSO 20 /**< Log related to GSO. */
+#define RTE_LOGTYPE_EVENTMODE 21 /**< Log related to eventmode. */
/* these log types can be used in an application */
#define RTE_LOGTYPE_USER1 24 /**< User-defined log type 1. */
diff --git a/lib/librte_eventdev/rte_eventmode_helper_internal.h b/lib/librte_eventdev/rte_eventmode_helper_internal.h
index 5b08582..e946f11 100644
--- a/lib/librte_eventdev/rte_eventmode_helper_internal.h
+++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h
@@ -3,4 +3,28 @@
*/
#ifndef _RTE_EVENTMODE_HELPER_INTERNAL_H_
#define _RTE_EVENTMODE_HELPER_INTERNAL_H_
+
+#include <rte_log.h>
+
+/* Logging macros */
+
+#define RTE_EM_HLPR_LOG_ERR(...) \
+ RTE_LOG(ERR, EVENTMODE, \
+ RTE_FMT("%s(): " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+ __func__, RTE_FMT_TAIL(__VA_ARGS__,)))
+
+#define RTE_EM_HLPR_LOG_INFO(...) \
+ RTE_LOG(INFO, EVENTMODE, \
+ RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+ RTE_FMT_TAIL(__VA_ARGS__,)))
+
+#ifdef RTE_LIBRTE_EVENTMODE_HELPER_DEBUG
+#define RTE_EM_HLPR_LOG_DEBUG(...) \
+ RTE_LOG(DEBUG, EVENTMODE, \
+ RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+ __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
+#else
+#define RTE_EM_HLPR_LOG_DEBUG(...) (void)0
+#endif
+
#endif /* _RTE_EVENTMODE_HELPER_INTERNAL_H_ */
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 03/20] eventdev: add eventmode CL options framework
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 02/20] eventdev: add routines for logging " Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 04/20] eventdev: allow application to set ethernet portmask Anoob Joseph
` (17 subsequent siblings)
20 siblings, 0 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
Adding usage prints and CL parsing routines for eventmode. Option to
select packet transfer mode is also added.
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
lib/librte_eventdev/rte_eventmode_helper.c | 128 +++++++++++++++++++++++++++++
lib/librte_eventdev/rte_eventmode_helper.h | 50 +++++++++++
2 files changed, 178 insertions(+)
diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index b7ff056..14ea493 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -1,7 +1,135 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2018 Cavium, Inc
*/
+#include <getopt.h>
#include <rte_eventmode_helper.h>
+#include <rte_malloc.h>
#include "rte_eventmode_helper_internal.h"
+
+#define CMD_LINE_OPT_TRANSFER_MODE "transfer-mode"
+
+static const char short_options[] =
+ ""
+ ;
+
+enum {
+ /* long options mapped to a short option */
+
+ /* first long only option value must be >= 256, so that we won't
+ * conflict with short options
+ */
+ CMD_LINE_OPT_MIN_NUM = 256,
+ CMD_LINE_OPT_TRANSFER_MODE_NUM,
+};
+
+static const struct option lgopts[] = {
+ {CMD_LINE_OPT_TRANSFER_MODE, 1, 0, CMD_LINE_OPT_TRANSFER_MODE_NUM},
+ {NULL, 0, 0, 0}
+};
+
+/* Internal functions */
+
+static int32_t
+internal_parse_decimal(const char *str)
+{
+ char *end = NULL;
+ unsigned long num;
+
+ num = strtoul(str, &end, 10);
+ if ((str[0] == '\0') || (end == NULL) || (*end != '\0'))
+ return -1;
+
+ return num;
+}
+
+/* Global functions */
+
+void
+rte_eventmode_helper_print_options_list(void)
+{
+ fprintf(stderr, " --"
+ " [--transfer-mode MODE]"
+ );
+}
+
+void
+rte_eventmode_helper_print_options_description(void)
+{
+ fprintf(stderr,
+ " --transfer-mode MODE\n"
+ " 0: Packet transfer via polling (default)\n"
+ " 1: Packet transfer via eventdev\n"
+ "\n");
+}
+
+static int
+em_parse_transfer_mode(struct rte_eventmode_helper_conf *conf,
+ const char *optarg)
+{
+ int32_t parsed_dec;
+
+ parsed_dec = internal_parse_decimal(optarg);
+ if (parsed_dec != RTE_EVENTMODE_HELPER_PKT_TRANSFER_MODE_POLL &&
+ parsed_dec != RTE_EVENTMODE_HELPER_PKT_TRANSFER_MODE_EVENT) {
+ RTE_EM_HLPR_LOG_ERR("Unsupported packet transfer mode");
+ return -1;
+ }
+ conf->mode = parsed_dec;
+ return 0;
+}
+
+static void
+em_initialize_helper_conf(struct rte_eventmode_helper_conf *conf)
+{
+ /* Set default conf */
+
+ /* Packet transfer mode: poll */
+ conf->mode = RTE_EVENTMODE_HELPER_PKT_TRANSFER_MODE_POLL;
+}
+
+struct rte_eventmode_helper_conf *
+rte_eventmode_helper_parse_args(int argc, char **argv)
+{
+ int32_t opt, ret;
+ struct rte_eventmode_helper_conf *conf = NULL;
+
+ /* Allocate memory for conf */
+ conf = rte_zmalloc("eventmode-helper-conf",
+ sizeof(struct rte_eventmode_helper_conf),
+ RTE_CACHE_LINE_SIZE);
+ if (conf == NULL) {
+ RTE_EM_HLPR_LOG_ERR(
+ "Failed allocating memory for eventmode helper conf");
+ goto err;
+ }
+
+ /* Initialize conf with default values */
+ em_initialize_helper_conf(conf);
+
+ while ((opt = getopt_long(argc, argv, short_options,
+ lgopts, NULL)) != EOF) {
+ switch (opt) {
+
+ /* Packet transfer mode */
+ case CMD_LINE_OPT_TRANSFER_MODE_NUM:
+ ret = em_parse_transfer_mode(conf, optarg);
+ if (ret < 0) {
+ RTE_EM_HLPR_LOG_ERR(
+ "Invalid packet transfer mode");
+ goto err;
+ }
+ break;
+ default:
+ goto err;
+ }
+ }
+ return conf;
+
+err:
+ if (conf != NULL)
+ rte_free(conf);
+
+ return NULL;
+}
diff --git a/lib/librte_eventdev/rte_eventmode_helper.h b/lib/librte_eventdev/rte_eventmode_helper.h
index 5d39bd3..bfe4fa9 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.h
+++ b/lib/librte_eventdev/rte_eventmode_helper.h
@@ -3,4 +3,54 @@
*/
#ifndef _RTE_EVENTMODE_HELPER_H_
#define _RTE_EVENTMODE_HELPER_H_
+
+/* Packet transfer mode of the application */
+enum rte_eventmode_helper_pkt_transfer_mode {
+ RTE_EVENTMODE_HELPER_PKT_TRANSFER_MODE_POLL = 0,
+ RTE_EVENTMODE_HELPER_PKT_TRANSFER_MODE_EVENT,
+};
+
+struct rte_eventmode_helper_conf {
+ enum rte_eventmode_helper_pkt_transfer_mode mode;
+ /**< Packet transfer mode of the application */
+ void *mode_params;
+ /**< Mode specific parameters */
+};
+
+/* Common helper functions for command line parsing */
+
+/**
+ * Print event mode options list
+ *
+ */
+void
+rte_eventmode_helper_print_options_list(void);
+
+/**
+ * Print event mode options description
+ *
+ */
+void
+rte_eventmode_helper_print_options_description(void);
+
+/**
+ * Parse event mode arguments
+ *
+ * The application can call this function in it's argument parsing routine to
+ * parse the event mode specific args and create the conf accordingly. This
+ * function is to be executed on the MASTER lcore only.
+ *
+ * @param argc
+ * A non-negative value. If it is greater than 0, the array members
+ * for argv[0] through argv[argc] (non-inclusive) shall contain pointers
+ * to strings.
+ * @param argv
+ * An array of strings. The contents of the array, as well as the strings
+ * which are pointed to by the array, may be modified by this function.
+ * @return
+ * Configuration generated by parsing the event mode args.
+ */
+struct rte_eventmode_helper_conf *
+rte_eventmode_helper_parse_args(int argc, char **argv);
+
#endif /* _RTE_EVENTMODE_HELPER_H_ */
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 04/20] eventdev: allow application to set ethernet portmask
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
` (2 preceding siblings ...)
2018-06-08 17:24 ` [dpdk-dev] [PATCH 03/20] eventdev: add eventmode CL options framework Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 05/20] eventdev: add framework for eventmode conf Anoob Joseph
` (16 subsequent siblings)
20 siblings, 0 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
Application would be required to restrict helper functions to use only
certain ports. The field eth_portmask field in the conf could be used
for this.
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
lib/librte_eventdev/rte_eventmode_helper.c | 3 +++
lib/librte_eventdev/rte_eventmode_helper.h | 7 +++++++
2 files changed, 10 insertions(+)
diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index 14ea493..9282682 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -87,6 +87,9 @@ em_initialize_helper_conf(struct rte_eventmode_helper_conf *conf)
/* Packet transfer mode: poll */
conf->mode = RTE_EVENTMODE_HELPER_PKT_TRANSFER_MODE_POLL;
+
+ /* Keep all ethernet ports enabled by default */
+ conf->eth_portmask = -1;
}
struct rte_eventmode_helper_conf *
diff --git a/lib/librte_eventdev/rte_eventmode_helper.h b/lib/librte_eventdev/rte_eventmode_helper.h
index bfe4fa9..7500f0c 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.h
+++ b/lib/librte_eventdev/rte_eventmode_helper.h
@@ -4,6 +4,8 @@
#ifndef _RTE_EVENTMODE_HELPER_H_
#define _RTE_EVENTMODE_HELPER_H_
+#include <rte_common.h>
+
/* Packet transfer mode of the application */
enum rte_eventmode_helper_pkt_transfer_mode {
RTE_EVENTMODE_HELPER_PKT_TRANSFER_MODE_POLL = 0,
@@ -13,6 +15,11 @@ enum rte_eventmode_helper_pkt_transfer_mode {
struct rte_eventmode_helper_conf {
enum rte_eventmode_helper_pkt_transfer_mode mode;
/**< Packet transfer mode of the application */
+ uint32_t eth_portmask;
+ /**<
+ * Mask of the eth ports to be used. This portmask would be
+ * checked while initializing devices using helper routines.
+ */
void *mode_params;
/**< Mode specific parameters */
};
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 05/20] eventdev: add framework for eventmode conf
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
` (3 preceding siblings ...)
2018-06-08 17:24 ` [dpdk-dev] [PATCH 04/20] eventdev: allow application to set ethernet portmask Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 06/20] eventdev: add common initialize routine for eventmode devs Anoob Joseph
` (15 subsequent siblings)
20 siblings, 0 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
Adding eventmode conf which would have all required configuration for
the event mode.
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
lib/librte_eventdev/rte_eventmode_helper.c | 16 ++++++++++++++++
lib/librte_eventdev/rte_eventmode_helper_internal.h | 5 +++++
2 files changed, 21 insertions(+)
diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index 9282682..ec014a6 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -97,6 +97,7 @@ rte_eventmode_helper_parse_args(int argc, char **argv)
{
int32_t opt, ret;
struct rte_eventmode_helper_conf *conf = NULL;
+ struct eventmode_conf *em_conf = NULL;
/* Allocate memory for conf */
conf = rte_zmalloc("eventmode-helper-conf",
@@ -108,9 +109,21 @@ rte_eventmode_helper_parse_args(int argc, char **argv)
goto err;
}
+ /* Allocate memory for event mode params */
+ conf->mode_params = rte_zmalloc("eventmode-helper-mode-params",
+ sizeof(struct eventmode_conf),
+ RTE_CACHE_LINE_SIZE);
+ if (conf->mode_params == NULL) {
+ RTE_EM_HLPR_LOG_ERR(
+ "Failed allocating memory for event mode params");
+ goto err;
+ }
+
/* Initialize conf with default values */
em_initialize_helper_conf(conf);
+ em_conf = (struct eventmode_conf *)(conf->mode_params);
+
while ((opt = getopt_long(argc, argv, short_options,
lgopts, NULL)) != EOF) {
switch (opt) {
@@ -131,6 +144,9 @@ rte_eventmode_helper_parse_args(int argc, char **argv)
return conf;
err:
+ if (em_conf != NULL)
+ rte_free(em_conf);
+
if (conf != NULL)
rte_free(conf);
diff --git a/lib/librte_eventdev/rte_eventmode_helper_internal.h b/lib/librte_eventdev/rte_eventmode_helper_internal.h
index e946f11..134ddd3 100644
--- a/lib/librte_eventdev/rte_eventmode_helper_internal.h
+++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h
@@ -27,4 +27,9 @@
#define RTE_EM_HLPR_LOG_DEBUG(...) (void)0
#endif
+/* Eventmode conf data */
+struct eventmode_conf {
+ uint64_t dummy;
+};
+
#endif /* _RTE_EVENTMODE_HELPER_INTERNAL_H_ */
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 06/20] eventdev: add common initialize routine for eventmode devs
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
` (4 preceding siblings ...)
2018-06-08 17:24 ` [dpdk-dev] [PATCH 05/20] eventdev: add framework for eventmode conf Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 07/20] eventdev: add eventdevice init for eventmode Anoob Joseph
` (14 subsequent siblings)
20 siblings, 0 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
Adding framework for common initialization routine for event mode.
Event mode would involve initialization of multiple devices, like
eventdev, ethdev etc and this routine would be the placeholder for all
initialization to come in.
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
lib/librte_eventdev/rte_eventmode_helper.c | 49 ++++++++++++++++++++++++++++++
lib/librte_eventdev/rte_eventmode_helper.h | 25 +++++++++++++++
2 files changed, 74 insertions(+)
diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index ec014a6..f2c2b78 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -3,6 +3,7 @@
*/
#include <getopt.h>
+#include <rte_ethdev.h>
#include <rte_eventmode_helper.h>
#include <rte_malloc.h>
@@ -152,3 +153,51 @@ rte_eventmode_helper_parse_args(int argc, char **argv)
return NULL;
}
+
+int32_t
+rte_eventmode_helper_initialize_devs(
+ struct rte_eventmode_helper_conf *mode_conf)
+{
+ int ret;
+ uint16_t portid;
+
+ if (mode_conf == NULL) {
+ RTE_EM_HLPR_LOG_ERR("Invalid conf");
+ return -1;
+ }
+
+ if (mode_conf->mode != RTE_EVENTMODE_HELPER_PKT_TRANSFER_MODE_EVENT)
+ return 0;
+
+ if (mode_conf->mode_params == NULL) {
+ RTE_EM_HLPR_LOG_ERR("Invalid mode params");
+ return -1;
+ }
+
+ /* Stop eth devices before setting up adapter */
+ RTE_ETH_FOREACH_DEV(portid) {
+
+ /* Use only the ports enabled */
+ if ((mode_conf->eth_portmask & (1 << portid)) == 0)
+ continue;
+
+ rte_eth_dev_stop(portid);
+ }
+
+ /* Start eth devices after setting up adapter */
+ RTE_ETH_FOREACH_DEV(portid) {
+
+ /* Use only the ports enabled */
+ if ((mode_conf->eth_portmask & (1 << portid)) == 0)
+ continue;
+
+ ret = rte_eth_dev_start(portid);
+ if (ret < 0) {
+ RTE_EM_HLPR_LOG_ERR(
+ "Error starting eth dev %d", portid);
+ return -1;
+ }
+ }
+
+ return 0;
+}
diff --git a/lib/librte_eventdev/rte_eventmode_helper.h b/lib/librte_eventdev/rte_eventmode_helper.h
index 7500f0c..e1e8a3b 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.h
+++ b/lib/librte_eventdev/rte_eventmode_helper.h
@@ -60,4 +60,29 @@ rte_eventmode_helper_print_options_description(void);
struct rte_eventmode_helper_conf *
rte_eventmode_helper_parse_args(int argc, char **argv);
+/* Helper functions for initialization, & launching workers */
+
+/**
+ * Initialize event mode devices
+ *
+ * Application could call this function to get the event device, eth device
+ * and eth rx adapter initialized according to the conf populated using the
+ * command line args.
+ *
+ * Application is expected to initialize the eth device and then the eventmode
+ * helper subsystem will stop & start eth device according to it's requirement.
+ * So call to this function should be done after the eth device is successfully
+ * initialized.
+ *
+ * @param mode_conf
+ * Configuration of the mode in which app is doing packet handling
+ * @return
+ * - 0 on success.
+ * - (<0) on failure.
+ */
+int32_t
+rte_eventmode_helper_initialize_devs(
+ struct rte_eventmode_helper_conf *mode_conf);
+
+
#endif /* _RTE_EVENTMODE_HELPER_H_ */
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 07/20] eventdev: add eventdevice init for eventmode
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
` (5 preceding siblings ...)
2018-06-08 17:24 ` [dpdk-dev] [PATCH 06/20] eventdev: add common initialize routine for eventmode devs Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 08/20] eventdev: add eventdev port-lcore link Anoob Joseph
` (13 subsequent siblings)
20 siblings, 0 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
Adding routines to initialize event devs. The internal conf structure
would be used to track device configuration.
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
lib/librte_eventdev/rte_eventmode_helper.c | 129 +++++++++++++++++++++
.../rte_eventmode_helper_internal.h | 16 ++-
2 files changed, 144 insertions(+), 1 deletion(-)
diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index f2c2b78..e55d4aa 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -4,6 +4,7 @@
#include <getopt.h>
#include <rte_ethdev.h>
+#include <rte_eventdev.h>
#include <rte_eventmode_helper.h>
#include <rte_malloc.h>
@@ -154,12 +155,132 @@ rte_eventmode_helper_parse_args(int argc, char **argv)
return NULL;
}
+/* Setup eventmode devs */
+
+static int
+rte_eventmode_helper_initialize_eventdev(struct eventmode_conf *em_conf)
+{
+ int ret = -1;
+ uint8_t i, j;
+ struct rte_event_dev_config eventdev_conf;
+ struct rte_event_dev_info evdev_default_conf;
+ struct rte_event_queue_conf eventq_conf = {0};
+ struct eventdev_params *eventdev_config;
+ int nb_eventdev = em_conf->nb_eventdev;
+ int nb_eventqueue;
+ uint8_t eventdev_id;
+
+ for (i = 0; i < nb_eventdev; i++) {
+
+ /* Get eventdev config */
+ eventdev_config = &(em_conf->eventdev_config[i]);
+
+ /* Get event dev ID */
+ eventdev_id = eventdev_config->eventdev_id;
+
+ /* Get the number of queues */
+ nb_eventqueue = eventdev_config->nb_eventqueue;
+
+ /* One queue is required for the final stage (doing eth tx) */
+ nb_eventqueue += 1;
+
+ /* Reset the default conf */
+ memset(&evdev_default_conf, 0,
+ sizeof(struct rte_event_dev_info));
+
+ /* Get default conf of eventdev */
+ ret = rte_event_dev_info_get(eventdev_id, &evdev_default_conf);
+ if (ret < 0) {
+ RTE_EM_HLPR_LOG_ERR(
+ "Error in getting event device info[devID:%d]",
+ eventdev_id);
+ return ret;
+ }
+
+ memset(&eventdev_conf, 0, sizeof(struct rte_event_dev_config));
+ eventdev_conf.nb_events_limit = 4096;
+ eventdev_conf.nb_event_queues = nb_eventqueue;
+ eventdev_conf.nb_event_ports =
+ eventdev_config->nb_eventport;
+ eventdev_conf.nb_event_queue_flows =
+ evdev_default_conf.max_event_queue_flows;
+ eventdev_conf.nb_event_port_dequeue_depth =
+ evdev_default_conf.max_event_port_dequeue_depth;
+ eventdev_conf.nb_event_port_enqueue_depth =
+ evdev_default_conf.max_event_port_enqueue_depth;
+
+ /* Configure event device */
+ ret = rte_event_dev_configure(eventdev_id, &eventdev_conf);
+ if (ret < 0) {
+ RTE_EM_HLPR_LOG_ERR(
+ "Error in configuring event device");
+ return ret;
+ }
+
+ /* Configure event queues */
+ for (j = 0; j < nb_eventqueue; j++) {
+
+ memset(&eventq_conf, 0,
+ sizeof(struct rte_event_queue_conf));
+
+ /* Read the requested conf */
+
+ /* Per event dev queues can be ATQ or SINGLE LINK */
+ eventq_conf.event_queue_cfg =
+ eventdev_config->ev_queue_mode;
+
+ /* Set schedule type as ATOMIC */
+ eventq_conf.schedule_type = RTE_SCHED_TYPE_ATOMIC;
+
+ /* Set max atomic flows to 1024 */
+ eventq_conf.nb_atomic_flows = 1024;
+ eventq_conf.nb_atomic_order_sequences = 1024;
+
+ /* Setup the queue */
+ ret = rte_event_queue_setup(eventdev_id, j,
+ &eventq_conf);
+ if (ret < 0) {
+ RTE_EM_HLPR_LOG_ERR(
+ "Error in event queue setup");
+ return ret;
+ }
+ }
+
+ /* Configure event ports */
+ for (j = 0; j < eventdev_config->nb_eventport; j++) {
+ ret = rte_event_port_setup(eventdev_id, j, NULL);
+ if (ret < 0) {
+ RTE_EM_HLPR_LOG_ERR(
+ "Error setting up event port");
+ return ret;
+ }
+ }
+ }
+
+ /* Start event devices */
+ for (i = 0; i < nb_eventdev; i++) {
+
+ /* Get eventdev config */
+ eventdev_config = &(em_conf->eventdev_config[i]);
+
+ ret = rte_event_dev_start(eventdev_config->eventdev_id);
+ if (ret < 0) {
+ RTE_EM_HLPR_LOG_ERR(
+ "Error in starting event device[devID: %d]",
+ eventdev_config->eventdev_id);
+ return ret;
+ }
+ }
+ return 0;
+}
+
int32_t
rte_eventmode_helper_initialize_devs(
struct rte_eventmode_helper_conf *mode_conf)
{
int ret;
uint16_t portid;
+ struct eventmode_conf *em_conf;
if (mode_conf == NULL) {
RTE_EM_HLPR_LOG_ERR("Invalid conf");
@@ -174,6 +295,9 @@ rte_eventmode_helper_initialize_devs(
return -1;
}
+ /* Get eventmode conf */
+ em_conf = (struct eventmode_conf *)(mode_conf->mode_params);
+
/* Stop eth devices before setting up adapter */
RTE_ETH_FOREACH_DEV(portid) {
@@ -184,6 +308,11 @@ rte_eventmode_helper_initialize_devs(
rte_eth_dev_stop(portid);
}
+ /* Setup eventdev */
+ ret = rte_eventmode_helper_initialize_eventdev(em_conf);
+ if (ret != 0)
+ return ret;
+
/* Start eth devices after setting up adapter */
RTE_ETH_FOREACH_DEV(portid) {
diff --git a/lib/librte_eventdev/rte_eventmode_helper_internal.h b/lib/librte_eventdev/rte_eventmode_helper_internal.h
index 134ddd3..4cd5ac4 100644
--- a/lib/librte_eventdev/rte_eventmode_helper_internal.h
+++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h
@@ -27,9 +27,23 @@
#define RTE_EM_HLPR_LOG_DEBUG(...) (void)0
#endif
+/* Max event devices supported */
+#define EVENT_MODE_MAX_EVENT_DEVS RTE_EVENT_MAX_DEVS
+
+/* Event dev params */
+struct eventdev_params {
+ uint8_t eventdev_id;
+ uint8_t nb_eventqueue;
+ uint8_t nb_eventport;
+ uint8_t ev_queue_mode;
+};
+
/* Eventmode conf data */
struct eventmode_conf {
- uint64_t dummy;
+ int nb_eventdev;
+ /**< No of event devs */
+ struct eventdev_params eventdev_config[EVENT_MODE_MAX_EVENT_DEVS];
+ /**< Per event dev conf */
};
#endif /* _RTE_EVENTMODE_HELPER_INTERNAL_H_ */
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 08/20] eventdev: add eventdev port-lcore link
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
` (6 preceding siblings ...)
2018-06-08 17:24 ` [dpdk-dev] [PATCH 07/20] eventdev: add eventdevice init for eventmode Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 09/20] eventdev: add option to specify schedule mode for app stage Anoob Joseph
` (12 subsequent siblings)
20 siblings, 0 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
Adding eventdev port-lcore link. In addition, this will also specify
which event queue need to be connected to the event port.
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
lib/librte_eventdev/rte_eventmode_helper.c | 56 ++++++++++++++++++++++
lib/librte_eventdev/rte_eventmode_helper.h | 12 +++++
.../rte_eventmode_helper_internal.h | 12 +++++
3 files changed, 80 insertions(+)
diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index e55d4aa..b3469f9 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -46,6 +46,24 @@ internal_parse_decimal(const char *str)
return num;
}
+static struct eventdev_params *
+internal_get_eventdev_params(struct eventmode_conf *em_conf,
+ uint8_t eventdev_id)
+{
+ int i;
+
+ for (i = 0; i < em_conf->nb_eventdev; i++) {
+ if (em_conf->eventdev_config[i].eventdev_id == eventdev_id)
+ break;
+ }
+
+ /* No match */
+ if (i == em_conf->nb_eventdev)
+ return NULL;
+
+ return &(em_conf->eventdev_config[i]);
+}
+
/* Global functions */
void
@@ -165,10 +183,12 @@ rte_eventmode_helper_initialize_eventdev(struct eventmode_conf *em_conf)
struct rte_event_dev_config eventdev_conf;
struct rte_event_dev_info evdev_default_conf;
struct rte_event_queue_conf eventq_conf = {0};
+ struct rte_eventmode_helper_event_link_info *link;
struct eventdev_params *eventdev_config;
int nb_eventdev = em_conf->nb_eventdev;
int nb_eventqueue;
uint8_t eventdev_id;
+ uint8_t *queue = NULL;
for (i = 0; i < nb_eventdev; i++) {
@@ -257,6 +277,42 @@ rte_eventmode_helper_initialize_eventdev(struct eventmode_conf *em_conf)
}
}
+ /* Make event queue - event port link */
+ for (j = 0; j < em_conf->nb_link; j++) {
+
+ /* Get link info */
+ link = &(em_conf->link[j]);
+
+ /* Get event dev ID */
+ eventdev_id = link->eventdev_id;
+
+ queue = &(link->eventq_id);
+
+ /* Link queue to port */
+ ret = rte_event_port_link(eventdev_id, link->event_portid,
+ queue, NULL, 1);
+ if (ret < 0) {
+ RTE_EM_HLPR_LOG_ERR("Error in event port linking");
+ return ret;
+ }
+
+ /* Link ATOMIC eth tx queue also to the port */
+
+ /* Get the corresponding eventdev config */
+ eventdev_config = internal_get_eventdev_params(em_conf,
+ eventdev_id);
+
+ /* Last queue would be reserved for eth tx */
+ ret = rte_event_port_link(eventdev_id,
+ link->event_portid,
+ &(eventdev_config->nb_eventqueue), NULL, 1);
+
+ if (ret < 0) {
+ RTE_EM_HLPR_LOG_ERR("Error in event port linking");
+ return ret;
+ }
+ }
+
/* Start event devices */
for (i = 0; i < nb_eventdev; i++) {
diff --git a/lib/librte_eventdev/rte_eventmode_helper.h b/lib/librte_eventdev/rte_eventmode_helper.h
index e1e8a3b..1ade32f 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.h
+++ b/lib/librte_eventdev/rte_eventmode_helper.h
@@ -24,6 +24,18 @@ struct rte_eventmode_helper_conf {
/**< Mode specific parameters */
};
+/* Event-lcore link conf */
+struct rte_eventmode_helper_event_link_info {
+ uint8_t eventdev_id;
+ /**< Event device ID */
+ uint8_t event_portid;
+ /**< Event port ID */
+ uint8_t eventq_id;
+ /**< Event queue to be linked to the port */
+ uint8_t lcore_id;
+ /**< Lcore to be polling on this port */
+};
+
/* Common helper functions for command line parsing */
/**
diff --git a/lib/librte_eventdev/rte_eventmode_helper_internal.h b/lib/librte_eventdev/rte_eventmode_helper_internal.h
index 4cd5ac4..36e2a5f 100644
--- a/lib/librte_eventdev/rte_eventmode_helper_internal.h
+++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h
@@ -30,6 +30,13 @@
/* Max event devices supported */
#define EVENT_MODE_MAX_EVENT_DEVS RTE_EVENT_MAX_DEVS
+/* Max event queues supported per event device */
+#define EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV RTE_EVENT_MAX_QUEUES_PER_DEV
+
+/* Max event-lcore links */
+#define EVENT_MODE_MAX_LCORE_LINKS \
+ (EVENT_MODE_MAX_EVENT_DEVS * EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV)
+
/* Event dev params */
struct eventdev_params {
uint8_t eventdev_id;
@@ -44,6 +51,11 @@ struct eventmode_conf {
/**< No of event devs */
struct eventdev_params eventdev_config[EVENT_MODE_MAX_EVENT_DEVS];
/**< Per event dev conf */
+ uint8_t nb_link;
+ /**< No of links */
+ struct rte_eventmode_helper_event_link_info
+ link[EVENT_MODE_MAX_LCORE_LINKS];
+ /**< Per link conf */
};
#endif /* _RTE_EVENTMODE_HELPER_INTERNAL_H_ */
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 09/20] eventdev: add option to specify schedule mode for app stage
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
` (7 preceding siblings ...)
2018-06-08 17:24 ` [dpdk-dev] [PATCH 08/20] eventdev: add eventdev port-lcore link Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 10/20] eventdev: add placeholder for ethdev init Anoob Joseph
` (11 subsequent siblings)
20 siblings, 0 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
Scheduling mode for each event queue is dependent on the same of app
stage. Configure event queue taking this also into account.
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
lib/librte_eventdev/rte_eventmode_helper.c | 23 ++++++++++++++++++++--
.../rte_eventmode_helper_internal.h | 10 ++++++++++
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index b3469f9..1c4d88d 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -103,6 +103,8 @@ em_parse_transfer_mode(struct rte_eventmode_helper_conf *conf,
static void
em_initialize_helper_conf(struct rte_eventmode_helper_conf *conf)
{
+ struct eventmode_conf *em_conf = NULL;
+
/* Set default conf */
/* Packet transfer mode: poll */
@@ -110,6 +112,12 @@ em_initialize_helper_conf(struct rte_eventmode_helper_conf *conf)
/* Keep all ethernet ports enabled by default */
conf->eth_portmask = -1;
+
+ /* Get eventmode conf */
+ em_conf = (struct eventmode_conf *)(conf->mode_params);
+
+ /* Stage 1 schedule type: atomic */
+ em_conf->ext_params.s1_sched_type = RTE_SCHED_TYPE_ATOMIC;
}
struct rte_eventmode_helper_conf *
@@ -249,8 +257,19 @@ rte_eventmode_helper_initialize_eventdev(struct eventmode_conf *em_conf)
eventq_conf.event_queue_cfg =
eventdev_config->ev_queue_mode;
- /* Set schedule type as ATOMIC */
- eventq_conf.schedule_type = RTE_SCHED_TYPE_ATOMIC;
+ /*
+ * All queues need to be set with sched_type as
+ * schedule type for the application stage. One queue
+ * would be reserved for the final eth tx stage. This
+ * will be an atomic queue.
+ */
+ if (j == nb_eventqueue-1) {
+ eventq_conf.schedule_type =
+ RTE_SCHED_TYPE_ATOMIC;
+ } else {
+ eventq_conf.schedule_type =
+ em_conf->ext_params.s1_sched_type;
+ }
/* Set max atomic flows to 1024 */
eventq_conf.nb_atomic_flows = 1024;
diff --git a/lib/librte_eventdev/rte_eventmode_helper_internal.h b/lib/librte_eventdev/rte_eventmode_helper_internal.h
index 36e2a5f..e9c1b4f 100644
--- a/lib/librte_eventdev/rte_eventmode_helper_internal.h
+++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h
@@ -56,6 +56,16 @@ struct eventmode_conf {
struct rte_eventmode_helper_event_link_info
link[EVENT_MODE_MAX_LCORE_LINKS];
/**< Per link conf */
+ union {
+ struct {
+ uint64_t s1_sched_type : 2;
+ /**< Stage 1 schedule type */
+ uint64_t s2_sched_type : 2;
+ /**< Stage 2 schedule type */
+ };
+ uint64_t u64;
+ } ext_params;
+ /**< 64 bit field to specify extended params */
};
#endif /* _RTE_EVENTMODE_HELPER_INTERNAL_H_ */
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 10/20] eventdev: add placeholder for ethdev init
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
` (8 preceding siblings ...)
2018-06-08 17:24 ` [dpdk-dev] [PATCH 09/20] eventdev: add option to specify schedule mode for app stage Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 11/20] eventdev: add Rx adapter init in eventmode Anoob Joseph
` (10 subsequent siblings)
20 siblings, 0 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
Presently, all the applications would do ethdev init and then pass
control to eventmode helper init. So not doing any "real"
initialization. But this would be expanded once applications are
modified to pass the eth init task also to the helper routine.
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
lib/librte_eventdev/rte_eventmode_helper.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index 1c4d88d..9f2d6de 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -349,6 +349,14 @@ rte_eventmode_helper_initialize_eventdev(struct eventmode_conf *em_conf)
return 0;
}
+static int
+rte_eventmode_helper_initialize_ethdev(struct eventmode_conf *em_conf)
+{
+ RTE_SET_USED(em_conf);
+
+ return 0;
+}
+
int32_t
rte_eventmode_helper_initialize_devs(
struct rte_eventmode_helper_conf *mode_conf)
@@ -388,6 +396,11 @@ rte_eventmode_helper_initialize_devs(
if (ret != 0)
return ret;
+ /* Setup ethdev */
+ ret = rte_eventmode_helper_initialize_ethdev(em_conf);
+ if (ret != 0)
+ return ret;
+
/* Start eth devices after setting up adapter */
RTE_ETH_FOREACH_DEV(portid) {
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 11/20] eventdev: add Rx adapter init in eventmode
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
` (9 preceding siblings ...)
2018-06-08 17:24 ` [dpdk-dev] [PATCH 10/20] eventdev: add placeholder for ethdev init Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 12/20] eventdev: add routine to validate conf Anoob Joseph
` (9 subsequent siblings)
20 siblings, 0 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
Adding rx adapter conf. The helper init routine would be initializing
the rx adapter according to the conf.
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
lib/librte_eventdev/rte_eventmode_helper.c | 122 +++++++++++++++++++++
.../rte_eventmode_helper_internal.h | 27 +++++
2 files changed, 149 insertions(+)
diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index 9f2d6de..aade9e1 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -6,6 +6,7 @@
#include <rte_ethdev.h>
#include <rte_eventdev.h>
#include <rte_eventmode_helper.h>
+#include <rte_event_eth_rx_adapter.h>
#include <rte_malloc.h>
#include "rte_eventmode_helper_internal.h"
@@ -357,6 +358,122 @@ rte_eventmode_helper_initialize_ethdev(struct eventmode_conf *em_conf)
return 0;
}
+static int
+rx_adapter_configure(struct eventmode_conf *em_conf,
+ struct rx_adapter_conf *adapter)
+{
+ int j;
+ int ret;
+ uint8_t eventdev_id;
+ uint32_t service_id;
+ struct adapter_connection_info *conn;
+ struct rte_event_port_conf port_conf = {0};
+ struct rte_event_eth_rx_adapter_queue_conf queue_conf = {0};
+ struct rte_event_dev_info evdev_default_conf = {0};
+
+ /* Get event dev ID */
+ eventdev_id = adapter->eventdev_id;
+
+ /* Create rx_adapter */
+
+ /* Get default configuration of event dev */
+ ret = rte_event_dev_info_get(eventdev_id, &evdev_default_conf);
+ if (ret < 0) {
+ RTE_EM_HLPR_LOG_ERR(
+ "Error in getting event device info[devID:%d]",
+ eventdev_id);
+ return ret;
+ }
+
+ /* Setup port conf */
+ port_conf.new_event_threshold = 1200;
+ port_conf.dequeue_depth =
+ evdev_default_conf.max_event_port_dequeue_depth;
+ port_conf.enqueue_depth =
+ evdev_default_conf.max_event_port_enqueue_depth;
+
+ /* Create adapter */
+ ret = rte_event_eth_rx_adapter_create(adapter->adapter_id,
+ adapter->eventdev_id,
+ &port_conf);
+ if (ret < 0) {
+ RTE_EM_HLPR_LOG_ERR("Error in rx adapter creation");
+ return ret;
+ }
+
+ /* Setup various connections in the adapter */
+
+ queue_conf.rx_queue_flags =
+ RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
+
+ for (j = 0; j < adapter->nb_connections; j++) {
+ /* Get connection */
+ conn = &(adapter->conn[j]);
+
+ /* Setup queue conf */
+ queue_conf.ev.queue_id = conn->eventq_id;
+ queue_conf.ev.sched_type = em_conf->ext_params.s1_sched_type;
+
+ /* Set flow ID as ethdev ID */
+ queue_conf.ev.flow_id = conn->ethdev_id;
+
+ /* Add queue to the adapter */
+ ret = rte_event_eth_rx_adapter_queue_add(
+ adapter->adapter_id,
+ conn->ethdev_id,
+ conn->ethdev_rx_qid,
+ &queue_conf);
+ if (ret < 0) {
+ RTE_EM_HLPR_LOG_ERR(
+ "Error in adding eth queue in event adapter");
+ return ret;
+ }
+ }
+
+ /* Get the service ID used by rx adapter */
+ ret = rte_event_eth_rx_adapter_service_id_get(adapter->adapter_id,
+ &service_id);
+ if (ret != -ESRCH && ret != 0) {
+ RTE_EM_HLPR_LOG_ERR(
+ "Error getting service ID used by adapter");
+ return ret;
+ }
+
+ /*
+ * Rx core will invoke the service when required. The runstate check
+ * is not required.
+ *
+ */
+ rte_service_set_runstate_mapped_check(service_id, 0);
+
+ /* Start adapter */
+ ret = rte_event_eth_rx_adapter_start(adapter->adapter_id);
+ if (ret) {
+ RTE_EM_HLPR_LOG_ERR("Error in starting rx adapter");
+ return ret;
+ }
+
+ return 0;
+}
+
+static int
+rte_eventmode_helper_initialize_rx_adapter(struct eventmode_conf *em_conf)
+{
+ int i, ret;
+ struct rx_adapter_conf *adapter;
+
+ /* Configure rx adapters */
+ for (i = 0; i < em_conf->nb_rx_adapter; i++) {
+ adapter = &(em_conf->adapter[i]);
+ ret = rx_adapter_configure(em_conf, adapter);
+ if (ret < 0) {
+ RTE_EM_HLPR_LOG_ERR("Rx adapter configuration failed");
+ return ret;
+ }
+ }
+ return 0;
+}
+
int32_t
rte_eventmode_helper_initialize_devs(
struct rte_eventmode_helper_conf *mode_conf)
@@ -401,6 +518,11 @@ rte_eventmode_helper_initialize_devs(
if (ret != 0)
return ret;
+ /* Setup rx adapter */
+ ret = rte_eventmode_helper_initialize_rx_adapter(em_conf);
+ if (ret != 0)
+ return ret;
+
/* Start eth devices after setting up adapter */
RTE_ETH_FOREACH_DEV(portid) {
diff --git a/lib/librte_eventdev/rte_eventmode_helper_internal.h b/lib/librte_eventdev/rte_eventmode_helper_internal.h
index e9c1b4f..63b2fb5 100644
--- a/lib/librte_eventdev/rte_eventmode_helper_internal.h
+++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h
@@ -30,6 +30,12 @@
/* Max event devices supported */
#define EVENT_MODE_MAX_EVENT_DEVS RTE_EVENT_MAX_DEVS
+/* Max rx adapters supported */
+#define EVENT_MODE_MAX_RX_ADAPTERS RTE_EVENT_MAX_DEVS
+
+/* Max rx adapter connections */
+#define EVENT_MODE_MAX_CONNECTIONS_PER_ADAPTER 16
+
/* Max event queues supported per event device */
#define EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV RTE_EVENT_MAX_QUEUES_PER_DEV
@@ -45,12 +51,33 @@ struct eventdev_params {
uint8_t ev_queue_mode;
};
+/* Rx adapter connection info */
+struct adapter_connection_info {
+ uint8_t ethdev_id;
+ uint8_t eventq_id;
+ int32_t ethdev_rx_qid;
+};
+
+/* Rx adapter conf */
+struct rx_adapter_conf {
+ int32_t eventdev_id;
+ int32_t adapter_id;
+ uint32_t rx_core_id;
+ uint8_t nb_connections;
+ struct adapter_connection_info
+ conn[EVENT_MODE_MAX_CONNECTIONS_PER_ADAPTER];
+};
+
/* Eventmode conf data */
struct eventmode_conf {
int nb_eventdev;
/**< No of event devs */
struct eventdev_params eventdev_config[EVENT_MODE_MAX_EVENT_DEVS];
/**< Per event dev conf */
+ uint8_t nb_rx_adapter;
+ /**< No of adapters */
+ struct rx_adapter_conf adapter[EVENT_MODE_MAX_RX_ADAPTERS];
+ /**< Adapter conf */
uint8_t nb_link;
/**< No of links */
struct rte_eventmode_helper_event_link_info
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 12/20] eventdev: add routine to validate conf
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
` (10 preceding siblings ...)
2018-06-08 17:24 ` [dpdk-dev] [PATCH 11/20] eventdev: add Rx adapter init in eventmode Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 13/20] eventdev: add default conf for event devs field in conf Anoob Joseph
` (8 subsequent siblings)
20 siblings, 0 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
Adding routine to validate event mode conf. This function will verify
the conf requested by the user and would populate other fields with
default values. Presently, the function acts as placeholder for the
above mentioned actions.
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
lib/librte_eventdev/rte_eventmode_helper.c | 33 ++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index aade9e1..8dbbd1a 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -182,6 +182,32 @@ rte_eventmode_helper_parse_args(int argc, char **argv)
return NULL;
}
+/* Pre-process conf before using for init*/
+
+static int
+rte_eventmode_validate_user_params(struct eventmode_conf *em_conf)
+{
+ /* TODO */
+ /* Check sanity of the conf requested by user */
+
+ RTE_SET_USED(em_conf);
+
+ return 0;
+}
+
+static int
+rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf)
+{
+ int ret;
+
+ /* After parsing all args, verify that the conf can be allowed */
+ ret = rte_eventmode_validate_user_params(em_conf);
+ if (ret != 0)
+ return ret;
+
+ return 0;
+}
+
/* Setup eventmode devs */
static int
@@ -498,6 +524,13 @@ rte_eventmode_helper_initialize_devs(
/* Get eventmode conf */
em_conf = (struct eventmode_conf *)(mode_conf->mode_params);
+ /* Validate the conf requested */
+ if (rte_eventmode_helper_validate_conf(em_conf) != 0) {
+ RTE_EM_HLPR_LOG_ERR(
+ "Failed while validating the conf requested");
+ return -1;
+ }
+
/* Stop eth devices before setting up adapter */
RTE_ETH_FOREACH_DEV(portid) {
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 13/20] eventdev: add default conf for event devs field in conf
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
` (11 preceding siblings ...)
2018-06-08 17:24 ` [dpdk-dev] [PATCH 12/20] eventdev: add routine to validate conf Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 14/20] eventdev: add default conf for Rx adapter conf Anoob Joseph
` (7 subsequent siblings)
20 siblings, 0 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
Generate a default conf for event devs, if it's not specified in the
conf. This routine will check the available event devices and it's
properties and sets the conf accordingly.
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
lib/librte_eventdev/rte_eventmode_helper.c | 67 ++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)
diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index 8dbbd1a..4d6888c 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -196,6 +196,63 @@ rte_eventmode_validate_user_params(struct eventmode_conf *em_conf)
}
static int
+rte_eventmode_helper_set_default_conf_eventdev(struct eventmode_conf *em_conf)
+{
+ int i, ret;
+ int nb_eventdev;
+ struct eventdev_params *eventdev_config;
+ struct rte_event_dev_info dev_info;
+
+ /* Get the number of event devices */
+ nb_eventdev = rte_event_dev_count();
+
+ if (nb_eventdev == 0) {
+ RTE_EM_HLPR_LOG_ERR("No event devices detected");
+ return -1;
+ }
+
+ for (i = 0; i < nb_eventdev; i++) {
+
+ /* Get the event dev conf */
+ eventdev_config = &(em_conf->eventdev_config[i]);
+
+ /* Read event device info */
+ ret = rte_event_dev_info_get(i, &dev_info);
+
+ if (ret < 0) {
+ RTE_EM_HLPR_LOG_ERR(
+ "Failed reading event device info (err:%d)",
+ ret);
+ return ret;
+ }
+
+ /* Check if enough ports are available */
+ if (dev_info.max_event_ports < 2) {
+ RTE_EM_HLPR_LOG_ERR("Not enough ports available");
+ return -1;
+ }
+
+ /* Save number of queues & ports available */
+ eventdev_config->eventdev_id = i;
+ eventdev_config->nb_eventqueue = dev_info.max_event_queues;
+ eventdev_config->nb_eventport = dev_info.max_event_ports;
+ eventdev_config->ev_queue_mode =
+ RTE_EVENT_QUEUE_CFG_SINGLE_LINK;
+
+ /* One port is required for eth_rx_adapter */
+ eventdev_config->nb_eventport -= 1;
+
+ /* One queue is reserved for the final ethernet tx stage */
+ eventdev_config->nb_eventqueue -= 1;
+
+ /* Update the number of eventdevs */
+ em_conf->nb_eventdev++;
+ }
+
+ return 0;
+}
+
+static int
rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf)
{
int ret;
@@ -205,6 +262,16 @@ rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf)
if (ret != 0)
return ret;
+ /*
+ * See if event devs are specified. Else probe the event devices
+ * and initialize the conf with all ports & queues available
+ */
+ if (em_conf->nb_eventdev == 0) {
+ ret = rte_eventmode_helper_set_default_conf_eventdev(em_conf);
+ if (ret != 0)
+ return ret;
+ }
+
return 0;
}
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 14/20] eventdev: add default conf for Rx adapter conf
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
` (12 preceding siblings ...)
2018-06-08 17:24 ` [dpdk-dev] [PATCH 13/20] eventdev: add default conf for event devs field in conf Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 15/20] eventdev: add default conf for event port-lcore link Anoob Joseph
` (6 subsequent siblings)
20 siblings, 0 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
Generate a default conf for Rx adapter, if not specified in the conf.
This routine will check the available eth ports and event queues, and
maps them 1:1. So one eth port will be connected to one event queue.
This way, event queue ID could be used to figure out the port on which
the packet came in.
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
lib/librte_eventdev/rte_eventmode_helper.c | 127 +++++++++++++++++++++
.../rte_eventmode_helper_internal.h | 4 +
2 files changed, 131 insertions(+)
diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index 4d6888c..bec893c 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -65,6 +65,29 @@ internal_get_eventdev_params(struct eventmode_conf *em_conf,
return &(em_conf->eventdev_config[i]);
}
+static inline unsigned
+internal_get_next_rx_core(struct eventmode_conf *em_conf, unsigned prev_core)
+{
+ unsigned next_core;
+
+get_next_core:
+ /* Get the next core */
+ next_core = rte_get_next_lcore(prev_core, 0, 0);
+
+ /* Check if we have reached max lcores */
+ if (next_core == RTE_MAX_LCORE)
+ return next_core;
+
+ /* Only some cores would be marked as rx cores. Skip others */
+ if (!(em_conf->rx_core_mask & (1 << next_core))) {
+ prev_core = next_core;
+ goto get_next_core;
+ }
+
+ return next_core;
+}
+
+
/* Global functions */
void
@@ -105,6 +128,7 @@ static void
em_initialize_helper_conf(struct rte_eventmode_helper_conf *conf)
{
struct eventmode_conf *em_conf = NULL;
+ unsigned rx_core_id;
/* Set default conf */
@@ -119,6 +143,13 @@ em_initialize_helper_conf(struct rte_eventmode_helper_conf *conf)
/* Stage 1 schedule type: atomic */
em_conf->ext_params.s1_sched_type = RTE_SCHED_TYPE_ATOMIC;
+
+ /* Set rx core. Use first core other than master core as Rx core */
+ rx_core_id = rte_get_next_lcore(0, /* curr core */
+ 1, /* skip master core */
+ 0 /* wrap */);
+
+ em_conf->rx_core_mask = (1 << rx_core_id);
}
struct rte_eventmode_helper_conf *
@@ -253,6 +284,89 @@ rte_eventmode_helper_set_default_conf_eventdev(struct eventmode_conf *em_conf)
}
static int
+rte_eventmode_helper_set_default_conf_adapter(struct eventmode_conf *em_conf)
+{
+ int nb_eth_dev;
+ int i;
+ int adapter_id;
+ int eventdev_id;
+ int conn_id;
+ struct rx_adapter_conf *adapter;
+ struct adapter_connection_info *conn;
+ struct eventdev_params *eventdev_config;
+
+ /* Create one adapter with all eth queues mapped to event queues 1:1 */
+
+ if (em_conf->nb_eventdev == 0) {
+ RTE_EM_HLPR_LOG_ERR("No event devs registered");
+ return -1;
+ }
+
+ /* Get the number of eth devs */
+ nb_eth_dev = rte_eth_dev_count_avail();
+
+ /* Use the first event dev */
+ eventdev_config = &(em_conf->eventdev_config[0]);
+
+ /* Get eventdev ID */
+ eventdev_id = eventdev_config->eventdev_id;
+ adapter_id = 0;
+
+ /* Get adapter conf */
+ adapter = &(em_conf->adapter[adapter_id]);
+
+ /* Set adapter conf */
+ adapter->eventdev_id = eventdev_id;
+ adapter->adapter_id = adapter_id;
+ adapter->rx_core_id = internal_get_next_rx_core(em_conf, -1);
+
+ /*
+ * All queues of one eth device (port) will be mapped to one event
+ * queue. Each port will have an individual connection.
+ *
+ */
+
+ /* Make sure there is enough event queues for 1:1 mapping */
+ if (nb_eth_dev > eventdev_config->nb_eventqueue) {
+ RTE_EM_HLPR_LOG_ERR(
+ "Not enough event queues for 1:1 mapping "
+ "[eth devs: %d, event queues: %d]\n",
+ nb_eth_dev,
+ eventdev_config->nb_eventqueue);
+ return -1;
+ }
+
+ for (i = 0; i < nb_eth_dev; i++) {
+
+ /* Use only the ports enabled */
+ if ((em_conf->eth_portmask & (1 << i)) == 0)
+ continue;
+
+ /* Get the connection id */
+ conn_id = adapter->nb_connections;
+
+ /* Get the connection */
+ conn = &(adapter->conn[conn_id]);
+
+ /* Set 1:1 mapping between eth ports & event queues*/
+ conn->ethdev_id = i;
+ conn->eventq_id = i;
+
+ /* Add all eth queues of one eth port to one event queue */
+ conn->ethdev_rx_qid = -1;
+
+ /* Update no of connections */
+ adapter->nb_connections++;
+
+ }
+
+ /* We have setup one adapter */
+ em_conf->nb_rx_adapter = 1;
+
+ return 0;
+}
+
+static int
rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf)
{
int ret;
@@ -272,6 +386,16 @@ rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf)
return ret;
}
+ /*
+ * See if adapters are specified. Else generate a default conf
+ * with one adapter and all eth queue - event queue mapped.
+ */
+ if (em_conf->nb_rx_adapter == 0) {
+ ret = rte_eventmode_helper_set_default_conf_adapter(em_conf);
+ if (ret != 0)
+ return ret;
+ }
+
return 0;
}
@@ -591,6 +715,9 @@ rte_eventmode_helper_initialize_devs(
/* Get eventmode conf */
em_conf = (struct eventmode_conf *)(mode_conf->mode_params);
+ /* Eventmode conf would need eth portmask */
+ em_conf->eth_portmask = mode_conf->eth_portmask;
+
/* Validate the conf requested */
if (rte_eventmode_helper_validate_conf(em_conf) != 0) {
RTE_EM_HLPR_LOG_ERR(
diff --git a/lib/librte_eventdev/rte_eventmode_helper_internal.h b/lib/librte_eventdev/rte_eventmode_helper_internal.h
index 63b2fb5..9db9684 100644
--- a/lib/librte_eventdev/rte_eventmode_helper_internal.h
+++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h
@@ -83,6 +83,10 @@ struct eventmode_conf {
struct rte_eventmode_helper_event_link_info
link[EVENT_MODE_MAX_LCORE_LINKS];
/**< Per link conf */
+ uint32_t rx_core_mask;
+ /**< Core mask of rx cores to be used */
+ uint32_t eth_portmask;
+ /**< Mask of the eth ports to be used */
union {
struct {
uint64_t s1_sched_type : 2;
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 15/20] eventdev: add default conf for event port-lcore link
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
` (13 preceding siblings ...)
2018-06-08 17:24 ` [dpdk-dev] [PATCH 14/20] eventdev: add default conf for Rx adapter conf Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 16/20] eventdev: add routines to display the eventmode conf Anoob Joseph
` (5 subsequent siblings)
20 siblings, 0 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
Generate a default conf for event port-lcore link, if not specified in
the conf. This routine will check the number of available ports and then
create links according to the number of cores available.
This patch also adds a new entry in the eventmode conf to denote that
all queues is to be linked with every port. This enables one core to
receive packets from every port.
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
lib/librte_eventdev/rte_eventmode_helper.c | 109 ++++++++++++++++++++-
.../rte_eventmode_helper_internal.h | 5 +
2 files changed, 113 insertions(+), 1 deletion(-)
diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index bec893c..6bdd64c 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -87,6 +87,28 @@ internal_get_next_rx_core(struct eventmode_conf *em_conf, unsigned prev_core)
return next_core;
}
+static inline unsigned
+internal_get_next_active_core(struct eventmode_conf *em_conf,
+ unsigned prev_core)
+{
+ unsigned next_core;
+
+get_next_core:
+ /* Get the next core */
+ next_core = rte_get_next_lcore(prev_core, 0, 0);
+
+ /* Check if we have reached max lcores */
+ if (next_core == RTE_MAX_LCORE)
+ return next_core;
+
+ /* Some cores would be reserved as rx cores. Skip them */
+ if (em_conf->rx_core_mask & (1 << next_core)) {
+ prev_core = next_core;
+ goto get_next_core;
+ }
+
+ return next_core;
+}
/* Global functions */
@@ -367,6 +389,74 @@ rte_eventmode_helper_set_default_conf_adapter(struct eventmode_conf *em_conf)
}
static int
+rte_eventmode_helper_set_default_conf_link(struct eventmode_conf *em_conf)
+{
+ int i, j;
+ struct eventdev_params *eventdev_config;
+ unsigned lcore_id = -1;
+ int link_index;
+ struct rte_eventmode_helper_event_link_info *link;
+
+ /*
+ * Create a 1:1 mapping from event ports to cores. If the number
+ * of event ports is lesser than the cores, some cores won't
+ * execute worker. If event ports are more, then some ports won't
+ * be used.
+ *
+ */
+
+ /*
+ * The event queue-port mapping is done according to the link. Since
+ * we are falling back to the default link conf, enabling
+ * "all_ev_queue_to_ev_port" mode flag. This will map all queues to the
+ * port.
+ */
+ em_conf->ext_params.all_ev_queue_to_ev_port = 1;
+
+ for (i = 0; i < em_conf->nb_eventdev; i++) {
+
+ /* Get event dev conf */
+ eventdev_config = &(em_conf->eventdev_config[i]);
+
+ /* Loop through the ports */
+ for (j = 0; j < eventdev_config->nb_eventport; j++) {
+
+ /* Get next active core id */
+ lcore_id = internal_get_next_active_core(em_conf,
+ lcore_id);
+
+ if (lcore_id == RTE_MAX_LCORE) {
+ /* Reached max cores */
+ return 0;
+ }
+
+ /* Save the current combination as one link */
+
+ /* Get the index */
+ link_index = em_conf->nb_link;
+
+ /* Get the corresponding link */
+ link = &(em_conf->link[link_index]);
+
+ /* Save link */
+ link->eventdev_id = eventdev_config->eventdev_id;
+ link->event_portid = j;
+ link->lcore_id = lcore_id;
+
+ /*
+ * Not setting eventq_id as by default all queues
+ * need to be mapped to the port, and is controlled
+ * by the operating mode.
+ */
+
+ /* Update number of links */
+ em_conf->nb_link++;
+ }
+ }
+ return 0;
+}
+
+static int
rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf)
{
int ret;
@@ -396,6 +486,16 @@ rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf)
return ret;
}
+ /*
+ * See if links are specified. Else generate a default conf for
+ * the event ports used.
+ */
+ if (em_conf->nb_link == 0) {
+ ret = rte_eventmode_helper_set_default_conf_link(em_conf);
+ if (ret != 0)
+ return ret;
+ }
+
return 0;
}
@@ -523,7 +623,14 @@ rte_eventmode_helper_initialize_eventdev(struct eventmode_conf *em_conf)
/* Get event dev ID */
eventdev_id = link->eventdev_id;
- queue = &(link->eventq_id);
+ /*
+ * If "all_ev_queue_to_ev_port" params flag is selected, all
+ * queues need to be mapped to the port.
+ */
+ if (em_conf->ext_params.all_ev_queue_to_ev_port)
+ queue = NULL;
+ else
+ queue = &(link->eventq_id);
/* Link queue to port */
ret = rte_event_port_link(eventdev_id, link->event_portid,
diff --git a/lib/librte_eventdev/rte_eventmode_helper_internal.h b/lib/librte_eventdev/rte_eventmode_helper_internal.h
index 9db9684..3a4e52f 100644
--- a/lib/librte_eventdev/rte_eventmode_helper_internal.h
+++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h
@@ -93,6 +93,11 @@ struct eventmode_conf {
/**< Stage 1 schedule type */
uint64_t s2_sched_type : 2;
/**< Stage 2 schedule type */
+ uint64_t all_ev_queue_to_ev_port : 1;
+ /**<
+ * When enabled, all event queues need to be mapped to
+ * each event port
+ */
};
uint64_t u64;
} ext_params;
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 16/20] eventdev: add routines to display the eventmode conf
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
` (14 preceding siblings ...)
2018-06-08 17:24 ` [dpdk-dev] [PATCH 15/20] eventdev: add default conf for event port-lcore link Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 17/20] eventdev: add routine to access eventmode link info Anoob Joseph
` (4 subsequent siblings)
20 siblings, 0 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
lib/librte_eventdev/Makefile | 1 +
lib/librte_eventdev/rte_eventmode_helper.c | 3 +
lib/librte_eventdev/rte_eventmode_helper.h | 10 ++
lib/librte_eventdev/rte_eventmode_helper_prints.c | 161 ++++++++++++++++++++++
4 files changed, 175 insertions(+)
create mode 100644 lib/librte_eventdev/rte_eventmode_helper_prints.c
diff --git a/lib/librte_eventdev/Makefile b/lib/librte_eventdev/Makefile
index 80a5830..c427b63 100644
--- a/lib/librte_eventdev/Makefile
+++ b/lib/librte_eventdev/Makefile
@@ -20,6 +20,7 @@ LDLIBS += -lrte_mbuf -lrte_cryptodev
# library source files
SRCS-y += rte_eventdev.c
SRCS-y += rte_eventmode_helper.c
+SRCS-y += rte_eventmode_helper_prints.c
SRCS-y += rte_event_ring.c
SRCS-y += rte_event_eth_rx_adapter.c
SRCS-y += rte_event_timer_adapter.c
diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index 6bdd64c..82cc6d3 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -832,6 +832,9 @@ rte_eventmode_helper_initialize_devs(
return -1;
}
+ /* Display the current conf */
+ rte_eventmode_helper_display_conf(mode_conf);
+
/* Stop eth devices before setting up adapter */
RTE_ETH_FOREACH_DEV(portid) {
diff --git a/lib/librte_eventdev/rte_eventmode_helper.h b/lib/librte_eventdev/rte_eventmode_helper.h
index 1ade32f..c1676e3 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.h
+++ b/lib/librte_eventdev/rte_eventmode_helper.h
@@ -96,5 +96,15 @@ int32_t
rte_eventmode_helper_initialize_devs(
struct rte_eventmode_helper_conf *mode_conf);
+/**
+ * Display event mode conf
+ *
+ * Parse the conf and display the current configuration.
+ *
+ * @param mode_conf
+ * Configuration of the mode in which app is doing packet handling
+ */
+void
+rte_eventmode_helper_display_conf(struct rte_eventmode_helper_conf *mode_conf);
#endif /* _RTE_EVENTMODE_HELPER_H_ */
diff --git a/lib/librte_eventdev/rte_eventmode_helper_prints.c b/lib/librte_eventdev/rte_eventmode_helper_prints.c
new file mode 100644
index 0000000..08b016d
--- /dev/null
+++ b/lib/librte_eventdev/rte_eventmode_helper_prints.c
@@ -0,0 +1,161 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Cavium, Inc
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <rte_eventmode_helper.h>
+#include "rte_eventmode_helper_internal.h"
+
+static void
+rte_eventmode_display_operating_mode(struct eventmode_conf *em_conf)
+{
+ char sched_types[][32] = {
+ "RTE_SCHED_TYPE_ORDERED",
+ "RTE_SCHED_TYPE_ATOMIC",
+ "RTE_SCHED_TYPE_PARALLEL",
+ };
+ RTE_EM_HLPR_LOG_INFO("Operating mode:");
+
+ RTE_EM_HLPR_LOG_INFO("\tScheduling type: \t%s",
+ sched_types[em_conf->ext_params.s1_sched_type]);
+
+ RTE_EM_HLPR_LOG_INFO("");
+}
+
+static void
+rte_eventmode_display_event_dev_conf(struct eventmode_conf *em_conf)
+{
+ int i;
+ char print_buf[256] = { 0 };
+ char queue_mode[][32] = {
+ "",
+ "ATQ (ALL TYPE QUEUE)",
+ "SINGLE LINK",
+ };
+
+ RTE_EM_HLPR_LOG_INFO("Event Device Configuration:");
+
+ for (i = 0; i < em_conf->nb_eventdev; i++) {
+ sprintf(print_buf,
+ "\tDev ID: %-2d \tQueues: %-2d \tPorts: %-2d",
+ em_conf->eventdev_config[i].eventdev_id,
+ em_conf->eventdev_config[i].nb_eventqueue,
+ em_conf->eventdev_config[i].nb_eventport);
+ sprintf(print_buf + strlen(print_buf),
+ "\tQueue mode: %s",
+ queue_mode[em_conf->eventdev_config[i].ev_queue_mode]);
+ RTE_EM_HLPR_LOG_INFO("%s", print_buf);
+ }
+ RTE_EM_HLPR_LOG_INFO("");
+}
+
+static void
+rte_eventmode_display_rx_adapter_conf(struct eventmode_conf *em_conf)
+{
+ int i, j;
+ int nb_rx_adapter = em_conf->nb_rx_adapter;
+ struct rx_adapter_conf *adapter;
+ struct adapter_connection_info *conn;
+ char print_buf[256] = { 0 };
+
+ RTE_EM_HLPR_LOG_INFO("Adapters configured: %d", nb_rx_adapter);
+
+ for (i = 0; i < nb_rx_adapter; i++) {
+ adapter = &(em_conf->adapter[i]);
+ RTE_EM_HLPR_LOG_INFO(
+ "\tAdaper ID: %-2d\tConnections: %-2d\tEvent dev ID: %-2d"
+ "\tRx core: %-2d",
+ adapter->adapter_id,
+ adapter->nb_connections,
+ adapter->eventdev_id,
+ adapter->rx_core_id);
+
+ for (j = 0; j < adapter->nb_connections; j++) {
+ conn = &(adapter->conn[j]);
+
+ sprintf(print_buf,
+ "\t\tEthdev ID: %-2d", conn->ethdev_id);
+
+ if (conn->ethdev_rx_qid == -1)
+ sprintf(print_buf + strlen(print_buf),
+ "\tEth rx queue: %-2s", "ALL");
+ else
+ sprintf(print_buf + strlen(print_buf),
+ "\tEth rx queue: %-2d",
+ conn->ethdev_rx_qid);
+
+ sprintf(print_buf + strlen(print_buf),
+ "\tEvent queue: %-2d", conn->eventq_id);
+ RTE_EM_HLPR_LOG_INFO("%s", print_buf);
+ }
+ }
+ RTE_EM_HLPR_LOG_INFO("");
+}
+
+static void
+rte_eventmode_display_link_conf(struct eventmode_conf *em_conf)
+{
+ int i;
+ struct rte_eventmode_helper_event_link_info *link;
+ char print_buf[256] = { 0 };
+
+ RTE_EM_HLPR_LOG_INFO("Links configured: %d", em_conf->nb_link);
+
+ for (i = 0; i < em_conf->nb_link; i++) {
+ link = &(em_conf->link[i]);
+
+ sprintf(print_buf,
+ "\tEvent dev ID: %-2d\tEvent port: %-2d",
+ link->eventdev_id,
+ link->event_portid);
+
+ if (em_conf->ext_params.all_ev_queue_to_ev_port)
+ sprintf(print_buf + strlen(print_buf),
+ "Event queue: %-2s\t", "ALL");
+ else
+ sprintf(print_buf + strlen(print_buf),
+ "Event queue: %-2d\t", link->eventq_id);
+
+ sprintf(print_buf + strlen(print_buf),
+ "Lcore: %-2d", link->lcore_id);
+ RTE_EM_HLPR_LOG_INFO("%s", print_buf);
+ }
+ RTE_EM_HLPR_LOG_INFO("");
+}
+
+void
+rte_eventmode_helper_display_conf(struct rte_eventmode_helper_conf *mode_conf)
+{
+ struct eventmode_conf *em_conf;
+
+ if (mode_conf == NULL) {
+ RTE_EM_HLPR_LOG_ERR("Invalid conf");
+ return;
+ }
+
+ if (mode_conf->mode != RTE_EVENTMODE_HELPER_PKT_TRANSFER_MODE_EVENT)
+ return;
+
+ if (mode_conf->mode_params == NULL) {
+ RTE_EM_HLPR_LOG_ERR("Invalid mode params");
+ return;
+ }
+
+ /* Get eventmode conf */
+ em_conf = (struct eventmode_conf *)(mode_conf->mode_params);
+
+ /* Display user exposed operating modes */
+ rte_eventmode_display_operating_mode(em_conf);
+
+ /* Display event device conf */
+ rte_eventmode_display_event_dev_conf(em_conf);
+
+ /* Display rx adapter conf */
+ rte_eventmode_display_rx_adapter_conf(em_conf);
+
+ /* Display event-lcore link */
+ rte_eventmode_display_link_conf(em_conf);
+}
+
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 17/20] eventdev: add routine to access eventmode link info
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
` (15 preceding siblings ...)
2018-06-08 17:24 ` [dpdk-dev] [PATCH 16/20] eventdev: add routines to display the eventmode conf Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 18/20] eventdev: add routine to access event queue for eth Tx Anoob Joseph
` (3 subsequent siblings)
20 siblings, 0 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
When the application is drafted for single stage eventmode, it will be
efficient to have the loop in the application space, rather than passing
it on to the helper. But application would need to have info on the
links to be able to do that efficiently. This function exposes the links
to that application.
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
lib/librte_eventdev/rte_eventmode_helper.c | 80 ++++++++++++++++++++++++++++++
lib/librte_eventdev/rte_eventmode_helper.h | 25 ++++++++++
2 files changed, 105 insertions(+)
diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index 82cc6d3..7827ea6 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -877,3 +877,83 @@ rte_eventmode_helper_initialize_devs(
return 0;
}
+
+/* Helper functions for eventmode workers */
+
+uint8_t
+rte_eventmode_helper_get_event_lcore_links(uint32_t lcore_id,
+ struct rte_eventmode_helper_conf *mode_conf,
+ struct rte_eventmode_helper_event_link_info **links)
+{
+ int i;
+ int index = 0;
+ uint8_t lcore_nb_link = 0;
+ struct rte_eventmode_helper_event_link_info *link;
+ struct rte_eventmode_helper_event_link_info *link_cache;
+ struct eventmode_conf *em_conf = NULL;
+ size_t cache_size;
+ size_t single_link_size;
+
+ if (mode_conf == NULL || links == NULL) {
+ RTE_EM_HLPR_LOG_ERR("Invalid args");
+ return 0;
+ }
+
+ /* Get eventmode conf */
+ em_conf = (struct eventmode_conf *)(mode_conf->mode_params);
+
+ if (em_conf == NULL) {
+ RTE_EM_HLPR_LOG_ERR("Invalid event mode conf");
+ return 0;
+ }
+
+ /* Get the number of links registered */
+ for (i = 0; i < em_conf->nb_link; i++) {
+
+ /* Get link */
+ link = &(em_conf->link[i]);
+
+ /* Check if we have link intended for this lcore */
+ if (link->lcore_id == lcore_id) {
+
+ /* Update the number of links for this core */
+ lcore_nb_link++;
+
+ }
+ }
+
+ /* Compute size of one entry to be copied */
+ single_link_size = sizeof(struct rte_eventmode_helper_event_link_info);
+
+ /* Compute size of the buffer required */
+ cache_size = lcore_nb_link *
+ sizeof(struct rte_eventmode_helper_event_link_info);
+
+ /* Allocate memory for caching the links */
+ link_cache = rte_zmalloc("eventmode-event-lcore-links", cache_size,
+ RTE_CACHE_LINE_SIZE);
+
+ /* Get the number of links registered */
+ for (i = 0; i < em_conf->nb_link; i++) {
+
+ /* Get link */
+ link = &(em_conf->link[i]);
+
+ /* Check if we have link intended for this lcore */
+ if (link->lcore_id == lcore_id) {
+
+ /* Cache the link */
+ memcpy(&link_cache[index], link, single_link_size);
+
+ /* Update index */
+ index++;
+ }
+ }
+
+ /* Update the links for application to use the cached links */
+ *links = link_cache;
+
+ /* Return the number of cached links */
+ return lcore_nb_link;
+}
+
diff --git a/lib/librte_eventdev/rte_eventmode_helper.h b/lib/librte_eventdev/rte_eventmode_helper.h
index c1676e3..1d8af44 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.h
+++ b/lib/librte_eventdev/rte_eventmode_helper.h
@@ -107,4 +107,29 @@ rte_eventmode_helper_initialize_devs(
void
rte_eventmode_helper_display_conf(struct rte_eventmode_helper_conf *mode_conf);
+/**
+ * Get event dev - lcore links
+ *
+ * When the application is doing single stage execution, the execution loop
+ * will be in the application. So the application would need the info on which
+ * event port need to be polled by an lcore etc. This helper function would
+ * help the application in doing so. The 'links' would point to the memory
+ * allocated for the links list, and the application should release this, once
+ * the use is over.
+ *
+ * @param lcore_id
+ * ID of the lcore for which the links list need to be populated
+ * @param mode_conf
+ * Configuration of the mode in which app is doing packet handling
+ * @param links
+ * Used to pass the pointer of the memory allocated by the helper to the
+ * application
+ * @return
+ * Number of links found for the lcore
+ */
+uint8_t
+rte_eventmode_helper_get_event_lcore_links(uint32_t lcore_id,
+ struct rte_eventmode_helper_conf *mode_conf,
+ struct rte_eventmode_helper_event_link_info **links);
+
#endif /* _RTE_EVENTMODE_HELPER_H_ */
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 18/20] eventdev: add routine to access event queue for eth Tx
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
` (16 preceding siblings ...)
2018-06-08 17:24 ` [dpdk-dev] [PATCH 17/20] eventdev: add routine to access eventmode link info Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 19/20] eventdev: add routine to launch eventmode workers Anoob Joseph
` (2 subsequent siblings)
20 siblings, 0 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
When the application is drafted for single stage eventmode, it will be
efficient to have the loop in the application space, rather than passing
it on to the helper.
When the application's stage is in ORDERED sched mode, the application
will have to change the sched type of the event to ATOMIC before sending
it, to ensure ingress ordering is maintained. Since, it is application
who would do the tx, this info is required in it's space.
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
lib/librte_eventdev/rte_eventmode_helper.c | 35 ++++++++++++++++++++++++++++++
lib/librte_eventdev/rte_eventmode_helper.h | 21 ++++++++++++++++++
2 files changed, 56 insertions(+)
diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index 7827ea6..7f2d269 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -957,3 +957,38 @@ rte_eventmode_helper_get_event_lcore_links(uint32_t lcore_id,
return lcore_nb_link;
}
+uint8_t
+rte_eventmode_helper_get_tx_queue(struct rte_eventmode_helper_conf *mode_conf,
+ uint8_t eventdev_id)
+{
+ struct eventdev_params *eventdev_config;
+ struct eventmode_conf *em_conf;
+
+ if (mode_conf == NULL) {
+ RTE_EM_HLPR_LOG_ERR("Invalid conf");
+ return (uint8_t)(-1);
+ }
+
+ if (mode_conf->mode_params == NULL) {
+ RTE_EM_HLPR_LOG_ERR("Invalid mode params");
+ return (uint8_t)(-1);
+ }
+
+ /* Get eventmode conf */
+ em_conf = (struct eventmode_conf *)(mode_conf->mode_params);
+
+ /* Get event device conf */
+ eventdev_config = internal_get_eventdev_params(em_conf, eventdev_id);
+
+ if (eventdev_config == NULL) {
+ RTE_EM_HLPR_LOG_ERR("Error reading eventdev conf");
+ return (uint8_t)(-1);
+ }
+
+ /*
+ * The last queue would be reserved to be used as atomic queue for the
+ * last stage (eth packet tx stage)
+ */
+ return eventdev_config->nb_eventqueue;
+}
+
diff --git a/lib/librte_eventdev/rte_eventmode_helper.h b/lib/librte_eventdev/rte_eventmode_helper.h
index 1d8af44..be2fe8d 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.h
+++ b/lib/librte_eventdev/rte_eventmode_helper.h
@@ -132,4 +132,25 @@ rte_eventmode_helper_get_event_lcore_links(uint32_t lcore_id,
struct rte_eventmode_helper_conf *mode_conf,
struct rte_eventmode_helper_event_link_info **links);
+/**
+ * Get eventdev tx queue
+ *
+ * If the application stage is in non-atomic scheduling mode, then it would be
+ * required to submit the events to an atomic queue before tx, so that the
+ * ingress order of the packets would be maintained. This tx queue would be
+ * created internally by the eventmode helper subsystem, and application
+ * would need it's queue ID when it is running the execution loop.
+ *
+ * @param mode_conf
+ * Configuration of the mode in which app is doing packet handling
+ * @param eventdev_id
+ * Event device ID
+ * @return
+ * - Tx queue ID
+ */
+uint8_t
+rte_eventmode_helper_get_tx_queue(struct rte_eventmode_helper_conf *mode_conf,
+ uint8_t eventdev_id);
+
+
#endif /* _RTE_EVENTMODE_HELPER_H_ */
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 19/20] eventdev: add routine to launch eventmode workers
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
` (17 preceding siblings ...)
2018-06-08 17:24 ` [dpdk-dev] [PATCH 18/20] eventdev: add routine to access event queue for eth Tx Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 20/20] examples/l2fwd: add eventmode for l2fwd Anoob Joseph
2018-06-11 8:32 ` [dpdk-dev] [PATCH 00/20] add eventmode helper functions Jerin Jacob
20 siblings, 0 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
With eventmode, workers could be drafted differently according to the
capabilities of the underlying event device. The added function would
receive an array of such workers and probes the eventmode properties to
choose the worker.
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
lib/librte_eventdev/rte_eventmode_helper.c | 299 +++++++++++++++++++++
lib/librte_eventdev/rte_eventmode_helper.h | 57 ++++
.../rte_eventmode_helper_internal.h | 23 ++
3 files changed, 379 insertions(+)
diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index 7f2d269..25cb4a9 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -2,6 +2,7 @@
* Copyright(c) 2018 Cavium, Inc
*/
#include <getopt.h>
+#include <stdbool.h>
#include <rte_ethdev.h>
#include <rte_eventdev.h>
@@ -13,6 +14,9 @@
#define CMD_LINE_OPT_TRANSFER_MODE "transfer-mode"
+static volatile bool rx_core_running;
+static volatile bool eventmode_worker_stop;
+
static const char short_options[] =
""
;
@@ -110,6 +114,16 @@ internal_get_next_active_core(struct eventmode_conf *em_conf,
return next_core;
}
+static inline bool
+internal_dev_has_burst_mode(uint8_t dev_id)
+{
+ struct rte_event_dev_info dev_info;
+
+ rte_event_dev_info_get(dev_id, &dev_info);
+ return (dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_BURST_MODE) ?
+ true : false;
+}
+
/* Global functions */
void
@@ -992,3 +1006,288 @@ rte_eventmode_helper_get_tx_queue(struct rte_eventmode_helper_conf *mode_conf,
return eventdev_config->nb_eventqueue;
}
+/* Helper functions for launching workers */
+
+static int32_t
+rte_eventmode_helper_start_worker_rx_core(struct eventmode_conf *em_conf,
+ uint32_t lcore_id)
+{
+ uint32_t service_id[EVENT_MODE_MAX_ADAPTERS_PER_RX_CORE];
+ struct rx_adapter_conf *adapter;
+ int service_count = 0;
+ int adapter_id;
+ int32_t ret;
+ int i;
+
+ RTE_EM_HLPR_LOG_INFO(
+ "Entering rx_core processing on lcore %u", lcore_id);
+
+ /*
+ * Need to parse adapter conf to see which all adapters need to be
+ * handled this core.
+ */
+ for (i = 0; i < em_conf->nb_rx_adapter; i++) {
+ /* Check if we have exceeded the max allowed */
+ if (service_count > EVENT_MODE_MAX_ADAPTERS_PER_RX_CORE) {
+ RTE_EM_HLPR_LOG_ERR(
+ "Exceeded the max allowed adapters per rx core");
+ break;
+ }
+
+ adapter = &(em_conf->adapter[i]);
+ if (adapter->rx_core_id != lcore_id)
+ continue;
+
+ /* Adapter need to be handled by this core */
+ adapter_id = adapter->adapter_id;
+
+ /* Get the service ID for the adapters */
+ ret = rte_event_eth_rx_adapter_service_id_get(adapter_id,
+ &(service_id[service_count]));
+
+ if (ret != -ESRCH && ret != 0) {
+ RTE_EM_HLPR_LOG_ERR(
+ "Error getting service ID used by adapter");
+ return ret;
+ }
+
+ /* Update service count */
+ service_count++;
+ }
+
+ rx_core_running = true;
+
+ while (rx_core_running) {
+ for (i = 0; i < service_count; i++) {
+ /* Initiate rx_adapter service */
+ rte_service_run_iter_on_app_lcore(service_id[i], 0);
+ }
+ }
+
+ return 0;
+}
+
+static int32_t
+rte_eventmode_helper_stop_worker_rx_core(void)
+{
+ if (rx_core_running) {
+ RTE_EM_HLPR_LOG_INFO("Stopping rx cores\n");
+ rx_core_running = false;
+ }
+ return 0;
+}
+
+static struct rte_eventmode_helper_app_worker_params *
+rte_eventmode_helper_find_worker(uint32_t lcore_id,
+ struct eventmode_conf *em_conf,
+ struct rte_eventmode_helper_app_worker_params *app_wrkrs,
+ uint8_t nb_wrkr_param)
+{
+ struct rte_eventmode_helper_event_link_info *link = NULL;
+ uint8_t eventdev_id;
+ struct eventdev_params *eventdev_config;
+ int i;
+ struct rte_eventmode_helper_app_worker_params curr_conf = {0};
+ struct rte_eventmode_helper_app_worker_params *tmp_wrkr;
+
+ /*
+ * Event device to be used will be derived from the first lcore-event
+ * link.
+ *
+ * Assumption: All lcore-event link tied to a core would be using the
+ * same event device. in other words, one core would be polling on
+ * queues of a single event device only.
+ */
+
+ /* Get a link for this lcore */
+ for (i = 0; i < em_conf->nb_link; i++) {
+ link = &(em_conf->link[i]);
+ if (link->lcore_id == lcore_id)
+ break;
+ }
+
+ if (link == NULL) {
+ RTE_EM_HLPR_LOG_ERR(
+ "No valid link found for lcore(%d)", lcore_id);
+ return NULL;
+ }
+
+ /* Get event dev ID */
+ eventdev_id = link->eventdev_id;
+
+ /* Get the corresponding eventdev config */
+ eventdev_config = internal_get_eventdev_params(em_conf, eventdev_id);
+
+ /* Populate the curr_conf with the capabilities */
+
+ /* Check for burst mode */
+ if (internal_dev_has_burst_mode(eventdev_id))
+ curr_conf.cap.burst = RTE_EVENTMODE_HELPER_RX_TYPE_BURST;
+ else
+ curr_conf.cap.burst = RTE_EVENTMODE_HELPER_RX_TYPE_NON_BURST;
+
+ curr_conf.cap.s1_sched_type =
+ rte_eventmode_helper_get_s1_sched_type(em_conf);
+
+ curr_conf.cap.s2_sched_type =
+ rte_eventmode_helper_get_s2_sched_type(em_conf);
+
+ /* TODO make this part of em_conf */
+ curr_conf.nb_stage = 1;
+
+ /* Now parse the passed list and see if we have matching capabilties */
+
+ /* Initialize the pointer used to traverse the list */
+ tmp_wrkr = app_wrkrs;
+
+ for (i = 0; i < nb_wrkr_param; i++, tmp_wrkr++) {
+
+ /* Skip this if capabilities are not matching */
+ if (tmp_wrkr->cap.u64 != curr_conf.cap.u64)
+ continue;
+
+ /* Skip if the number of stages is not matching */
+ if (tmp_wrkr->nb_stage != curr_conf.nb_stage)
+ continue;
+
+ /* If the checks pass, we have a match */
+ return tmp_wrkr;
+ }
+
+ /* TODO required for ATQ */
+ RTE_SET_USED(eventdev_config);
+
+ return NULL;
+}
+
+static int
+rte_eventmode_helper_verify_match_worker(
+ struct rte_eventmode_helper_app_worker_params *match_wrkr)
+{
+ if (match_wrkr->nb_stage == 0) {
+ RTE_EM_HLPR_LOG_ERR("App stages cannot be 0");
+ return 0;
+ }
+
+ /* Verify the stages registered */
+ switch (match_wrkr->nb_stage) {
+ case 2:
+ if (match_wrkr->s2_worker_thread == NULL) {
+ RTE_EM_HLPR_LOG_ERR(
+ "No worker registered for second stage");
+ return 0;
+ }
+ /* Fall through */
+ case 1:
+ if (match_wrkr->s1_worker_thread == NULL) {
+ RTE_EM_HLPR_LOG_ERR(
+ "No worker registered for first stage");
+ return 0;
+ }
+ break;
+ default:
+ RTE_EM_HLPR_LOG_ERR("Only two stages are supported now");
+ return 0;
+ }
+
+ /* Success */
+ return 1;
+}
+
+void
+rte_eventmode_helper_launch_worker(struct rte_eventmode_helper_conf *mode_conf,
+ struct rte_eventmode_helper_app_worker_params *app_wrkr,
+ uint8_t nb_wrkr_param)
+{
+ struct rte_eventmode_helper_app_worker_params *match_wrkr;
+ uint32_t lcore_id;
+ int i;
+ struct eventmode_conf *em_conf;
+
+ if (mode_conf == NULL) {
+ RTE_EM_HLPR_LOG_ERR("Invalid conf");
+ return;
+ }
+
+ if (mode_conf->mode_params == NULL) {
+ RTE_EM_HLPR_LOG_ERR("Invalid mode params");
+ return;
+ }
+
+ /* Get eventmode conf */
+ em_conf = (struct eventmode_conf *)(mode_conf->mode_params);
+
+ /* Get core ID */
+ lcore_id = rte_lcore_id();
+
+ /* TODO check capability for rx core */
+
+ /* Check if this is rx core */
+ if (em_conf->rx_core_mask & (1 << lcore_id)) {
+ rte_eventmode_helper_start_worker_rx_core(em_conf, lcore_id);
+ return;
+ }
+
+ if (app_wrkr == NULL || nb_wrkr_param == 0) {
+ RTE_EM_HLPR_LOG_ERR("Invalid args");
+ return;
+ }
+
+ /*
+ * This is a regular worker thread. The application would be
+ * registering multiple workers with various capabilities. The
+ * worker to be run will be selected by the capabilities of the
+ * event device configured.
+ */
+
+ /* Get the first matching worker for the event device */
+ match_wrkr = rte_eventmode_helper_find_worker(lcore_id,
+ em_conf,
+ app_wrkr,
+ nb_wrkr_param);
+
+ if (match_wrkr == NULL) {
+ RTE_EM_HLPR_LOG_ERR(
+ "No matching worker registered for lcore %d", lcore_id);
+ goto clean_and_exit;
+ }
+
+ /* Verify sanity of the matched worker */
+ if (rte_eventmode_helper_verify_match_worker(match_wrkr) != 1) {
+ RTE_EM_HLPR_LOG_ERR("Error in validating the matched worker");
+ goto clean_and_exit;
+ }
+
+ /*
+ * If single stage, then the worker thread will have the loop,
+ * thereby avoiding the dereferencing of the function pointer.
+ */
+ if (match_wrkr->nb_stage == 1) {
+ match_wrkr->s1_worker_thread((void *)mode_conf);
+ goto clean_and_exit;
+ }
+
+ /* TODO write worker stop API */
+ eventmode_worker_stop = false;
+
+ /* Run the worker threads */
+ while (!eventmode_worker_stop) {
+
+ /* Launch the stages registered */
+ for (i = 1; i <= match_wrkr->nb_stage; i++) {
+ switch (i) {
+ case 1:
+ match_wrkr->s1_worker_thread((void *)em_conf);
+ break;
+ case 2:
+ match_wrkr->s2_worker_thread((void *)em_conf);
+ break;
+ }
+ }
+ }
+
+clean_and_exit:
+
+ /* Flag rx_cores to stop, if started */
+ rte_eventmode_helper_stop_worker_rx_core();
+}
diff --git a/lib/librte_eventdev/rte_eventmode_helper.h b/lib/librte_eventdev/rte_eventmode_helper.h
index be2fe8d..25b1180 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.h
+++ b/lib/librte_eventdev/rte_eventmode_helper.h
@@ -12,6 +12,22 @@ enum rte_eventmode_helper_pkt_transfer_mode {
RTE_EVENTMODE_HELPER_PKT_TRANSFER_MODE_EVENT,
};
+/* Event mode packet rx types */
+enum rte_eventmode_helper_rx_types {
+ RTE_EVENTMODE_HELPER_RX_TYPE_INVALID = 0,
+ RTE_EVENTMODE_HELPER_RX_TYPE_NON_BURST,
+ RTE_EVENTMODE_HELPER_RX_TYPE_BURST,
+ RTE_EVENTMODE_HELPER_RX_TYPE_MAX = 16
+};
+
+/* Event mode packet tx types */
+enum rte_eventmode_helper_tx_types {
+ RTE_EVETNMODE_HELPER_TX_TYPE_INVALID = 0,
+ RTE_EVENTMODE_HELPER_TX_TYPE_LOCKED,
+ RTE_EVENTMODE_HELPER_TX_TYPE_LOCKLESS,
+ RTE_EVENTMODE_HELPER_TX_TYPE_MAX = 16
+};
+
struct rte_eventmode_helper_conf {
enum rte_eventmode_helper_pkt_transfer_mode mode;
/**< Packet transfer mode of the application */
@@ -36,6 +52,27 @@ struct rte_eventmode_helper_event_link_info {
/**< Lcore to be polling on this port */
};
+/* Workers registered by the application */
+struct rte_eventmode_helper_app_worker_params {
+ union {
+ struct {
+ uint64_t burst : 4;
+ /**< Specify status of rx type burst */
+ uint64_t s1_sched_type : 2;
+ /**< Stage 1 scheduling type for the thread */
+ uint64_t s2_sched_type : 2;
+ /**< Stage 2 scheduling type for the thread */
+ };
+ uint64_t u64;
+ } cap;
+ /**< Capabilities of this worker */
+ uint8_t nb_stage;
+ void (*s1_worker_thread)(void *);
+ /**< Stage 1 worker thread */
+ void (*s2_worker_thread)(void *);
+ /**< Stage 2 worker thread */
+};
+
/* Common helper functions for command line parsing */
/**
@@ -152,5 +189,25 @@ uint8_t
rte_eventmode_helper_get_tx_queue(struct rte_eventmode_helper_conf *mode_conf,
uint8_t eventdev_id);
+/**
+ * Launch eventmode worker
+ *
+ * The application can request the eventmode helper subsystem to launch the
+ * worker based on the capabilities of event device and the options selected
+ * while initializing the eventmode.
+ *
+ * @param mode_conf
+ * Configuration of the mode in which app is doing packet handling
+ * @param app_wrkr
+ * List of all the workers registered by application, along with it's
+ * capabilties
+ * @param nb_wrkr_param
+ * Number of workers passed by the application
+ *
+ */
+void
+rte_eventmode_helper_launch_worker(struct rte_eventmode_helper_conf *mode_conf,
+ struct rte_eventmode_helper_app_worker_params *app_wrkr,
+ uint8_t nb_wrkr_param);
#endif /* _RTE_EVENTMODE_HELPER_H_ */
diff --git a/lib/librte_eventdev/rte_eventmode_helper_internal.h b/lib/librte_eventdev/rte_eventmode_helper_internal.h
index 3a4e52f..996c654 100644
--- a/lib/librte_eventdev/rte_eventmode_helper_internal.h
+++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h
@@ -43,6 +43,9 @@
#define EVENT_MODE_MAX_LCORE_LINKS \
(EVENT_MODE_MAX_EVENT_DEVS * EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV)
+/* Max adapters that one rx core can handle */
+#define EVENT_MODE_MAX_ADAPTERS_PER_RX_CORE EVENT_MODE_MAX_RX_ADAPTERS
+
/* Event dev params */
struct eventdev_params {
uint8_t eventdev_id;
@@ -104,4 +107,24 @@ struct eventmode_conf {
/**< 64 bit field to specify extended params */
};
+/*
+ * Get sched type of the first stage of app
+ *
+ */
+static inline uint8_t
+rte_eventmode_helper_get_s1_sched_type(struct eventmode_conf *em_conf)
+{
+ return em_conf->ext_params.s1_sched_type;
+}
+
+/*
+ * Get sched type of the first stage of app
+ *
+ */
+static inline uint8_t
+rte_eventmode_helper_get_s2_sched_type(struct eventmode_conf *em_conf)
+{
+ return em_conf->ext_params.s2_sched_type;
+}
+
#endif /* _RTE_EVENTMODE_HELPER_INTERNAL_H_ */
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* [dpdk-dev] [PATCH 20/20] examples/l2fwd: add eventmode for l2fwd
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
` (18 preceding siblings ...)
2018-06-08 17:24 ` [dpdk-dev] [PATCH 19/20] eventdev: add routine to launch eventmode workers Anoob Joseph
@ 2018-06-08 17:24 ` Anoob Joseph
2018-06-11 8:32 ` [dpdk-dev] [PATCH 00/20] add eventmode helper functions Jerin Jacob
20 siblings, 0 replies; 31+ messages in thread
From: Anoob Joseph @ 2018-06-08 17:24 UTC (permalink / raw)
To: Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Anoob Joseph, Hemant Agrawal, Narayana Prasad, Nikhil Rao,
Pavan Nikhilesh, Sunil Kumar Kori, dev
Adding eventmode support in l2fwd. This uses rte_eventmode_helper APIs
to setup and use the eventmode capabilties.
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
examples/l2fwd/l2fwd_worker.c | 815 +++++++++++++++++++++++++++++++++++++++++-
examples/l2fwd/main.c | 64 +++-
2 files changed, 864 insertions(+), 15 deletions(-)
diff --git a/examples/l2fwd/l2fwd_worker.c b/examples/l2fwd/l2fwd_worker.c
index 56e0bdb..bc63b31 100644
--- a/examples/l2fwd/l2fwd_worker.c
+++ b/examples/l2fwd/l2fwd_worker.c
@@ -25,6 +25,9 @@
#include <rte_branch_prediction.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
+#include <rte_eventdev.h>
+#include <rte_eventmode_helper.h>
+#include <rte_malloc.h>
#include <rte_mbuf.h>
#include "l2fwd_common.h"
@@ -138,6 +141,16 @@ l2fwd_periodic_drain_stats_monitor(struct lcore_queue_conf *qconf,
}
}
+static inline void
+l2fwd_drain_loop(struct lcore_queue_conf *qconf, struct tsc_tracker *t,
+ int is_master_core)
+{
+ while (!force_quit) {
+ /* Do periodic operations (buffer drain & stats monitor) */
+ l2fwd_periodic_drain_stats_monitor(qconf, t, is_master_core);
+ }
+}
+
static void
l2fwd_mac_updating(struct rte_mbuf *m, unsigned dest_portid)
{
@@ -180,9 +193,45 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid)
l2fwd_send_pkt(m, dst_port);
}
-/* main processing loop */
+static inline void
+l2fwd_send_single_pkt(struct rte_mbuf *m)
+{
+ l2fwd_send_pkt(m, m->port);
+}
+
+static inline void
+l2fwd_event_pre_forward(struct rte_event *ev, unsigned portid)
+{
+ unsigned dst_port;
+ struct rte_mbuf *m;
+
+ /* Get the mbuf */
+ m = ev->mbuf;
+
+ /* Get the destination port from the tables */
+ dst_port = l2fwd_dst_ports[portid];
+
+ /* Save the destination port in the mbuf */
+ m->port = dst_port;
+
+ /* Perform work */
+ if (mac_updating)
+ l2fwd_mac_updating(m, dst_port);
+}
+
+static inline void
+l2fwd_event_switch_to_atomic(struct rte_event *ev, uint8_t atomic_queue_id)
+{
+ ev->event_type = RTE_EVENT_TYPE_CPU;
+ ev->op = RTE_EVENT_OP_FORWARD;
+ ev->sched_type = RTE_SCHED_TYPE_ATOMIC;
+ ev->queue_id = atomic_queue_id;
+}
+
+
+/* poll mode processing loop */
static void
-l2fwd_main_loop(void)
+l2fwd_poll_mode_worker(void)
{
struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
struct rte_mbuf *m;
@@ -241,9 +290,767 @@ l2fwd_main_loop(void)
}
}
+/*
+ * Event mode exposes various operating modes depending on the
+ * capabilities of the event device and the operating mode
+ * selected.
+ */
+
+/* Workers registered */
+#define L2FWD_EVENTMODE_WORKERS 4
+
+/*
+ * Event mode worker
+ * Operating mode : Single stage non-burst with atomic scheduling
+ */
+static void
+l2fwd_eventmode_non_burst_atomic_worker(void *args)
+{
+ struct rte_event ev;
+ struct rte_mbuf *pkt;
+ struct rte_eventmode_helper_conf *mode_conf;
+ struct rte_eventmode_helper_event_link_info *links = NULL;
+ unsigned lcore_nb_link = 0;
+ uint32_t lcore_id;
+ unsigned i, nb_rx = 0;
+ unsigned portid;
+ struct lcore_queue_conf *qconf;
+ int is_master_core;
+ struct tsc_tracker tsc = {0};
+
+ /* Get core ID */
+ lcore_id = rte_lcore_id();
+
+ RTE_LOG(INFO, L2FWD,
+ "Launching event mode single stage non-burst woker with "
+ "atomic scheduling on lcore %d\n", lcore_id);
+
+ /* Set the flag if master core */
+ is_master_core = (lcore_id == rte_get_master_lcore()) ? 1 : 0;
+
+ /* Get qconf for this core */
+ qconf = &lcore_queue_conf[lcore_id];
+
+ /* Set drain tsc */
+ tsc.drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) /
+ US_PER_S * BURST_TX_DRAIN_US;
+
+ /* Mode conf will be passed as args */
+ mode_conf = (struct rte_eventmode_helper_conf *)args;
+
+ /* Get the links configured for this lcore */
+ lcore_nb_link = rte_eventmode_helper_get_event_lcore_links(lcore_id,
+ mode_conf, &links);
+
+ /* Check if we have links registered for this lcore */
+ if (lcore_nb_link == 0) {
+ /* No links registered. The core could do periodic drains */
+ l2fwd_drain_loop(qconf, &tsc, is_master_core);
+ goto clean_and_exit;
+ }
+
+ /* We have valid links */
+
+ /* See if it's single link */
+ if (lcore_nb_link == 1)
+ goto single_link_loop;
+ else
+ goto multi_link_loop;
+
+single_link_loop:
+
+ RTE_LOG(INFO, L2FWD, " -- lcoreid=%u event_port_id=%u\n", lcore_id,
+ links[0].event_portid);
+
+ while (!force_quit) {
+
+ /* Do periodic operations (buffer drain & stats monitor) */
+ l2fwd_periodic_drain_stats_monitor(qconf, &tsc, is_master_core);
+
+ /* Read packet from event queues */
+ nb_rx = rte_event_dequeue_burst(links[0].eventdev_id,
+ links[0].event_portid,
+ &ev, /* events */
+ 1, /* nb_events */
+ 0 /* timeout_ticks */);
+
+ if (nb_rx == 0)
+ continue;
+
+ portid = ev.queue_id;
+ port_statistics[portid].rx++;
+ pkt = ev.mbuf;
+
+ rte_prefetch0(rte_pktmbuf_mtod(pkt, void *));
+ l2fwd_simple_forward(pkt, portid);
+ }
+ goto clean_and_exit;
+
+multi_link_loop:
+
+ for (i = 0; i < lcore_nb_link; i++) {
+ RTE_LOG(INFO, L2FWD, " -- lcoreid=%u event_port_id=%u\n",
+ lcore_id, links[i].event_portid);
+ }
+
+ while (!force_quit) {
+
+ /* Do periodic operations (buffer drain & stats monitor) */
+ l2fwd_periodic_drain_stats_monitor(qconf, &tsc, is_master_core);
+
+ for (i = 0; i < lcore_nb_link; i++) {
+ /* Read packet from event queues */
+ nb_rx = rte_event_dequeue_burst(links[i].eventdev_id,
+ links[i].event_portid,
+ &ev, /* events */
+ 1, /* nb_events */
+ 0 /* timeout_ticks */);
+
+ if (nb_rx == 0)
+ continue;
+
+ portid = ev.queue_id;
+ port_statistics[portid].rx++;
+ pkt = ev.mbuf;
+
+ rte_prefetch0(rte_pktmbuf_mtod(pkt, void *));
+ l2fwd_simple_forward(pkt, portid);
+ }
+ }
+ goto clean_and_exit;
+
+clean_and_exit:
+ if (links != NULL)
+ rte_free(links);
+}
+
+/*
+ * Event mode worker
+ * Operating mode : Single stage burst with atomic scheduling
+ */
+static void
+l2fwd_eventmode_burst_atomic_worker(void *args)
+{
+ struct rte_event ev[MAX_PKT_BURST];
+ struct rte_mbuf *pkt;
+ struct rte_eventmode_helper_conf *mode_conf;
+ struct rte_eventmode_helper_event_link_info *links = NULL;
+ unsigned lcore_nb_link = 0;
+ uint32_t lcore_id;
+ unsigned i, j, nb_rx = 0;
+ unsigned portid;
+ struct lcore_queue_conf *qconf;
+ int is_master_core;
+ struct rte_event_port_conf event_port_conf;
+ uint16_t dequeue_len = 0;
+ struct tsc_tracker tsc = {0};
+
+ /* Get core ID */
+ lcore_id = rte_lcore_id();
+
+ RTE_LOG(INFO, L2FWD,
+ "Launching event mode single stage burst woker with "
+ "atomic scheduling on lcore %d\n", lcore_id);
+
+ /* Set the flag if master core */
+ is_master_core = (lcore_id == rte_get_master_lcore()) ? 1 : 0;
+
+ /* Get qconf for this core */
+ qconf = &lcore_queue_conf[lcore_id];
+
+ /* Set drain tsc */
+ tsc.drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) /
+ US_PER_S * BURST_TX_DRAIN_US;
+
+ /* Mode conf will be passed as args */
+ mode_conf = (struct rte_eventmode_helper_conf *)args;
+
+ /* Get the links configured for this lcore */
+ lcore_nb_link = rte_eventmode_helper_get_event_lcore_links(lcore_id,
+ mode_conf, &links);
+
+ /* Check if we have links registered for this lcore */
+ if (lcore_nb_link == 0) {
+ /* No links registered. The core could do periodic drains */
+ l2fwd_drain_loop(qconf, &tsc, is_master_core);
+ goto clean_and_exit;
+ }
+
+ /* We have valid links */
+
+ /* Get the burst size of the event device */
+
+ /* Get the default conf of the first link */
+ rte_event_port_default_conf_get(links[0].eventdev_id,
+ links[0].event_portid,
+ &event_port_conf);
+
+ /* Save the burst size */
+ dequeue_len = event_port_conf.dequeue_depth;
+
+ /* Dequeue len should not exceed MAX_PKT_BURST */
+ if (dequeue_len > MAX_PKT_BURST)
+ dequeue_len = MAX_PKT_BURST;
+
+ /* See if it's single link */
+ if (lcore_nb_link == 1)
+ goto single_link_loop;
+ else
+ goto multi_link_loop;
+
+single_link_loop:
+
+ RTE_LOG(INFO, L2FWD, " -- lcoreid=%u event_port_id=%u\n", lcore_id,
+ links[0].event_portid);
+
+ while (!force_quit) {
+
+ /* Do periodic operations (buffer drain & stats monitor) */
+ l2fwd_periodic_drain_stats_monitor(qconf, &tsc, is_master_core);
+
+ /* Read packet from event queues */
+ nb_rx = rte_event_dequeue_burst(links[0].eventdev_id,
+ links[0].event_portid,
+ ev, /* events */
+ dequeue_len, /* nb_events */
+ 0 /* timeout_ticks */);
+
+ if (nb_rx == 0)
+ continue;
+
+ for (j = 0; j < nb_rx; j++) {
+ portid = ev[j].queue_id;
+ port_statistics[portid].rx++;
+ pkt = ev[j].mbuf;
+
+ rte_prefetch0(rte_pktmbuf_mtod(pkt, void *));
+ l2fwd_simple_forward(pkt, portid);
+ }
+ }
+ goto clean_and_exit;
+
+multi_link_loop:
+
+ for (i = 0; i < lcore_nb_link; i++) {
+ RTE_LOG(INFO, L2FWD, " -- lcoreid=%u event_port_id=%u\n",
+ lcore_id, links[i].event_portid);
+ }
+
+ while (!force_quit) {
+
+ /* Do periodic operations (buffer drain & stats monitor) */
+ l2fwd_periodic_drain_stats_monitor(qconf, &tsc, is_master_core);
+
+ for (i = 0; i < lcore_nb_link; i++) {
+ /* Read packet from event queues */
+ nb_rx = rte_event_dequeue_burst(links[i].eventdev_id,
+ links[i].event_portid,
+ ev, /* events */
+ dequeue_len, /* nb_events */
+ 0 /* timeout_ticks */);
+
+ if (nb_rx == 0)
+ continue;
+
+ for (j = 0; j < nb_rx; j++) {
+ portid = ev[j].queue_id;
+ port_statistics[portid].rx++;
+ pkt = ev[j].mbuf;
+
+ rte_prefetch0(rte_pktmbuf_mtod(pkt, void *));
+ l2fwd_simple_forward(pkt, portid);
+ }
+ }
+ }
+ goto clean_and_exit;
+
+clean_and_exit:
+ if (links != NULL)
+ rte_free(links);
+}
+
+/*
+ * Event mode worker
+ * Operating mode : Single stage non-burst with ordered scheduling
+ */
+static void
+l2fwd_eventmode_non_burst_ordered_worker(void *args)
+{
+ struct rte_event ev;
+ struct rte_mbuf *pkt;
+ struct rte_eventmode_helper_conf *mode_conf;
+ struct rte_eventmode_helper_event_link_info *links = NULL;
+ unsigned lcore_nb_link = 0;
+ uint32_t lcore_id;
+ unsigned i, nb_rx = 0;
+ unsigned portid;
+ struct lcore_queue_conf *qconf;
+ int is_master_core;
+ uint8_t tx_queue;
+ uint8_t eventdev_id;
+ struct tsc_tracker tsc = {0};
+
+ /* Get core ID */
+ lcore_id = rte_lcore_id();
+
+ RTE_LOG(INFO, L2FWD,
+ "Launching event mode single stage non-burst woker with "
+ "ordered scheduling on lcore %d\n", lcore_id);
+
+ /* Set the flag if master core */
+ is_master_core = (lcore_id == rte_get_master_lcore()) ? 1 : 0;
+
+ /* Get qconf for this core */
+ qconf = &lcore_queue_conf[lcore_id];
+
+ /* Set drain tsc */
+ tsc.drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) /
+ US_PER_S * BURST_TX_DRAIN_US;
+
+ /* Mode conf will be passed as args */
+ mode_conf = (struct rte_eventmode_helper_conf *)args;
+
+ /* Get the links configured for this lcore */
+ lcore_nb_link = rte_eventmode_helper_get_event_lcore_links(lcore_id,
+ mode_conf, &links);
+
+ /* Check if we have links registered for this lcore */
+ if (lcore_nb_link == 0) {
+ /* No links registered. The core could do periodic drains */
+ l2fwd_drain_loop(qconf, &tsc, is_master_core);
+ goto clean_and_exit;
+ }
+
+ /* We have valid links */
+
+ /*
+ * When the stage 1 is set to have scheduling ORDERED, the event need
+ * to change the scheduling type to ATOMIC before it can be send out.
+ * This would ensure that the packets are send out in the same order
+ * as it came.
+ */
+
+ /*
+ * The helper function would create a queue with ATOMIC scheduling
+ * for this purpose. Worker would submit packets to that queue if the
+ * event is not coming from an ATOMIC queue.
+ */
+
+ /* Get event dev ID from the first link */
+ eventdev_id = links[0].eventdev_id;
+
+ /*
+ * One queue would be reserved to be used as atomic queue for the last
+ * stage (eth packet tx stage)
+ */
+ tx_queue = rte_eventmode_helper_get_tx_queue(mode_conf, eventdev_id);
+
+ /* See if it's single link */
+ if (lcore_nb_link == 1)
+ goto single_link_loop;
+ else
+ goto multi_link_loop;
+
+single_link_loop:
+
+ RTE_LOG(INFO, L2FWD, " -- lcoreid=%u event_port_id=%u\n", lcore_id,
+ links[0].event_portid);
+
+ while (!force_quit) {
+
+ /* Do periodic operations (buffer drain & stats monitor) */
+ l2fwd_periodic_drain_stats_monitor(qconf, &tsc, is_master_core);
+
+ /* Read packet from event queues */
+ nb_rx = rte_event_dequeue_burst(links[0].eventdev_id,
+ links[0].event_portid,
+ &ev, /* events */
+ 1, /* nb_events */
+ 0 /* timeout_ticks */);
+
+ if (nb_rx == 0)
+ continue;
+
+ /*
+ * Check if this event came on atomic queue. If yes, do eth tx
+ */
+ if (ev.sched_type == RTE_SCHED_TYPE_ATOMIC) {
+ l2fwd_send_single_pkt(ev.mbuf);
+ continue;
+ }
+
+ /* Else, we have a fresh packet */
+ portid = ev.queue_id;
+ port_statistics[portid].rx++;
+ pkt = ev.mbuf;
+
+ rte_prefetch0(rte_pktmbuf_mtod(pkt, void *));
+
+ /* Process packet */
+ l2fwd_event_pre_forward(&ev, portid);
+
+ /* Update the scheduling type for tx stage */
+ l2fwd_event_switch_to_atomic(&ev, tx_queue);
+
+ /* Submit the updated event for tx stage */
+ rte_event_enqueue_burst(links[0].eventdev_id,
+ links[0].event_portid,
+ &ev, /* events */
+ 1 /* nb_events */);
+ }
+ goto clean_and_exit;
+
+multi_link_loop:
+
+ for (i = 0; i < lcore_nb_link; i++) {
+ RTE_LOG(INFO, L2FWD, " -- lcoreid=%u event_port_id=%u\n",
+ lcore_id, links[i].event_portid);
+ }
+
+ while (!force_quit) {
+
+ /* Do periodic operations (buffer drain & stats monitor) */
+ l2fwd_periodic_drain_stats_monitor(qconf, &tsc, is_master_core);
+
+ for (i = 0; i < lcore_nb_link; i++) {
+ /* Read packet from event queues */
+ nb_rx = rte_event_dequeue_burst(links[i].eventdev_id,
+ links[i].event_portid,
+ &ev, /* events */
+ 1, /* nb_events */
+ 0 /* timeout_ticks */);
+
+ if (nb_rx == 0)
+ continue;
+
+ /*
+ * Check if this event came on atomic queue.
+ * If yes, do eth tx
+ */
+ if (ev.sched_type == RTE_SCHED_TYPE_ATOMIC) {
+ l2fwd_send_single_pkt(ev.mbuf);
+ continue;
+ }
+
+ /* Else, we have a fresh packet */
+ portid = ev.queue_id;
+ port_statistics[portid].rx++;
+ pkt = ev.mbuf;
+
+ rte_prefetch0(rte_pktmbuf_mtod(pkt, void *));
+
+ /* Process packet */
+ l2fwd_event_pre_forward(&ev, portid);
+
+ /* Update the scheduling type for tx stage */
+ l2fwd_event_switch_to_atomic(&ev, tx_queue);
+
+ /* Submit the updated event for tx stage */
+ rte_event_enqueue_burst(links[i].eventdev_id,
+ links[i].event_portid,
+ &ev, /* events */
+ 1 /* nb_events */);
+ }
+ }
+ goto clean_and_exit;
+
+clean_and_exit:
+ if (links != NULL)
+ rte_free(links);
+}
+
+/*
+ * Event mode worker
+ * Operating mode : Single stage burst with ordered scheduling
+ */
+static void
+l2fwd_eventmode_burst_ordered_worker(void *args)
+{
+ struct rte_event ev[MAX_PKT_BURST];
+ struct rte_mbuf *pkt;
+ struct rte_eventmode_helper_conf *mode_conf;
+ struct rte_eventmode_helper_event_link_info *links = NULL;
+ unsigned lcore_nb_link = 0;
+ uint32_t lcore_id;
+ unsigned i, j, nb_rx = 0;
+ unsigned portid;
+ struct lcore_queue_conf *qconf;
+ int is_master_core;
+ struct rte_event_port_conf event_port_conf;
+ uint16_t dequeue_len = 0;
+ uint8_t tx_queue;
+ uint8_t eventdev_id;
+ struct tsc_tracker tsc = {0};
+
+ /* Get core ID */
+ lcore_id = rte_lcore_id();
+
+ RTE_LOG(INFO, L2FWD,
+ "Launching event mode single stage burst woker with "
+ "ordered scheduling on lcore %d\n", lcore_id);
+
+ /* Set the flag if master core */
+ is_master_core = (lcore_id == rte_get_master_lcore()) ? 1 : 0;
+
+ /* Get qconf for this core */
+ qconf = &lcore_queue_conf[lcore_id];
+
+ /* Set drain tsc */
+ tsc.drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) /
+ US_PER_S * BURST_TX_DRAIN_US;
+
+ /* Mode conf will be passed as args */
+ mode_conf = (struct rte_eventmode_helper_conf *)args;
+
+ /* Get the links configured for this lcore */
+ lcore_nb_link = rte_eventmode_helper_get_event_lcore_links(lcore_id,
+ mode_conf, &links);
+
+ /* Check if we have links registered for this lcore */
+ if (lcore_nb_link == 0) {
+ /* No links registered. The core could do periodic drains */
+ l2fwd_drain_loop(qconf, &tsc, is_master_core);
+ goto clean_and_exit;
+ }
+
+ /* We have valid links */
+
+ /*
+ * When the stage 1 is set to have scheduling ORDERED, the event need
+ * to change the scheduling type to ATOMIC before it can be send out.
+ * This would ensure that the packets are send out in the same order
+ * as it came.
+ */
+
+ /*
+ * The helper function would create a queue with ATOMIC scheduling
+ * for this purpose. Worker would submit packets to that queue if the
+ * event is not coming from an ATOMIC queue.
+ */
+
+ /* Get event dev ID from the first link */
+ eventdev_id = links[0].eventdev_id;
+
+ /*
+ * One queue would be reserved to be used as atomic queue for the last
+ * stage (eth packet tx stage)
+ */
+ tx_queue = rte_eventmode_helper_get_tx_queue(mode_conf, eventdev_id);
+
+ /* Get the burst size of the event device */
+
+ /* Get the default conf of the first link */
+ rte_event_port_default_conf_get(links[0].eventdev_id,
+ links[0].event_portid,
+ &event_port_conf);
+
+ /* Save the burst size */
+ dequeue_len = event_port_conf.dequeue_depth;
+
+ /* Dequeue len should not exceed MAX_PKT_BURST */
+ if (dequeue_len > MAX_PKT_BURST)
+ dequeue_len = MAX_PKT_BURST;
+
+ /* See if it's single link */
+ if (lcore_nb_link == 1)
+ goto single_link_loop;
+ else
+ goto multi_link_loop;
+
+single_link_loop:
+
+ RTE_LOG(INFO, L2FWD, " -- lcoreid=%u event_port_id=%u\n", lcore_id,
+ links[0].event_portid);
+
+ while (!force_quit) {
+
+ /* Do periodic operations (buffer drain & stats monitor) */
+ l2fwd_periodic_drain_stats_monitor(qconf, &tsc, is_master_core);
+
+ /* Read packet from event queues */
+ nb_rx = rte_event_dequeue_burst(links[0].eventdev_id,
+ links[0].event_portid,
+ ev, /* events */
+ dequeue_len, /* nb_events */
+ 0 /* timeout_ticks */);
+
+ if (nb_rx == 0)
+ continue;
+
+ for (j = 0; j < nb_rx; j++) {
+ /*
+ * Check if this event came on atomic queue.
+ * If yes, do eth tx
+ */
+ if (ev[j].sched_type == RTE_SCHED_TYPE_ATOMIC) {
+ l2fwd_send_single_pkt(ev[j].mbuf);
+ continue;
+ }
+
+ /* Else, we have a fresh packet */
+ portid = ev[j].queue_id;
+ port_statistics[portid].rx++;
+ pkt = ev[j].mbuf;
+
+ rte_prefetch0(rte_pktmbuf_mtod(pkt, void *));
+
+ /* Process packet */
+ l2fwd_event_pre_forward(&(ev[j]), portid);
+
+ /* Update the scheduling type for tx stage */
+ l2fwd_event_switch_to_atomic(&(ev[j]), tx_queue);
+
+ /* Submit the updated event for tx stage */
+ rte_event_enqueue_burst(links[0].eventdev_id,
+ links[0].event_portid,
+ &(ev[j]), /* events */
+ 1 /* nb_events */);
+ }
+ }
+ goto clean_and_exit;
+
+multi_link_loop:
+
+ for (i = 0; i < lcore_nb_link; i++) {
+ RTE_LOG(INFO, L2FWD, " -- lcoreid=%u event_port_id=%u\n",
+ lcore_id, links[i].event_portid);
+ }
+
+ while (!force_quit) {
+
+ /* Do periodic operations (buffer drain & stats monitor) */
+ l2fwd_periodic_drain_stats_monitor(qconf, &tsc, is_master_core);
+
+ for (i = 0; i < lcore_nb_link; i++) {
+ /* Read packet from event queues */
+ nb_rx = rte_event_dequeue_burst(links[i].eventdev_id,
+ links[i].event_portid,
+ ev, /* events */
+ dequeue_len, /* nb_events */
+ 0 /* timeout_ticks */);
+
+ if (nb_rx == 0)
+ continue;
+
+ for (j = 0; j < nb_rx; j++) {
+ /*
+ * Check if this event came on atomic queue.
+ * If yes, do eth tx
+ */
+ if (ev[j].sched_type == RTE_SCHED_TYPE_ATOMIC) {
+ l2fwd_send_single_pkt(ev[j].mbuf);
+ continue;
+ }
+
+ /* Else, we have a fresh packet */
+ portid = ev[j].queue_id;
+ port_statistics[portid].rx++;
+ pkt = ev[j].mbuf;
+
+ rte_prefetch0(rte_pktmbuf_mtod(pkt, void *));
+
+ /* Process packet */
+ l2fwd_event_pre_forward(&(ev[j]), portid);
+
+ /* Update the scheduling type for tx stage */
+ l2fwd_event_switch_to_atomic(&(ev[j]),
+ tx_queue);
+
+ /* Submit the updated event for tx stage */
+ rte_event_enqueue_burst(links[i].eventdev_id,
+ links[i].event_portid,
+ &(ev[j]), /* events */
+ 1 /* nb_events */);
+ }
+ }
+ }
+ goto clean_and_exit;
+
+clean_and_exit:
+ if (links != NULL)
+ rte_free(links);
+}
+
+static uint8_t
+l2fwd_eventmode_populate_wrkr_params(
+ struct rte_eventmode_helper_app_worker_params *wrkrs)
+{
+ uint8_t nb_wrkr_param = 0;
+ struct rte_eventmode_helper_app_worker_params *wrkr;
+
+ /* Save workers */
+
+ wrkr = wrkrs;
+
+ /* Single stage non-burst with atomic scheduling */
+ wrkr->cap.burst = RTE_EVENTMODE_HELPER_RX_TYPE_NON_BURST;
+ wrkr->cap.s1_sched_type = RTE_SCHED_TYPE_ATOMIC;
+ wrkr->nb_stage = 1;
+ wrkr->s1_worker_thread = l2fwd_eventmode_non_burst_atomic_worker;
+
+ nb_wrkr_param++;
+ wrkr++;
+
+ /* Single stage burst with atomic scheduling */
+ wrkr->cap.burst = RTE_EVENTMODE_HELPER_RX_TYPE_BURST;
+ wrkr->cap.s1_sched_type = RTE_SCHED_TYPE_ATOMIC;
+ wrkr->nb_stage = 1;
+ wrkr->s1_worker_thread = l2fwd_eventmode_burst_atomic_worker;
+
+ nb_wrkr_param++;
+ wrkr++;
+
+ /* Single stage non-burst with ordered scheduling */
+ wrkr->cap.burst = RTE_EVENTMODE_HELPER_RX_TYPE_NON_BURST;
+ wrkr->cap.s1_sched_type = RTE_SCHED_TYPE_ORDERED;
+ wrkr->nb_stage = 1;
+ wrkr->s1_worker_thread = l2fwd_eventmode_non_burst_ordered_worker;
+
+ nb_wrkr_param++;
+ wrkr++;
+
+ /* Single stage burst with ordered scheduling */
+ wrkr->cap.burst = RTE_EVENTMODE_HELPER_RX_TYPE_BURST;
+ wrkr->cap.s1_sched_type = RTE_SCHED_TYPE_ORDERED;
+ wrkr->nb_stage = 1;
+ wrkr->s1_worker_thread = l2fwd_eventmode_burst_ordered_worker;
+
+ nb_wrkr_param++;
+ return nb_wrkr_param;
+}
+
+static void
+l2fwd_eventmode_worker(struct rte_eventmode_helper_conf *mode_conf)
+{
+ struct rte_eventmode_helper_app_worker_params
+ l2fwd_wrkr[L2FWD_EVENTMODE_WORKERS] = {0};
+ uint8_t nb_wrkr_param;
+
+ /* Populate l2fwd_wrkr params */
+ nb_wrkr_param = l2fwd_eventmode_populate_wrkr_params(l2fwd_wrkr);
+
+ /*
+ * The helper function will launch the correct worker after checking the
+ * event device's capabilities.
+ */
+ rte_eventmode_helper_launch_worker(mode_conf, l2fwd_wrkr,
+ nb_wrkr_param);
+}
+
int
-l2fwd_launch_one_lcore(__attribute__((unused)) void *dummy)
+l2fwd_launch_one_lcore(void *args)
{
- l2fwd_main_loop();
+ struct rte_eventmode_helper_conf *mode_conf;
+
+ mode_conf = (struct rte_eventmode_helper_conf *)args;
+
+ if (mode_conf->mode == RTE_EVENTMODE_HELPER_PKT_TRANSFER_MODE_POLL) {
+ /* App is initialized to run in poll mode */
+ l2fwd_poll_mode_worker();
+ } else if (mode_conf->mode ==
+ RTE_EVENTMODE_HELPER_PKT_TRANSFER_MODE_EVENT) {
+ /* App is initialized to run in event mode */
+ l2fwd_eventmode_worker(mode_conf);
+ }
return 0;
}
diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index ac81beb..278b9a8 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -38,6 +38,7 @@
#include <rte_ethdev.h>
#include <rte_mempool.h>
#include <rte_mbuf.h>
+#include <rte_eventmode_helper.h>
#include "l2fwd_common.h"
#include "l2fwd_worker.h"
@@ -69,6 +70,8 @@ l2fwd_usage(const char *prgname)
" [-q NQ]",
prgname);
+ rte_eventmode_helper_print_options_list();
+
fprintf(stderr, "\n\n");
fprintf(stderr,
@@ -79,7 +82,9 @@ l2fwd_usage(const char *prgname)
" When enabled:\n"
" - The source MAC address is replaced by the TX port MAC address\n"
" - The destination MAC address is replaced by 02:00:00:00:00:TX_PORT_ID\n"
- "\n");
+ "");
+
+ rte_eventmode_helper_print_options_description();
}
static int
@@ -158,12 +163,14 @@ static const struct option lgopts[] = {
/* Parse the argument given in the command line of the application */
static int
-l2fwd_parse_args(int argc, char **argv)
+l2fwd_parse_args(int argc, char **argv,
+ struct rte_eventmode_helper_conf **mode_conf)
{
- int opt, ret, timer_secs;
+ int opt, timer_secs;
char **argvopt;
int option_index;
char *prgname = argv[0];
+ int options_parsed = 0;
argvopt = argv;
@@ -212,12 +219,31 @@ l2fwd_parse_args(int argc, char **argv)
}
}
- if (optind >= 0)
- argv[optind-1] = prgname;
+ /* Update argc & argv to move to event mode options */
+ options_parsed = optind-1;
+ argc -= options_parsed;
+ argv += options_parsed;
- ret = optind-1;
- optind = 1; /* reset getopt lib */
- return ret;
+ /* Reset getopt lib */
+ optind = 1;
+
+ /* Check for event mode parameters and get the conf prepared*/
+ *mode_conf = rte_eventmode_helper_parse_args(argc, argv);
+ if (*mode_conf == NULL) {
+ l2fwd_usage(prgname);
+ return -1;
+ }
+
+ /* Add the number of options parsed */
+ options_parsed += optind-1;
+
+ if (options_parsed >= 0)
+ argv[options_parsed] = prgname;
+
+ /* Reset getopt lib */
+ optind = 1;
+
+ return options_parsed;
}
/* Check the link status of all ports in up to 9s, and print them finally */
@@ -315,6 +341,7 @@ main(int argc, char **argv)
unsigned nb_ports_in_mask = 0;
unsigned int nb_lcores = 0;
unsigned int nb_mbufs;
+ struct rte_eventmode_helper_conf *mode_conf = NULL;
/* Set default values for global vars */
l2fwd_init_global_vars();
@@ -329,8 +356,12 @@ main(int argc, char **argv)
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
- /* parse application arguments (after the EAL ones) */
- ret = l2fwd_parse_args(argc, argv);
+ /*
+ * Parse application arguments (after the EAL ones). This would parse
+ * the event mode options too, and would set the conf pointer
+ * accordingly.
+ */
+ ret = l2fwd_parse_args(argc, argv, &mode_conf);
if (ret < 0)
rte_exit(EXIT_FAILURE, "Invalid L2FWD arguments\n");
@@ -521,9 +552,20 @@ main(int argc, char **argv)
check_all_ports_link_status(l2fwd_enabled_port_mask);
+ /*
+ * Set the enabled port mask in helper conf to be used by helper
+ * sub-system. This would be used while intializing devices using
+ * helper sub-system.
+ */
+ mode_conf->eth_portmask = l2fwd_enabled_port_mask;
+
+ /* Initialize eventmode components */
+ rte_eventmode_helper_initialize_devs(mode_conf);
+
ret = 0;
/* launch per-lcore init on every lcore */
- rte_eal_mp_remote_launch(l2fwd_launch_one_lcore, NULL, CALL_MASTER);
+ rte_eal_mp_remote_launch(l2fwd_launch_one_lcore, (void *)mode_conf,
+ CALL_MASTER);
RTE_LCORE_FOREACH_SLAVE(lcore_id) {
if (rte_eal_wait_lcore(lcore_id) < 0) {
ret = -1;
--
2.7.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [dpdk-dev] [PATCH 00/20] add eventmode helper functions
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
` (19 preceding siblings ...)
2018-06-08 17:24 ` [dpdk-dev] [PATCH 20/20] examples/l2fwd: add eventmode for l2fwd Anoob Joseph
@ 2018-06-11 8:32 ` Jerin Jacob
20 siblings, 0 replies; 31+ messages in thread
From: Jerin Jacob @ 2018-06-11 8:32 UTC (permalink / raw)
To: Anoob Joseph
Cc: Bruce Richardson, Pablo de Lara, Hemant Agrawal, Narayana Prasad,
Nikhil Rao, Pavan Nikhilesh, Sunil Kumar Kori, dev, gage.eads,
harry.van.haaren, narender.vangati
-----Original Message-----
> Date: Fri, 8 Jun 2018 22:53:59 +0530
> From: Anoob Joseph <anoob.joseph@caviumnetworks.com>
> To: Bruce Richardson <bruce.richardson@intel.com>, Jerin Jacob
> <jerin.jacob@caviumnetworks.com>, Pablo de Lara
> <pablo.de.lara.guarch@intel.com>
> Cc: Anoob Joseph <anoob.joseph@caviumnetworks.com>, Hemant Agrawal
> <hemant.agrawal@nxp.com>, Narayana Prasad
> <narayanaprasad.athreya@caviumnetworks.com>, Nikhil Rao
> <nikhil.rao@intel.com>, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>,
> Sunil Kumar Kori <sunil.kori@nxp.com>, dev@dpdk.org
> Subject: [PATCH 00/20] add eventmode helper functions
> X-Mailer: git-send-email 2.7.4
>
> This patchset adds common initialization code required for using
> applications in event mode. The APIs exposed, abstracts the complex
> configuration options exposed by eventdev, ethdev & eth rx adapter.
> Also, this enables the usage of multiple workers fine tuned for the
> features of the underlying hardware.
>
> With these APIs, existing poll mode applications can be made event
> driven easily, and the applications can better leverage the event
> mode's capabilities.
>
> L2fwd application has been made event-driven to demonstrate the usage
> of helper APIs. Tested with nicvf eth PMD and event_octeontx event
> PMD on Cavium's CN83XX platform.
>
> Parts of this patchset is inspired by an RFC send by
> Sunil Kumar Kori <sunil.kori@nxp.com>
Hi Anoob,
There is bit overlap with Nikhil's TX adapter patches and this series.
I prefer to have Nikhil's Tx adapter gets in first(as he sent the RFC
first) and then rework this series to adapt Tx adapter patches. I think,
this will enable
- application code will be even much cleaner with Tx adapter.
- zero overlap
- no major rework
Nikhil,
When you are planning to send the first version of Tx adapter patch so
we all can review it and give time for Anoob to rework this series
based on Tx adapter APIs'
All,
Is there any concern on overall rte_eventmode_helper.h approach to
avoid code duplication for Rx and Tx adapter configuration codes
across all the applications?
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper
2018-06-08 17:24 ` [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper Anoob Joseph
@ 2018-06-27 6:20 ` Sunil Kumar Kori
2018-06-28 10:43 ` Joseph, Anoob
0 siblings, 1 reply; 31+ messages in thread
From: Sunil Kumar Kori @ 2018-06-27 6:20 UTC (permalink / raw)
To: Anoob Joseph, Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Hemant Agrawal, Narayana Prasad, Nikhil Rao, Pavan Nikhilesh, dev
Regards
Sunil Kumar
> -----Original Message-----
> From: Anoob Joseph [mailto:anoob.joseph@caviumnetworks.com]
> Sent: Friday, June 8, 2018 10:54 PM
> To: Bruce Richardson <bruce.richardson@intel.com>; Jerin Jacob
> <jerin.jacob@caviumnetworks.com>; Pablo de Lara
> <pablo.de.lara.guarch@intel.com>
> Cc: Anoob Joseph <anoob.joseph@caviumnetworks.com>; Hemant Agrawal
> <hemant.agrawal@nxp.com>; Narayana Prasad
> <narayanaprasad.athreya@caviumnetworks.com>; Nikhil Rao
> <nikhil.rao@intel.com>; Pavan Nikhilesh
> <pbhagavatula@caviumnetworks.com>; Sunil Kumar Kori
> <sunil.kori@nxp.com>; dev@dpdk.org
> Subject: [PATCH 01/20] eventdev: add files for eventmode helper
>
> Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
> ---
> lib/librte_eventdev/Makefile | 2 ++
> lib/librte_eventdev/rte_eventmode_helper.c | 7 +++++++
> lib/librte_eventdev/rte_eventmode_helper.h | 6 ++++++
> lib/librte_eventdev/rte_eventmode_helper_internal.h | 6 ++++++
> 4 files changed, 21 insertions(+)
> create mode 100644 lib/librte_eventdev/rte_eventmode_helper.c
> create mode 100644 lib/librte_eventdev/rte_eventmode_helper.h
> create mode 100644 lib/librte_eventdev/rte_eventmode_helper_internal.h
>
Having a separate helper library to configure eventdev may be a overhead to the application
as application needs to understand main DPDK API as well as helper routines.
It can be kept in application as a separate file.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper
2018-06-27 6:20 ` Sunil Kumar Kori
@ 2018-06-28 10:43 ` Joseph, Anoob
2018-06-28 10:47 ` Ananyev, Konstantin
2018-07-03 6:27 ` Sunil Kumar Kori
0 siblings, 2 replies; 31+ messages in thread
From: Joseph, Anoob @ 2018-06-28 10:43 UTC (permalink / raw)
To: Sunil Kumar Kori, Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Hemant Agrawal, Narayana Prasad, Nikhil Rao, Pavan Nikhilesh, dev
Hi Sunil,
On 27-06-2018 11:50, Sunil Kumar Kori wrote:
> External Email
>
> Regards
> Sunil Kumar
>
>> -----Original Message-----
>> From: Anoob Joseph [mailto:anoob.joseph@caviumnetworks.com]
>> Sent: Friday, June 8, 2018 10:54 PM
>> To: Bruce Richardson <bruce.richardson@intel.com>; Jerin Jacob
>> <jerin.jacob@caviumnetworks.com>; Pablo de Lara
>> <pablo.de.lara.guarch@intel.com>
>> Cc: Anoob Joseph <anoob.joseph@caviumnetworks.com>; Hemant Agrawal
>> <hemant.agrawal@nxp.com>; Narayana Prasad
>> <narayanaprasad.athreya@caviumnetworks.com>; Nikhil Rao
>> <nikhil.rao@intel.com>; Pavan Nikhilesh
>> <pbhagavatula@caviumnetworks.com>; Sunil Kumar Kori
>> <sunil.kori@nxp.com>; dev@dpdk.org
>> Subject: [PATCH 01/20] eventdev: add files for eventmode helper
>>
>> Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
>> ---
>> lib/librte_eventdev/Makefile | 2 ++
>> lib/librte_eventdev/rte_eventmode_helper.c | 7 +++++++
>> lib/librte_eventdev/rte_eventmode_helper.h | 6 ++++++
>> lib/librte_eventdev/rte_eventmode_helper_internal.h | 6 ++++++
>> 4 files changed, 21 insertions(+)
>> create mode 100644 lib/librte_eventdev/rte_eventmode_helper.c
>> create mode 100644 lib/librte_eventdev/rte_eventmode_helper.h
>> create mode 100644 lib/librte_eventdev/rte_eventmode_helper_internal.h
>>
> Having a separate helper library to configure eventdev may be a overhead to the application
> as application needs to understand main DPDK API as well as helper routines.
> It can be kept in application as a separate file.
For one application we could add a new file, but if we are to enable
event mode with multiple applications, wouldn't this be duplication of
lot of code? Considering that I haven't added the required parsing
routines, the code additions in one application to make it eventdriven
would be huge.
I do agree that making this as a library poses its own challenges, but
do you have something better in mind? Another option we can think of is
making all these changes part of some common headers and then each
application can include and start using these functions. I'm fine with
any approach, but we need to consider making at-least l3fwd &
ipsec-secgw also event driven.
Thanks,
Anoob
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper
2018-06-28 10:43 ` Joseph, Anoob
@ 2018-06-28 10:47 ` Ananyev, Konstantin
2018-06-28 10:58 ` Joseph, Anoob
2018-07-03 6:27 ` Sunil Kumar Kori
1 sibling, 1 reply; 31+ messages in thread
From: Ananyev, Konstantin @ 2018-06-28 10:47 UTC (permalink / raw)
To: Joseph, Anoob, Sunil Kumar Kori, Richardson, Bruce, Jerin Jacob,
De Lara Guarch, Pablo
Cc: Hemant Agrawal, Narayana Prasad, Rao, Nikhil, Pavan Nikhilesh, dev
Hi Anoob,
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Joseph, Anoob
> Sent: Thursday, June 28, 2018 11:43 AM
> To: Sunil Kumar Kori <sunil.kori@nxp.com>; Richardson, Bruce <bruce.richardson@intel.com>; Jerin Jacob
> <jerin.jacob@caviumnetworks.com>; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Cc: Hemant Agrawal <hemant.agrawal@nxp.com>; Narayana Prasad <narayanaprasad.athreya@caviumnetworks.com>; Rao, Nikhil
> <nikhil.rao@intel.com>; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper
>
> Hi Sunil,
>
> On 27-06-2018 11:50, Sunil Kumar Kori wrote:
> > External Email
> >
> > Regards
> > Sunil Kumar
> >
> >> -----Original Message-----
> >> From: Anoob Joseph [mailto:anoob.joseph@caviumnetworks.com]
> >> Sent: Friday, June 8, 2018 10:54 PM
> >> To: Bruce Richardson <bruce.richardson@intel.com>; Jerin Jacob
> >> <jerin.jacob@caviumnetworks.com>; Pablo de Lara
> >> <pablo.de.lara.guarch@intel.com>
> >> Cc: Anoob Joseph <anoob.joseph@caviumnetworks.com>; Hemant Agrawal
> >> <hemant.agrawal@nxp.com>; Narayana Prasad
> >> <narayanaprasad.athreya@caviumnetworks.com>; Nikhil Rao
> >> <nikhil.rao@intel.com>; Pavan Nikhilesh
> >> <pbhagavatula@caviumnetworks.com>; Sunil Kumar Kori
> >> <sunil.kori@nxp.com>; dev@dpdk.org
> >> Subject: [PATCH 01/20] eventdev: add files for eventmode helper
> >>
> >> Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
> >> ---
> >> lib/librte_eventdev/Makefile | 2 ++
> >> lib/librte_eventdev/rte_eventmode_helper.c | 7 +++++++
> >> lib/librte_eventdev/rte_eventmode_helper.h | 6 ++++++
> >> lib/librte_eventdev/rte_eventmode_helper_internal.h | 6 ++++++
> >> 4 files changed, 21 insertions(+)
> >> create mode 100644 lib/librte_eventdev/rte_eventmode_helper.c
> >> create mode 100644 lib/librte_eventdev/rte_eventmode_helper.h
> >> create mode 100644 lib/librte_eventdev/rte_eventmode_helper_internal.h
> >>
> > Having a separate helper library to configure eventdev may be a overhead to the application
> > as application needs to understand main DPDK API as well as helper routines.
> > It can be kept in application as a separate file.
> For one application we could add a new file, but if we are to enable
> event mode with multiple applications, wouldn't this be duplication of
> lot of code? Considering that I haven't added the required parsing
> routines, the code additions in one application to make it eventdriven
> would be huge.
>
> I do agree that making this as a library poses its own challenges, but
> do you have something better in mind? Another option we can think of is
> making all these changes part of some common headers and then each
> application can include and start using these functions. I'm fine with
> any approach, but we need to consider making at-least l3fwd &
> ipsec-secgw also event driven.
A quick q - does it mean that l3fwd and ipsec-secgw would become event driven only?
Or it would be possible to choose (at startup or at build time) between current and new
behavior?
Konstantin
> Thanks,
> Anoob
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper
2018-06-28 10:47 ` Ananyev, Konstantin
@ 2018-06-28 10:58 ` Joseph, Anoob
2018-06-28 11:44 ` Ananyev, Konstantin
0 siblings, 1 reply; 31+ messages in thread
From: Joseph, Anoob @ 2018-06-28 10:58 UTC (permalink / raw)
To: Ananyev, Konstantin, Sunil Kumar Kori, Richardson, Bruce,
Jerin Jacob, De Lara Guarch, Pablo
Cc: Hemant Agrawal, Narayana Prasad, Rao, Nikhil, Pavan Nikhilesh, dev
Hi Konstantin,
On 28-06-2018 16:17, Ananyev, Konstantin wrote:
> Hi Anoob,
>
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Joseph, Anoob
>> Sent: Thursday, June 28, 2018 11:43 AM
>> To: Sunil Kumar Kori <sunil.kori@nxp.com>; Richardson, Bruce <bruce.richardson@intel.com>; Jerin Jacob
>> <jerin.jacob@caviumnetworks.com>; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
>> Cc: Hemant Agrawal <hemant.agrawal@nxp.com>; Narayana Prasad <narayanaprasad.athreya@caviumnetworks.com>; Rao, Nikhil
>> <nikhil.rao@intel.com>; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>; dev@dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper
>>
>> Hi Sunil,
>>
>> On 27-06-2018 11:50, Sunil Kumar Kori wrote:
>>> External Email
>>>
>>> Regards
>>> Sunil Kumar
>>>
>>>> -----Original Message-----
>>>> From: Anoob Joseph [mailto:anoob.joseph@caviumnetworks.com]
>>>> Sent: Friday, June 8, 2018 10:54 PM
>>>> To: Bruce Richardson <bruce.richardson@intel.com>; Jerin Jacob
>>>> <jerin.jacob@caviumnetworks.com>; Pablo de Lara
>>>> <pablo.de.lara.guarch@intel.com>
>>>> Cc: Anoob Joseph <anoob.joseph@caviumnetworks.com>; Hemant Agrawal
>>>> <hemant.agrawal@nxp.com>; Narayana Prasad
>>>> <narayanaprasad.athreya@caviumnetworks.com>; Nikhil Rao
>>>> <nikhil.rao@intel.com>; Pavan Nikhilesh
>>>> <pbhagavatula@caviumnetworks.com>; Sunil Kumar Kori
>>>> <sunil.kori@nxp.com>; dev@dpdk.org
>>>> Subject: [PATCH 01/20] eventdev: add files for eventmode helper
>>>>
>>>> Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
>>>> ---
>>>> lib/librte_eventdev/Makefile | 2 ++
>>>> lib/librte_eventdev/rte_eventmode_helper.c | 7 +++++++
>>>> lib/librte_eventdev/rte_eventmode_helper.h | 6 ++++++
>>>> lib/librte_eventdev/rte_eventmode_helper_internal.h | 6 ++++++
>>>> 4 files changed, 21 insertions(+)
>>>> create mode 100644 lib/librte_eventdev/rte_eventmode_helper.c
>>>> create mode 100644 lib/librte_eventdev/rte_eventmode_helper.h
>>>> create mode 100644 lib/librte_eventdev/rte_eventmode_helper_internal.h
>>>>
>>> Having a separate helper library to configure eventdev may be a overhead to the application
>>> as application needs to understand main DPDK API as well as helper routines.
>>> It can be kept in application as a separate file.
>> For one application we could add a new file, but if we are to enable
>> event mode with multiple applications, wouldn't this be duplication of
>> lot of code? Considering that I haven't added the required parsing
>> routines, the code additions in one application to make it eventdriven
>> would be huge.
>>
>> I do agree that making this as a library poses its own challenges, but
>> do you have something better in mind? Another option we can think of is
>> making all these changes part of some common headers and then each
>> application can include and start using these functions. I'm fine with
>> any approach, but we need to consider making at-least l3fwd &
>> ipsec-secgw also event driven.
> A quick q - does it mean that l3fwd and ipsec-secgw would become event driven only?
> Or it would be possible to choose (at startup or at build time) between current and new
> behavior?
The mode would be chosen with CL option "--transfer-mode <MODE>". When
MODE=0, the application will run in existing (poll) mode. When MODE=1,
the application would run in event mode. In that case only, event
device, eth rx adapter etc would be initialized and used.
Sample usage: ./l2fwd <EAL options> -- <app options> -- --transfer-mode
0 #for existing behavior
Right now mode is selected during startup. Do you think build time is
better?
Thanks,
Anoob
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper
2018-06-28 10:58 ` Joseph, Anoob
@ 2018-06-28 11:44 ` Ananyev, Konstantin
2018-06-28 11:54 ` Joseph, Anoob
0 siblings, 1 reply; 31+ messages in thread
From: Ananyev, Konstantin @ 2018-06-28 11:44 UTC (permalink / raw)
To: Joseph, Anoob, Sunil Kumar Kori, Richardson, Bruce, Jerin Jacob,
De Lara Guarch, Pablo
Cc: Hemant Agrawal, Narayana Prasad, Rao, Nikhil, Pavan Nikhilesh, dev
> -----Original Message-----
> From: Joseph, Anoob [mailto:Anoob.Joseph@caviumnetworks.com]
> Sent: Thursday, June 28, 2018 11:59 AM
> To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Sunil Kumar Kori <sunil.kori@nxp.com>; Richardson, Bruce
> <bruce.richardson@intel.com>; Jerin Jacob <jerin.jacob@caviumnetworks.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>
> Cc: Hemant Agrawal <hemant.agrawal@nxp.com>; Narayana Prasad <narayanaprasad.athreya@caviumnetworks.com>; Rao, Nikhil
> <nikhil.rao@intel.com>; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper
>
> Hi Konstantin,
>
> On 28-06-2018 16:17, Ananyev, Konstantin wrote:
> > Hi Anoob,
> >
> >> -----Original Message-----
> >> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Joseph, Anoob
> >> Sent: Thursday, June 28, 2018 11:43 AM
> >> To: Sunil Kumar Kori <sunil.kori@nxp.com>; Richardson, Bruce <bruce.richardson@intel.com>; Jerin Jacob
> >> <jerin.jacob@caviumnetworks.com>; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> >> Cc: Hemant Agrawal <hemant.agrawal@nxp.com>; Narayana Prasad <narayanaprasad.athreya@caviumnetworks.com>; Rao,
> Nikhil
> >> <nikhil.rao@intel.com>; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>; dev@dpdk.org
> >> Subject: Re: [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper
> >>
> >> Hi Sunil,
> >>
> >> On 27-06-2018 11:50, Sunil Kumar Kori wrote:
> >>> External Email
> >>>
> >>> Regards
> >>> Sunil Kumar
> >>>
> >>>> -----Original Message-----
> >>>> From: Anoob Joseph [mailto:anoob.joseph@caviumnetworks.com]
> >>>> Sent: Friday, June 8, 2018 10:54 PM
> >>>> To: Bruce Richardson <bruce.richardson@intel.com>; Jerin Jacob
> >>>> <jerin.jacob@caviumnetworks.com>; Pablo de Lara
> >>>> <pablo.de.lara.guarch@intel.com>
> >>>> Cc: Anoob Joseph <anoob.joseph@caviumnetworks.com>; Hemant Agrawal
> >>>> <hemant.agrawal@nxp.com>; Narayana Prasad
> >>>> <narayanaprasad.athreya@caviumnetworks.com>; Nikhil Rao
> >>>> <nikhil.rao@intel.com>; Pavan Nikhilesh
> >>>> <pbhagavatula@caviumnetworks.com>; Sunil Kumar Kori
> >>>> <sunil.kori@nxp.com>; dev@dpdk.org
> >>>> Subject: [PATCH 01/20] eventdev: add files for eventmode helper
> >>>>
> >>>> Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
> >>>> ---
> >>>> lib/librte_eventdev/Makefile | 2 ++
> >>>> lib/librte_eventdev/rte_eventmode_helper.c | 7 +++++++
> >>>> lib/librte_eventdev/rte_eventmode_helper.h | 6 ++++++
> >>>> lib/librte_eventdev/rte_eventmode_helper_internal.h | 6 ++++++
> >>>> 4 files changed, 21 insertions(+)
> >>>> create mode 100644 lib/librte_eventdev/rte_eventmode_helper.c
> >>>> create mode 100644 lib/librte_eventdev/rte_eventmode_helper.h
> >>>> create mode 100644 lib/librte_eventdev/rte_eventmode_helper_internal.h
> >>>>
> >>> Having a separate helper library to configure eventdev may be a overhead to the application
> >>> as application needs to understand main DPDK API as well as helper routines.
> >>> It can be kept in application as a separate file.
> >> For one application we could add a new file, but if we are to enable
> >> event mode with multiple applications, wouldn't this be duplication of
> >> lot of code? Considering that I haven't added the required parsing
> >> routines, the code additions in one application to make it eventdriven
> >> would be huge.
> >>
> >> I do agree that making this as a library poses its own challenges, but
> >> do you have something better in mind? Another option we can think of is
> >> making all these changes part of some common headers and then each
> >> application can include and start using these functions. I'm fine with
> >> any approach, but we need to consider making at-least l3fwd &
> >> ipsec-secgw also event driven.
> > A quick q - does it mean that l3fwd and ipsec-secgw would become event driven only?
> > Or it would be possible to choose (at startup or at build time) between current and new
> > behavior?
> The mode would be chosen with CL option "--transfer-mode <MODE>". When
> MODE=0, the application will run in existing (poll) mode. When MODE=1,
> the application would run in event mode. In that case only, event
> device, eth rx adapter etc would be initialized and used.
Ok sounds good to me.
>
> Sample usage: ./l2fwd <EAL options> -- <app options> -- --transfer-mode
> 0 #for existing behavior
>
> Right now mode is selected during startup. Do you think build time is
> better?
No, I am quite happy with suggested approach.
My only concern would be to keep intact existing functionality/performance
and minimize changes in the existing code.
Thanks
Konstantin
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper
2018-06-28 11:44 ` Ananyev, Konstantin
@ 2018-06-28 11:54 ` Joseph, Anoob
0 siblings, 0 replies; 31+ messages in thread
From: Joseph, Anoob @ 2018-06-28 11:54 UTC (permalink / raw)
To: Ananyev, Konstantin, Sunil Kumar Kori, Richardson, Bruce,
Jerin Jacob, De Lara Guarch, Pablo
Cc: Hemant Agrawal, Narayana Prasad, Rao, Nikhil, Pavan Nikhilesh, dev
Hi Konstantin,
On 28-06-2018 17:14, Ananyev, Konstantin wrote:
>
>> -----Original Message-----
>> From: Joseph, Anoob [mailto:Anoob.Joseph@caviumnetworks.com]
>> Sent: Thursday, June 28, 2018 11:59 AM
>> To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Sunil Kumar Kori <sunil.kori@nxp.com>; Richardson, Bruce
>> <bruce.richardson@intel.com>; Jerin Jacob <jerin.jacob@caviumnetworks.com>; De Lara Guarch, Pablo
>> <pablo.de.lara.guarch@intel.com>
>> Cc: Hemant Agrawal <hemant.agrawal@nxp.com>; Narayana Prasad <narayanaprasad.athreya@caviumnetworks.com>; Rao, Nikhil
>> <nikhil.rao@intel.com>; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>; dev@dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper
>>
>> Hi Konstantin,
>>
>> On 28-06-2018 16:17, Ananyev, Konstantin wrote:
>>> Hi Anoob,
>>>
>>>> -----Original Message-----
>>>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Joseph, Anoob
>>>> Sent: Thursday, June 28, 2018 11:43 AM
>>>> To: Sunil Kumar Kori <sunil.kori@nxp.com>; Richardson, Bruce <bruce.richardson@intel.com>; Jerin Jacob
>>>> <jerin.jacob@caviumnetworks.com>; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
>>>> Cc: Hemant Agrawal <hemant.agrawal@nxp.com>; Narayana Prasad <narayanaprasad.athreya@caviumnetworks.com>; Rao,
>> Nikhil
>>>> <nikhil.rao@intel.com>; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>; dev@dpdk.org
>>>> Subject: Re: [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper
>>>>
>>>> Hi Sunil,
>>>>
>>>> On 27-06-2018 11:50, Sunil Kumar Kori wrote:
>>>>> External Email
>>>>>
>>>>> Regards
>>>>> Sunil Kumar
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Anoob Joseph [mailto:anoob.joseph@caviumnetworks.com]
>>>>>> Sent: Friday, June 8, 2018 10:54 PM
>>>>>> To: Bruce Richardson <bruce.richardson@intel.com>; Jerin Jacob
>>>>>> <jerin.jacob@caviumnetworks.com>; Pablo de Lara
>>>>>> <pablo.de.lara.guarch@intel.com>
>>>>>> Cc: Anoob Joseph <anoob.joseph@caviumnetworks.com>; Hemant Agrawal
>>>>>> <hemant.agrawal@nxp.com>; Narayana Prasad
>>>>>> <narayanaprasad.athreya@caviumnetworks.com>; Nikhil Rao
>>>>>> <nikhil.rao@intel.com>; Pavan Nikhilesh
>>>>>> <pbhagavatula@caviumnetworks.com>; Sunil Kumar Kori
>>>>>> <sunil.kori@nxp.com>; dev@dpdk.org
>>>>>> Subject: [PATCH 01/20] eventdev: add files for eventmode helper
>>>>>>
>>>>>> Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
>>>>>> ---
>>>>>> lib/librte_eventdev/Makefile | 2 ++
>>>>>> lib/librte_eventdev/rte_eventmode_helper.c | 7 +++++++
>>>>>> lib/librte_eventdev/rte_eventmode_helper.h | 6 ++++++
>>>>>> lib/librte_eventdev/rte_eventmode_helper_internal.h | 6 ++++++
>>>>>> 4 files changed, 21 insertions(+)
>>>>>> create mode 100644 lib/librte_eventdev/rte_eventmode_helper.c
>>>>>> create mode 100644 lib/librte_eventdev/rte_eventmode_helper.h
>>>>>> create mode 100644 lib/librte_eventdev/rte_eventmode_helper_internal.h
>>>>>>
>>>>> Having a separate helper library to configure eventdev may be a overhead to the application
>>>>> as application needs to understand main DPDK API as well as helper routines.
>>>>> It can be kept in application as a separate file.
>>>> For one application we could add a new file, but if we are to enable
>>>> event mode with multiple applications, wouldn't this be duplication of
>>>> lot of code? Considering that I haven't added the required parsing
>>>> routines, the code additions in one application to make it eventdriven
>>>> would be huge.
>>>>
>>>> I do agree that making this as a library poses its own challenges, but
>>>> do you have something better in mind? Another option we can think of is
>>>> making all these changes part of some common headers and then each
>>>> application can include and start using these functions. I'm fine with
>>>> any approach, but we need to consider making at-least l3fwd &
>>>> ipsec-secgw also event driven.
>>> A quick q - does it mean that l3fwd and ipsec-secgw would become event driven only?
>>> Or it would be possible to choose (at startup or at build time) between current and new
>>> behavior?
>> The mode would be chosen with CL option "--transfer-mode <MODE>". When
>> MODE=0, the application will run in existing (poll) mode. When MODE=1,
>> the application would run in event mode. In that case only, event
>> device, eth rx adapter etc would be initialized and used.
> Ok sounds good to me.
>
>> Sample usage: ./l2fwd <EAL options> -- <app options> -- --transfer-mode
>> 0 #for existing behavior
>>
>> Right now mode is selected during startup. Do you think build time is
>> better?
> No, I am quite happy with suggested approach.
> My only concern would be to keep intact existing functionality/performance
> and minimize changes in the existing code.
> Thanks
> Konstantin
>
>
Existing functionality/performance would be intact. That was the whole
idea with the helper function additions. Following would be a rough
estimate of the additions,
1. Call to the helper function to print the usage in app_usage
2. Call to the helper function to parse the args and return the
generated "conf"
3. Call to the helper function for initializing devs based on conf (when
poll mode, this will return immediately)
4. Launch worker based on conf. When it's poll mode, call the existing
poll mode worker.
Hope this approach is fine even when extended to other apps.
Thanks,
Anoob
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper
2018-06-28 10:43 ` Joseph, Anoob
2018-06-28 10:47 ` Ananyev, Konstantin
@ 2018-07-03 6:27 ` Sunil Kumar Kori
2018-07-03 13:13 ` Joseph, Anoob
1 sibling, 1 reply; 31+ messages in thread
From: Sunil Kumar Kori @ 2018-07-03 6:27 UTC (permalink / raw)
To: Joseph, Anoob, Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Hemant Agrawal, Narayana Prasad, Nikhil Rao, Pavan Nikhilesh, dev
Hello Anoob,
Regards
Sunil Kumar
> -----Original Message-----
> From: Joseph, Anoob [mailto:Anoob.Joseph@caviumnetworks.com]
> Sent: Thursday, June 28, 2018 4:13 PM
> To: Sunil Kumar Kori <sunil.kori@nxp.com>; Bruce Richardson
> <bruce.richardson@intel.com>; Jerin Jacob
> <jerin.jacob@caviumnetworks.com>; Pablo de Lara
> <pablo.de.lara.guarch@intel.com>
> Cc: Hemant Agrawal <hemant.agrawal@nxp.com>; Narayana Prasad
> <narayanaprasad.athreya@caviumnetworks.com>; Nikhil Rao
> <nikhil.rao@intel.com>; Pavan Nikhilesh
> <pbhagavatula@caviumnetworks.com>; dev@dpdk.org
> Subject: Re: [PATCH 01/20] eventdev: add files for eventmode helper
>
> Hi Sunil,
>
> On 27-06-2018 11:50, Sunil Kumar Kori wrote:
> > External Email
> >
> > Regards
> > Sunil Kumar
> >
> >> -----Original Message-----
> >> From: Anoob Joseph [mailto:anoob.joseph@caviumnetworks.com]
> >> Sent: Friday, June 8, 2018 10:54 PM
> >> To: Bruce Richardson <bruce.richardson@intel.com>; Jerin Jacob
> >> <jerin.jacob@caviumnetworks.com>; Pablo de Lara
> >> <pablo.de.lara.guarch@intel.com>
> >> Cc: Anoob Joseph <anoob.joseph@caviumnetworks.com>; Hemant Agrawal
> >> <hemant.agrawal@nxp.com>; Narayana Prasad
> >> <narayanaprasad.athreya@caviumnetworks.com>; Nikhil Rao
> >> <nikhil.rao@intel.com>; Pavan Nikhilesh
> >> <pbhagavatula@caviumnetworks.com>; Sunil Kumar Kori
> >> <sunil.kori@nxp.com>; dev@dpdk.org
> >> Subject: [PATCH 01/20] eventdev: add files for eventmode helper
> >>
> >> Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
> >> ---
> >> lib/librte_eventdev/Makefile | 2 ++
> >> lib/librte_eventdev/rte_eventmode_helper.c | 7 +++++++
> >> lib/librte_eventdev/rte_eventmode_helper.h | 6 ++++++
> >> lib/librte_eventdev/rte_eventmode_helper_internal.h | 6 ++++++
> >> 4 files changed, 21 insertions(+)
> >> create mode 100644 lib/librte_eventdev/rte_eventmode_helper.c
> >> create mode 100644 lib/librte_eventdev/rte_eventmode_helper.h
> >> create mode 100644
> >> lib/librte_eventdev/rte_eventmode_helper_internal.h
> >>
> > Having a separate helper library to configure eventdev may be a
> > overhead to the application as application needs to understand main DPDK API
> as well as helper routines.
> > It can be kept in application as a separate file.
> For one application we could add a new file, but if we are to enable event mode
> with multiple applications, wouldn't this be duplication of lot of code?
> Considering that I haven't added the required parsing routines, the code
> additions in one application to make it eventdriven would be huge.
>
> I do agree that making this as a library poses its own challenges, but do you have
> something better in mind? Another option we can think of is making all these
> changes part of some common headers and then each application can include
> and start using these functions. I'm fine with any approach, but we need to
> consider making at-least l3fwd & ipsec-secgw also event driven.
>
With this approach, following may be the challenges:
1. Documentation will be required for user to use eventdev helper library.
2. Helper library should cater all the generic use cases which can be catered from rte_eventdev_*** library.
If not, supported configuration/use cases should also be documented and should be future evolving with eventdev library enhancements.
> Thanks,
> Anoob
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper
2018-07-03 6:27 ` Sunil Kumar Kori
@ 2018-07-03 13:13 ` Joseph, Anoob
2018-07-04 10:49 ` Sunil Kumar Kori
0 siblings, 1 reply; 31+ messages in thread
From: Joseph, Anoob @ 2018-07-03 13:13 UTC (permalink / raw)
To: Sunil Kumar Kori, Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Hemant Agrawal, Narayana Prasad, Nikhil Rao, Pavan Nikhilesh, dev
Hi Sunil,
Please see inline.
Thanks,
Anoob
On 03-07-2018 11:57, Sunil Kumar Kori wrote:
> External Email
>
> Hello Anoob,
>
> Regards
> Sunil Kumar
>
>> -----Original Message-----
>> From: Joseph, Anoob [mailto:Anoob.Joseph@caviumnetworks.com]
>> Sent: Thursday, June 28, 2018 4:13 PM
>> To: Sunil Kumar Kori <sunil.kori@nxp.com>; Bruce Richardson
>> <bruce.richardson@intel.com>; Jerin Jacob
>> <jerin.jacob@caviumnetworks.com>; Pablo de Lara
>> <pablo.de.lara.guarch@intel.com>
>> Cc: Hemant Agrawal <hemant.agrawal@nxp.com>; Narayana Prasad
>> <narayanaprasad.athreya@caviumnetworks.com>; Nikhil Rao
>> <nikhil.rao@intel.com>; Pavan Nikhilesh
>> <pbhagavatula@caviumnetworks.com>; dev@dpdk.org
>> Subject: Re: [PATCH 01/20] eventdev: add files for eventmode helper
>>
>> Hi Sunil,
>>
>> On 27-06-2018 11:50, Sunil Kumar Kori wrote:
>>> External Email
>>>
>>> Regards
>>> Sunil Kumar
>>>
>>>> -----Original Message-----
>>>> From: Anoob Joseph [mailto:anoob.joseph@caviumnetworks.com]
>>>> Sent: Friday, June 8, 2018 10:54 PM
>>>> To: Bruce Richardson <bruce.richardson@intel.com>; Jerin Jacob
>>>> <jerin.jacob@caviumnetworks.com>; Pablo de Lara
>>>> <pablo.de.lara.guarch@intel.com>
>>>> Cc: Anoob Joseph <anoob.joseph@caviumnetworks.com>; Hemant Agrawal
>>>> <hemant.agrawal@nxp.com>; Narayana Prasad
>>>> <narayanaprasad.athreya@caviumnetworks.com>; Nikhil Rao
>>>> <nikhil.rao@intel.com>; Pavan Nikhilesh
>>>> <pbhagavatula@caviumnetworks.com>; Sunil Kumar Kori
>>>> <sunil.kori@nxp.com>; dev@dpdk.org
>>>> Subject: [PATCH 01/20] eventdev: add files for eventmode helper
>>>>
>>>> Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
>>>> ---
>>>> lib/librte_eventdev/Makefile | 2 ++
>>>> lib/librte_eventdev/rte_eventmode_helper.c | 7 +++++++
>>>> lib/librte_eventdev/rte_eventmode_helper.h | 6 ++++++
>>>> lib/librte_eventdev/rte_eventmode_helper_internal.h | 6 ++++++
>>>> 4 files changed, 21 insertions(+)
>>>> create mode 100644 lib/librte_eventdev/rte_eventmode_helper.c
>>>> create mode 100644 lib/librte_eventdev/rte_eventmode_helper.h
>>>> create mode 100644
>>>> lib/librte_eventdev/rte_eventmode_helper_internal.h
>>>>
>>> Having a separate helper library to configure eventdev may be a
>>> overhead to the application as application needs to understand main DPDK API
>> as well as helper routines.
>>> It can be kept in application as a separate file.
>> For one application we could add a new file, but if we are to enable event mode
>> with multiple applications, wouldn't this be duplication of lot of code?
>> Considering that I haven't added the required parsing routines, the code
>> additions in one application to make it eventdriven would be huge.
>>
>> I do agree that making this as a library poses its own challenges, but do you have
>> something better in mind? Another option we can think of is making all these
>> changes part of some common headers and then each application can include
>> and start using these functions. I'm fine with any approach, but we need to
>> consider making at-least l3fwd & ipsec-secgw also event driven.
>>
> With this approach, following may be the challenges:
> 1. Documentation will be required for user to use eventdev helper library.
> 2. Helper library should cater all the generic use cases which can be catered from rte_eventdev_*** library.
> If not, supported configuration/use cases should also be documented and should be future evolving with eventdev library enhancements.
The formal documentation is yet to be added. I do agree that we will
need a sufficiently detailed documentation for the helper. Right now,
all helper routines are added with enough scope for development in the
future. This patch series was to float the helper library idea and get
possible suggestions for improvement.
Is there any other issue with the approach, apart from the documentation?
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper
2018-07-03 13:13 ` Joseph, Anoob
@ 2018-07-04 10:49 ` Sunil Kumar Kori
0 siblings, 0 replies; 31+ messages in thread
From: Sunil Kumar Kori @ 2018-07-04 10:49 UTC (permalink / raw)
To: Joseph, Anoob, Bruce Richardson, Jerin Jacob, Pablo de Lara
Cc: Hemant Agrawal, Narayana Prasad, Nikhil Rao, Pavan Nikhilesh, dev
Hello Anoob,
Comments inline.
Regards
Sunil Kumar
> -----Original Message-----
> From: Joseph, Anoob [mailto:Anoob.Joseph@caviumnetworks.com]
> Sent: Tuesday, July 3, 2018 6:44 PM
> To: Sunil Kumar Kori <sunil.kori@nxp.com>; Bruce Richardson
> <bruce.richardson@intel.com>; Jerin Jacob
> <jerin.jacob@caviumnetworks.com>; Pablo de Lara
> <pablo.de.lara.guarch@intel.com>
> Cc: Hemant Agrawal <hemant.agrawal@nxp.com>; Narayana Prasad
> <narayanaprasad.athreya@caviumnetworks.com>; Nikhil Rao
> <nikhil.rao@intel.com>; Pavan Nikhilesh
> <pbhagavatula@caviumnetworks.com>; dev@dpdk.org
> Subject: Re: [PATCH 01/20] eventdev: add files for eventmode helper
>
> Hi Sunil,
>
> Please see inline.
>
> Thanks,
>
> Anoob
>
>
> On 03-07-2018 11:57, Sunil Kumar Kori wrote:
> > External Email
> >
> > Hello Anoob,
> >
> > Regards
> > Sunil Kumar
> >
> >> -----Original Message-----
> >> From: Joseph, Anoob [mailto:Anoob.Joseph@caviumnetworks.com]
> >> Sent: Thursday, June 28, 2018 4:13 PM
> >> To: Sunil Kumar Kori <sunil.kori@nxp.com>; Bruce Richardson
> >> <bruce.richardson@intel.com>; Jerin Jacob
> >> <jerin.jacob@caviumnetworks.com>; Pablo de Lara
> >> <pablo.de.lara.guarch@intel.com>
> >> Cc: Hemant Agrawal <hemant.agrawal@nxp.com>; Narayana Prasad
> >> <narayanaprasad.athreya@caviumnetworks.com>; Nikhil Rao
> >> <nikhil.rao@intel.com>; Pavan Nikhilesh
> >> <pbhagavatula@caviumnetworks.com>; dev@dpdk.org
> >> Subject: Re: [PATCH 01/20] eventdev: add files for eventmode helper
> >>
> >> Hi Sunil,
> >>
> >> On 27-06-2018 11:50, Sunil Kumar Kori wrote:
> >>> External Email
> >>>
> >>> Regards
> >>> Sunil Kumar
> >>>
> >>>> -----Original Message-----
> >>>> From: Anoob Joseph [mailto:anoob.joseph@caviumnetworks.com]
> >>>> Sent: Friday, June 8, 2018 10:54 PM
> >>>> To: Bruce Richardson <bruce.richardson@intel.com>; Jerin Jacob
> >>>> <jerin.jacob@caviumnetworks.com>; Pablo de Lara
> >>>> <pablo.de.lara.guarch@intel.com>
> >>>> Cc: Anoob Joseph <anoob.joseph@caviumnetworks.com>; Hemant
> Agrawal
> >>>> <hemant.agrawal@nxp.com>; Narayana Prasad
> >>>> <narayanaprasad.athreya@caviumnetworks.com>; Nikhil Rao
> >>>> <nikhil.rao@intel.com>; Pavan Nikhilesh
> >>>> <pbhagavatula@caviumnetworks.com>; Sunil Kumar Kori
> >>>> <sunil.kori@nxp.com>; dev@dpdk.org
> >>>> Subject: [PATCH 01/20] eventdev: add files for eventmode helper
> >>>>
> >>>> Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
> >>>> ---
> >>>> lib/librte_eventdev/Makefile | 2 ++
> >>>> lib/librte_eventdev/rte_eventmode_helper.c | 7 +++++++
> >>>> lib/librte_eventdev/rte_eventmode_helper.h | 6 ++++++
> >>>> lib/librte_eventdev/rte_eventmode_helper_internal.h | 6 ++++++
> >>>> 4 files changed, 21 insertions(+)
> >>>> create mode 100644 lib/librte_eventdev/rte_eventmode_helper.c
> >>>> create mode 100644 lib/librte_eventdev/rte_eventmode_helper.h
> >>>> create mode 100644
> >>>> lib/librte_eventdev/rte_eventmode_helper_internal.h
> >>>>
> >>> Having a separate helper library to configure eventdev may be a
> >>> overhead to the application as application needs to understand main
> >>> DPDK API
> >> as well as helper routines.
> >>> It can be kept in application as a separate file.
> >> For one application we could add a new file, but if we are to enable
> >> event mode with multiple applications, wouldn't this be duplication of lot of
> code?
> >> Considering that I haven't added the required parsing routines, the
> >> code additions in one application to make it eventdriven would be huge.
> >>
> >> I do agree that making this as a library poses its own challenges,
> >> but do you have something better in mind? Another option we can think
> >> of is making all these changes part of some common headers and then
> >> each application can include and start using these functions. I'm
> >> fine with any approach, but we need to consider making at-least l3fwd &
> ipsec-secgw also event driven.
> >>
> > With this approach, following may be the challenges:
> > 1. Documentation will be required for user to use eventdev helper library.
> > 2. Helper library should cater all the generic use cases which can be catered
> from rte_eventdev_*** library.
> > If not, supported configuration/use cases should also be documented and
> should be future evolving with eventdev library enhancements.
> The formal documentation is yet to be added. I do agree that we will need a
> sufficiently detailed documentation for the helper. Right now, all helper routines
> are added with enough scope for development in the future. This patch series
> was to float the helper library idea and get possible suggestions for
> improvement.
>
> Is there any other issue with the approach, apart from the documentation?
No, I am okay with current approach.
^ permalink raw reply [flat|nested] 31+ messages in thread
end of thread, other threads:[~2018-07-04 10:49 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper Anoob Joseph
2018-06-27 6:20 ` Sunil Kumar Kori
2018-06-28 10:43 ` Joseph, Anoob
2018-06-28 10:47 ` Ananyev, Konstantin
2018-06-28 10:58 ` Joseph, Anoob
2018-06-28 11:44 ` Ananyev, Konstantin
2018-06-28 11:54 ` Joseph, Anoob
2018-07-03 6:27 ` Sunil Kumar Kori
2018-07-03 13:13 ` Joseph, Anoob
2018-07-04 10:49 ` Sunil Kumar Kori
2018-06-08 17:24 ` [dpdk-dev] [PATCH 02/20] eventdev: add routines for logging " Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 03/20] eventdev: add eventmode CL options framework Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 04/20] eventdev: allow application to set ethernet portmask Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 05/20] eventdev: add framework for eventmode conf Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 06/20] eventdev: add common initialize routine for eventmode devs Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 07/20] eventdev: add eventdevice init for eventmode Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 08/20] eventdev: add eventdev port-lcore link Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 09/20] eventdev: add option to specify schedule mode for app stage Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 10/20] eventdev: add placeholder for ethdev init Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 11/20] eventdev: add Rx adapter init in eventmode Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 12/20] eventdev: add routine to validate conf Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 13/20] eventdev: add default conf for event devs field in conf Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 14/20] eventdev: add default conf for Rx adapter conf Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 15/20] eventdev: add default conf for event port-lcore link Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 16/20] eventdev: add routines to display the eventmode conf Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 17/20] eventdev: add routine to access eventmode link info Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 18/20] eventdev: add routine to access event queue for eth Tx Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 19/20] eventdev: add routine to launch eventmode workers Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 20/20] examples/l2fwd: add eventmode for l2fwd Anoob Joseph
2018-06-11 8:32 ` [dpdk-dev] [PATCH 00/20] add eventmode helper functions Jerin Jacob
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).