* [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD
@ 2016-11-16 18:00 Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 1/7] eventdev: header and implementation Harry van Haaren
` (7 more replies)
0 siblings, 8 replies; 18+ messages in thread
From: Harry van Haaren @ 2016-11-16 18:00 UTC (permalink / raw)
To: dev; +Cc: Harry van Haaren
This series of RFC patches implements the libeventdev API and a software
eventdev PMD.
The implementation here is intended to enable the community to use the
eventdev API, specifically to test if the API serves the purpose that it is
designed to. It should be noted this is an RFC implementation, and hence
there should be no performance expectations.
An RFC for the eventdev was sent in August[1] by Jerin Jacob of Cavium,
which introduced the core concepts of the eventdev to the community. Since
then there has been extensive discussion[2] on the mailing list, which had
led to various modifications to the initial proposed API.
The API as presented in the first patch contains a number of changes that
have not yet been discussed. These changes were noticed during the
implementation of the software eventdev PMD, and were added to the API to
enable completion of the PMD. These modifications include a statistics API
and a dump API. For more details, please refer to the commit message of the
patch itself.
The functionality provided by each of the patches is as follows:
1: Add eventdev API and library infrastructure
2: Enable compilation of library
3: Add software eventdev PMD
4: Enable compilation of PMD
5: Add test code
6: Enable test code compilation
7: Sample application demonstrating basic usage
This breakdown of the patchset hopefully enables the community to experiment
with the eventdev API, and allows us all to gain first-hand experience in
using the eventdev API. Note also that this patchset has not passed
checkpatch testing just yet - will fix for v2 :)
As next steps I see value in discussing the proposed changes included in
this version of the header file, while welcoming feedback from the community
on the API in general too.
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
[1] http://dpdk.org/ml/archives/dev/2016-August/045181.html
[2] http://dpdk.org/ml/archives/dev/2016-October/thread.html#48196
Harry van Haaren (7):
eventdev: header and implementation
eventdev: makefiles
event/sw: software eventdev implementation
event/sw: makefiles and config
test/eventdev: unit and functional tests
test/eventdev: unit func makefiles
examples/eventdev_pipeline: adding example
app/test/Makefile | 3 +
app/test/test_eventdev_func.c | 1272 ++++++++++++++++++++++++
app/test/test_eventdev_unit.c | 557 +++++++++++
config/common_base | 12 +
drivers/Makefile | 1 +
drivers/event/Makefile | 36 +
drivers/event/sw/Makefile | 59 ++
drivers/event/sw/event_ring.h | 142 +++
drivers/event/sw/iq_ring.h | 160 +++
drivers/event/sw/rte_pmd_evdev_sw_version.map | 3 +
drivers/event/sw/sw_evdev.c | 619 ++++++++++++
drivers/event/sw/sw_evdev.h | 234 +++++
drivers/event/sw/sw_evdev_scheduler.c | 660 +++++++++++++
drivers/event/sw/sw_evdev_worker.c | 218 +++++
examples/eventdev_pipeline/Makefile | 49 +
examples/eventdev_pipeline/main.c | 717 ++++++++++++++
lib/Makefile | 1 +
lib/librte_eal/common/include/rte_vdev.h | 1 +
lib/librte_eventdev/Makefile | 54 ++
lib/librte_eventdev/rte_eventdev.c | 466 +++++++++
lib/librte_eventdev/rte_eventdev.h | 1289 +++++++++++++++++++++++++
lib/librte_eventdev/rte_eventdev_ops.h | 177 ++++
lib/librte_eventdev/rte_eventdev_pmd.h | 69 ++
lib/librte_eventdev/rte_eventdev_version.map | 33 +
mk/rte.app.mk | 5 +
25 files changed, 6837 insertions(+)
create mode 100644 app/test/test_eventdev_func.c
create mode 100644 app/test/test_eventdev_unit.c
create mode 100644 drivers/event/Makefile
create mode 100644 drivers/event/sw/Makefile
create mode 100644 drivers/event/sw/event_ring.h
create mode 100644 drivers/event/sw/iq_ring.h
create mode 100644 drivers/event/sw/rte_pmd_evdev_sw_version.map
create mode 100644 drivers/event/sw/sw_evdev.c
create mode 100644 drivers/event/sw/sw_evdev.h
create mode 100644 drivers/event/sw/sw_evdev_scheduler.c
create mode 100644 drivers/event/sw/sw_evdev_worker.c
create mode 100644 examples/eventdev_pipeline/Makefile
create mode 100644 examples/eventdev_pipeline/main.c
create mode 100644 lib/librte_eventdev/Makefile
create mode 100644 lib/librte_eventdev/rte_eventdev.c
create mode 100644 lib/librte_eventdev/rte_eventdev.h
create mode 100644 lib/librte_eventdev/rte_eventdev_ops.h
create mode 100644 lib/librte_eventdev/rte_eventdev_pmd.h
create mode 100644 lib/librte_eventdev/rte_eventdev_version.map
--
2.7.4
^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH 1/7] eventdev: header and implementation
2016-11-16 18:00 [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD Harry van Haaren
@ 2016-11-16 18:00 ` Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 2/7] eventdev: makefiles Harry van Haaren
` (6 subsequent siblings)
7 siblings, 0 replies; 18+ messages in thread
From: Harry van Haaren @ 2016-11-16 18:00 UTC (permalink / raw)
To: dev; +Cc: Harry van Haaren, Gage Eads, Bruce Richardson
This commit adds the eventdev API header, and the library infrastructure
necessary to work with an eventdev instance. The header is mostly the same
as discussed on the mailing list, in particular see the libeventdev RFC
thread[1]. A second thread[2] gathered input from the community, which
resulted in various modifications to the header.
Since then, some modifications have been made that were discovered during
the implementation of the software implementation of an eventdev. These
changes are present in this header as suggestions, and feedback on these
changes is welcomed. Some of the main items are:
- A statistics API, similar to rte_ethdev_stats_get()
- A dump API, similar to rte_ring_dump()
- Return value of rte_eventdev_enqueue() changed for dequeue consistency
- rte_event has implementation/operation field as discussed[3]
- Add enqueue types using operation[4]
This commit does not change any existing DPDK code - only adds the eventdev
header and infrastructure.
Signed-off-by: Gage Eads <gage.eads@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
[1] http://dpdk.org/ml/archives/dev/2016-August/045181.html
[2] http://dpdk.org/ml/archives/dev/2016-October/048196.html
[3] http://dpdk.org/ml/archives/dev/2016-October/049459.html
[4] http://dpdk.org/ml/archives/dev/2016-October/049641.html
---
lib/librte_eventdev/rte_eventdev.c | 466 ++++++++++
lib/librte_eventdev/rte_eventdev.h | 1272 ++++++++++++++++++++++++++
lib/librte_eventdev/rte_eventdev_ops.h | 177 ++++
lib/librte_eventdev/rte_eventdev_pmd.h | 69 ++
lib/librte_eventdev/rte_eventdev_version.map | 33 +
5 files changed, 2017 insertions(+)
create mode 100644 lib/librte_eventdev/rte_eventdev.c
create mode 100644 lib/librte_eventdev/rte_eventdev.h
create mode 100644 lib/librte_eventdev/rte_eventdev_ops.h
create mode 100644 lib/librte_eventdev/rte_eventdev_pmd.h
create mode 100644 lib/librte_eventdev/rte_eventdev_version.map
diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
new file mode 100644
index 0000000..aace5ca
--- /dev/null
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -0,0 +1,466 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+
+#include <rte_eal.h>
+#include <rte_eal_memconfig.h>
+#include <rte_dev.h>
+#include "rte_eventdev.h"
+#include "rte_eventdev_pmd.h"
+#include "rte_eventdev_ops.h"
+
+#define RTE_MAX_EVENT_DEVS 32
+struct rte_event_dev *event_devs[RTE_MAX_EVENT_DEVS];
+static int rte_num_event_dev_pmds;
+
+TAILQ_HEAD(rte_eventdev_list, rte_event_dev);
+
+static struct rte_tailq_elem rte_eventdev_tailq = {
+ .name = "EVENT_DEVS",
+};
+EAL_REGISTER_TAILQ(rte_eventdev_tailq)
+
+#ifdef RTE_LIBRTE_EVENTDEV_DEBUG
+#define RTE_PMD_DEBUG_TRACE(...) \
+ rte_pmd_debug_trace(__func__, __VA_ARGS__)
+#else
+#define RTE_PMD_DEBUG_TRACE(...)
+#endif
+
+
+int
+rte_event_dev_register(struct rte_event_dev *new_dev)
+{
+ uint8_t index = rte_num_event_dev_pmds;
+ struct rte_eventdev_list *list;
+
+ list = RTE_TAILQ_CAST(rte_eventdev_tailq.head, rte_eventdev_list);
+
+ /* The primary process is responsible for adding the eventdevs to the
+ * tailQ, and the secondary processes simply look up the eventdev in
+ * the list and add it to their local array for fast access.
+ */
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ new_dev->id = index;
+
+ rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK);
+ TAILQ_INSERT_TAIL(list, new_dev, next);
+ rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);
+ } else {
+ struct rte_event_dev *dev;
+
+ bool found = false;
+ rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK);
+ TAILQ_FOREACH(dev, list, next) {
+ if (strcmp(dev->name, new_dev->name) == 0) {
+ found = true;
+ break;
+ }
+ }
+ rte_rwlock_read_unlock(RTE_EAL_TAILQ_RWLOCK);
+
+ if (!found)
+ return -1;
+ }
+
+ event_devs[new_dev->id] = new_dev;
+
+ rte_num_event_dev_pmds++;
+
+ return 0;
+}
+
+uint8_t
+rte_event_dev_count(void)
+{
+ return rte_num_event_dev_pmds;
+}
+
+int8_t
+rte_event_dev_get_dev_id(const char *name)
+{
+ struct rte_event_dev *d;
+ int i;
+
+ /* FIXME: This loop only works on secondary processes when the same
+ * eventdev vdevs as the primary process are passed on the command
+ * line.
+ */
+ for (i = 0; i < rte_num_event_dev_pmds; i++) {
+ d = event_devs[i];
+ if (strcmp(d->name, name) == 0)
+ return d->id;
+ }
+ return -EINVAL;
+}
+
+int
+rte_event_dev_socket_id(uint8_t dev_id)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev)
+ return -EINVAL;
+
+ return dev->socket_id;
+}
+
+int
+rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev_info)
+ return -EINVAL;
+
+ *dev_info = dev->info;
+
+ return 0;
+}
+
+int
+rte_event_dev_configure(uint8_t dev_id, struct rte_event_dev_config *config)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+ int ret;
+
+ if (!dev || dev->configured || !config)
+ return -EINVAL;
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev->ops->configure, -ENOTSUP);
+ ret = dev->ops->configure(dev, config);
+ if (ret)
+ return ret;
+
+ dev->configured = true;
+
+ return 0;
+}
+
+void
+rte_event_queue_default_conf_get(uint8_t dev_id,
+ uint8_t queue_id,
+ struct rte_event_queue_conf *queue_conf)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return;
+
+ RTE_FUNC_PTR_OR_RET(dev->ops->queue_default_conf_get);
+ return dev->ops->queue_default_conf_get(dev, queue_id, queue_conf);
+}
+
+int
+rte_event_queue_setup(uint8_t dev_id,
+ uint8_t queue_id,
+ const struct rte_event_queue_conf *queue_conf)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return 0;
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev->ops->queue_setup, -ENOTSUP);
+ return dev->ops->queue_setup(dev, queue_id, queue_conf);
+}
+
+uint16_t
+rte_event_queue_count(uint8_t dev_id)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return 0;
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev->ops->queue_count, -ENOTSUP);
+ return dev->ops->queue_count(dev);
+}
+
+uint8_t
+rte_event_queue_priority(uint8_t dev_id, uint8_t queue_id)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return 0;
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev->ops->queue_priority, -ENOTSUP);
+ return dev->ops->queue_priority(dev, queue_id);
+}
+
+void
+rte_event_port_default_conf_get(uint8_t dev_id,
+ uint8_t port_id,
+ struct rte_event_port_conf *port_conf)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return;
+
+ RTE_FUNC_PTR_OR_RET(dev->ops->port_default_conf_get);
+ return dev->ops->port_default_conf_get(dev, port_id, port_conf);
+}
+
+int
+rte_event_port_setup(uint8_t dev_id,
+ uint8_t port_id,
+ const struct rte_event_port_conf *port_conf)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return -1;
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev->ops->port_setup, -ENOTSUP);
+ return dev->ops->port_setup(dev, port_id, port_conf);
+}
+
+uint8_t
+rte_event_port_dequeue_depth(uint8_t dev_id, uint8_t port_id)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return -1;
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev->ops->port_dequeue_depth, -ENOTSUP);
+ return dev->ops->port_dequeue_depth(dev, port_id);
+}
+
+uint8_t
+rte_event_port_enqueue_depth(uint8_t dev_id, uint8_t port_id)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return -1;
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev->ops->port_enqueue_depth, -ENOTSUP);
+ return dev->ops->port_enqueue_depth(dev, port_id);
+}
+
+uint8_t
+rte_event_port_count(uint8_t dev_id)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return 0;
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev->ops->port_count, -ENOTSUP);
+ return dev->ops->port_count(dev);
+}
+
+int
+rte_event_dev_start(uint8_t dev_id)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return -1;
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev->ops->start, -ENOTSUP);
+ return dev->ops->start(dev);
+}
+
+void
+rte_event_dev_stop(uint8_t dev_id)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return;
+
+ RTE_FUNC_PTR_OR_RET(dev->ops->stop);
+ return dev->ops->stop(dev);
+}
+
+int
+rte_event_dev_close(uint8_t dev_id)
+{
+ int ret;
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return -1;
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev->ops->close, -ENOTSUP);
+ ret = dev->ops->close(dev);
+ if (ret)
+ return ret;
+
+ dev->configured = false;
+ return 0;
+}
+
+int
+rte_event_enqueue(uint8_t dev_id,
+ uint8_t event_port_id,
+ struct rte_event *ev,
+ bool pin_event)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return -1;
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev->ops->enqueue, -ENOTSUP);
+ return dev->ops->enqueue(dev, event_port_id, ev, pin_event);
+}
+
+int
+rte_event_enqueue_burst(uint8_t dev_id, uint8_t event_port_id,
+ struct rte_event ev[], int num, bool pin_event)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return -1;
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev->ops->enqueue_burst, -ENOTSUP);
+ return dev->ops->enqueue_burst(dev, event_port_id, ev, num, pin_event);
+}
+
+uint64_t
+rte_event_dequeue_wait_time(uint8_t dev_id, uint64_t ns)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return 0;
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev->ops->dequeue_wait_time, -ENOTSUP);
+ return dev->ops->dequeue_wait_time(dev, ns);
+}
+
+bool
+rte_event_dequeue(uint8_t dev_id, uint8_t event_port_id,
+ struct rte_event *ev, uint64_t wait)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return false;
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev->ops->dequeue, -ENOTSUP);
+ return dev->ops->dequeue(dev, event_port_id, ev, wait);
+}
+
+int
+rte_event_dequeue_burst(uint8_t dev_id, uint8_t event_port_id,
+ struct rte_event ev[], int num, uint64_t wait)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return -1;
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev->ops->dequeue_burst, -ENOTSUP);
+ return dev->ops->dequeue_burst(dev, event_port_id, ev, num, wait);
+}
+
+int
+rte_event_schedule(uint8_t dev_id)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return -1;
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev->ops->schedule, -ENOTSUP);
+ return dev->ops->schedule(dev);
+}
+
+void
+rte_event_release(uint8_t dev_id, uint8_t event_port_id, uint8_t index)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return;
+
+ RTE_FUNC_PTR_OR_RET(dev->ops->release);
+ dev->ops->release(dev, event_port_id, index);
+}
+
+int
+rte_event_port_link(uint8_t dev_id, uint8_t port_id,
+ struct rte_event_queue_link link[], int num)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return -1;
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev->ops->port_link, -ENOTSUP);
+ return dev->ops->port_link(dev, port_id, link, num);
+}
+
+int
+rte_event_port_unlink(uint8_t dev_id, uint8_t port_id, uint8_t queues[], int num)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return -1;
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev->ops->port_unlink, -ENOTSUP);
+ return dev->ops->port_unlink(dev, port_id, queues, num);
+}
+
+int
+rte_event_dev_stats_get(uint8_t dev_id, struct rte_event_dev_stats *stats)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return -1;
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev->ops->stats_get, -ENOTSUP);
+ return dev->ops->stats_get(dev, stats);
+}
+
+void
+rte_event_dev_dump(FILE *f, uint8_t dev_id)
+{
+ struct rte_event_dev *dev = event_devs[dev_id];
+
+ if (!dev || !dev->configured)
+ return;
+
+ RTE_FUNC_PTR_OR_RET(dev->ops->dump);
+ dev->ops->dump(f, dev);
+}
diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
new file mode 100644
index 0000000..d0b5f7d
--- /dev/null
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -0,0 +1,1272 @@
+/*
+ * BSD LICENSE
+ *
+ * Copyright 2016 Cavium.
+ * Copyright 2016 Intel Corporation.
+ * Copyright 2016 NXP.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Cavium nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _RTE_EVENTDEV_H_
+#define _RTE_EVENTDEV_H_
+
+/**
+ * @file
+ *
+ * RTE Event Device API
+ *
+ * The Event Device API is composed of two parts:
+ *
+ * - The application-oriented Event API that includes functions to setup
+ * an event device (configure it, setup its queues, ports and start it), to
+ * establish the link between queues to port and to receive events, and so on.
+ *
+ * - The driver-oriented Event API that exports a function allowing
+ * an event poll Mode Driver (PMD) to simultaneously register itself as
+ * an event device driver.
+ *
+ * Event device components:
+ *
+ * +-----------------+
+ * | +-------------+ |
+ * +-------+ | | flow 0 | |
+ * |Packet | | +-------------+ |
+ * |event | | +-------------+ |
+ * | | | | flow 1 | |event_port_link(port0, queue0)
+ * +-------+ | +-------------+ | | +--------+
+ * +-------+ | +-------------+ o-----v-----o |dequeue +------+
+ * |Crypto | | | flow n | | | event +------->|Core 0|
+ * |work | | +-------------+ o----+ | port 0 | | |
+ * |done ev| | event queue 0 | | +--------+ +------+
+ * +-------+ +-----------------+ |
+ * +-------+ |
+ * |Timer | +-----------------+ | +--------+
+ * |expiry | | +-------------+ | +------o |dequeue +------+
+ * |event | | | flow 0 | o-----------o event +------->|Core 1|
+ * +-------+ | +-------------+ | +----o port 1 | | |
+ * Event enqueue | +-------------+ | | +--------+ +------+
+ * o-------------> | | flow 1 | | |
+ * enqueue( | +-------------+ | |
+ * queue_id, | | | +--------+ +------+
+ * flow_id, | +-------------+ | | | |dequeue |Core 2|
+ * sched_type, | | flow n | o-----------o event +------->| |
+ * event_type, | +-------------+ | | | port 2 | +------+
+ * subev_type, | event queue 1 | | +--------+
+ * event) +-----------------+ | +--------+
+ * | | |dequeue +------+
+ * +-------+ +-----------------+ | | event +------->|Core n|
+ * |Core | | +-------------+ o-----------o port n | | |
+ * |(SW) | | | flow 0 | | | +--------+ +--+---+
+ * |event | | +-------------+ | | |
+ * +-------+ | +-------------+ | | |
+ * ^ | | flow 1 | | | |
+ * | | +-------------+ o------+ |
+ * | | +-------------+ | |
+ * | | | flow n | | |
+ * | | +-------------+ | |
+ * | | event queue n | |
+ * | +-----------------+ |
+ * | |
+ * +-----------------------------------------------------------+
+ *
+ *
+ *
+ * Event device: A hardware or software-based event scheduler.
+ *
+ * Event: A unit of scheduling that encapsulates a packet or other datatype
+ * like SW generated event from the core, Crypto work completion notification,
+ * Timer expiry event notification etc as well as metadata.
+ * The metadata includes flow ID, scheduling type, event priority, event_type,
+ * sub_event_type etc.
+ *
+ * Event queue: A queue containing events that are scheduled by the event dev.
+ * An event queue contains events of different flows associated with scheduling
+ * types, such as atomic, ordered, or parallel.
+ *
+ * Event port: An application's interface into the event dev for enqueue and
+ * dequeue operations. Each event port can be linked with one or more
+ * event queues for dequeue operations.
+ *
+ * By default, all the functions of the Event Device API exported by a PMD
+ * are lock-free functions which assume to not be invoked in parallel on
+ * different logical cores to work on the same target object. For instance,
+ * the dequeue function of a PMD cannot be invoked in parallel on two logical
+ * cores to operates on same event port. Of course, this function
+ * can be invoked in parallel by different logical cores on different ports.
+ * It is the responsibility of the upper level application to enforce this rule.
+ *
+ * In all functions of the Event API, the Event device is
+ * designated by an integer >= 0 named the device identifier *dev_id*
+ *
+ * At the Event driver level, Event devices are represented by a generic
+ * data structure of type *rte_event_dev*.
+ *
+ * Event devices are dynamically registered during the PCI/SoC device probing
+ * phase performed at EAL initialization time.
+ * When an Event device is being probed, a *rte_event_dev* structure and
+ * a new device identifier are allocated for that device. Then, the
+ * event_dev_init() function supplied by the Event driver matching the probed
+ * device is invoked to properly initialize the device.
+ *
+ * The role of the device init function consists of resetting the hardware or
+ * software event driver implementations.
+ *
+ * If the device init operation is successful, the correspondence between
+ * the device identifier assigned to the new device and its associated
+ * *rte_event_dev* structure is effectively registered.
+ * Otherwise, both the *rte_event_dev* structure and the device identifier are
+ * freed.
+ *
+ * The functions exported by the application Event API to setup a device
+ * designated by its device identifier must be invoked in the following order:
+ * - rte_event_dev_configure()
+ * - rte_event_queue_setup()
+ * - rte_event_port_setup()
+ * - rte_event_port_link()
+ * - rte_event_dev_start()
+ *
+ * Then, the application can invoke, in any order, the functions
+ * exported by the Event API to schedule events, dequeue events, enqueue events,
+ * change event queue(s) to event port [un]link establishment and so on.
+ *
+ * Application may use rte_event_[queue/port]_default_conf_get() to get the
+ * default configuration to set up an event queue or event port by
+ * overriding few default values.
+ *
+ * If the application wants to change the configuration (i.e. call
+ * rte_event_dev_configure(), rte_event_queue_setup(), or
+ * rte_event_port_setup()), it must call rte_event_dev_stop() first to stop the
+ * device and then do the reconfiguration before calling rte_event_dev_start()
+ * again. The schedule, enqueue and dequeue functions should not be invoked
+ * when the device is stopped.
+ *
+ * Finally, an application can close an Event device by invoking the
+ * rte_event_dev_close() function.
+ *
+ * Each function of the application Event API invokes a specific function
+ * of the PMD that controls the target device designated by its device
+ * identifier.
+ *
+ * For this purpose, all device-specific functions of an Event driver are
+ * supplied through a set of pointers contained in a generic structure of type
+ * *event_dev_ops*.
+ * The address of the *event_dev_ops* structure is stored in the *rte_event_dev*
+ * structure by the device init function of the Event driver, which is
+ * invoked during the PCI/SoC device probing phase, as explained earlier.
+ *
+ * In other words, each function of the Event API simply retrieves the
+ * *rte_event_dev* structure associated with the device identifier and
+ * performs an indirect invocation of the corresponding driver function
+ * supplied in the *event_dev_ops* structure of the *rte_event_dev* structure.
+ *
+ * For performance reasons, the address of the fast-path functions of the
+ * Event driver is not contained in the *event_dev_ops* structure.
+ * Instead, they are directly stored at the beginning of the *rte_event_dev*
+ * structure to avoid an extra indirect memory access during their invocation.
+ *
+ * RTE event device drivers do not use interrupts for enqueue or dequeue
+ * operation. Instead, Event drivers export Poll-Mode enqueue and dequeue
+ * functions to applications.
+ *
+ * An event driven based application has following typical workflow on fastpath:
+ * \code{.c}
+ * while (1) {
+ *
+ * rte_event_schedule(dev_id);
+ *
+ * rte_event_dequeue(...);
+ *
+ * (event processing)
+ *
+ * rte_event_enqueue(...);
+ * }
+ * \endcode
+ *
+ * The *schedule* operation is intended to do event scheduling, and the
+ * *dequeue* operation returns the scheduled events. An implementation
+ * is free to define the semantics between *schedule* and *dequeue*. For
+ * example, a system based on a hardware scheduler can define its
+ * rte_event_schedule() to be an NOOP, whereas a software scheduler can use
+ * the *schedule* operation to schedule events.
+ *
+ * The events are injected to event device through *enqueue* operation by
+ * event producers in the system. The typical event producers are ethdev
+ * subsystem for generating packet events, core(SW) for generating events based
+ * on different stages of application processing, cryptodev for generating
+ * crypto work completion notification etc
+ *
+ * The *dequeue* operation gets one or more events from the event ports.
+ * The application process the events and send to downstream event queue through
+ * rte_event_enqueue() if it is an intermediate stage of event processing, on
+ * the final stage, the application may send to different subsystem like ethdev
+ * to send the packet/event on the wire using ethdev rte_eth_tx_burst() API.
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdbool.h>
+
+#include <rte_pci.h>
+#include <rte_dev.h>
+#include <rte_devargs.h>
+#include <rte_errno.h>
+
+/**
+ * Get the total number of event devices that have been successfully
+ * initialised.
+ *
+ * @return
+ * The total number of usable event devices.
+ */
+uint8_t
+rte_event_dev_count(void);
+
+/**
+ * Get the device identifier for the named event device.
+ *
+ * @param name
+ * Event device name to select the event device identifier.
+ *
+ * @return
+ * Returns event device identifier on success.
+ * - <0: Failure to find named event device.
+ */
+int8_t
+rte_event_dev_get_dev_id(const char *name);
+
+/**
+ * Return the NUMA socket to which a device is connected.
+ *
+ * @param dev_id
+ * The identifier of the device.
+ * @return
+ * The NUMA socket id to which the device is connected or
+ * a default of zero if the socket could not be determined.
+ * - -1: dev_id value is out of range.
+ */
+int
+rte_event_dev_socket_id(uint8_t dev_id);
+
+/* Event device capability bitmap flags */
+#define RTE_EVENT_DEV_CAP_QUEUE_QOS (1 << 0)
+/**< Event scheduling prioritization is based on the priority associated with
+ * each event queue.
+ *
+ * \see rte_event_queue_setup(), RTE_EVENT_QUEUE_PRIORITY_NORMAL
+ */
+#define RTE_EVENT_DEV_CAP_EVENT_QOS (1 << 1)
+/**< Event scheduling prioritization is based on the priority associated with
+ * each event. Priority of each event is supplied in *rte_event* structure
+ * on each enqueue operation.
+ *
+ * \see rte_event_enqueue()
+ */
+
+/**
+ * Event device information
+ */
+struct rte_event_dev_info {
+ const char *driver_name; /**< Event driver name */
+ struct rte_pci_device *pci_dev; /**< PCI information */
+ uint32_t min_dequeue_wait_ns;
+ /**< Minimum supported global dequeue wait delay(ns) by this device */
+ uint32_t max_dequeue_wait_ns;
+ /**< Maximum supported global dequeue wait delay(ns) by this device */
+ uint32_t dequeue_wait_ns;
+ /**< Configured global dequeue wait delay(ns) for this device */
+ uint8_t max_event_queues;
+ /**< Maximum event_queues supported by this device */
+ uint32_t max_event_queue_flows;
+ /**< Maximum supported flows in an event queue by this device*/
+ uint8_t max_event_queue_priority_levels;
+ /**< Maximum number of event queue priority levels by this device.
+ * Valid when the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability
+ */
+ uint8_t nb_event_queues;
+ /**< Configured number of event queues for this device */
+ uint8_t max_event_priority_levels;
+ /**< Maximum number of event priority levels by this device.
+ * Valid when the device has RTE_EVENT_DEV_CAP_EVENT_QOS capability
+ */
+ uint8_t max_event_ports;
+ /**< Maximum number of event ports supported by this device */
+ uint8_t nb_event_ports;
+ /**< Configured number of event ports for this device */
+ uint8_t max_event_port_dequeue_queue_depth;
+ /**< Maximum dequeue queue depth for any event port.
+ * Implementations can schedule N events at a time to an event port.
+ * A device that does not support bulk dequeue will set this as 1.
+ * \see rte_event_port_setup()
+ */
+ uint32_t max_event_port_enqueue_queue_depth;
+ /**< Maximum enqueue queue depth for any event port. Implementations
+ * can batch N events at a time to enqueue through event port
+ * \see rte_event_port_setup()
+ */
+ int32_t max_num_events;
+ /**< A *closed system* event dev has a limit on the number of events it
+ * can manage at a time. An *open system* event dev does not have a
+ * limit and will specify this as -1.
+ */
+ uint32_t event_dev_cap;
+ /**< Event device capabilities(RTE_EVENT_DEV_CAP_)*/
+};
+
+/**
+ * Retrieve the contextual information of an event device.
+ *
+ * @param dev_id
+ * The identifier of the device.
+ *
+ * @param[out] dev_info
+ * A pointer to a structure of type *rte_event_dev_info* to be filled with the
+ * contextual information of the device.
+ *
+ * @return
+ * Returns event device identifier on success.
+ * - <0: Failure to find event device with dev_id.
+ */
+int
+rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info);
+
+/* Event device configuration bitmap flags */
+#define RTE_EVENT_DEV_CFG_PER_DEQUEUE_WAIT (1 << 0)
+/**< Override the global *dequeue_wait_ns* and use per dequeue wait in ns.
+ * \see rte_event_dequeue_wait_time(), rte_event_dequeue()
+ */
+
+/** Event device configuration structure */
+struct rte_event_dev_config {
+ uint32_t dequeue_wait_ns;
+ /**< rte_event_dequeue() wait for *dequeue_wait_ns* ns on this device.
+ * This value should be in the range of *min_dequeue_wait_ns* and
+ * *max_dequeue_wait_ns* which previously provided in
+ * rte_event_dev_info_get()
+ * \see RTE_EVENT_DEV_CFG_PER_DEQUEUE_WAIT
+ */
+ int32_t nb_events_limit;
+ /**< Applies to *closed system* event dev only. This field indicates a
+ * limit to ethdev-like devices to limit the number of events injected
+ * into the system to not overwhelm core-to-core events.
+ * This value cannot exceed the *max_num_events* which previously
+ * provided in rte_event_dev_info_get()
+ */
+ uint8_t nb_event_queues;
+ /**< Number of event queues to configure on this device.
+ * This value cannot exceed the *max_event_queues* which previously
+ * provided in rte_event_dev_info_get()
+ */
+ uint8_t nb_event_ports;
+ /**< Number of event ports to configure on this device.
+ * This value cannot exceed the *max_event_ports* which previously
+ * provided in rte_event_dev_info_get()
+ */
+ uint32_t event_dev_cfg;
+ /**< Event device config flags(RTE_EVENT_DEV_CFG_)*/
+};
+
+/**
+ * Configure an event device.
+ *
+ * This function must be invoked first before any other function in the
+ * API. This function can also be re-invoked when a device is in the
+ * stopped state.
+ *
+ * The caller may use rte_event_dev_info_get() to get the capability of each
+ * resources available for this event device.
+ *
+ * @param dev_id
+ * The identifier of the device to configure.
+ * @param config
+ * The event device configuration structure.
+ *
+ * @return
+ * - 0: Success, device configured.
+ * - <0: Error code returned by the driver configuration function.
+ */
+int
+rte_event_dev_configure(uint8_t dev_id, struct rte_event_dev_config *config);
+
+
+/* Event queue specific APIs */
+
+#define RTE_EVENT_QUEUE_PRIORITY_HIGHEST 0
+/**< Highest event queue priority */
+#define RTE_EVENT_QUEUE_PRIORITY_NORMAL 128
+/**< Normal event queue priority */
+#define RTE_EVENT_QUEUE_PRIORITY_LOWEST 255
+/**< Lowest event queue priority */
+
+/* Event queue configuration bitmap flags */
+#define RTE_EVENT_QUEUE_CFG_TYPE_MASK (3ULL << 0) /**< Mask CFG types */
+#define RTE_EVENT_QUEUE_CFG_ALL_TYPES (0ULL << 0) /**< Enable all types */
+#define RTE_EVENT_QUEUE_CFG_ATOMIC_ONLY (1ULL << 0) /**< Atomic scheduling only */
+#define RTE_EVENT_QUEUE_CFG_ORDERED_ONLY (2ULL << 0) /**< Ordered scheduling only */
+#define RTE_EVENT_QUEUE_CFG_PARALLEL_ONLY (3ULL << 0) /**< Parallel scheduling only */
+#define RTE_EVENT_QUEUE_CFG_SINGLE_CONSUMER (1ULL << 2)
+/**< This event queue links only to a single event port.
+ *
+ * \see rte_event_port_setup(), rte_event_port_link()
+ */
+
+/** Event queue configuration structure */
+struct rte_event_queue_conf {
+ uint32_t nb_atomic_flows;
+ /**< The maximum number of active flows this queue can track at any
+ * given time. The value must be in the range of
+ * [1 - max_event_queue_flows)] which previously supplied
+ * to rte_event_dev_configure().
+ */
+ uint32_t nb_atomic_order_sequences;
+ /**< The maximum number of outstanding events waiting to be (egress-)
+ * reordered by this queue. In other words, the number of entries in
+ * this queue’s reorder buffer.The value must be in the range of
+ * [1 - max_event_queue_flows)] which previously supplied
+ * to rte_event_dev_configure().
+ */
+ uint32_t event_queue_cfg; /**< Queue config flags(EVENT_QUEUE_CFG_) */
+ uint8_t priority;
+ /**< Priority for this event queue relative to other event queues.
+ * The requested priority should in the range of
+ * [RTE_EVENT_QUEUE_PRIORITY_HIGHEST, RTE_EVENT_QUEUE_PRIORITY_LOWEST].
+ * The implementation shall normalize the requested priority to
+ * event device supported priority value.
+ * Valid when the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability
+ */
+};
+
+/**
+ * Retrieve the default configuration information of an event queue designated
+ * by its *queue_id* from the event driver for an event device.
+ *
+ * This function intended to be used in conjunction with rte_event_queue_setup()
+ * where caller needs to set up the queue by overriding few default values.
+ *
+ * @param dev_id
+ * The identifier of the device.
+ * @param queue_id
+ * The index of the event queue to get the configuration information.
+ * The value must be in the range [0, nb_event_queues - 1]
+ * previously supplied to rte_event_dev_configure().
+ * @param[out] queue_conf
+ * The pointer to the default event queue configuration data.
+ *
+ * \see rte_event_queue_setup()
+ *
+ */
+void
+rte_event_queue_default_conf_get(uint8_t dev_id, uint8_t queue_id,
+ struct rte_event_queue_conf *queue_conf);
+
+/**
+ * Allocate and set up an event queue for an event device.
+ *
+ * @param dev_id
+ * The identifier of the device.
+ * @param queue_id
+ * The index of the event queue to setup. The value must be in the range
+ * [0, nb_event_queues - 1] previously supplied to rte_event_dev_configure().
+ * @param queue_conf
+ * The pointer to the configuration data to be used for the event queue.
+ * NULL value is allowed, in which case default configuration used.
+ *
+ * \see rte_event_queue_default_conf_get()
+ *
+ * @return
+ * - 0: Success, event queue correctly set up.
+ * - <0: event queue configuration failed
+ */
+int
+rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
+ const struct rte_event_queue_conf *queue_conf);
+
+/**
+ * Get the number of event queues on a specific event device
+ *
+ * @param dev_id
+ * Event device identifier.
+ * @return
+ * - The number of configured event queues
+ */
+uint16_t
+rte_event_queue_count(uint8_t dev_id);
+
+/**
+ * Get the priority of the event queue on a specific event device
+ *
+ * @param dev_id
+ * Event device identifier.
+ * @param queue_id
+ * Event queue identifier.
+ * @return
+ * - If the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability then the
+ * configured priority of the event queue in
+ * [RTE_EVENT_QUEUE_PRIORITY_HIGHEST, RTE_EVENT_QUEUE_PRIORITY_LOWEST] range
+ * else the value one
+ */
+uint8_t
+rte_event_queue_priority(uint8_t dev_id, uint8_t queue_id);
+
+/* Event port specific APIs */
+
+/** Event port configuration structure */
+struct rte_event_port_conf {
+ int32_t new_event_threshold;
+ /**< A backpressure threshold for new event enqueues on this port.
+ * Use for *closed system* event dev where event capacity is limited,
+ * and cannot exceed the capacity of the event dev.
+ * Configuring ports with different thresholds can make higher priority
+ * traffic less likely to be backpressured.
+ * For example, a port used to inject NIC Rx packets into the event dev
+ * can have a lower threshold so as not to overwhelm the device,
+ * while ports used for worker pools can have a higher threshold.
+ */
+ uint8_t dequeue_queue_depth;
+ /**< Configure number of bulk dequeues for this event port.
+ * This value cannot exceed the *max_event_port_dequeue_queue_depth*
+ * which previously supplied to rte_event_dev_configure()
+ */
+ uint8_t enqueue_queue_depth;
+ /**< Configure number of bulk enqueues for this event port.
+ * This value cannot exceed the *max_event_port_enqueue_queue_depth*
+ * which previously supplied to rte_event_dev_configure()
+ */
+};
+
+/**
+ * Retrieve the default configuration information of an event port designated
+ * by its *port_id* from the event driver for an event device.
+ *
+ * This function intended to be used in conjunction with rte_event_port_setup()
+ * where caller needs to set up the port by overriding few default values.
+ *
+ * @param dev_id
+ * The identifier of the device.
+ * @param port_id
+ * The index of the event port to get the configuration information.
+ * The value must be in the range [0, nb_event_ports - 1]
+ * previously supplied to rte_event_dev_configure().
+ * @param[out] port_conf
+ * The pointer to the default event port configuration data
+ *
+ * \see rte_event_port_setup()
+ *
+ */
+void
+rte_event_port_default_conf_get(uint8_t dev_id, uint8_t port_id,
+ struct rte_event_port_conf *port_conf);
+
+/**
+ * Allocate and set up an event port for an event device.
+ *
+ * @param dev_id
+ * The identifier of the device.
+ * @param port_id
+ * The index of the event port to setup. The value must be in the range
+ * [0, nb_event_ports - 1] previously supplied to rte_event_dev_configure().
+ * @param port_conf
+ * The pointer to the configuration data to be used for the queue.
+ * NULL value is allowed, in which case default configuration used.
+ *
+ * \see rte_event_port_default_conf_get()
+ *
+ * @return
+ * - 0: Success, event port correctly set up.
+ * - <0: Port configuration failed
+ * - (-EDQUOT) Quota exceeded(Application tried to link the queue configured
+ * with RTE_EVENT_QUEUE_CFG_SINGLE_CONSUMER to more than one event ports)
+ */
+int
+rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
+ const struct rte_event_port_conf *port_conf);
+
+/**
+ * Get the number of dequeue queue depth configured for event port designated
+ * by its *port_id* on a specific event device
+ *
+ * @param dev_id
+ * Event device identifier.
+ * @param port_id
+ * Event port identifier.
+ * @return
+ * - The number of configured dequeue queue depth
+ *
+ * \see rte_event_dequeue_burst()
+ */
+uint8_t
+rte_event_port_dequeue_depth(uint8_t dev_id, uint8_t port_id);
+
+/**
+ * Get the number of enqueue queue depth configured for event port designated
+ * by its *port_id* on a specific event device
+ *
+ * @param dev_id
+ * Event device identifier.
+ * @param port_id
+ * Event port identifier.
+ * @return
+ * - The number of configured enqueue queue depth
+ *
+ * \see rte_event_enqueue_burst()
+ */
+uint8_t
+rte_event_port_enqueue_depth(uint8_t dev_id, uint8_t port_id);
+
+/**
+ * Get the number of ports on a specific event device
+ *
+ * @param dev_id
+ * Event device identifier.
+ * @return
+ * - The number of configured ports
+ */
+uint8_t
+rte_event_port_count(uint8_t dev_id);
+
+/**
+ * Start an event device.
+ *
+ * The device start step is the last one and consists of setting the event
+ * queues to start accepting the events and schedules to event ports.
+ *
+ * On success, all basic functions exported by the API (event enqueue,
+ * event dequeue and so on) can be invoked.
+ *
+ * @param dev_id
+ * Event device identifier
+ * @return
+ * - 0: Success, device started.
+ * - <0: Error code of the driver device start function.
+ */
+int
+rte_event_dev_start(uint8_t dev_id);
+
+/**
+ * Stop an event device. The device can be restarted with a call to
+ * rte_event_dev_start()
+ *
+ * @param dev_id
+ * Event device identifier.
+ */
+void
+rte_event_dev_stop(uint8_t dev_id);
+
+/**
+ * Close an event device. The device cannot be restarted!
+ *
+ * @param dev_id
+ * Event device identifier
+ *
+ * @return
+ * - 0 on successfully closing device
+ * - <0 on failure to close device
+ */
+int
+rte_event_dev_close(uint8_t dev_id);
+
+/* Scheduler type definitions */
+#define RTE_SCHED_TYPE_ORDERED 0
+/**< Ordered scheduling
+ *
+ * Events from an ordered flow of an event queue can be scheduled to multiple
+ * ports for concurrent processing while maintaining the original event order.
+ * This scheme enables the user to achieve high single flow throughput by
+ * avoiding SW synchronization for ordering between ports which bound to cores.
+ *
+ * The source flow ordering from an event queue is maintained when events are
+ * enqueued to their destination queue within the same ordered flow context.
+ * An event port holds the context until application call rte_event_dequeue()
+ * from the same port, which implicitly releases the context.
+ * User may allow the scheduler to release the context earlier than that
+ * by calling rte_event_release()
+ *
+ * Events from the source queue appear in their original order when dequeued
+ * from a destination queue.
+ * Event ordering is based on the received event(s), but also other
+ * (newly allocated or stored) events are ordered when enqueued within the same
+ * ordered context. Events not enqueued (e.g. released or stored) within the
+ * context are considered missing from reordering and are skipped at this time
+ * (but can be ordered again within another context).
+ *
+ * \see rte_event_dequeue(), rte_event_release()
+ */
+
+#define RTE_SCHED_TYPE_ATOMIC 1
+/**< Atomic scheduling
+ *
+ * Events from an atomic flow of an event queue can be scheduled only to a
+ * single port at a time. The port is guaranteed to have exclusive (atomic)
+ * access to the associated flow context, which enables the user to avoid SW
+ * synchronization. Atomic flows also help to maintain event ordering
+ * since only one port at a time can process events from a flow of an
+ * event queue.
+ *
+ * The atomic queue synchronization context is dedicated to the port until
+ * application call rte_event_dequeue() from the same port, which implicitly
+ * releases the context. User may allow the scheduler to release the context
+ * earlier than that by calling rte_event_release()
+ *
+ * \see rte_event_dequeue(), rte_event_release()
+ */
+
+#define RTE_SCHED_TYPE_PARALLEL 2
+/**< Parallel scheduling
+ *
+ * The scheduler performs priority scheduling, load balancing, etc. functions
+ * but does not provide additional event synchronization or ordering.
+ * It is free to schedule events from a single parallel flow of an event queue
+ * to multiple events ports for concurrent processing.
+ * The application is responsible for flow context synchronization and
+ * event ordering (SW synchronization).
+ */
+
+/* Event types to classify the event source */
+#define RTE_EVENT_TYPE_ETHDEV 0x0
+/**< The event generated from ethdev subsystem */
+#define RTE_EVENT_TYPE_CRYPTODEV 0x1
+/**< The event generated from crypodev subsystem */
+#define RTE_EVENT_TYPE_TIMERDEV 0x2
+/**< The event generated from timerdev subsystem */
+#define RTE_EVENT_TYPE_CORE 0x3
+/**< The event generated from core.
+ * Application may use *sub_event_type* to further classify the event
+ */
+#define RTE_EVENT_TYPE_MAX 0x10
+/**< Maximum number of event types */
+
+/* Event priority */
+#define RTE_EVENT_PRIORITY_HIGHEST 0
+/**< Highest event priority */
+#define RTE_EVENT_PRIORITY_NORMAL 128
+/**< Normal event priority */
+#define RTE_EVENT_PRIORITY_LOWEST 255
+/**< Lowest event priority */
+
+
+#define RTE_EVENT_OP_NEW 0 /**< New event without previous ctx */
+#define RTE_EVENT_OP_FORWARD 1 /**< Re-enqueue prev dequeued event */
+#define RTE_EVENT_OP_DROP 2 /**< Discard context for event */
+
+/**
+ * The generic *rte_event* structure to hold the event attributes
+ * for dequeue and enqueue operation
+ */
+struct rte_event {
+ /** WORD0 */
+ union {
+ uint64_t u64;
+ /** Event attributes for dequeue or enqueue operation */
+ struct {
+ uint32_t flow_id:24;
+ /**< Targeted flow identifier for the enqueue and
+ * dequeue operation.
+ * The value must be in the range of
+ * [1 - max_event_queue_flows)] which
+ * previously supplied to rte_event_dev_configure().
+ */
+ uint32_t operation:6;
+ /**< The type of event being enqueued - new/forward/etc
+ * This field is not preserved across an instance and
+ * is undefined on dequeue.
+ */
+ uint32_t sched_type:2;
+ /**< Scheduler synchronization type (RTE_SCHED_TYPE_)
+ * associated with flow id on a given event queue
+ * for the enqueue and dequeue operation.
+ */
+ uint8_t queue_id:8;
+ /**< Targeted event queue identifier for the enqueue or
+ * dequeue operation.
+ * The value must be in the range of
+ * [0, nb_event_queues - 1] which previously supplied to
+ * rte_event_dev_configure().
+ */
+ uint8_t event_type;
+ /**< Event type to classify the event source. */
+ uint8_t sub_event_type;
+ /**< Sub-event types based on the event source.
+ * \see RTE_EVENT_TYPE_CORE
+ */
+ uint8_t priority;
+ /**< Event priority relative to other events in the
+ * event queue. The requested priority should in the
+ * range of [RTE_EVENT_PRIORITY_HIGHEST,
+ * RTE_EVENT_PRIORITY_LOWEST].
+ * The implementation shall normalize the requested
+ * priority to supported priority value.
+ * Valid when the device has RTE_EVENT_DEV_CAP_EVENT_QOS
+ * capability.
+ */
+ };
+ };
+ /** WORD1 */
+ union {
+ uintptr_t event;
+ /**< Opaque event pointer */
+ struct rte_mbuf *mbuf;
+ /**< mbuf pointer if dequeued event is associated with mbuf */
+ };
+};
+
+/**
+ * Schedule one or more events in the event dev.
+ *
+ * An event dev implementation may define this is a NOOP, for instance if
+ * the event dev performs its scheduling in hardware.
+ *
+ * @param dev_id
+ * The identifier of the device.
+ */
+int
+rte_event_schedule(uint8_t dev_id);
+
+/**
+ * Enqueue the event object supplied in the *rte_event* structure on an
+ * event device designated by its *dev_id* through the event port specified by
+ * *port_id*. The event object specifies the event queue on which this
+ * event will be enqueued.
+ *
+ * @param dev_id
+ * Event device identifier.
+ * @param port_id
+ * The identifier of the event port.
+ * @param ev
+ * Pointer to struct rte_event
+ *
+ * @param pin_event
+ * Hint to the scheduler that the event can be pinned to the same port for
+ * the next scheduling stage. For implementations that support it, this
+ * allows the same core to process the next stage in the pipeline for a given
+ * event, taking advantage of cache locality. The pinned event will be
+ * received through rte_event_dequeue(). This is a hint and the event is
+ * not guaranteed to be pinned to the port. This hint is valid only when the
+ * event is dequeued with rte_event_dequeue() followed by rte_event_enqueue().
+ *
+ * @return
+ * - 0 on success
+ * - <0 on failure. Failure can occur if the event port's output queue is
+ * backpressured, for instance.
+ */
+int
+rte_event_enqueue(uint8_t dev_id, uint8_t port_id, struct rte_event *ev,
+ bool pin_event);
+
+/**
+ * Enqueue a burst of events objects supplied in *rte_event* structure on an
+ * event device designated by its *dev_id* through the event port specified by
+ * *port_id*. Each event object specifies the event queue on which it
+ * will be enqueued.
+ *
+ * The rte_event_enqueue_burst() function is invoked to enqueue
+ * multiple event objects.
+ * It is the burst variant of rte_event_enqueue() function.
+ *
+ * The *num* parameter is the number of event objects to enqueue which are
+ * supplied in the *ev* array of *rte_event* structure.
+ *
+ * The rte_event_enqueue_burst() function returns the number of
+ * events objects it actually enqueued. A return value equal to *num* means
+ * that all event objects have been enqueued.
+ *
+ * @param dev_id
+ * The identifier of the device.
+ * @param port_id
+ * The identifier of the event port.
+ * @param ev
+ * An array of *num* pointers to *rte_event* structure
+ * which contain the event object enqueue operations to be processed.
+ * @param num
+ * The number of event objects to enqueue, typically number of
+ * rte_event_port_enqueue_depth() available for this port.
+ * @param pin_event
+ * Hint to the scheduler that the event can be pinned to the same port for
+ * the next scheduling stage. For implementations that support it, this
+ * allows the same core to process the next stage in the pipeline for a given
+ * event, taking advantage of cache locality. The pinned event will be
+ * received through rte_event_dequeue(). This is a hint and the event is
+ * not guaranteed to be pinned to the port. This hint is valid only when the
+ * event is dequeued with rte_event_dequeue() followed by rte_event_enqueue().
+ *
+ * @return
+ * The number of event objects actually enqueued on the event device. The
+ * return value can be less than the value of the *num* parameter when the
+ * event devices queue is full or if invalid parameters are specified in a
+ * *rte_event*. If return value is less than *num*, the remaining events at
+ * the end of ev[] are not consumed, and the caller has to take care of them.
+ *
+ * \see rte_event_enqueue(), rte_event_port_enqueue_depth()
+ */
+int
+rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id,
+ struct rte_event ev[], int num, bool pin_event);
+
+/**
+ * Converts nanoseconds to *wait* value for rte_event_dequeue()
+ *
+ * If the device is configured with RTE_EVENT_DEV_CFG_PER_DEQUEUE_WAIT flag then
+ * application can use this function to convert wait value in nanoseconds to
+ * implementations specific wait value supplied in rte_event_dequeue()
+ *
+ * @param dev_id
+ * The identifier of the device.
+ * @param ns
+ * Wait time in nanosecond
+ *
+ * @return
+ * Value for the *wait* parameter in rte_event_dequeue() function
+ *
+ * \see rte_event_dequeue(), RTE_EVENT_DEV_CFG_PER_DEQUEUE_WAIT
+ * \see rte_event_dev_configure()
+ *
+ */
+uint64_t
+rte_event_dequeue_wait_time(uint8_t dev_id, uint64_t ns);
+
+/**
+ * Dequeue an event from the event port specified by *port_id* on the
+ * event device designated by its *dev_id*.
+ *
+ * rte_event_dequeue() does not dictate the specifics of scheduling algorithm as
+ * each eventdev driver may have different criteria to schedule an event.
+ * However, in general, from an application perspective scheduler may use the
+ * following scheme to dispatch an event to the port.
+ *
+ * 1) Selection of event queue based on
+ * a) The list of event queues are linked to the event port.
+ * b) If the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability then event
+ * queue selection from list is based on event queue priority relative to
+ * other event queue supplied as *priority* in rte_event_queue_setup()
+ * c) If the device has RTE_EVENT_DEV_CAP_EVENT_QOS capability then event
+ * queue selection from the list is based on event priority supplied as
+ * *priority* in rte_event_enqueue_burst()
+ * 2) Selection of event
+ * a) The number of flows available in selected event queue.
+ * b) Schedule type method associated with the event
+ *
+ * On a successful dequeue, the event port holds flow id and schedule type
+ * context associated with the dispatched event. The context is automatically
+ * released in the next rte_event_dequeue() invocation, or rte_event_release()
+ * can be called to release the context early.
+ *
+ * @param dev_id
+ * The identifier of the device.
+ * @param port_id
+ * The identifier of the event port.
+ * @param[out] ev
+ * Pointer to struct rte_event. On successful event dispatch, implementation
+ * updates the event attributes.
+ *
+ * @param wait
+ * 0 - no-wait, returns immediately if there is no event.
+ * >0 - wait for the event, if the device is configured with
+ * RTE_EVENT_DEV_CFG_PER_DEQUEUE_WAIT then this function will wait until
+ * the event available or *wait* time.
+ * if the device is not configured with RTE_EVENT_DEV_CFG_PER_DEQUEUE_WAIT
+ * then this function will wait until the event available or *dequeue_wait_ns*
+ * ns which was previously supplied to rte_event_dev_configure()
+ *
+ * @return
+ * When true, a valid event has been dispatched by the scheduler.
+ *
+ */
+bool
+rte_event_dequeue(uint8_t dev_id, uint8_t port_id,
+ struct rte_event *ev, uint64_t wait);
+
+/**
+ * Dequeue a burst of events objects from the event port designated by its
+ * *event_port_id*, on an event device designated by its *dev_id*.
+ *
+ * The rte_event_dequeue_burst() function is invoked to dequeue
+ * multiple event objects. It is the burst variant of rte_event_dequeue()
+ * function.
+ *
+ * The *num* parameter is the maximum number of event objects to dequeue which
+ * are returned in the *ev* array of *rte_event* structure.
+ *
+ * The rte_event_dequeue_burst() function returns the number of
+ * events objects it actually dequeued. A return value equal to
+ * *num* means that all event objects have been dequeued.
+ *
+ * The number of events dequeued is the number of scheduler contexts held by
+ * this port. These contexts are automatically released in the next
+ * rte_event_dequeue() invocation, or rte_event_release() can be called once
+ * per event to release the contexts early.
+ *
+ * @param dev_id
+ * The identifier of the device.
+ * @param port_id
+ * The identifier of the event port.
+ * @param ev
+ * An array of *num* *rte_event* structures which is populated with the
+ * dequeued event objects.
+ *
+ * @param num
+ * The maximum number of event objects to dequeue, typically number of
+ * rte_event_port_dequeue_depth() available for this port.
+ *
+ * @param wait
+ * 0 - no-wait, returns immediately if there is no event.
+ * >0 - wait for the event, if the device is configured with
+ * RTE_EVENT_DEV_CFG_PER_DEQUEUE_WAIT then this function will wait until the
+ * event available or *wait* time.
+ * if the device is not configured with RTE_EVENT_DEV_CFG_PER_DEQUEUE_WAIT
+ * then this function will wait until the event available or *dequeue_wait_ns*
+ * ns which was previously supplied to rte_event_dev_configure()
+ *
+ * @return
+ * The number of event objects actually dequeued from the port. The return
+ * value can be less than the value of the *num* parameter when the
+ * event port's queue is not full.
+ *
+ * \see rte_event_dequeue(), rte_event_port_dequeue_depth()
+ */
+int
+rte_event_dequeue_burst(uint8_t dev_id, uint8_t port_id,
+ struct rte_event *ev, int num, uint64_t wait);
+
+/**
+ * Release the current flow context associated with a schedule type which
+ * dequeued from a given event queue though the event port designated by
+ * its *port_id*
+ *
+ * If current flow's scheduler type method is *RTE_SCHED_TYPE_ATOMIC*
+ * then this function hints the scheduler that the user has completed critical
+ * section processing in the current atomic context.
+ * The scheduler is now allowed to schedule events from the same flow from
+ * an event queue to another port. However, the context may be still held
+ * until the next rte_event_dequeue() or rte_event_dequeue_burst() call, this
+ * call allows but does not force the scheduler to release the context early.
+ *
+ * Early atomic context release may increase parallelism and thus system
+ * performance, but the user needs to design carefully the split into critical
+ * vs non-critical sections.
+ *
+ * If current flow's scheduler type method is *RTE_SCHED_TYPE_ORDERED*
+ * then this function hints the scheduler that the user has done all that need
+ * to maintain event order in the current ordered context.
+ * The scheduler is allowed to release the ordered context of this port and
+ * avoid reordering any following enqueues.
+ *
+ * Early ordered context release may increase parallelism and thus system
+ * performance.
+ *
+ * If current flow's scheduler type method is *RTE_SCHED_TYPE_PARALLEL*
+ * or no scheduling context is held then this function may be an NOOP,
+ * depending on the implementation.
+ *
+ * If multiple events are dequeued with rte_event_dequeue_burst(),
+ * rte_event_release() will release each flow context associated with a
+ * schedule type of an event though *index*, it denotes the order in
+ * which it was dequeued with rte_event_dequeue_burst()
+ *
+ * @param dev_id
+ * The identifier of the device.
+ * @param port_id
+ * The identifier of the event port.
+ * @param index
+ * The index of the event that dequeued with rte_event_dequeue_burst()
+ * which needs to release. The value zero used if the event dequeued with
+ * rte_event_dequeue()
+ *
+ * \see rte_event_dequeue(), rte_event_dequeue_burst()
+ */
+void
+rte_event_release(uint8_t dev_id, uint8_t port_id, uint8_t index);
+
+#define RTE_EVENT_QUEUE_SERVICE_PRIORITY_HIGHEST 0
+/**< Highest event queue servicing priority */
+#define RTE_EVENT_QUEUE_SERVICE_PRIORITY_NORMAL 128
+/**< Normal event queue servicing priority */
+#define RTE_EVENT_QUEUE_SERVICE_PRIORITY_LOWEST 255
+/**< Lowest event queue servicing priority */
+
+/** Structure to hold the queue to port link establishment attributes */
+struct rte_event_queue_link {
+ uint8_t queue_id;
+ /**< Event queue identifier to select the source queue to link */
+ uint8_t priority;
+ /**< The priority of the event queue for this event port.
+ * The priority defines the event port's servicing priority for
+ * event queue, which may be ignored by an implementation.
+ * The requested priority should in the range of
+ * [RTE_EVENT_QUEUE_SERVICE_PRIORITY_HIGHEST,
+ * RTE_EVENT_QUEUE_SERVICE_PRIORITY_LOWEST].
+ * The implementation shall normalize the requested priority to
+ * implementation supported priority value.
+ */
+};
+
+/**
+ * Link multiple source event queues supplied in *rte_event_queue_link*
+ * structure as *queue_id* to the destination event port designated by its
+ * *port_id* on the event device designated by its *dev_id*.
+ *
+ * The link establishment shall enable the event port *port_id* from
+ * receiving events from the specified event queue *queue_id*
+ *
+ * An event queue may link to one or more event ports.
+ * The number of links can be established from an event queue to event port is
+ * implementation defined.
+ *
+ * Event queue(s) to event port link establishment can be changed at runtime
+ * without re-configuring the device to support scaling and to reduce the
+ * latency of critical work by establishing the link with more event ports
+ * at runtime.
+ *
+ * @param dev_id
+ * The identifier of the device.
+ *
+ * @param port_id
+ * Event port identifier to select the destination port to link.
+ *
+ * @param link
+ * An array of *num* pointers to *rte_event_queue_link* structure
+ * which contain the event queue to event port link establishment attributes.
+ * NULL value is allowed, in which case this function links all the configured
+ * event queues *nb_event_queues* which previously supplied to
+ * rte_event_dev_configure() to the event port *port_id* with normal servicing
+ * priority(RTE_EVENT_QUEUE_SERVICE_PRIORITY_NORMAL).
+ *
+ * @param num
+ * The number of links to establish
+ *
+ * @return
+ * The number of links actually established on the event device. The return
+ * value can be less than the value of the *num* parameter when the
+ * implementation has the limitation on specific queue to port link
+ * establishment or if invalid parameters are specified
+ * in a *rte_event_queue_link*.
+ * If the return value is less than *num*, the remaining links at the end of
+ * link[] are not established, and the caller has to take care of them.
+ * If return value is less than *num* then implementation shall update the
+ * rte_errno accordingly, Possible rte_errno values are
+ * (-EDQUOT) Quota exceeded(Application tried to link the queue configured with
+ * RTE_EVENT_QUEUE_CFG_SINGLE_CONSUMER to more than one event ports)
+ * (-EINVAL) Invalid parameter
+ *
+ */
+int
+rte_event_port_link(uint8_t dev_id, uint8_t port_id,
+ struct rte_event_queue_link link[], int num);
+
+/**
+ * Unlink multiple source event queues supplied in *queues* from the destination
+ * event port designated by its *port_id* on the event device designated
+ * by its *dev_id*.
+ *
+ * The unlink establishment shall disable the event port *port_id* from
+ * receiving events from the specified event queue *queue_id*
+ *
+ * Event queue(s) to event port unlink establishment can be changed at runtime
+ * without re-configuring the device.
+ *
+ * @param dev_id
+ * The identifier of the device.
+ *
+ * @param port_id
+ * Event port identifier to select the destination port to unlink.
+ *
+ * @param queues
+ * An array of *num* event queues to be unlinked from the event port.
+ * NULL value is allowed, in which case this function unlinks all the
+ * event queue(s) from the event port *port_id*.
+ *
+ * @param num
+ * The number of unlinks to establish
+ *
+ * @return
+ * The number of unlinks actually established on the event device. The return
+ * value can be less than the value of the *num* parameter when the
+ * implementation has the limitation on specific queue to port unlink
+ * establishment or if invalid parameters are specified.
+ * If the return value is less than *num*, the remaining queues at the end of
+ * queues[] are not established, and the caller has to take care of them.
+ * If return value is less than *num* then implementation shall update the
+ * rte_errno accordingly, Possible rte_errno values are
+ * (-EINVAL) Invalid parameter
+ *
+ */
+int
+rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
+ uint8_t queues[], int num);
+
+#define RTE_EVENT_DEV_MAX_PORTS 256 /**< Max number of ports for an instance */
+#define RTE_EVENT_DEV_MAX_QUEUES 256 /**< Max number of queues for an instance */
+
+/**
+ * Struct that contains the general statistics of the eventdev instance.
+ */
+struct rte_event_dev_stats {
+ uint64_t rx_pkts; /**< Total packets received */
+ uint64_t rx_dropped; /**< Total packets dropped (Eg Invalid QID) */
+ uint64_t tx_pkts; /**< Total packets transmitted */
+
+ /**> Packets received on this port */
+ uint64_t port_rx_pkts[RTE_EVENT_DEV_MAX_PORTS];
+ /**> Packets dropped on this port */
+ uint64_t port_rx_dropped[RTE_EVENT_DEV_MAX_PORTS];
+ /**> Packets inflight on this port */
+ uint64_t port_inflight[RTE_EVENT_DEV_MAX_PORTS];
+ /**> Packets transmitted on this port */
+ uint64_t port_tx_pkts[RTE_EVENT_DEV_MAX_PORTS];
+ /**> Packets received on this qid */
+ uint64_t queue_rx_pkts[RTE_EVENT_DEV_MAX_QUEUES];
+ /**> Packets dropped on this qid */
+ uint64_t queue_rx_dropped[RTE_EVENT_DEV_MAX_QUEUES];
+ /**> Packets transmitted on this qid */
+ uint64_t queue_tx_pkts[RTE_EVENT_DEV_MAX_QUEUES];
+};
+
+/**
+ * Return stats for the eventdev instance, packets enqueued and dequeued
+ * per port and per queue.
+ *
+ * @param dev_id
+ * The identifier of the device.
+ * @param stats
+ * Stats structure to be completed by the API
+ * @return
+ * 0 on success, negative errno value on error
+ */
+int
+rte_event_dev_stats_get(uint8_t dev_id, struct rte_event_dev_stats *stats);
+
+/**
+ * Dump internal information about *dev_id* to the FILE* provided in *f*.
+ */
+void rte_event_dev_dump(FILE *f, uint8_t dev_id);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_EVENTDEV_H_ */
diff --git a/lib/librte_eventdev/rte_eventdev_ops.h b/lib/librte_eventdev/rte_eventdev_ops.h
new file mode 100644
index 0000000..e4f3062
--- /dev/null
+++ b/lib/librte_eventdev/rte_eventdev_ops.h
@@ -0,0 +1,177 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _RTE_EVENT_DEV_OPS_
+#define _RTE_EVENT_DEV_OPS_
+
+#include <stdint.h>
+
+struct rte_event;
+struct rte_event_dev;
+struct rte_event_link;
+struct rte_event_dev_info;
+struct rte_event_dev_config;
+struct rte_event_queue_conf;
+struct rte_event_port_conf;
+
+/* Creation and info */
+typedef int (*event_dev_configure)(
+ struct rte_event_dev *dev,
+ struct rte_event_dev_config *config);
+typedef int (*event_dev_start)(struct rte_event_dev *dev);
+typedef void (*event_dev_stop)(struct rte_event_dev *dev);
+typedef int (*event_dev_close)(struct rte_event_dev *dev);
+
+/* Queue control */
+typedef void (*event_queue_default_conf_get)(
+ struct rte_event_dev *dev,
+ uint8_t queue_id,
+ struct rte_event_queue_conf *queue_conf);
+typedef int (*event_dev_queue_setup)(
+ struct rte_event_dev *dev,
+ uint8_t queue_id,
+ const struct rte_event_queue_conf *queue_conf);
+typedef uint16_t (*event_dev_queue_count)(struct rte_event_dev *dev);
+typedef uint8_t (*event_queue_priority)(
+ struct rte_event_dev *dev,
+ uint8_t queue_id);
+
+
+/* Port control */
+typedef void (*event_port_default_conf_get)(
+ struct rte_event_dev *dev,
+ uint8_t port_id,
+ struct rte_event_port_conf *port_conf);
+typedef int (*event_dev_port_setup)(
+ struct rte_event_dev *dev,
+ uint8_t port_id,
+ const struct rte_event_port_conf *port_conf);
+typedef uint8_t (*event_dev_port_dequeue_depth)(
+ struct rte_event_dev *dev,
+ uint8_t port_id);
+typedef uint8_t (*event_dev_port_enqueue_depth)(
+ struct rte_event_dev *dev,
+ uint8_t port_id);
+typedef uint8_t (*event_dev_port_count)(struct rte_event_dev *dev);
+
+/* Enqueue, dequeue and scheduling */
+typedef int (*event_dev_enqueue)(
+ struct rte_event_dev *dev,
+ uint8_t port_id,
+ struct rte_event *ev,
+ bool pin_event);
+typedef int (*event_dev_enqueue_burst)(
+ struct rte_event_dev *dev,
+ uint8_t port_id,
+ struct rte_event ev[],
+ int num,
+ bool pin_event);
+typedef bool (*event_dev_dequeue_wait_time)(
+ struct rte_event_dev *dev,
+ uint64_t ns);
+typedef bool (*event_dev_dequeue)(
+ struct rte_event_dev *dev,
+ uint8_t port_id,
+ struct rte_event *ev,
+ uint64_t wait);
+typedef int (*event_dev_dequeue_burst)(
+ struct rte_event_dev *dev,
+ uint8_t port_id,
+ struct rte_event ev[],
+ int num,
+ uint64_t wait);
+typedef int (*event_dev_schedule)(struct rte_event_dev *dev);
+typedef void (*event_dev_release)(
+ struct rte_event_dev *dev,
+ uint8_t port_id,
+ uint8_t index);
+
+/* Mapping */
+typedef int (*event_dev_port_link)(
+ struct rte_event_dev *dev,
+ uint8_t port_id,
+ struct rte_event_queue_link link[],
+ int num);
+typedef int (*event_dev_port_unlink)(
+ struct rte_event_dev *dev,
+ uint8_t port_id,
+ uint8_t queues[],
+ int num);
+
+/* stats */
+typedef int (*event_dev_stats_get)(
+ const struct rte_event_dev *dev,
+ struct rte_event_dev_stats *stats);
+typedef void (*event_dev_dump)(
+ FILE *f,
+ const struct rte_event_dev *dev);
+
+struct rte_event_dev_ops {
+ /* Creation and info */
+ event_dev_configure configure;
+ event_dev_start start;
+ event_dev_stop stop;
+ event_dev_close close;
+
+ /* Port control */
+ event_port_default_conf_get port_default_conf_get;
+ event_dev_port_setup port_setup;
+ event_dev_port_dequeue_depth port_dequeue_depth;
+ event_dev_port_enqueue_depth port_enqueue_depth;
+ event_dev_port_count port_count;
+
+ /* Queue control */
+ event_queue_default_conf_get queue_default_conf_get;
+ event_dev_queue_setup queue_setup;
+ event_dev_queue_count queue_count;
+ event_queue_priority queue_priority;
+
+ /* Enqueue, dequeue and scheduling */
+ event_dev_enqueue enqueue;
+ event_dev_enqueue_burst enqueue_burst;
+ event_dev_dequeue_wait_time dequeue_wait_time;
+ event_dev_dequeue dequeue;
+ event_dev_dequeue_burst dequeue_burst;
+ event_dev_schedule schedule;
+ event_dev_release release;
+
+ /* Mapping */
+ event_dev_port_link port_link;
+ event_dev_port_unlink port_unlink;
+
+ /* Stats */
+ event_dev_stats_get stats_get;
+ event_dev_dump dump;
+};
+
+#endif /* _RTE_EVENT_DEV_OPS_ */
diff --git a/lib/librte_eventdev/rte_eventdev_pmd.h b/lib/librte_eventdev/rte_eventdev_pmd.h
new file mode 100644
index 0000000..d8346b3
--- /dev/null
+++ b/lib/librte_eventdev/rte_eventdev_pmd.h
@@ -0,0 +1,69 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _RTE_EVENTDEV_PMD_H_
+#define _RTE_EVENTDEV_PMD_H_
+
+/** @file
+ * RTE EVENTDEV PMD API
+ *
+ * @note
+ * This API is for the Event Dev PMD only, and user applications should never
+ * call these functions directly.
+ */
+
+#include "rte_eventdev.h"
+#include "rte_eventdev_ops.h"
+
+/** Max number of chars in an eventdev name */
+#define RTE_EVENTDEV_PMD_NAME_SIZE 64
+
+/* Main struct that is passed around - contains pointers to all other structs
+ * linked with this dev. A dev represents the PMD behind an event device.
+ */
+struct rte_event_dev {
+ char name[RTE_EVENTDEV_PMD_NAME_SIZE];
+ const struct rte_event_dev_ops *ops;
+ struct rte_event_dev_info info;
+ uint32_t socket_id;
+ uint8_t id;
+ bool configured;
+ TAILQ_ENTRY(rte_event_dev) next;
+};
+
+/**
+ * Registers a PMD in the list of available event dev PMDs
+ */
+int
+rte_event_dev_register(struct rte_event_dev *new_dev);
+
+#endif /* _RTE_EVENTDEV_PMD_H_ */
diff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map
new file mode 100644
index 0000000..26f1dd5
--- /dev/null
+++ b/lib/librte_eventdev/rte_eventdev_version.map
@@ -0,0 +1,33 @@
+DPDK_17.02 {
+ global:
+
+ rte_event_dequeue;
+ rte_event_dequeue_burst;
+
+ rte_event_dev_close;
+ rte_event_dev_configure;
+ rte_event_dev_count;
+ rte_event_dev_get_dev_id;
+ rte_event_dev_info_get;
+ rte_event_dev_register;
+ rte_event_dev_socket_id;
+ rte_event_dev_start;
+ rte_event_dev_stop;
+
+ rte_event_enqueue;
+ rte_event_enqueue_burst;
+
+ rte_event_port_count;
+ rte_event_port_link;
+ rte_event_port_setup;
+ rte_event_port_unlink;
+
+ rte_event_queue_setup;
+ rte_event_queue_count;
+
+ rte_event_release;
+ rte_event_run;
+ rte_event_schedule;
+
+ local: *;
+};
--
2.7.4
^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH 2/7] eventdev: makefiles
2016-11-16 18:00 [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 1/7] eventdev: header and implementation Harry van Haaren
@ 2016-11-16 18:00 ` Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 3/7] event/sw: software eventdev implementation Harry van Haaren
` (5 subsequent siblings)
7 siblings, 0 replies; 18+ messages in thread
From: Harry van Haaren @ 2016-11-16 18:00 UTC (permalink / raw)
To: dev; +Cc: Harry van Haaren, Gage Eads, Bruce Richardson
Makefiles that compile the previously committed eventdev header and
infrastructure files. This commit changes the Makefiles and config/base
to add the config options of building the eventdev.
Signed-off-by: Gage Eads <gage.eads@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---
config/common_base | 6 ++++
drivers/Makefile | 1 +
drivers/event/Makefile | 34 ++++++++++++++++++++
lib/Makefile | 1 +
lib/librte_eal/common/include/rte_vdev.h | 1 +
lib/librte_eventdev/Makefile | 54 ++++++++++++++++++++++++++++++++
mk/rte.app.mk | 1 +
7 files changed, 98 insertions(+)
create mode 100644 drivers/event/Makefile
create mode 100644 lib/librte_eventdev/Makefile
diff --git a/config/common_base b/config/common_base
index 4bff83a..a0a07f6 100644
--- a/config/common_base
+++ b/config/common_base
@@ -411,6 +411,12 @@ CONFIG_RTE_LIBRTE_PMD_ZUC_DEBUG=n
CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO=y
#
+# Compile event device library
+#
+CONFIG_RTE_LIBRTE_EVENTDEV=y
+CONFIG_RTE_LIBRTE_EVENTDEV_DEBUG=n
+
+#
# Compile librte_ring
#
CONFIG_RTE_LIBRTE_RING=y
diff --git a/drivers/Makefile b/drivers/Makefile
index 81c03a8..40b8347 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -33,5 +33,6 @@ include $(RTE_SDK)/mk/rte.vars.mk
DIRS-y += net
DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto
+DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event
include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/event/Makefile b/drivers/event/Makefile
new file mode 100644
index 0000000..93f90eb
--- /dev/null
+++ b/drivers/event/Makefile
@@ -0,0 +1,34 @@
+# BSD LICENSE
+#
+# Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/lib/Makefile b/lib/Makefile
index 990f23a..75b9868 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -58,6 +58,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_TABLE) += librte_table
DIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += librte_pipeline
DIRS-$(CONFIG_RTE_LIBRTE_REORDER) += librte_reorder
DIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += librte_pdump
+DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += librte_eventdev
ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
DIRS-$(CONFIG_RTE_LIBRTE_KNI) += librte_kni
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
index 784e837..22c1e19 100644
--- a/lib/librte_eal/common/include/rte_vdev.h
+++ b/lib/librte_eal/common/include/rte_vdev.h
@@ -38,6 +38,7 @@ extern "C" {
#endif
#include <sys/queue.h>
+#include <rte_eal.h>
#include <rte_dev.h>
/** Double linked list of virtual device drivers. */
diff --git a/lib/librte_eventdev/Makefile b/lib/librte_eventdev/Makefile
new file mode 100644
index 0000000..5e2c467
--- /dev/null
+++ b/lib/librte_eventdev/Makefile
@@ -0,0 +1,54 @@
+# BSD LICENSE
+#
+# Copyright(c) 2016 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_eventdev.a
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+
+EXPORT_MAP := rte_eventdev_version.map
+
+LIBABIVER := 1
+
+# all source are stored in SRCS-y
+SRCS-$(CONFIG_RTE_LIBRTE_EVENTDEV) := rte_eventdev.c
+
+# install this header file
+SYMLINK-$(CONFIG_RTE_LIBRTE_EVENTDEV)-include := rte_eventdev.h rte_eventdev_pmd.h rte_eventdev_ops.h
+
+# this lib depends upon:
+DEPDIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += lib/librte_eal
+DEPDIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += lib/librte_kvargs
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index f75f0e2..716725a 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -93,6 +93,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF) += -lrte_mbuf
_LDLIBS-$(CONFIG_RTE_LIBRTE_NET) += -lrte_net
_LDLIBS-$(CONFIG_RTE_LIBRTE_ETHER) += -lrte_ethdev
_LDLIBS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += -lrte_cryptodev
+_LDLIBS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += -lrte_eventdev
_LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += -lrte_mempool
_LDLIBS-$(CONFIG_RTE_LIBRTE_RING) += -lrte_ring
_LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrte_eal
--
2.7.4
^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH 3/7] event/sw: software eventdev implementation
2016-11-16 18:00 [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 1/7] eventdev: header and implementation Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 2/7] eventdev: makefiles Harry van Haaren
@ 2016-11-16 18:00 ` Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 4/7] event/sw: makefiles and config Harry van Haaren
` (4 subsequent siblings)
7 siblings, 0 replies; 18+ messages in thread
From: Harry van Haaren @ 2016-11-16 18:00 UTC (permalink / raw)
To: dev; +Cc: Harry van Haaren, Gage Eads, Bruce Richardson
This commit adds a software implementation of the eventdev API. The
implementation here is intended to enable the community to use the eventdev
API, and test if the API serves the purpose that it is designed to. It
should be noted this is an RFC implementation, and hence there should be no
performance expectations. Note that the code added here is based on a
prototype implementation, and hence some cleanup is expected to be
necessary.
The main components of the implementation is three files:
- sw_evdev.c Creation, configuration, etc
- sw_evdev_worker.c Worker cores' enqueue (etc) functions
- sw_evdev_scheduler.c Core pkt scheduling implementation
This commit only adds the implementation, no existing DPDK files are modified.
Signed-off-by: Gage Eads <gage.eads@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---
drivers/event/sw/Makefile | 59 +++
drivers/event/sw/event_ring.h | 142 ++++++
drivers/event/sw/iq_ring.h | 160 +++++++
drivers/event/sw/rte_pmd_evdev_sw_version.map | 3 +
drivers/event/sw/sw_evdev.c | 619 ++++++++++++++++++++++++
drivers/event/sw/sw_evdev.h | 234 +++++++++
drivers/event/sw/sw_evdev_scheduler.c | 660 ++++++++++++++++++++++++++
drivers/event/sw/sw_evdev_worker.c | 218 +++++++++
8 files changed, 2095 insertions(+)
create mode 100644 drivers/event/sw/Makefile
create mode 100644 drivers/event/sw/event_ring.h
create mode 100644 drivers/event/sw/iq_ring.h
create mode 100644 drivers/event/sw/rte_pmd_evdev_sw_version.map
create mode 100644 drivers/event/sw/sw_evdev.c
create mode 100644 drivers/event/sw/sw_evdev.h
create mode 100644 drivers/event/sw/sw_evdev_scheduler.c
create mode 100644 drivers/event/sw/sw_evdev_worker.c
diff --git a/drivers/event/sw/Makefile b/drivers/event/sw/Makefile
new file mode 100644
index 0000000..7fc4371
--- /dev/null
+++ b/drivers/event/sw/Makefile
@@ -0,0 +1,59 @@
+# BSD LICENSE
+#
+# Copyright(c) 2016 Intel Corporation. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+
+# library name
+LIB = librte_pmd_evdev_sw.a
+
+# build flags
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+# library version
+LIBABIVER := 1
+
+# versioning export map
+EXPORT_MAP := rte_pmd_evdev_sw_version.map
+
+# library source files
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_EVDEV_SW) += sw_evdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_EVDEV_SW) += sw_evdev_worker.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_EVDEV_SW) += sw_evdev_scheduler.c
+
+# export include files
+SYMLINK-y-include +=
+
+# library dependencies
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_EVDEV_SW) += lib/librte_eal
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_EVDEV_SW) += lib/librte_eventdev
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/event/sw/event_ring.h b/drivers/event/sw/event_ring.h
new file mode 100644
index 0000000..531fb68
--- /dev/null
+++ b/drivers/event/sw/event_ring.h
@@ -0,0 +1,142 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _EVENT_RING_
+#define _EVENT_RING_
+
+#include <stdint.h>
+#include <x86intrin.h>
+
+#include <rte_common.h>
+#include <rte_memory.h>
+#include <rte_malloc.h>
+
+#define QE_RING_NAMESIZE 32
+
+struct qe_ring {
+ char name[QE_RING_NAMESIZE] __rte_cache_aligned;
+ uint32_t ring_size; /* size of memory block allocated to the ring */
+ uint32_t mask; /* mask for read/write values == ring_size -1 */
+ uint32_t size; /* actual usable space in the ring */
+ volatile uint32_t write_idx __rte_cache_aligned;
+ volatile uint32_t read_idx __rte_cache_aligned;
+
+ struct rte_event ring[0] __rte_cache_aligned;
+};
+
+#ifndef force_inline
+#define force_inline inline __attribute__((always_inline))
+#endif
+
+static inline struct qe_ring * __attribute__((cold))
+qe_ring_create(const char *name, unsigned int size, unsigned socket_id)
+{
+ struct qe_ring *retval;
+ const uint32_t ring_size = rte_align32pow2(size + 1);
+ size_t memsize = sizeof(*retval) +
+ (ring_size * sizeof(retval->ring[0]));
+
+ retval = rte_zmalloc_socket(NULL, memsize, 0, socket_id);
+ if (retval == NULL)
+ goto end;
+
+ snprintf(retval->name, sizeof(retval->name), "EVDEV_RG_%s", name);
+ retval->ring_size = ring_size;
+ retval->mask = ring_size - 1;
+ retval->size = size;
+end:
+ return retval;
+}
+
+static inline void
+qe_ring_destroy(struct qe_ring *r)
+{
+ rte_free(r);
+}
+
+static force_inline unsigned int
+qe_ring_count(const struct qe_ring *r)
+{
+ return r->write_idx - r->read_idx;
+}
+
+static force_inline unsigned int
+qe_ring_free_count(const struct qe_ring *r)
+{
+ return r->size - qe_ring_count(r);
+}
+
+static force_inline unsigned int
+qe_ring_enqueue_burst(struct qe_ring *r, struct rte_event *qes,
+ unsigned int nb_qes, uint16_t *free_count)
+{
+ const uint32_t size = r->size;
+ const uint32_t mask = r->mask;
+ const uint32_t read = r->read_idx;
+ uint32_t write = r->write_idx;
+ const uint32_t space = read + size - write;
+ uint32_t i;
+
+ if (space < nb_qes)
+ nb_qes = space;
+
+ for (i = 0; i < nb_qes; i++, write++)
+ r->ring[write & mask] = qes[i];
+
+ r->write_idx = write;
+
+ *free_count = space - nb_qes;
+
+ return nb_qes;
+}
+
+static force_inline unsigned int
+qe_ring_dequeue_burst(struct qe_ring *r, struct rte_event *qes,
+ unsigned int nb_qes)
+{
+ const uint32_t mask = r->mask;
+ uint32_t read = r->read_idx;
+ const uint32_t write = r->write_idx;
+ const uint32_t items = write - read;
+ uint32_t i;
+
+ if (items < nb_qes)
+ nb_qes = items;
+
+ for (i = 0; i < nb_qes; i++, read++)
+ qes[i] = r->ring[read & mask];
+
+ r->read_idx += nb_qes;
+
+ return nb_qes;
+}
+
+#endif
diff --git a/drivers/event/sw/iq_ring.h b/drivers/event/sw/iq_ring.h
new file mode 100644
index 0000000..a870e59
--- /dev/null
+++ b/drivers/event/sw/iq_ring.h
@@ -0,0 +1,160 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _IQ_RING_
+#define _IQ_RING_
+
+#include <stdint.h>
+#include <x86intrin.h>
+
+#include <rte_common.h>
+#include <rte_memory.h>
+#include <rte_malloc.h>
+#include <rte_eventdev.h>
+
+#define IQ_RING_NAMESIZE 12
+#define QID_IQ_DEPTH 128
+#define QID_IQ_MASK (uint16_t)(QID_IQ_DEPTH - 1)
+
+struct iq_ring {
+ char name[IQ_RING_NAMESIZE] __rte_cache_aligned;
+ uint16_t write_idx;
+ uint16_t read_idx;
+
+ struct rte_event ring[QID_IQ_DEPTH];
+};
+
+#ifndef force_inline
+#define force_inline inline __attribute__((always_inline))
+#endif
+
+static inline struct iq_ring * __attribute__((cold))
+iq_ring_create(const char *name, unsigned socket_id)
+{
+ struct iq_ring *retval;
+
+ retval = rte_malloc_socket(NULL, sizeof(*retval), 0, socket_id);
+ if (retval == NULL)
+ goto end;
+
+ snprintf(retval->name, sizeof(retval->name), "%s", name);
+ retval->write_idx = retval->read_idx = 0;
+end:
+ return retval;
+}
+
+static inline void
+iq_ring_destroy(struct iq_ring *r)
+{
+ rte_free(r);
+}
+
+static force_inline uint16_t
+iq_ring_count(const struct iq_ring *r)
+{
+ return r->write_idx - r->read_idx;
+}
+
+static force_inline uint16_t
+iq_ring_free_count(const struct iq_ring *r)
+{
+ return QID_IQ_MASK - iq_ring_count(r);
+}
+
+static force_inline uint16_t
+iq_ring_enqueue_burst(struct iq_ring *r, struct rte_event *qes, uint16_t nb_qes)
+{
+ const uint16_t read = r->read_idx;
+ uint16_t write = r->write_idx;
+ const uint16_t space = read + QID_IQ_MASK - write;
+ uint16_t i;
+
+ if (space < nb_qes)
+ nb_qes = space;
+
+ for (i = 0; i < nb_qes; i++, write++)
+ r->ring[write & QID_IQ_MASK] = qes[i];
+
+ r->write_idx = write;
+
+ return nb_qes;
+}
+
+static force_inline uint16_t
+iq_ring_dequeue_burst(struct iq_ring *r, struct rte_event *qes, uint16_t nb_qes)
+{
+ uint16_t read = r->read_idx;
+ const uint16_t write = r->write_idx;
+ const uint16_t items = write - read;
+ uint16_t i;
+
+ for (i = 0; i < nb_qes; i++, read++)
+ qes[i] = r->ring[read & QID_IQ_MASK];
+
+ if (items < nb_qes)
+ nb_qes = items;
+
+ r->read_idx += nb_qes;
+
+ return nb_qes;
+}
+
+static force_inline const struct rte_event *
+iq_ring_peek(const struct iq_ring *r)
+{
+ return &r->ring[r->read_idx & QID_IQ_MASK];
+}
+
+static force_inline void
+iq_ring_pop(struct iq_ring *r)
+{
+ r->read_idx++;
+}
+
+static force_inline int
+iq_ring_enqueue(struct iq_ring *r, const struct rte_event *qe)
+{
+ const uint16_t read = r->read_idx;
+ const uint16_t write = r->write_idx;
+ const uint16_t space = read + QID_IQ_MASK - write;
+
+ if (space == 0)
+ return -1;
+
+ r->ring[write & QID_IQ_MASK] = *qe;
+
+ r->write_idx = write + 1;
+
+ return 0;
+}
+
+#endif
diff --git a/drivers/event/sw/rte_pmd_evdev_sw_version.map b/drivers/event/sw/rte_pmd_evdev_sw_version.map
new file mode 100644
index 0000000..1f84b68
--- /dev/null
+++ b/drivers/event/sw/rte_pmd_evdev_sw_version.map
@@ -0,0 +1,3 @@
+DPDK_17.02 {
+ local: *;
+};
diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c
new file mode 100644
index 0000000..4868122
--- /dev/null
+++ b/drivers/event/sw/sw_evdev.c
@@ -0,0 +1,619 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+
+#include <rte_vdev.h>
+#include <rte_memzone.h>
+#include <rte_kvargs.h>
+#include <rte_ring.h>
+#include <rte_eventdev_pmd.h>
+
+#include "sw_evdev.h"
+#include "iq_ring.h"
+
+#define NUMA_NODE_ARG "numa_node"
+
+static int
+sw_dev_stats_get(const struct rte_event_dev *dev,
+ struct rte_event_dev_stats *stats)
+{
+ const struct sw_evdev *sw = (const void *)dev;
+ unsigned int i;
+
+ if (dev == NULL || stats == NULL)
+ return -EINVAL;
+
+ memset(stats, 0, sizeof(*stats));
+
+ stats->rx_pkts = sw->stats.rx_pkts;
+ stats->rx_dropped = sw->stats.rx_dropped;
+ stats->tx_pkts = sw->stats.tx_pkts;
+
+ for (i = 0; i < sw->port_count; i++) {
+ stats->port_rx_pkts[i] = sw->ports[i].stats.rx_pkts;
+ stats->port_rx_dropped[i] = sw->ports[i].stats.rx_dropped;
+ stats->port_inflight[i] = sw->ports[i].inflights;
+ stats->port_tx_pkts[i] = sw->ports[i].stats.tx_pkts;
+ }
+
+ for (i = 0; i < sw->qid_count; i++) {
+ stats->queue_rx_pkts[i] = sw->qids[i].stats.rx_pkts;
+ stats->queue_rx_dropped[i] = sw->qids[i].stats.rx_dropped;
+ stats->queue_tx_pkts[i] = sw->qids[i].stats.tx_pkts;
+ }
+ return 0;
+}
+
+static int
+sw_port_link(struct rte_event_dev *dev, uint8_t port_id,
+ struct rte_event_queue_link link[], int num)
+{
+ struct sw_evdev *sw = (void *)dev;
+ struct sw_port *p = &sw->ports[port_id];
+ int i;
+
+ if (link == NULL) {
+ /* TODO: map all queues */
+ rte_errno = -EDQUOT;
+ return 0;
+ }
+ if (port_id > sw->port_count) {
+ rte_errno = -EINVAL;
+ return 0;
+ }
+
+ for (i = 0; i < num; i++) {
+ struct sw_qid *q;
+ uint32_t qid = link[i].queue_id;
+ if (qid >= sw->qid_count) {
+ break; /* error - invalid QIDs */
+ }
+ q = &sw->qids[qid];
+
+ /* check for qid map overflow */
+ if (q->cq_num_mapped_cqs >= RTE_DIM(q->cq_map))
+ break;
+
+ if (p->is_directed && p->num_qids_mapped > 0)
+ break;
+
+ if (q->type == RTE_SCHED_TYPE_DIRECT) {
+ /* check directed qids only map to one port */
+ if (p->num_qids_mapped > 0)
+ break;
+ /* check port only takes a directed flow */
+ if (num > 1)
+ break;
+
+ p->is_directed = 1;
+ p->num_qids_mapped = 1;
+ } else if (q->type == RTE_SCHED_TYPE_ORDERED) {
+ p->num_ordered_qids++;
+ p->num_qids_mapped++;
+ } else if (q->type == RTE_SCHED_TYPE_ATOMIC) {
+ p->num_qids_mapped++;
+ }
+
+ q->cq_map[q->cq_num_mapped_cqs++] = port_id;
+ }
+ return i;
+}
+
+static void
+sw_dump(FILE *f, const struct rte_event_dev *dev)
+{
+ static const char *q_type_strings[] = {"Ordered" , "Atomic",
+ "Parallel", "Directed"
+ };
+ uint32_t i;
+ const struct sw_evdev *sw = (const void *)dev;
+ fprintf(f, "EventDev %s: ports %d, qids %d\n", sw->dev.name,
+ sw->port_count, sw->qid_count);
+
+ fprintf(f, "\trx %"PRIu64"\n\tdrop %"PRIu64"\n\ttx %"PRIu64"\n",
+ sw->stats.rx_pkts, sw->stats.rx_dropped, sw->stats.tx_pkts);
+ fprintf(f, "\tsched calls: %"PRIu64"\n", sw->sched_called);
+ fprintf(f, "\tsched cq/qid call: %"PRIu64"\n", sw->sched_cq_qid_called);
+ fprintf(f, "\tsched no IQ enq: %"PRIu64"\n", sw->sched_no_iq_enqueues);
+ fprintf(f, "\tsched no CQ enq: %"PRIu64"\n", sw->sched_no_cq_enqueues);
+ fprintf(f, "\toverloads %"PRIu64"\t%s\n", sw->sched_overload_counter,
+ sw->overloaded ? " [OVERLOADED NOW]" : "");
+
+#define COL_RED "\x1b[31m"
+#define COL_RESET "\x1b[0m"
+
+ for (i = 0; i < sw->port_count; i++) {
+ const struct sw_port *p = &sw->ports[i];
+ fprintf(f, " Port %d %s %s\n", i,
+ p->is_directed ? " (SingleCons)" : "",
+ p->overloaded ? " ["COL_RED"OVERLOAD"COL_RESET"]" : "");
+ fprintf(f, "\trx %"PRIu64"\n\tdrop %"PRIu64"\n\ttx %"PRIu64"\n"
+ "\tinf %d\n", sw->ports[i].stats.rx_pkts,
+ sw->ports[i].stats.rx_dropped,
+ sw->ports[i].stats.tx_pkts, sw->ports[i].inflights);
+
+ uint64_t rx_used = qe_ring_count(p->rx_worker_ring);
+ uint64_t rx_free = qe_ring_free_count(p->rx_worker_ring);
+ const char *rxcol = (rx_free == 0) ? COL_RED : COL_RESET;
+ fprintf(f, "\t%srx ring used: %ld\tfree: %ld"COL_RESET"\n",
+ rxcol, rx_used, rx_free);
+
+ uint64_t tx_used = qe_ring_count(p->cq_worker_ring);
+ uint64_t tx_free = qe_ring_free_count(p->cq_worker_ring);
+ const char *txcol = (tx_free == 0) ? COL_RED : COL_RESET;
+ fprintf(f, "\t%scq ring used: %ld\tfree: %ld"COL_RESET"\n",
+ txcol, tx_used, tx_free);
+ }
+
+ for (i = 0; i < sw->qid_count; i++) {
+ fprintf(f, " Queue %d (%s)\n", i, q_type_strings[sw->qids[i].type]);
+ fprintf(f, "\trx %"PRIu64"\n\tdrop %"PRIu64"\n\ttx %"PRIu64"\n",
+ sw->qids[i].stats.rx_pkts, sw->qids[i].stats.rx_dropped,
+ sw->qids[i].stats.tx_pkts);
+ uint32_t iq;
+ for(iq = 0; iq < SW_IQS_MAX; iq++) {
+ uint32_t used = iq_ring_count(sw->qids[i].iq[iq]);
+ uint32_t free = iq_ring_free_count(sw->qids[i].iq[iq]);
+ const char *col = (free == 0) ? COL_RED : COL_RESET;
+ fprintf(f, "\t%siq %d: Used %d\tFree %d"COL_RESET"\n",
+ col, iq, used, free);
+ }
+ }
+}
+
+static int
+sw_port_setup(struct rte_event_dev *dev, uint8_t port_id,
+ const struct rte_event_port_conf *conf)
+{
+ struct sw_evdev *sw = (void *)dev;
+ struct sw_port *p = &sw->ports[port_id];
+ char buf[QE_RING_NAMESIZE];
+ unsigned i;
+
+ if (conf->enqueue_queue_depth >
+ dev->info.max_event_port_enqueue_queue_depth ||
+ conf->dequeue_queue_depth >
+ dev->info.max_event_port_dequeue_queue_depth){
+ rte_errno = EINVAL;
+ return -1;
+ }
+
+ *p = (struct sw_port){0}; /* zero entire structure */
+ p->id = port_id;
+
+ /* TODO: how do we work with an overload scheme here?
+ * For now, still use a huge buffer, with per-port thresholds.
+ * When it fills beyond the configured max size, we throttle.
+ */
+ snprintf(buf, sizeof(buf), "%s_%s", dev->name, "rx_worker_ring");
+ p->rx_worker_ring = qe_ring_create(buf, MAX_SW_PROD_Q_DEPTH,
+ dev->socket_id);
+ if (p->rx_worker_ring == NULL)
+ return -1;
+
+ /* threshold is number of free spaces that are left in ring
+ * before overload should kick in. QE ring returns free_count,
+ * so storing this way makes more sense than actual depth
+ */
+ uint32_t requested = MAX_SW_PROD_Q_DEPTH - conf->new_event_threshold;
+ p->overload_threshold = requested > 255 ? 255 : requested;
+
+ snprintf(buf, sizeof(buf), "%s_%s", dev->name, "cq_worker_ring");
+ p->cq_worker_ring = qe_ring_create(buf, conf->dequeue_queue_depth,
+ dev->socket_id);
+ if (p->cq_worker_ring == NULL) {
+ qe_ring_destroy(p->rx_worker_ring);
+ return -1;
+ }
+ sw->cq_ring_space[port_id] = conf->dequeue_queue_depth;
+
+ /* set hist list contents to empty */
+ for (i = 0; i < SW_PORT_HIST_LIST; i++) {
+ p->hist_list[i].fid = -1;
+ p->hist_list[i].qid = -1;
+ }
+
+ return 0;
+}
+
+static int
+sw_port_cleanup(struct sw_evdev *sw, uint8_t port_id)
+{
+ struct sw_port *p = &sw->ports[port_id];
+
+ qe_ring_destroy(p->rx_worker_ring);
+ qe_ring_destroy(p->cq_worker_ring);
+ memset(p, 0, sizeof(*p));
+
+ return 0;
+}
+
+static uint8_t
+sw_port_count(struct rte_event_dev *dev)
+{
+ struct sw_evdev *sw = (void *)dev;
+ return sw->port_count;
+}
+
+
+static uint16_t
+sw_queue_count(struct rte_event_dev *dev)
+{
+ struct sw_evdev *sw = (void *)dev;
+ return sw->qid_count;
+}
+
+static int32_t
+qid_cleanup(struct sw_evdev *sw, uint32_t idx)
+{
+ struct sw_qid *qid = &sw->qids[idx];
+ uint32_t i;
+
+ for (i = 0; i < SW_IQS_MAX; i++) {
+ iq_ring_destroy(qid->iq[i]);
+ }
+
+ if (qid->type == RTE_SCHED_TYPE_ORDERED) {
+ rte_free(qid->reorder_buffer);
+ rte_ring_free(qid->reorder_buffer_freelist);
+ }
+ memset(qid, 0, sizeof(*qid));
+
+ return 0;
+}
+
+static int32_t
+qid_init(struct sw_evdev *sw, unsigned idx, int type,
+ const struct rte_event_queue_conf *queue_conf)
+{
+ int i;
+ int socket_id = sw->dev.socket_id;
+ char buf[IQ_RING_NAMESIZE];
+ struct sw_qid *qid = &sw->qids[idx];
+
+ for (i = 0; i < SW_IQS_MAX; i++) {
+ snprintf(buf, sizeof(buf), "q_%u_iq_%d", idx, i);
+ qid->iq[i] = iq_ring_create(buf, socket_id);
+ if (!qid->iq[i]) {
+ SW_LOG_DBG("ring create failed");
+ goto cleanup;
+ }
+ }
+
+ /* Initialize the iq packet mask to 1, as __builtin_clz() is undefined
+ * if the value passed in is zero.
+ */
+ qid->iq_pkt_mask = 1;
+
+ /* Initialize the FID structures to no pinning (-1), and zero packets */
+ struct sw_fid_t fid = {.cq = -1, .count = 0};
+ for (i = 0; i < SW_QID_NUM_FIDS; i++)
+ qid->fids[i] = fid;
+
+ qid->id = idx;
+ qid->type = type;
+ qid->priority = queue_conf->priority;
+
+ if (qid->type == RTE_SCHED_TYPE_ORDERED) {
+ uint32_t window_size;
+
+ /* rte_ring and window_size_mask require require window_size to
+ * be a power-of-2.
+ */
+ window_size = rte_align32pow2(
+ queue_conf->nb_atomic_order_sequences);
+
+ qid->window_size = window_size - 1;
+
+ if (!window_size) {
+ SW_LOG_DBG("invalid reorder_window_size for ordered queue\n");
+ goto cleanup;
+ }
+
+ snprintf(buf, sizeof(buf), "%s_iq_%d_rob", sw->dev.name, i);
+ qid->reorder_buffer = rte_zmalloc_socket(buf,
+ window_size * sizeof(qid->reorder_buffer[0]),
+ 0, socket_id);
+ if (!qid->reorder_buffer) {
+ SW_LOG_DBG("reorder_buffer malloc failed\n");
+ goto cleanup;
+ }
+
+ memset(&qid->reorder_buffer[0],
+ 0,
+ window_size * sizeof(qid->reorder_buffer[0]));
+
+ snprintf(buf, sizeof(buf), "%s_iq_%d_freelist", sw->dev.name, i);
+ qid->reorder_buffer_freelist = rte_ring_create(buf,
+ window_size,
+ socket_id,
+ RING_F_SP_ENQ | RING_F_SC_DEQ);
+ if (!qid->reorder_buffer_freelist) {
+ SW_LOG_DBG("freelist ring create failed");
+ goto cleanup;
+ }
+
+ /* Populate the freelist with reorder buffer entries. Enqueue
+ * 'window_size - 1' entries because the rte_ring holds only
+ * that many.
+ */
+ for (i = 0; i < (int) window_size - 1; i++) {
+ if (rte_ring_sp_enqueue(qid->reorder_buffer_freelist,
+ &qid->reorder_buffer[i]) < 0)
+ goto cleanup;
+ }
+
+ qid->reorder_buffer_index = 0;
+ qid->cq_next_tx = 0;
+ }
+
+ return 0;
+
+cleanup:
+ for (i = 0; i < SW_IQS_MAX; i++) {
+ if (qid->iq[i])
+ iq_ring_destroy(qid->iq[i]);
+ }
+
+ if (qid->reorder_buffer) {
+ rte_free(qid->reorder_buffer);
+ qid->reorder_buffer = NULL;
+ }
+
+ if (qid->reorder_buffer_freelist) {
+ rte_ring_free(qid->reorder_buffer_freelist);
+ qid->reorder_buffer_freelist = NULL;
+ }
+
+ return -EINVAL;
+}
+
+static int
+sw_queue_setup(struct rte_event_dev *dev,
+ uint8_t queue_id,
+ const struct rte_event_queue_conf *conf)
+{
+ int type;
+ if (conf->nb_atomic_flows > 0 &&
+ conf ->nb_atomic_order_sequences > 0)
+ return -1;
+
+ if (conf->event_queue_cfg & RTE_EVENT_QUEUE_CFG_SINGLE_CONSUMER)
+ type = RTE_SCHED_TYPE_DIRECT;
+ else if (conf->nb_atomic_flows > 0)
+ type = RTE_SCHED_TYPE_ATOMIC;
+ else if (conf->nb_atomic_order_sequences > 0)
+ type = RTE_SCHED_TYPE_ORDERED;
+ else
+ type = RTE_SCHED_TYPE_PARALLEL;
+
+ return qid_init((void *)dev, queue_id, type, conf);
+}
+
+static int
+sw_dev_configure(struct rte_event_dev *dev,
+ struct rte_event_dev_config *config)
+{
+ struct sw_evdev *se = (void *)dev;
+
+ if (config->nb_event_queues > dev->info.max_event_queues ||
+ config->nb_event_ports > dev->info.max_event_ports)
+ return -1;
+
+ se->qid_count = config->nb_event_queues;
+ se->port_count = config->nb_event_ports;
+ return 0;
+}
+
+static int
+assign_numa_node(const char *key __rte_unused, const char *value, void *opaque)
+{
+ int *socket_id = opaque;
+ *socket_id = atoi(value);
+ if (*socket_id > RTE_MAX_NUMA_NODES)
+ return -1;
+ return 0;
+}
+
+static inline void
+swap_ptr(void *a, void *b)
+{
+ void *tmp = a;
+ a = b;
+ b= tmp;
+}
+
+static int
+sw_start(struct rte_event_dev *dev)
+{
+ unsigned int i, j;
+ struct sw_evdev *sw = (void *)dev;
+ /* check all ports are set up */
+ for (i = 0; i < sw->port_count; i++)
+ if (sw->ports[i].rx_worker_ring == NULL)
+ return -1;
+
+ /* check all queues are configured and mapped to ports*/
+ for (i = 0; i < sw->qid_count; i++)
+ if (sw->qids[i].iq[0] == NULL ||
+ sw->qids[i].cq_num_mapped_cqs == 0)
+ return -1;
+
+ /* build up our prioritized array of qids */
+ /* We don't use qsort here, as if all/multiple entries have the same
+ * priority, the result is non-deterministic. From "man 3 qsort":
+ * "If two members compare as equal, their order in the sorted
+ * array is undefined."
+ */
+ for (i = 0; i < sw->qid_count; i++) {
+ sw->qids_prioritized[i] = &sw->qids[i];
+ for (j = i; j > 0; j--)
+ if (sw->qids_prioritized[j]->priority <
+ sw->qids_prioritized[j-1]->priority)
+ swap_ptr(sw->qids_prioritized[j],
+ sw->qids_prioritized[j-1]);
+ }
+ sw->started = 1;
+ return 0;
+}
+
+static void
+sw_stop(struct rte_event_dev *dev)
+{
+ struct sw_evdev *sw = (void *)dev;
+ sw->started = 0;
+}
+static int
+sw_close(struct rte_event_dev *dev)
+{
+ struct sw_evdev *sw = (void *)dev;
+ uint32_t i;
+
+ for(i = 0; i < sw->qid_count; i++) {
+ qid_cleanup(sw, i);
+ }
+ sw->qid_count = 0;
+
+ for (i = 0; i < sw->port_count; i++) {
+ sw_port_cleanup(sw, i);
+ }
+ sw->port_count = 0;
+
+ memset(&sw->stats, 0, sizeof(sw->stats));
+
+ return 0;
+}
+
+static int
+sw_probe(const char *name, const char *params)
+{
+ static const struct rte_event_dev_ops evdev_sw_ops = {
+ .configure = sw_dev_configure,
+ .queue_setup = sw_queue_setup,
+ .queue_count = sw_queue_count,
+ .port_setup = sw_port_setup,
+ .port_link = sw_port_link,
+ .port_count = sw_port_count,
+ .start = sw_start,
+ .stop = sw_stop,
+ .close = sw_close,
+ .stats_get = sw_dev_stats_get,
+ .dump = sw_dump,
+
+ .enqueue = sw_event_enqueue,
+ .enqueue_burst = sw_event_enqueue_burst,
+ .dequeue = sw_event_dequeue,
+ .dequeue_burst = sw_event_dequeue_burst,
+ .release = sw_event_release,
+ .schedule = sw_event_schedule,
+ };
+ static const char *args[] = { NUMA_NODE_ARG, NULL };
+ const struct rte_memzone *mz;
+ struct sw_evdev *se;
+ struct rte_event_dev_info evdev_sw_info = {
+ .driver_name = PMD_NAME,
+ .max_event_queues = SW_QIDS_MAX,
+ .max_event_queue_flows = SW_QID_NUM_FIDS,
+ .max_event_queue_priority_levels = SW_Q_PRIORITY_MAX,
+ .max_event_priority_levels = SW_IQS_MAX,
+ .max_event_ports = SW_PORTS_MAX,
+ .max_event_port_dequeue_queue_depth = MAX_SW_CONS_Q_DEPTH,
+ .max_event_port_enqueue_queue_depth = MAX_SW_PROD_Q_DEPTH,
+ /* for event limits, there is no hard limit, but it
+ * depends on number of Queues configured and depth of
+ * producer/consumer queues
+ */
+ .max_num_events = -1,
+ .event_dev_cap = (RTE_EVENT_DEV_CAP_QUEUE_QOS |
+ RTE_EVENT_DEV_CAP_EVENT_QOS),
+ };
+ int socket_id = 0;
+
+ if (params != NULL && params[0] != '\0') {
+ struct rte_kvargs *kvlist = rte_kvargs_parse(params, args);
+
+ if (!kvlist) {
+ RTE_LOG(INFO, PMD,
+ "Ignoring unsupported parameters when creating device '%s'\n",
+ name);
+ } else {
+ int ret = rte_kvargs_process(kvlist, NUMA_NODE_ARG,
+ assign_numa_node, &socket_id);
+ rte_kvargs_free(kvlist);
+
+ if (ret != 0) {
+ RTE_LOG(ERR, PMD,
+ "%s: Error parsing numa node parameter",
+ name);
+ return ret;
+ }
+ }
+ }
+
+ RTE_LOG(INFO, PMD, "Creating eventdev sw device %s, on numa node %d\n",
+ name, socket_id);
+
+ mz = rte_memzone_reserve(name, sizeof(*se), socket_id, 0);
+ if (mz == NULL)
+ return -1; /* memzone_reserve sets rte_errno on error */
+
+ se = mz->addr;
+ se->mz = mz;
+ snprintf(se->dev.name, sizeof(se->dev.name), "%s", name);
+ se->dev.configured = false;
+ se->dev.info = evdev_sw_info;
+ se->dev.ops = &evdev_sw_ops;
+ se->dev.socket_id = socket_id;
+
+ return rte_event_dev_register(&se->dev);
+}
+
+static int
+sw_remove(const char *name)
+{
+ if (name == NULL)
+ return -EINVAL;
+
+ RTE_LOG(INFO, PMD, "Closing eventdev sw device %s\n", name);
+ /* TODO unregister eventdev and release memzone */
+
+ return 0;
+}
+
+static struct rte_vdev_driver evdev_sw_pmd_drv = {
+ .probe = sw_probe,
+ .remove = sw_remove
+};
+
+RTE_PMD_REGISTER_VDEV(evdev_sw, evdev_sw_pmd_drv);
+RTE_PMD_REGISTER_PARAM_STRING(evdev_sw,"numa_node=<int>");
diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h
new file mode 100644
index 0000000..534e078
--- /dev/null
+++ b/drivers/event/sw/sw_evdev.h
@@ -0,0 +1,234 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SW_EVDEV_H_
+#define _SW_EVDEV_H_
+
+#include <rte_eventdev.h>
+#include <rte_eventdev_pmd.h>
+#include "event_ring.h"
+
+#define PMD_NAME "evdev_sw"
+
+#define SW_QIDS_MAX 128
+#define SW_QID_NUM_FIDS 16384
+#define SW_IQS_MAX 4
+#define SW_Q_PRIORITY_MAX 255
+#define SW_PORTS_MAX 128
+#define MAX_SW_CONS_Q_DEPTH 255
+
+/* allow for lots of over-provisioning */
+#define MAX_SW_PROD_Q_DEPTH 4096
+
+#define SW_FRAGMENTS_MAX 16
+#define PORT_DEQUEUE_BURST_SIZE 16
+#define SW_PORT_HIST_LIST (MAX_SW_PROD_Q_DEPTH + (MAX_SW_CONS_Q_DEPTH*2))
+
+#define SW_PORT_OVERLOAD_THRES (512)
+
+#define RTE_SCHED_TYPE_DIRECT (RTE_SCHED_TYPE_PARALLEL + 1)
+
+#ifdef RTE_LIBRTE_PMD_EVDEV_SW_DEBUG
+#define SW_LOG_INFO(fmt, args...) \
+ RTE_LOG(INFO, PMD, "[%s] %s() line %u: " fmt "\n", \
+ PMD_NAME, \
+ __func__, __LINE__, ## args)
+
+#define SW_LOG_DBG(fmt, args...) \
+ RTE_LOG(DEBUG, PMD, "[%s] %s() line %u: " fmt "\n", \
+ PMD_NAME, \
+ __func__, __LINE__, ## args)
+#else
+#define SW_LOG_INFO(fmt, args...)
+#define SW_LOG_DBG(fmt, args...)
+#endif
+
+enum {
+ QE_FLAG_VALID_SHIFT = 0,
+ QE_FLAG_COMPLETE_SHIFT,
+ QE_FLAG_NOT_EOP_SHIFT,
+ _QE_FLAG_COUNT
+};
+
+#define QE_FLAG_VALID (1 << QE_FLAG_VALID_SHIFT) /* set for NEW, FWD, FRAG */
+#define QE_FLAG_COMPLETE (1 << QE_FLAG_COMPLETE_SHIFT) /* set for FWD, DROP */
+#define QE_FLAG_NOT_EOP (1 << QE_FLAG_NOT_EOP_SHIFT) /* set for FRAG only */
+
+static const uint8_t sw_qe_flag_map[] = {
+ QE_FLAG_VALID /* RTE_QEENT_OP_NEW */,
+ QE_FLAG_VALID | QE_FLAG_COMPLETE /* RTE_QEENT_OP_FWD */,
+ QE_FLAG_COMPLETE /* RTE_QEENT_OP_DROP */,
+ QE_FLAG_VALID | QE_FLAG_COMPLETE | QE_FLAG_NOT_EOP,
+};
+
+/* Records basic event stats at a given point. Used in port and qid structs */
+struct sw_point_stats {
+ uint64_t rx_pkts;
+ uint64_t rx_dropped;
+ uint64_t tx_pkts;
+};
+
+struct reorder_buffer_entry {
+ uint16_t num_fragments; /**< Number of packet fragments */
+ uint16_t fragment_index; /**< Points to the oldest valid frag */
+ uint8_t ready; /**< Entry is ready to be reordered */
+ struct rte_event fragments[SW_FRAGMENTS_MAX];
+};
+
+struct sw_hist_list_entry {
+ int32_t qid;
+ int32_t fid;
+ struct reorder_buffer_entry *rob_entry;
+};
+
+struct sw_port {
+ /* A numeric ID for the port. This should be used to access the
+ * statistics as returned by *rte_event_dev_stats_get*, and in other
+ * places where the API requires accessing a port by integer. It is not
+ * valid to assume that ports will be allocated in a linear sequence.
+ */
+ uint8_t id;
+
+ /** Indicates if this port is overloaded, and we need to throttle input */
+ uint8_t overloaded;
+ uint8_t overload_threshold;
+
+ int16_t is_directed; /** Takes from a single directed QID */
+ int16_t num_ordered_qids; /** For loadbalanced we can optimise pulling
+ packets from producers if there is no reordering
+ involved */
+
+ /* track packets in and out of this port */
+ struct sw_point_stats stats;
+
+ /** Ring and buffer for pulling events from workers for scheduling */
+ struct qe_ring *rx_worker_ring __rte_cache_aligned;
+ uint32_t pp_buf_start;
+ uint32_t pp_buf_count;
+ struct rte_event pp_buf[PORT_DEQUEUE_BURST_SIZE];
+
+
+ /** Ring and buffer for pushing packets to workers after scheduling */
+ struct qe_ring *cq_worker_ring __rte_cache_aligned;
+ uint16_t cq_buf_count;
+ uint16_t outstanding_releases; /* num releases yet to be completed */
+ struct rte_event cq_buf[MAX_SW_CONS_Q_DEPTH];
+
+ /* History list structs, containing info on pkts egressed to worker */
+ uint16_t hist_head __rte_cache_aligned;
+ uint16_t hist_tail;
+ uint16_t inflights;
+ struct sw_hist_list_entry hist_list[SW_PORT_HIST_LIST];
+
+ uint8_t num_qids_mapped;
+};
+
+struct sw_fid_t {
+ /* which CQ this FID is currently pinned to */
+ uint32_t cq;
+ /* number of packets gone to the CQ with this FID */
+ uint32_t count;
+};
+
+struct sw_qid {
+ /* The type of this QID */
+ int type;
+ /* Integer ID representing the queue. This is used in history lists,
+ * to identify the stage of processing. */
+ uint32_t id;
+ struct sw_point_stats stats;
+
+ /* Internal priority rings for packets */
+ struct iq_ring *iq[SW_IQS_MAX];
+ uint32_t iq_pkt_mask; /* A mask to indicate packets in an IQ */
+ uint64_t iq_pkt_count[SW_IQS_MAX];
+
+ /* Information on what CQs are polling this IQ */
+ uint32_t cq_num_mapped_cqs;
+ uint32_t cq_next_tx; /* cq to write next (non-atomic) packet */
+ uint32_t cq_map[SW_PORTS_MAX];
+
+ /* Track flow ids for atomic load balancing */
+ struct sw_fid_t fids[SW_QID_NUM_FIDS];
+
+ /* Track packet order for reordering when needed */
+ struct reorder_buffer_entry *reorder_buffer; /* packets awaiting reordering */
+ struct rte_ring *reorder_buffer_freelist; /* available reorder slots */
+ uint32_t reorder_buffer_index; /* oldest valid reorder buffer entry */
+ uint32_t window_size; /* Used to wrap reorder_buffer_index */
+
+ uint8_t priority;
+};
+
+struct sw_evdev {
+ /* must be the first item in the private dev struct */
+ struct rte_event_dev dev;
+
+ const struct rte_memzone *mz;
+
+ /* Contains all ports - load balanced and directed */
+ struct sw_port ports[SW_PORTS_MAX];
+ uint32_t port_count;
+ uint16_t cq_ring_space[SW_PORTS_MAX]; /* How many packets are in the cq */
+
+ /* All qids - allocated in one slab for vectorization */
+ struct sw_qid qids[SW_QIDS_MAX];
+ uint32_t qid_count;
+
+ /* Array of pointers to load-balanced QIDs sorted by priority level */
+ struct sw_qid *qids_prioritized[SW_QIDS_MAX];
+
+ /* Stats */
+ struct sw_point_stats stats __rte_cache_aligned;
+ uint64_t sched_called;
+ uint64_t sched_no_iq_enqueues;
+ uint64_t sched_no_cq_enqueues;
+ uint64_t sched_cq_qid_called;
+ uint64_t sched_overload_counter;
+
+ uint8_t started;
+
+ uint32_t overloaded __rte_cache_aligned;
+};
+
+int sw_event_enqueue(struct rte_event_dev *dev, uint8_t port_id,
+ struct rte_event *ev, bool pin_event);
+int sw_event_enqueue_burst(struct rte_event_dev *dev, uint8_t port_id,
+ struct rte_event ev[], int num, bool pin_event);
+bool sw_event_dequeue(struct rte_event_dev *dev, uint8_t port_id,
+ struct rte_event *ev, uint64_t wait);
+int sw_event_dequeue_burst(struct rte_event_dev *dev, uint8_t port_id,
+ struct rte_event *ev, int num, uint64_t wait);
+void sw_event_release(struct rte_event_dev *dev, uint8_t port_id, uint8_t index);
+int sw_event_schedule(struct rte_event_dev *dev);
+
+#endif /* _SW_EVDEV_H_ */
diff --git a/drivers/event/sw/sw_evdev_scheduler.c b/drivers/event/sw/sw_evdev_scheduler.c
new file mode 100644
index 0000000..02831d2
--- /dev/null
+++ b/drivers/event/sw/sw_evdev_scheduler.c
@@ -0,0 +1,660 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <rte_ring.h>
+#include "sw_evdev.h"
+#include "iq_ring.h"
+
+#define SW_IQS_MASK (SW_IQS_MAX-1)
+
+/* Retrieve the highest priority IQ or -1 if no pkts available. Doing the
+ * CLZ twice is faster than caching the value due to data dependencies
+ */
+#define PKT_MASK_TO_IQ(pkts) \
+ (__builtin_ctz(pkts | (1 << SW_IQS_MAX)))
+
+/* Clamp the highest priorities to the max value as allowed by
+ * the mask. Assums MASK is (powerOfTwo - 1). Priority 0 (highest) are shifted
+ * into leftmost IQ so that clz() reads it first on dequeue
+ */
+#define PRIO_TO_IQ(prio) (prio > SW_IQS_MASK ? SW_IQS_MASK : prio)
+
+static inline uint32_t
+sw_schedule_atomic_to_cq(struct sw_evdev *sw, struct sw_qid * const qid,
+ uint32_t iq_num, unsigned int count)
+{
+ uint32_t i;
+
+ if(count == 0)
+ return 0;
+
+ /* This is the QID ID. The QID ID is static, hence it can be
+ * used to identify the stage of processing in history lists etc */
+ uint32_t qid_id = qid->id;
+
+ for (i = 0; i < count; i++) {
+ const struct rte_event *qe = iq_ring_peek(qid->iq[iq_num]);
+ struct sw_fid_t *fid = &qid->fids[qe->flow_id];
+ int cq = fid->cq;
+
+ /* If no CQ is assigned, pick one */
+ if (cq < 0) {
+ /* select CQ based on least inflights,
+ * defaulting to the first mapped CQ
+ */
+ uint32_t cq_idx = qid->cq_next_tx++;
+ if (qid->cq_next_tx == qid->cq_num_mapped_cqs)
+ qid->cq_next_tx = 0;
+ cq = qid->cq_map[cq_idx];
+ int cq_free_cnt = sw->cq_ring_space[cq];
+
+ for (cq_idx = 0; cq_idx < qid->cq_num_mapped_cqs; cq_idx++) {
+ int test_cq = qid->cq_map[cq_idx];
+ int test_cq_free = sw->cq_ring_space[test_cq];
+
+ if (test_cq_free > cq_free_cnt)
+ cq = test_cq, cq_free_cnt = test_cq_free;
+ }
+ }
+
+ struct sw_port *p = &sw->ports[cq];
+
+ /* If the destination CQ or its history list is full, move on
+ * to the next queue.
+ */
+ if (sw->cq_ring_space[cq] == 0 ||
+ p->inflights == SW_PORT_HIST_LIST) {
+ struct qe_ring *worker = sw->ports[cq].cq_worker_ring;
+ qe_ring_enqueue_burst(worker, sw->ports[cq].cq_buf,
+ sw->ports[cq].cq_buf_count,
+ &sw->cq_ring_space[cq]);
+ sw->ports[cq].cq_buf_count = 0;
+#if 0
+ printf("%s cq %d was 0, now %d\n", __func__,
+ cq, sw->cq_ring_space[cq]);
+#endif
+ if(sw->cq_ring_space[cq] == 0)
+ break;
+ }
+
+ sw->cq_ring_space[cq]--;
+
+ /* store which CQ this FID is active on,
+ * for future pkts of the same flow
+ */
+ fid->cq = cq;
+ fid->count++;
+
+ qid->stats.tx_pkts++;
+ sw->ports[cq].inflights++;
+
+ int head = (p->hist_head & (SW_PORT_HIST_LIST-1));
+
+ p->hist_list[head].fid = qe->flow_id;
+ p->hist_list[head].qid = qid_id;
+
+ p->hist_head++;
+ p->stats.tx_pkts++;
+ sw->ports[cq].cq_buf[sw->ports[cq].cq_buf_count++] = *qe;
+ iq_ring_pop(qid->iq[iq_num]);
+ }
+ return i;
+}
+
+static inline uint32_t
+sw_schedule_parallel_to_cq(struct sw_evdev *sw, struct sw_qid * const qid,
+ uint32_t iq_num, unsigned int count, int keep_order)
+{
+ uint32_t i;
+ uint32_t cq_idx = qid->cq_next_tx;
+
+ /* This is the QID ID. The QID ID is static, hence it can be
+ * used to identify the stage of processing in history lists etc */
+ uint32_t qid_id = qid->id;
+
+
+ if (keep_order)
+ /* only schedule as many as we have reorder buffer entries */
+ count = RTE_MIN(count, rte_ring_count(qid->reorder_buffer_freelist));
+
+ for (i = 0; i < count; i++) {
+ const struct rte_event *qe = iq_ring_peek(qid->iq[iq_num]);
+ uint32_t cq_check_count = 0;
+ uint32_t cq;
+
+ /*
+ * for parallel, just send to next available CQ in round-robin
+ * fashion. So scan for an available CQ. If all CQs are full
+ * just return and move on to next QID
+ */
+ do {
+ if (++cq_check_count > qid->cq_num_mapped_cqs)
+ goto exit;
+ cq = qid->cq_map[cq_idx];
+ if (++cq_idx == qid->cq_num_mapped_cqs)
+ cq_idx = 0;
+ } while (qe_ring_free_count(sw->ports[cq].cq_worker_ring) == 0 ||
+ sw->ports[cq].inflights == SW_PORT_HIST_LIST);
+
+ struct sw_port *p = &sw->ports[cq];
+ if (sw->cq_ring_space[cq] == 0 ||
+ p->inflights == SW_PORT_HIST_LIST)
+ break;
+
+ sw->cq_ring_space[cq]--;
+
+ qid->stats.tx_pkts++;
+
+ const int head = (p->hist_head & (SW_PORT_HIST_LIST-1));
+
+ p->hist_list[head].fid = qe->flow_id;
+ p->hist_list[head].qid = qid_id;
+
+ if (keep_order)
+ rte_ring_sc_dequeue(qid->reorder_buffer_freelist,
+ (void *)&p->hist_list[head].rob_entry);
+
+ sw->ports[cq].cq_buf[sw->ports[cq].cq_buf_count++] = *qe;
+ iq_ring_pop(qid->iq[iq_num]);
+
+ rte_compiler_barrier();
+ p->inflights++;
+ p->stats.tx_pkts++;
+ p->hist_head++;
+ }
+exit:
+ qid->cq_next_tx = cq_idx;
+ return i;
+}
+
+static uint32_t
+sw_schedule_dir_to_cq(struct sw_evdev *sw, struct sw_qid * const qid,
+ uint32_t iq_num, unsigned int count)
+{
+ uint32_t cq_id = qid->cq_map[0];
+ struct sw_port *port = &sw->ports[cq_id];
+
+ /* get max burst enq size for cq_ring */
+ uint32_t count_free = sw->cq_ring_space[cq_id];
+ if (count == 0 || count_free == 0)
+ return 0;
+
+ /* burst dequeue from the QID IQ ring */
+ struct iq_ring *ring = qid->iq[iq_num];
+ uint32_t ret = iq_ring_dequeue_burst(ring,
+ &port->cq_buf[port->cq_buf_count], count_free);
+ port->cq_buf_count += ret;
+
+ /* Update QID, Port and Total TX stats */
+ qid->stats.tx_pkts += ret;
+ port->stats.tx_pkts += ret;
+
+ /* Subtract credits from cached value */
+ sw->cq_ring_space[cq_id] -= ret;
+
+ return ret;
+}
+
+static uint32_t
+sw_schedule_qid_to_cq(struct sw_evdev *sw)
+{
+ uint32_t pkts = 0;
+ uint32_t qid_idx;
+
+ sw->sched_cq_qid_called++;
+
+ for (qid_idx = 0; qid_idx < sw->qid_count; qid_idx++) {
+ /* make the QID lookup here be based on priority of the QID */
+ struct sw_qid *qid = sw->qids_prioritized[qid_idx];
+
+ int type = qid->type;
+ int iq_num = PKT_MASK_TO_IQ(qid->iq_pkt_mask);
+
+ /* zero mapped CQs indicates directed */
+ if (iq_num >= SW_IQS_MAX)
+ continue;
+
+ unsigned int count = iq_ring_count(qid->iq[iq_num]);
+ uint32_t pkts_done = 0;
+
+ if (type == RTE_SCHED_TYPE_DIRECT)
+ pkts_done += sw_schedule_dir_to_cq(sw, qid,
+ iq_num, count);
+ else if (type == RTE_SCHED_TYPE_ATOMIC)
+ pkts_done += sw_schedule_atomic_to_cq(sw, qid,
+ iq_num, count);
+ else
+ pkts_done += sw_schedule_parallel_to_cq(sw, qid,
+ iq_num, count,
+ (type == RTE_SCHED_TYPE_ORDERED));
+
+ /* Check if the IQ that was polled is now empty, and unset it
+ * in the IQ mask if its empty.
+ */
+ int all_done = (pkts_done == count);
+
+ qid->iq_pkt_mask &= ~(all_done << (iq_num));
+ pkts += pkts_done;
+ }
+
+ return pkts;
+}
+
+/* This function will perform re-ordering of packets, and injecting into
+ * the appropriate QID IQ. As LB and DIR QIDs are in the same array, but *NOT*
+ * contiguous in that array, this function accepts a "range" of QIDs to scan.
+ */
+static uint16_t
+sw_schedule_reorder(struct sw_evdev *sw, int qid_start, int qid_end)
+{
+ /* Perform egress reordering */
+ struct rte_event *qe;
+ uint32_t pkts_iter = 0;
+
+ for (; qid_start < qid_end; qid_start++) {
+ struct sw_qid *qid = &sw->qids[qid_start];
+ int i, num_entries_in_use;
+
+ if (qid->type != RTE_SCHED_TYPE_ORDERED)
+ continue;
+
+ num_entries_in_use = rte_ring_free_count(
+ qid->reorder_buffer_freelist);
+
+ for (i = 0; i < num_entries_in_use; i++) {
+ struct reorder_buffer_entry *entry;
+ int j;
+
+ entry = &qid->reorder_buffer[qid->reorder_buffer_index];
+
+ if (!entry->ready)
+ break;
+
+ for (j = 0; j < entry->num_fragments; j++) {
+ uint16_t dest_qid;
+ uint16_t dest_iq;
+
+ qe = &entry->fragments[entry->fragment_index + j];
+
+ dest_qid = qe->flow_id;
+ dest_iq = PRIO_TO_IQ(qe->priority);
+
+ if(dest_qid >= sw->qid_count) {
+ sw->stats.rx_dropped++;
+ continue;
+ }
+
+ struct sw_qid *dest_qid_ptr = &sw->qids[dest_qid];
+ const struct iq_ring *dest_iq_ptr = dest_qid_ptr->iq[dest_iq];
+ if (iq_ring_free_count(dest_iq_ptr) == 0)
+ break;
+
+ pkts_iter++;
+
+ struct sw_qid *q = &sw->qids[dest_qid];
+ struct iq_ring *r = q->iq[dest_iq];
+
+ /* we checked for space above, so enqueue must
+ * succeed
+ */
+ iq_ring_enqueue(r, qe);
+ q->iq_pkt_mask |= (1 << (dest_iq));
+ q->iq_pkt_count[dest_iq]++;
+ q->stats.rx_pkts++;
+ }
+
+ entry->ready = (j != entry->num_fragments);
+ entry->num_fragments -= j;
+ entry->fragment_index += j;
+
+ if (!entry->ready) {
+ entry->fragment_index = 0;
+
+ rte_ring_sp_enqueue(qid->reorder_buffer_freelist,
+ entry);
+
+ qid->reorder_buffer_index++;
+ qid->reorder_buffer_index %= qid->window_size;
+ }
+ }
+ }
+ return pkts_iter;
+}
+
+static uint32_t
+sw_schedule_pull_port_lb(struct sw_evdev *sw, uint32_t port_id)
+{
+ uint32_t pkts_iter = 0;
+ struct sw_port *port = &sw->ports[port_id];
+ struct qe_ring *worker = port->rx_worker_ring;
+
+ /* If shadow ring has 0 pkts, pull from worker ring */
+ if(port->pp_buf_count == 0) {
+ port->pp_buf_start = 0;
+ port->pp_buf_count = qe_ring_dequeue_burst(worker, port->pp_buf,
+ RTE_DIM(port->pp_buf));
+
+ if (port->overloaded &&
+ qe_ring_count(worker) < SW_PORT_OVERLOAD_THRES/2) {
+ port->overloaded = 0;
+ sw->sched_overload_counter++;
+ rte_atomic32_dec((void *)&sw->overloaded);
+ }
+ }
+
+ while (port->pp_buf_count) {
+ const struct rte_event *qe = &port->pp_buf[port->pp_buf_start];
+ struct sw_hist_list_entry *hist_entry = NULL;
+ uint8_t flags = qe->operation;
+ const uint16_t eop = !(flags & QE_FLAG_NOT_EOP);
+ int needs_reorder = 0;
+
+ static const struct reorder_buffer_entry dummy_rob;
+
+ /*
+ * if we don't have space for this packet in an IQ,
+ * then move on to next queue. Technically, for a
+ * packet that needs reordering, we don't need to check
+ * here, but it simplifies things not to special-case
+ */
+ uint32_t iq_num = PRIO_TO_IQ(qe->priority);
+ struct sw_qid *qid = &sw->qids[qe->queue_id];
+ struct iq_ring *iq_ring = qid->iq[iq_num];
+
+ if ((flags & QE_FLAG_VALID) &&
+ iq_ring_free_count(iq_ring) == 0)
+ break;
+
+ /* now process based on flags. Note that for directed
+ * queues, the enqueue_flush masks off all but the
+ * valid flag. This makes FWD and partial enqueues just
+ * NEW type, and makes DROPS no-op calls.
+ */
+ if ((flags & QE_FLAG_COMPLETE) && port->inflights > 0) {
+ const uint32_t hist_tail = port->hist_tail &
+ (SW_PORT_HIST_LIST - 1);
+
+ hist_entry = &port->hist_list[hist_tail];
+ const uint32_t hist_qid = hist_entry->qid;
+ const uint32_t hist_fid = hist_entry->fid;
+
+ struct sw_fid_t *fid = &sw->qids[hist_qid].fids[hist_fid];
+ fid->count -= eop;
+ if (fid->count == 0)
+ fid->cq = -1;
+
+ /* set reorder ready if an ordered QID */
+ uintptr_t rob_ptr = (uintptr_t)hist_entry->rob_entry;
+ const uintptr_t valid = (rob_ptr != 0);
+ needs_reorder = valid;
+ rob_ptr |= ((valid - 1) & (uintptr_t)&dummy_rob);
+ ((struct reorder_buffer_entry*)rob_ptr)->ready =
+ eop * needs_reorder;
+
+ port->inflights -= eop;
+ port->hist_tail += eop;
+ }
+ if (flags & QE_FLAG_VALID) {
+ port->stats.rx_pkts++;
+
+ if (needs_reorder) {
+ struct reorder_buffer_entry *rob_entry =
+ hist_entry->rob_entry;
+
+ //TODO: How do we alert the user that they've exceeded max frags?
+ if (rob_entry->num_fragments == SW_FRAGMENTS_MAX)
+ sw->stats.rx_dropped++;
+ else
+ rob_entry->fragments[rob_entry->num_fragments++] = *qe;
+ goto end_qe;
+ }
+
+ /* Use the iq_num from above to push the QE
+ * into the qid at the right priority
+ */
+
+ qid->iq_pkt_mask |= (1 << (iq_num));
+ iq_ring_enqueue(iq_ring, qe);
+ qid->iq_pkt_count[iq_num]++;
+ qid->stats.rx_pkts++;
+ pkts_iter++;
+ }
+
+ end_qe:
+ port->pp_buf_start++;
+ port->pp_buf_count--;
+ } /* while (avail_qes) */
+
+ return pkts_iter;
+}
+
+static uint32_t
+sw_schedule_pull_port_dir(struct sw_evdev *sw, uint32_t port_id)
+{
+ uint32_t pkts_iter = 0;
+ struct sw_port *port = &sw->ports[port_id];
+ struct qe_ring *worker = port->rx_worker_ring;
+
+ /* If shadow ring has 0 pkts, pull from worker ring */
+ if (port->pp_buf_count == 0) {
+ port->pp_buf_start = 0;
+ port->pp_buf_count = qe_ring_dequeue_burst(worker, port->pp_buf,
+ RTE_DIM(port->pp_buf));
+
+ if (port->overloaded &&
+ qe_ring_count(worker) < SW_PORT_OVERLOAD_THRES/2) {
+ port->overloaded = 0;
+ sw->sched_overload_counter++;
+ rte_atomic32_dec((void *)&sw->overloaded);
+ }
+ }
+
+ while (port->pp_buf_count) {
+ const struct rte_event *qe = &port->pp_buf[port->pp_buf_start];
+ uint8_t flags = qe->operation;
+
+ if ((flags & QE_FLAG_VALID) == 0)
+ goto end_qe;
+
+ uint32_t iq_num = PRIO_TO_IQ(qe->priority);
+ struct sw_qid *qid = &sw->qids[qe->queue_id];
+ struct iq_ring *iq_ring = qid->iq[iq_num];
+
+ if (iq_ring_free_count(iq_ring) == 0)
+ break; /* move to next port */
+
+ port->stats.rx_pkts++;
+
+ /* Use the iq_num from above to push the QE
+ * into the qid at the right priority
+ */
+ qid->iq_pkt_mask |= (1 << (iq_num));
+ iq_ring_enqueue(iq_ring, qe);
+ qid->iq_pkt_count[iq_num]++;
+ qid->stats.rx_pkts++;
+ pkts_iter++;
+
+ end_qe:
+ port->pp_buf_start++;
+ port->pp_buf_count--;
+ } /* while port->pp_buf_count */
+
+ return pkts_iter;
+}
+
+static uint32_t
+sw_schedule_pull_port_no_reorder(struct sw_evdev *sw, uint32_t port_id)
+{
+ uint32_t pkts_iter = 0;
+ struct sw_port *port = &sw->ports[port_id];
+ struct qe_ring *worker = port->rx_worker_ring;
+
+ if (port->pp_buf_count == 0) {
+ port->pp_buf_start = 0;
+ port->pp_buf_count = qe_ring_dequeue_burst(worker, port->pp_buf,
+ RTE_DIM(port->pp_buf));
+
+ if (port->overloaded &&
+ qe_ring_count(worker) < SW_PORT_OVERLOAD_THRES/2) {
+ port->overloaded = 0;
+ sw->sched_overload_counter++;
+ rte_atomic32_dec((void *)&sw->overloaded);
+ }
+ }
+
+ while (port->pp_buf_count) {
+ const struct rte_event *ev = &port->pp_buf[port->pp_buf_start];
+ struct sw_hist_list_entry *hist_entry = NULL;
+ uint8_t flags = ev->operation;
+
+ /* for fragments, ignore completion
+ * NOTE: if not_eop flag is set, completion flag must
+ * also be set so we can use xor */
+ flags ^= !(flags & QE_FLAG_NOT_EOP) >>
+ (QE_FLAG_NOT_EOP_SHIFT - QE_FLAG_COMPLETE_SHIFT);
+
+ /*
+ * if we don't have space for this packet in an IQ,
+ * then move on to next queue.
+ */
+ uint32_t iq_num = PRIO_TO_IQ(ev->priority);
+ struct sw_qid *qid = &sw->qids[ev->queue_id];
+ struct iq_ring *iq_ring = qid->iq[iq_num];
+
+ if ((flags & QE_FLAG_VALID) &&
+ iq_ring_free_count(iq_ring) == 0)
+ break;
+
+ /* now process based on flags. Note that for directed
+ * queues, the enqueue_flush masks off all but the
+ * valid flag. This makes FWD and partial enqueues just
+ * NEW type, and makes DROPS no-op calls.
+ */
+ if ((flags & QE_FLAG_COMPLETE) && port->inflights > 0) {
+ const uint32_t hist_tail = port->hist_tail &
+ (SW_PORT_HIST_LIST - 1);
+
+ hist_entry = &port->hist_list[hist_tail];
+ const uint32_t hist_qid = hist_entry->qid;
+ const uint32_t hist_fid = hist_entry->fid;
+
+ struct sw_fid_t *fid = &sw->qids[hist_qid].fids[hist_fid];
+ fid->count--;
+ if (fid->count == 0)
+ fid->cq = -1;
+
+ port->inflights --;
+ port->hist_tail ++;
+ }
+ if (flags & QE_FLAG_VALID) {
+ port->stats.rx_pkts++;
+
+ /* Use the iq_num from above to push the QE
+ * into the qid at the right priority
+ */
+
+ qid->iq_pkt_mask |= (1 << (iq_num));
+ iq_ring_enqueue(iq_ring, ev);
+ qid->iq_pkt_count[iq_num]++;
+ qid->stats.rx_pkts++;
+ pkts_iter++;
+ }
+
+ port->pp_buf_start++;
+ port->pp_buf_count--;
+ } /* while (avail_qes) */
+
+ return pkts_iter;
+}
+
+int
+sw_event_schedule(struct rte_event_dev *dev)
+{
+ static const uint32_t num_pkts = 256;
+ struct sw_evdev *sw = (struct sw_evdev *)dev;
+ uint32_t in_pkts, out_pkts;
+ uint32_t out_pkts_total = 0, in_pkts_total = 0;
+ uint32_t i;
+
+ sw->sched_called++;
+ if (!sw->started)
+ return -1;
+
+ do {
+ uint32_t in_pkts_this_iteration = 0;
+
+ /* Pull from rx_ring for ports */
+ do {
+ in_pkts = 0;
+ for (i = 0; i < sw->port_count; i++)
+ /* TODO: use a function pointer in the port itself */
+ if (sw->ports[i].is_directed)
+ in_pkts += sw_schedule_pull_port_dir(sw, i);
+ else if (sw->ports[i].num_ordered_qids > 0)
+ in_pkts += sw_schedule_pull_port_lb(sw, i);
+ else
+ in_pkts += sw_schedule_pull_port_no_reorder(sw, i);
+
+ /* QID scan for re-ordered */
+ in_pkts += sw_schedule_reorder(sw, 0,
+ sw->qid_count);
+ in_pkts_this_iteration += in_pkts;
+ } while (in_pkts > 0 && in_pkts_this_iteration < num_pkts);
+
+ out_pkts = 0;
+ out_pkts += sw_schedule_qid_to_cq(sw);
+ out_pkts_total += out_pkts;
+ in_pkts_total += in_pkts_this_iteration;
+
+ if (in_pkts == 0 && out_pkts == 0)
+ break;
+ } while (out_pkts_total < num_pkts);
+
+ /* push all the internal buffered QEs in port->cq_ring to the
+ * worker cores: aka, do the ring transfers batched.
+ */
+ for(i = 0; i < sw->port_count; i++) {
+ struct qe_ring *worker = sw->ports[i].cq_worker_ring;
+ qe_ring_enqueue_burst(worker, sw->ports[i].cq_buf,
+ sw->ports[i].cq_buf_count,
+ &sw->cq_ring_space[i]);
+ sw->ports[i].cq_buf_count = 0;
+ }
+
+ sw->stats.tx_pkts += out_pkts_total;
+ sw->stats.rx_pkts += in_pkts_total;
+
+ sw->sched_no_iq_enqueues += (in_pkts_total == 0);
+ sw->sched_no_cq_enqueues += (out_pkts_total == 0);
+
+ return out_pkts_total;
+}
diff --git a/drivers/event/sw/sw_evdev_worker.c b/drivers/event/sw/sw_evdev_worker.c
new file mode 100644
index 0000000..1b055cc
--- /dev/null
+++ b/drivers/event/sw/sw_evdev_worker.c
@@ -0,0 +1,218 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sw_evdev.h"
+
+#include <rte_atomic.h>
+#include <rte_hash_crc.h>
+
+#define FLOWID_MASK (SW_QID_NUM_FIDS-1)
+
+static inline void
+sw_overload_check_and_set(struct sw_evdev *sw, struct sw_port *p,
+ uint16_t free_count)
+{
+ if (!p->overloaded &&
+ free_count < MAX_SW_PROD_Q_DEPTH - p->overload_threshold) {
+ p->overloaded = 1;
+ rte_atomic32_inc((void *)&sw->overloaded);
+ }
+}
+
+int
+sw_event_enqueue(struct rte_event_dev *dev, uint8_t port_id, struct rte_event *ev,
+ bool pin_event)
+{
+ RTE_SET_USED(pin_event);
+ uint16_t free_count;
+ struct sw_evdev *sw = (void *)dev;
+
+ if(port_id >= sw->port_count)
+ return -1;
+
+ struct sw_port *p = &sw->ports[port_id];
+ /* TODO: Concider optimization: keep port overloaded in flat array in
+ * sw instance, do a lookup and just one return branch together with
+ * port_id check above */
+ if(sw->overloaded && ev->operation == RTE_EVENT_OP_NEW)
+ return -ENOSPC;
+
+ ev->operation = sw_qe_flag_map[ev->operation];
+ const uint8_t invalid_qid = (ev[0].queue_id >= sw->qid_count);
+ ev[0].operation &= ~(invalid_qid << QE_FLAG_VALID_SHIFT);
+ /* mask flowID to valid range after a crc to jumble bits */
+ ev[0].flow_id = FLOWID_MASK & rte_hash_crc_4byte(ev[0].flow_id, -1);
+
+ if(invalid_qid) {
+ p->stats.rx_dropped++;
+ }
+
+ unsigned int num_enq = qe_ring_enqueue_burst(p->rx_worker_ring,
+ ev, 1, &free_count);
+
+ sw_overload_check_and_set(sw, p, free_count);
+
+ /* TODO: Discuss on ML and fix this inconsistency in API:
+ * num_enq is the number of packet enqueued, so
+ * 0 = no packets
+ * 1 = got a packet
+ * This is different to how currently documented in API.
+ */
+ return num_enq;
+}
+
+int
+sw_event_enqueue_burst(struct rte_event_dev *dev, uint8_t port_id,
+ struct rte_event ev[], int num, bool pin_event)
+{
+ /* TODO: change enqueue API to uint32_t for num? */
+ int32_t i;
+ uint16_t free_count;
+ struct sw_evdev *sw = (void *)dev;
+
+ if(port_id >= sw->port_count)
+ return 0;
+
+ struct sw_port *p = &sw->ports[port_id];
+ RTE_SET_USED(pin_event);
+
+ for (i = 0; i < num; i++) {
+ /* optimize to two loops, with and without overload */
+ if(sw->overloaded && ev[i].operation == RTE_EVENT_OP_NEW)
+ return -ENOSPC;
+
+ ev[i].operation = sw_qe_flag_map[ev[i].operation];
+ const uint8_t invalid_qid = (ev[i].queue_id >= sw->qid_count);
+ ev[i].operation &= ~(invalid_qid << QE_FLAG_VALID_SHIFT);
+ ev[i].flow_id = FLOWID_MASK & rte_hash_crc_4byte(ev[i].flow_id, -1);
+
+ if(invalid_qid) {
+ p->stats.rx_dropped++;
+ }
+ }
+
+ /* returns number of events actually enqueued */
+ uint32_t deq = qe_ring_enqueue_burst(p->rx_worker_ring, ev, num,
+ &free_count);
+ sw_overload_check_and_set(sw, p, free_count);
+ return deq;
+}
+
+bool
+sw_event_dequeue(struct rte_event_dev *dev, uint8_t port_id,
+ struct rte_event *ev, uint64_t wait)
+{
+ RTE_SET_USED(wait);
+ struct sw_evdev *sw = (void *)dev;
+
+ if(port_id >= sw->port_count)
+ return 0;
+
+ struct sw_port *p = &sw->ports[port_id];
+ struct qe_ring *ring = p->cq_worker_ring;
+
+ /* check that all previous dequeus have been released */
+ uint16_t out_rels = p->outstanding_releases;
+ uint16_t i;
+ for(i = 0; i < out_rels; i++) {
+ sw_event_release(dev, port_id, i);
+ }
+
+ /* Intel modification: may not be in final API */
+ if(ev == 0)
+ return 0;
+
+ /* returns number of events actually dequeued, after storing */
+ uint32_t ndeq = qe_ring_dequeue_burst(ring, ev, 1);
+ p->outstanding_releases = ndeq;
+ return ndeq;
+}
+
+int
+sw_event_dequeue_burst(struct rte_event_dev *dev, uint8_t port_id,
+ struct rte_event *ev, int num, uint64_t wait)
+{
+ RTE_SET_USED(wait);
+ struct sw_evdev *sw = (void *)dev;
+
+ if(port_id >= sw->port_count)
+ return 0;
+
+ struct sw_port *p = &sw->ports[port_id];
+ struct qe_ring *ring = p->cq_worker_ring;
+
+ /* check that all previous dequeus have been released */
+ if (!p->is_directed) {
+ uint16_t out_rels = p->outstanding_releases;
+ uint16_t i;
+ for(i = 0; i < out_rels; i++) {
+ sw_event_release(dev, port_id, i);
+ }
+ }
+
+ /* Intel modification: may not be in final API */
+ if(ev == 0)
+ return 0;
+
+ /* returns number of events actually dequeued */
+ uint32_t ndeq = qe_ring_dequeue_burst(ring, ev, num);
+ p->outstanding_releases = ndeq;
+ return ndeq;
+}
+
+void
+sw_event_release(struct rte_event_dev *dev, uint8_t port_id, uint8_t index)
+{
+ struct sw_evdev *sw = (void *)dev;
+ struct sw_port *p = &sw->ports[port_id];
+ RTE_SET_USED(p);
+ RTE_SET_USED(index);
+
+ /* This function "hints" the scheduler that packet *index* of the
+ * previous burst:
+ * (Atomic) has completed is critical section
+ * (Ordered) is ready for egress
+ *
+ * It is not mandatory to implement this functionality, but it may
+ * improve load-balancing / parallelism in the packet flows.
+ */
+
+ /* create drop message */
+ struct rte_event ev = {
+ .operation = sw_qe_flag_map[RTE_EVENT_OP_DROP],
+ };
+
+ uint16_t free_count;
+ qe_ring_enqueue_burst(p->rx_worker_ring, &ev, 1, &free_count);
+
+ p->outstanding_releases--;
+}
--
2.7.4
^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH 4/7] event/sw: makefiles and config
2016-11-16 18:00 [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD Harry van Haaren
` (2 preceding siblings ...)
2016-11-16 18:00 ` [dpdk-dev] [PATCH 3/7] event/sw: software eventdev implementation Harry van Haaren
@ 2016-11-16 18:00 ` Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 5/7] test/eventdev: unit and functional tests Harry van Haaren
` (3 subsequent siblings)
7 siblings, 0 replies; 18+ messages in thread
From: Harry van Haaren @ 2016-11-16 18:00 UTC (permalink / raw)
To: dev; +Cc: Harry van Haaren, Gage Eads, Bruce Richardson
This commit modifies the existing Makefiles to have the sw_evdev instance
compiled. At this point in the patchset, the infrastructure and sw_evdev
pmd is compiled, which means that it can be instantiated and used
successfully.
Signed-off-by: Gage Eads <gage.eads@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---
config/common_base | 6 ++++++
drivers/event/Makefile | 2 ++
mk/rte.app.mk | 4 ++++
3 files changed, 12 insertions(+)
diff --git a/config/common_base b/config/common_base
index a0a07f6..862178a 100644
--- a/config/common_base
+++ b/config/common_base
@@ -417,6 +417,12 @@ CONFIG_RTE_LIBRTE_EVENTDEV=y
CONFIG_RTE_LIBRTE_EVENTDEV_DEBUG=n
#
+# Compile a pure sw event device instance
+#
+CONFIG_RTE_LIBRTE_PMD_EVDEV_SW=y
+CONFIG_RTE_LIBRTE_PMD_EVDEV_SW_DEBUG=n
+
+#
# Compile librte_ring
#
CONFIG_RTE_LIBRTE_RING=y
diff --git a/drivers/event/Makefile b/drivers/event/Makefile
index 93f90eb..b9c37d7 100644
--- a/drivers/event/Makefile
+++ b/drivers/event/Makefile
@@ -31,4 +31,6 @@
include $(RTE_SDK)/mk/rte.vars.mk
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_EVDEV_SW) += sw
+
include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 716725a..2fce863 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -148,6 +148,10 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += -lrte_pmd_zuc
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += -L$(LIBSSO_ZUC_PATH)/build -lsso_zuc
endif # CONFIG_RTE_LIBRTE_CRYPTODEV
+ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y)
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_EVDEV_SW) += -lrte_pmd_evdev_sw
+endif # CONFIG_RTE_LIBRTE_EVENTDEV
+
endif # !CONFIG_RTE_BUILD_SHARED_LIBS
_LDLIBS-y += --no-whole-archive
--
2.7.4
^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH 5/7] test/eventdev: unit and functional tests
2016-11-16 18:00 [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD Harry van Haaren
` (3 preceding siblings ...)
2016-11-16 18:00 ` [dpdk-dev] [PATCH 4/7] event/sw: makefiles and config Harry van Haaren
@ 2016-11-16 18:00 ` Harry van Haaren
2016-11-23 3:32 ` Jerin Jacob
2016-11-16 18:00 ` [dpdk-dev] [PATCH 6/7] test/eventdev: unit func makefiles Harry van Haaren
` (2 subsequent siblings)
7 siblings, 1 reply; 18+ messages in thread
From: Harry van Haaren @ 2016-11-16 18:00 UTC (permalink / raw)
To: dev; +Cc: Harry van Haaren, Gage Eads, David Hunt
This commit adds basic unit and functional tests for the eventdev
API. The test code is added in this commit, but not yet enabled until
the next commit.
Signed-off-by: Gage Eads <gage.eads@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---
app/test/test_eventdev_func.c | 1268 +++++++++++++++++++++++++++++++++++++++++
app/test/test_eventdev_unit.c | 557 ++++++++++++++++++
2 files changed, 1825 insertions(+)
create mode 100644 app/test/test_eventdev_func.c
create mode 100644 app/test/test_eventdev_unit.c
diff --git a/app/test/test_eventdev_func.c b/app/test/test_eventdev_func.c
new file mode 100644
index 0000000..d7fe481
--- /dev/null
+++ b/app/test/test_eventdev_func.c
@@ -0,0 +1,1268 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/queue.h>
+
+#include <rte_memory.h>
+#include <rte_memzone.h>
+#include <rte_launch.h>
+#include <rte_eal.h>
+#include <rte_per_lcore.h>
+#include <rte_lcore.h>
+#include <rte_debug.h>
+#include <rte_ethdev.h>
+#include <rte_cycles.h>
+
+#include <rte_eventdev.h>
+#include "test.h"
+
+#define MAX_PORTS 16
+#define MAX_QIDS 16
+#define NUM_PACKETS (1<<18)
+
+struct test {
+ struct rte_mempool *mbuf_pool;
+ int ev;
+ int port[MAX_PORTS];
+ int qid[MAX_QIDS];
+ int nb_qids;
+};
+
+static inline struct rte_mbuf *
+rte_gen_arp(int portid, struct rte_mempool *mp)
+{
+ /*
+ * len = 14 + 46
+ * ARP, Request who-has 10.0.0.1 tell 10.0.0.2, length 46
+ */
+ static const uint8_t arp_request[] = {
+ /*0x0000:*/ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xec, 0xa8,
+ 0x6b, 0xfd, 0x02, 0x29, 0x08, 0x06, 0x00, 0x01,
+ /*0x0010:*/ 0x08, 0x00, 0x06, 0x04, 0x00, 0x01, 0xec, 0xa8,
+ 0x6b, 0xfd, 0x02, 0x29, 0x0a, 0x00, 0x00, 0x01,
+ /*0x0020:*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00,
+ 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /*0x0030:*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+ };
+ struct rte_mbuf *m;
+ int pkt_len = sizeof(arp_request) - 1;
+
+ m = rte_pktmbuf_alloc(mp);
+ if (!m)
+ return 0;
+
+ memcpy((void *)((uint64_t)m->buf_addr + m->data_off),
+ arp_request, pkt_len);
+ rte_pktmbuf_pkt_len(m) = pkt_len;
+ rte_pktmbuf_data_len(m) = pkt_len;
+
+ RTE_SET_USED(portid);
+ /*
+ * Ignore MAC address for super-simple testing
+ * struct ether_addr mac_addr;
+ * rte_eth_macaddr_get(portid, &mac_addr);
+ * memcpy((void *)((uint64_t)m->buf_addr + m->data_off + 6),
+ * &mac_addr, 6);
+ */
+
+ return m;
+}
+
+/* initialization and config */
+static inline int
+init(struct test *t, int nb_queues, int nb_ports)
+{
+ struct rte_event_dev_config config = {
+ .nb_event_queues = nb_queues,
+ .nb_event_ports = nb_ports,
+ };
+ int ret, nevdevs = rte_event_dev_count();
+
+ void *temp = t->mbuf_pool; /* save and restore mbuf pool */
+
+ memset(t, 0, sizeof(*t));
+ t->mbuf_pool = temp;
+
+ if (nevdevs < 1) {
+ printf("%d: No Eventdev Devices Found\n", __LINE__);
+ return -1;
+ }
+
+ const char *eventdev_name = "evdev_sw0";
+
+ t->ev = rte_event_dev_get_dev_id(eventdev_name);
+ if (t->ev < 0) {
+ printf("%d: Eventdev %s not found - quitting.\n", __LINE__, eventdev_name);
+ return -1;
+ }
+
+ ret = rte_event_dev_configure(t->ev, &config);
+ if (ret < 0)
+ printf("%d: Error configuring device\n", __LINE__);
+ return ret;
+};
+
+static inline int
+create_ports(struct test *t, int num_ports)
+{
+ int i;
+ static const struct rte_event_port_conf conf = {
+ .dequeue_queue_depth = 32,
+ .enqueue_queue_depth = 64,
+ };
+
+ for (i = 0; i < num_ports; i++) {
+ if (rte_event_port_setup(t->ev, i, &conf) < 0) {
+ printf("Error setting up port %d\n", i);
+ return -1;
+ }
+ t->port[i] = i;
+ }
+
+ return 0;
+}
+
+static inline int
+create_atomic_qids(struct test *t, int num_qids)
+{
+ int i;
+
+ /* Q creation */
+ static const struct rte_event_queue_conf conf = {
+ .priority = RTE_EVENT_QUEUE_PRIORITY_NORMAL,
+ .nb_atomic_flows = 1024,
+ };
+
+ for (i = t->nb_qids; i < t->nb_qids + num_qids; i++) {
+ if (rte_event_queue_setup(t->ev, i, &conf) < 0) {
+ printf("%d: error creating qid %d\n", __LINE__, i);
+ return -1;
+ }
+ t->qid[i] = i;
+ }
+ t->nb_qids += num_qids;
+
+ return 0;
+}
+
+static inline int
+create_ordered_qids(struct test *t, int num_qids)
+{
+ int i;
+
+ /* Q creation */
+ static const struct rte_event_queue_conf conf = {
+ .priority = RTE_EVENT_QUEUE_PRIORITY_NORMAL,
+ .nb_atomic_order_sequences = 1024,
+ };
+
+ for (i = t->nb_qids; i < t->nb_qids + num_qids; i++) {
+ if (rte_event_queue_setup(t->ev, i, &conf) < 0) {
+ printf("%d: error creating qid %d\n", __LINE__, i);
+ return -1;
+ }
+ t->qid[i] = i;
+ }
+ t->nb_qids += num_qids;
+
+ return 0;
+}
+
+static inline int
+create_unordered_qids(struct test *t, int num_qids)
+{
+ int i;
+
+ /* Q creation */
+ static const struct rte_event_queue_conf conf = {
+ .priority = RTE_EVENT_QUEUE_PRIORITY_NORMAL,
+ };
+
+ for (i = t->nb_qids; i < t->nb_qids + num_qids; i++) {
+ if (rte_event_queue_setup(t->ev, i, &conf) < 0) {
+ printf("%d: error creating qid %d\n", __LINE__, i);
+ return -1;
+ }
+ t->qid[i] = i;
+ }
+ t->nb_qids += num_qids;
+
+ return 0;
+}
+
+static inline int
+create_directed_qids(struct test *t, int num_qids, int ports[])
+{
+ int i;
+
+ /* Q creation */
+ static const struct rte_event_queue_conf conf = {
+ .priority = RTE_EVENT_QUEUE_PRIORITY_NORMAL,
+ .event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_CONSUMER,
+ };
+
+ for (i = t->nb_qids; i < t->nb_qids + num_qids; i++) {
+ struct rte_event_queue_link link;
+
+ if (rte_event_queue_setup(t->ev, i, &conf) < 0) {
+ printf("%d: error creating qid %d\n", __LINE__, i);
+ return -1;
+ }
+ t->qid[i] = i;
+
+ link = (struct rte_event_queue_link){
+ t->qid[i],
+ RTE_EVENT_QUEUE_SERVICE_PRIORITY_NORMAL
+ };
+ if (rte_event_port_link(t->ev, ports[i - t->nb_qids], &link, 1) != 1) {
+ printf("%d: error creating link for qid %d\n",
+ __LINE__, i);
+ return -1;
+ }
+ }
+ t->nb_qids += num_qids;
+
+ return 0;
+}
+
+/* destruction */
+static inline int
+cleanup(struct test *t)
+{
+ rte_event_dev_stop(t->ev);
+ rte_event_dev_close(t->ev);
+ return 0;
+};
+
+/* run_prio_packet_test
+ * This performs a basic packet priority check on the test instance passed in.
+ * It is factored out of the main priority tests as the same tests must be
+ * performed to ensure prioritization of each type of QID.
+ *
+ * Requirements:
+ * - An initialized test structure, including mempool
+ * - t->port[0] is initialized for both Enq / Deq of packets to the QID
+ * - t->qid[0] is the QID to be tested
+ * - if LB QID, the CQ must be mapped to the QID.
+ */
+static int
+run_prio_packet_test(struct test *t)
+{
+ int err;
+ const uint32_t MAGIC_SEQN[] = {4711, 1234};
+ const uint32_t PRIORITY[] = {3, 0};
+ unsigned i;
+ for(i = 0; i < RTE_DIM(MAGIC_SEQN); i++) {
+ /* generate pkt and enqueue */
+ struct rte_event ev;
+ struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool);
+ if (!arp) {
+ printf("%d: gen of pkt failed\n", __LINE__);
+ return -1;
+ }
+ arp->seqn = MAGIC_SEQN[i];
+
+ ev = (struct rte_event){
+ .priority = PRIORITY[i],
+ .operation = RTE_EVENT_OP_NEW,
+ .queue_id = t->qid[0],
+ .mbuf = arp
+ };
+ err = rte_event_enqueue(t->ev, t->port[0], &ev, 0);
+ if (err < 0) {
+ printf("%d: error failed to enqueue\n", __LINE__);
+ return -1;
+ }
+ }
+
+ rte_event_schedule(t->ev);
+
+ struct rte_event_dev_stats stats;
+ err = rte_event_dev_stats_get(t->ev, &stats);
+ if (err) {
+ printf("%d: error failed to get stats\n", __LINE__);
+ return -1;
+ }
+
+ if (stats.port_rx_pkts[t->port[0]] != 2) {
+ printf("%d: error stats incorrect for directed port\n", __LINE__);
+ rte_event_dev_dump(stdout, t->ev);
+ return -1;
+ }
+
+ struct rte_event ev, ev2;
+ uint32_t deq_pkts;
+ deq_pkts = rte_event_dequeue(t->ev, t->port[0], &ev, 0);
+ if (deq_pkts != 1) {
+ printf("%d: error failed to deq\n", __LINE__);
+ rte_event_dev_dump(stdout, t->ev);
+ return -1;
+ }
+ if(ev.mbuf->seqn != MAGIC_SEQN[1]) {
+ printf("%d: first packet out not highest priority\n", __LINE__);
+ rte_event_dev_dump(stdout, t->ev);
+ return -1;
+ }
+ rte_pktmbuf_free(ev.mbuf);
+
+ deq_pkts = rte_event_dequeue(t->ev, t->port[0], &ev2, 0);
+ if (deq_pkts != 1) {
+ printf("%d: error failed to deq\n", __LINE__);
+ rte_event_dev_dump(stdout, t->ev);
+ return -1;
+ }
+ if(ev2.mbuf->seqn != MAGIC_SEQN[0]) {
+ printf("%d: second packet out not lower priority\n", __LINE__);
+ rte_event_dev_dump(stdout, t->ev);
+ return -1;
+ }
+ rte_pktmbuf_free(ev2.mbuf);
+
+ cleanup(t);
+ return 0;
+}
+
+static int
+test_single_directed_packet(struct test *t)
+{
+ const int rx_enq = 0;
+ const int wrk_enq = 2;
+ int err;
+
+ /* Create instance with 3 directed QIDs going to 3 ports */
+ if (init(t, 3, 3) < 0 ||
+ create_ports(t, 3) < 0 ||
+ create_directed_qids(t, 3, t->port) < 0)
+ return -1;
+
+ if (rte_event_dev_start(t->ev) < 0) {
+ printf("%d: Error with start call\n", __LINE__);
+ return -1;
+ }
+
+ /************** FORWARD ****************/
+ struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool);
+ struct rte_event ev = {
+ .operation = RTE_EVENT_OP_NEW,
+ .queue_id = wrk_enq,
+ .mbuf = arp,
+ };
+
+ if (!arp) {
+ printf("%d: gen of pkt failed\n", __LINE__);
+ return -1;
+ }
+
+ const uint32_t MAGIC_SEQN = 4711;
+ arp->seqn = MAGIC_SEQN;
+
+ /* generate pkt and enqueue */
+ err = rte_event_enqueue(t->ev, rx_enq, &ev, 0);
+ if (err < 0) {
+ printf("%d: error failed to enqueue\n", __LINE__);
+ return -1;
+ }
+
+ /* Run schedule() as dir packets may need to be re-ordered */
+ if (rte_event_schedule(t->ev) < 0) {
+ printf("%d: Error with schedule call\n", __LINE__);
+ return -1;
+ }
+
+ struct rte_event_dev_stats stats;
+ err = rte_event_dev_stats_get(t->ev, &stats);
+ if (err) {
+ printf("%d: error failed to get stats\n", __LINE__);
+ return -1;
+ }
+
+ if (stats.port_rx_pkts[rx_enq] != 1) {
+ printf("%d: error stats incorrect for directed port\n", __LINE__);
+ return -1;
+ }
+
+ uint32_t deq_pkts;
+ deq_pkts = rte_event_dequeue(t->ev, wrk_enq, &ev, 1);
+ if (deq_pkts != 1) {
+ printf("%d: error failed to deq\n", __LINE__);
+ return -1;
+ }
+
+ err = rte_event_dev_stats_get(t->ev, &stats);
+ if (stats.port_rx_pkts[wrk_enq] != 0 &&
+ stats.port_rx_pkts[wrk_enq] != 1) {
+ printf("%d: error directed stats post-dequeue\n", __LINE__);
+ return -1;
+ }
+
+ if (ev.mbuf->seqn != MAGIC_SEQN) {
+ printf("%d: error magic sequence number not dequeued\n", __LINE__);
+ return -1;
+ }
+
+ rte_pktmbuf_free(ev.mbuf);
+ cleanup(t);
+ return 0;
+}
+
+static int
+test_overload_trip(struct test *t)
+{
+ int err;
+
+ /* Create instance with 3 directed QIDs going to 3 ports */
+ if (init(t, 1, 1) < 0 ||
+ create_ports(t, 1) < 0 ||
+ create_atomic_qids(t, 1) < 0)
+ return -1;
+
+ struct rte_event_queue_link link = {t->qid[0],
+ RTE_EVENT_QUEUE_SERVICE_PRIORITY_NORMAL };
+ int ret = rte_event_port_link(t->ev, t->port[0], &link, 1);
+ if (ret != 1) {
+ printf("%d: error mapping lb qid0\n", __LINE__);
+ return -1;
+ }
+
+ if (rte_event_dev_start(t->ev) < 0) {
+ printf("%d: Error with start call\n", __LINE__);
+ return -1;
+ }
+
+ struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool);
+ if (!arp) {
+ printf("%d: gen of pkt failed\n", __LINE__);
+ return -1;
+ }
+
+ /* 512 packets is threshold
+ * iters 0 - 511 is 512 packets, then overload will be flagged
+ * iter 512 (the 513th pkt) is the first refused NEW packet */
+ const uint32_t THRES = (256+1);
+ uint32_t i;
+ for (i = 0; i < THRES; i++) {
+ struct rte_event ev = {
+ .operation = RTE_EVENT_OP_NEW,
+ .queue_id = t->qid[0],
+ .mbuf = arp,
+ };
+ err = rte_event_enqueue(t->ev, 0, &ev, 0);
+ if(i == THRES-1) {
+ if(err != -ENOSPC) {
+ printf("%d: overload trip didn't cause NEW pkt enq fail\n", __LINE__);
+ return -1;
+ }
+ else {
+ //printf("iter %d -ENOSPC returned for new enq as expected.\n", i);
+ }
+ } else {
+ if (err < 0) {
+ printf("%d: error failed to enqueue\n", __LINE__);
+ return -1;
+ }
+ }
+ }
+
+ for (i = 0; i < THRES; i++) {
+ if (rte_event_schedule(t->ev) < 0) {
+ printf("%d: Error with schedule call\n", __LINE__);
+ return -1;
+ }
+
+ uint32_t deq_pkts;
+ struct rte_event ev;
+ deq_pkts = rte_event_dequeue(t->ev, 0, &ev, 1);
+
+ /* i == THRES-1 *should* fail to deq, due to NEW pkt rejection
+ * when enqueue is attempted in overload mode */
+ if (i == (THRES-1) && deq_pkts == 0)
+ break;
+
+ if (deq_pkts != 1) {
+ printf("%d: warning failed to deq event i = %d\n",
+ __LINE__, i);
+ //return -1;
+ }
+ }
+
+ rte_pktmbuf_free(arp);
+ cleanup(t);
+ return 0;
+}
+
+static int
+test_directed_overload(struct test *t)
+{
+ int err;
+
+ /* Create instance with 3 directed QIDs going to 3 ports */
+ if (init(t, 1, 1) < 0 ||
+ create_ports(t, 1) < 0 ||
+ create_directed_qids(t, 1, t->port) < 0)
+ return -1;
+
+ if (rte_event_dev_start(t->ev) < 0) {
+ printf("%d: Error with start call\n", __LINE__);
+ return -1;
+ }
+
+ /* 512 packets is threshold
+ * iters 0 - 511 is 512 packets, then overload will be flagged
+ * iter 512 (the 513th pkt) is the first refused NEW packet */
+ const uint32_t THRES = (256+1);
+ uint32_t i;
+ for (i = 0; i < THRES; i++) {
+ struct rte_event ev = {
+ .operation = RTE_EVENT_OP_NEW,
+ .queue_id = t->qid[0],
+ .event = (uintptr_t)i,
+ };
+ err = rte_event_enqueue(t->ev, 0, &ev, 0);
+ if(i == THRES-1) {
+ if(err != -ENOSPC) {
+ printf("%d: overload trip didn't cause NEW pkt enq fail\n", __LINE__);
+ //return -1;
+ }
+ else {
+ //printf("iter %d -ENOSPC returned for new enq as expected.\n", i);
+ }
+ } else {
+ if (err < 0) {
+ printf("%d: error failed to enqueue\n", __LINE__);
+ return -1;
+ }
+ }
+ }
+
+ if (rte_event_schedule(t->ev) < 0) {
+ printf("%d: Error with schedule call\n", __LINE__);
+ return -1;
+ }
+
+ uint32_t pkt_deq_cntr = 0;
+ for (i = 0; i < THRES; i++) {
+ if (rte_event_schedule(t->ev) < 0) {
+ printf("%d: Error with schedule call\n", __LINE__);
+ return -1;
+ }
+
+ int32_t deq_pkts;
+ struct rte_event ev;
+ deq_pkts = rte_event_dequeue(t->ev, 0, &ev, 1);
+
+ /* i == THRES-1 *should* fail to deq, due to NEW pkt rejection
+ * when enqueue is attempted in overload mode */
+ if (i == (THRES-1) && deq_pkts == 0)
+ break;
+
+ if (deq_pkts != 1) {
+ printf("%d: warning failed to deq (iter = %d), ret %d. Dumping stats\n",
+ __LINE__, i, deq_pkts);
+ rte_event_dev_dump(stdout, t->ev);
+ return -1;
+ }
+ pkt_deq_cntr += deq_pkts;
+ }
+
+ cleanup(t);
+ return 0;
+}
+
+
+static int
+test_priority_directed(struct test *t)
+{
+ if (init(t, 1, 1) < 0 ||
+ create_ports(t, 1) < 0 ||
+ create_directed_qids(t, 1, t->port) < 0) {
+ printf("%d: Error initialising device\n", __LINE__);
+ return -1;
+ }
+
+ if (rte_event_dev_start(t->ev) < 0) {
+ printf("%d: Error with start call\n", __LINE__);
+ return -1;
+ }
+
+ return run_prio_packet_test(t);
+}
+
+static int
+test_priority_atomic(struct test *t)
+{
+ if (init(t, 1, 1) < 0 ||
+ create_ports(t, 1) < 0 ||
+ create_atomic_qids(t, 1) < 0) {
+ printf("%d: Error initialising device\n", __LINE__);
+ return -1;
+ }
+
+ /* map the QID */
+ struct rte_event_queue_link link = {t->qid[0],
+ RTE_EVENT_QUEUE_SERVICE_PRIORITY_NORMAL };
+ if (rte_event_port_link(t->ev, t->port[0], &link, 1) != 1) {
+ printf("%d: error mapping qid to port\n", __LINE__);
+ return -1;
+ }
+ if (rte_event_dev_start(t->ev) < 0) {
+ printf("%d: Error with start call\n", __LINE__);
+ return -1;
+ }
+
+ return run_prio_packet_test(t);
+}
+
+static int
+test_priority_ordered(struct test *t)
+{
+ if (init(t, 1, 1) < 0 ||
+ create_ports(t, 1) < 0 ||
+ create_ordered_qids(t, 1) < 0) {
+ printf("%d: Error initialising device\n", __LINE__);
+ return -1;
+ }
+
+ /* map the QID */
+ struct rte_event_queue_link link = {t->qid[0],
+ RTE_EVENT_QUEUE_SERVICE_PRIORITY_NORMAL };
+ if (rte_event_port_link(t->ev, t->port[0], &link, 1) != 1) {
+ printf("%d: error mapping qid to port\n", __LINE__);
+ return -1;
+ }
+ if (rte_event_dev_start(t->ev) < 0) {
+ printf("%d: Error with start call\n", __LINE__);
+ return -1;
+ }
+
+ return run_prio_packet_test(t);
+}
+
+static int
+test_priority_unordered(struct test *t)
+{
+ if (init(t, 1, 1) < 0 ||
+ create_ports(t, 1) < 0 ||
+ create_unordered_qids(t, 1) < 0) {
+ printf("%d: Error initialising device\n", __LINE__);
+ return -1;
+ }
+
+ /* map the QID */
+ struct rte_event_queue_link link = {t->qid[0],
+ RTE_EVENT_QUEUE_SERVICE_PRIORITY_NORMAL };
+ if (rte_event_port_link(t->ev, t->port[0], &link, 1) != 1) {
+ printf("%d: error mapping qid to port\n", __LINE__);
+ return -1;
+ }
+ if (rte_event_dev_start(t->ev) < 0) {
+ printf("%d: Error with start call\n", __LINE__);
+ return -1;
+ }
+
+ return run_prio_packet_test(t);
+}
+
+static int
+burst_packets(struct test *t)
+{
+ /************** CONFIG ****************/
+ uint32_t i;
+ int err;
+ int ret;
+
+ /* Create instance with 4 ports and 2 queues */
+ if (init(t, 2, 2) < 0 ||
+ create_ports(t, 2) < 0 ||
+ create_atomic_qids(t, 2) < 0) {
+ printf("%d: Error initialising device\n", __LINE__);
+ return -1;
+ }
+
+ /* CQ mapping to QID */
+ struct rte_event_queue_link link = {t->qid[0],
+ RTE_EVENT_QUEUE_SERVICE_PRIORITY_NORMAL };
+ ret = rte_event_port_link(t->ev, t->port[0], &link, 1);
+ if (ret != 1) {
+ printf("%d: error mapping lb qid0\n", __LINE__);
+ return -1;
+ }
+ link.queue_id = t->qid[1];
+ ret = rte_event_port_link(t->ev, t->port[1], &link, 1);
+ if (ret != 1) {
+ printf("%d: error mapping lb qid1\n", __LINE__);
+ return -1;
+ }
+
+ if (rte_event_dev_start(t->ev) < 0) {
+ printf("%d: Error with start call\n", __LINE__);
+ return -1;
+ }
+
+ /************** FORWARD ****************/
+ const uint32_t rx_port = 0;
+ const uint32_t NUM_PKTS = 2;
+
+ for (i = 0; i < NUM_PKTS; i++) {
+ struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool);
+ if (!arp) {
+ printf("%d: error generating pkt\n" , __LINE__);
+ return -1;
+ }
+
+ struct rte_event ev = {
+ .operation = RTE_EVENT_OP_NEW,
+ .queue_id = i % 2,
+ .flow_id = i % 3,
+ .mbuf = arp,
+ };
+ /* generate pkt and enqueue */
+ err = rte_event_enqueue(t->ev, t->port[rx_port], &ev, 0);
+ if (err < 1) {
+ printf("%d: Failed to enqueue\n", __LINE__);
+ return -1;
+ }
+ }
+ int16_t pkts = rte_event_schedule(t->ev);
+
+ RTE_SET_USED(pkts);
+
+ /* Check stats for all NUM_PKTS arrived to sched core */
+ struct rte_event_dev_stats stats;
+
+ err = rte_event_dev_stats_get(t->ev, &stats);
+ if (err) {
+ printf("%d: failed to get stats\n", __LINE__);
+ return -1;
+ }
+ if (stats.rx_pkts != NUM_PKTS || stats.tx_pkts != NUM_PKTS) {
+ printf("%d: Sched core didn't receive all %d pkts\n", __LINE__, NUM_PKTS);
+ rte_event_dev_dump(stdout, t->ev);
+ return -1;
+ }
+
+ uint32_t deq_pkts;
+ int p;
+
+ deq_pkts = 0;
+ /******** DEQ QID 1 *******/
+ do {
+ struct rte_event ev;
+ p = rte_event_dequeue(t->ev, t->port[0], &ev, 0);
+ deq_pkts += p;
+ rte_pktmbuf_free(ev.mbuf);
+ } while (p);
+
+ if (deq_pkts != NUM_PKTS/2) {
+ printf("%d: Half of NUM_PKTS didn't arrive at port 1\n", __LINE__);
+ return -1;
+ }
+
+ /******** DEQ QID 2 *******/
+ deq_pkts = 0;
+ do {
+ struct rte_event ev;
+ p = rte_event_dequeue(t->ev, t->port[1], &ev, 0);
+ deq_pkts += p;
+ rte_pktmbuf_free(ev.mbuf);
+ } while (p);
+ if (deq_pkts != NUM_PKTS/2) {
+ printf("%d: Half of NUM_PKTS didn't arrive at port 2\n", __LINE__);
+ return -1;
+ }
+
+ cleanup(t);
+ return 0;
+}
+
+static int
+load_balancing(struct test *t)
+{
+ const int rx_enq = 0;
+ int err;
+ uint32_t i;
+
+ if (init(t, 1, 4) < 0 ||
+ create_ports(t, 4) < 0 ||
+ create_atomic_qids(t, 1) < 0) {
+ printf("%d: Error initialising device\n", __LINE__);
+ return -1;
+ }
+
+ struct rte_event_queue_link link = {t->qid[0],
+ RTE_EVENT_QUEUE_SERVICE_PRIORITY_NORMAL };
+ for (i = 0; i < 3; i++) {
+ /* map port 1 - 3 inclusive */
+ if (rte_event_port_link(t->ev, t->port[i+1], &link, 1) != 1) {
+ printf("%d: error mapping qid to port %d\n", __LINE__, i);
+ return -1;
+ }
+ }
+
+ if (rte_event_dev_start(t->ev) < 0) {
+ printf("%d: Error with start call\n", __LINE__);
+ return -1;
+ }
+
+ /************** FORWARD ****************/
+ /*
+ * Create a set of flows that test the load-balancing operation of the
+ * implementation. Fill CQ 0 and 1 with flows 0 and 1, and test
+ * with a new flow, which should be sent to the 3rd mapped CQ
+ */
+ static uint32_t flows[] = {0, 1, 1, 0, 0, 2, 2, 0, 2};
+#define PKT_NUM (sizeof(flows) / sizeof(flows[0]))
+ for (i = 0; i < PKT_NUM; i++) {
+ struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool);
+ if (!arp) {
+ printf("%d: gen of pkt failed\n", __LINE__);
+ return -1;
+ }
+
+ struct rte_event ev = {
+ .operation = RTE_EVENT_OP_NEW,
+ .queue_id = t->qid[0],
+ .flow_id = flows[i],
+ .mbuf = arp,
+ };
+ /* generate pkt and enqueue */
+ err = rte_event_enqueue(t->ev, t->port[rx_enq], &ev, 0);
+ if (err < 1) {
+ printf("%d: Failed to enqueue\n", __LINE__);
+ return -1;
+ }
+ }
+
+ rte_event_schedule(t->ev);
+
+ struct rte_event_dev_stats stats;
+ err = rte_event_dev_stats_get(t->ev, &stats);
+ if (err) {
+ printf("%d: failed to get stats\n", __LINE__);
+ return -1;
+ }
+
+ if (stats.port_inflight[1] != 4) {
+ printf("%d:%s: port 1 inflight not correct\n", __LINE__, __func__);
+ return -1;
+ }
+ if (stats.port_inflight[2] != 2) {
+ printf("%d:%s: port 2 inflight not correct\n", __LINE__, __func__);
+ return -1;
+ }
+ if (stats.port_inflight[3] != 3) {
+ printf("%d:%s: port 3 inflight not correct\n", __LINE__, __func__);
+ return -1;
+ }
+
+ cleanup(t);
+ return 0;
+}
+
+static int
+invalid_qid(struct test *t)
+{
+ struct rte_event_dev_stats stats;
+ const int rx_enq = 0;
+ int err;
+ uint32_t i;
+
+ if (init(t, 1, 4) < 0 ||
+ create_ports(t, 4) < 0 ||
+ create_atomic_qids(t, 1) < 0) {
+ printf("%d: Error initialising device\n", __LINE__);
+ return -1;
+ }
+
+ /* CQ mapping to QID */
+ for(i = 0; i < 4; i++) {
+ struct rte_event_queue_link link = {t->qid[0],
+ RTE_EVENT_QUEUE_SERVICE_PRIORITY_NORMAL };
+ err = rte_event_port_link(t->ev, t->port[i], &link, 1);
+ if (err != 1) {
+ printf("%d: error mapping port 1 qid\n", __LINE__);
+ return -1;
+ }
+ }
+
+ if (rte_event_dev_start(t->ev) < 0) {
+ printf("%d: Error with start call\n", __LINE__);
+ return -1;
+ }
+
+ /*
+ * Send in a packet with an invalid qid to the scheduler.
+ * We should see the packed enqueued OK, but the inflights for
+ * that packet should not be incremented, and the rx_dropped
+ * should be incremented.
+ */
+ static uint32_t flows1[] = {20};
+
+#define PKT_NUM1 (sizeof(flows1) / sizeof(flows1[0]))
+
+ for (i = 0; i < PKT_NUM1; i++) {
+ struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool);
+ if (!arp) {
+ printf("%d: gen of pkt failed\n", __LINE__);
+ return -1;
+ }
+
+ struct rte_event ev = {
+ .operation = RTE_EVENT_OP_NEW,
+ .queue_id = t->qid[0] + flows1[i],
+ .flow_id = i,
+ .mbuf = arp,
+ };
+ /* generate pkt and enqueue */
+ err = rte_event_enqueue(t->ev, t->port[rx_enq], &ev, 0);
+ if (err < 1) {
+ printf("%d: Failed to enqueue\n", __LINE__);
+ return -1;
+ }
+ }
+
+ /* call the scheduler */
+ int16_t pkts = rte_event_schedule(t->ev);
+ RTE_SET_USED(pkts);
+
+ err = rte_event_dev_stats_get(t->ev, &stats);
+ if (err) {
+ printf("%d: failed to get stats\n", __LINE__);
+ return -1;
+ }
+
+ /*
+ * Now check the resulting inflights on the port, and the rx_dropped.
+ */
+ if (stats.port_inflight[0] != 0) {
+ printf("%d:%s: port 1 inflight count not correct\n", __LINE__, __func__);
+ rte_event_dev_dump(stdout, 0);
+ return -1;
+ }
+ if (stats.port_rx_dropped[0] != 1) {
+ printf("%d:%s: port 1 drops\n", __LINE__, __func__);
+ rte_event_dev_dump(stdout, 0);
+ return -1;
+ }
+ /* each packet drop should only be counted in one place - port or dev */
+ if (stats.rx_dropped != 0) {
+ printf("%d:%s: port 1 dropped count not correct\n", __LINE__, __func__);
+ rte_event_dev_dump(stdout, 0);
+ return -1;
+ }
+
+ cleanup(t);
+ return 0;
+}
+
+static int
+worker_loopback_worker_fn(void *arg)
+{
+ struct test *t = arg;
+ uint8_t port = t->port[1];
+ int count = 0;
+ int err;
+
+ /*
+ * Takes packets from the input port and then loops them back through
+ * the Queue Manager. Each packet gets looped through QIDs 0-8, 16 times,
+ * so each packet goes through 8*16 = 128 times.
+ */
+ printf("%d: \tWorker function started\n", __LINE__);
+ while (count < NUM_PACKETS) {
+#define BURST_SIZE 32
+ struct rte_event ev[BURST_SIZE];
+ uint16_t i, nb_rx = rte_event_dequeue(t->ev, port, ev, BURST_SIZE);
+ if (nb_rx == 0) {
+ rte_pause();
+ continue;
+ }
+
+ for (i = 0; i < nb_rx; i++) {
+ ev[i].queue_id++;
+ if (ev[i].queue_id != 8) {
+ ev[i].operation = RTE_EVENT_OP_FORWARD;
+ err = rte_event_enqueue(t->ev, port, &ev[i], 0);
+ if (err <= 0) {
+ printf("%d: Can't enqueue FWD!!\n", __LINE__);
+ return -1;
+ }
+ continue;
+ }
+
+ ev[i].queue_id = 0;
+ ev[i].mbuf->udata64++;
+ if (ev[i].mbuf->udata64 != 16) {
+ ev[i].operation = RTE_EVENT_OP_FORWARD;
+ err = rte_event_enqueue(t->ev, port, &ev[i], 0);
+ if (err <= 0) {
+ printf("%d: Can't enqueue FWD!!\n", __LINE__);
+ return -1;
+ }
+ continue;
+ }
+ /* we have hit 16 iterations through system - drop */
+ rte_pktmbuf_free(ev[i].mbuf);
+ count++;
+ ev[i].operation = RTE_EVENT_OP_DROP;
+ err = rte_event_enqueue(t->ev, port, &ev[i], 0);
+ if(err != 1) {
+ printf("%d drop enqueue failed\n", __LINE__);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+static int
+worker_loopback_producer_fn(void *arg)
+{
+ struct test *t = arg;
+ uint8_t port = t->port[0];
+ uint64_t count = 0;
+
+ printf("%d: \tProducer function started\n", __LINE__);
+ while (count < NUM_PACKETS) {
+ struct rte_mbuf *m = rte_pktmbuf_alloc(t->mbuf_pool);
+ if (m == NULL) {
+ printf("%d: Error allocating mbuf\n", __LINE__);
+ return -1;
+ }
+ m->udata64 = 0;
+
+ struct rte_event ev = {
+ .operation = RTE_EVENT_OP_NEW,
+ .queue_id = t->qid[0],
+ .flow_id = (uintptr_t)m & 0xFFFF,
+ .mbuf = m,
+ };
+
+ while (rte_event_enqueue(t->ev, port, &ev, 0) != 1)
+ rte_pause();
+
+ count++;
+ }
+
+ return 0;
+}
+
+static int
+worker_loopback(struct test *t)
+{
+ /* use a single producer core, and a worker core to see what happens
+ * if the worker loops packets back multiple times
+ */
+ struct rte_event_dev_stats stats;
+ uint64_t print_cycles = 0, cycles = 0;
+ uint64_t tx_pkts = 0;
+ int err;
+ int w_lcore, p_lcore;
+ uint32_t i;
+
+ if (init(t, 8, 2) < 0 ||
+ create_ports(t, 2) < 0 ||
+ create_atomic_qids(t, 8) < 0) {
+ printf("%d: Error initialising device\n", __LINE__);
+ return -1;
+ }
+
+ /* CQ mapping to QID */
+ for(i = 0; i < 8; i++) {
+ struct rte_event_queue_link link = {t->qid[i],
+ RTE_EVENT_QUEUE_SERVICE_PRIORITY_NORMAL };
+ err = rte_event_port_link(t->ev, t->port[1], &link, 1);
+ if (err != 1) {
+ printf("%d: error mapping port 2 qid %d\n", __LINE__, i);
+ return -1;
+ }
+ }
+
+ if (rte_event_dev_start(t->ev) < 0) {
+ printf("%d: Error with start call\n", __LINE__);
+ return -1;
+ }
+
+ p_lcore = rte_get_next_lcore(
+ /* start core */ -1,
+ /* skip master */ 1,
+ /* wrap */ 0);
+ w_lcore = rte_get_next_lcore(p_lcore, 1, 0);
+
+ rte_eal_remote_launch(worker_loopback_producer_fn, t, p_lcore);
+ rte_eal_remote_launch(worker_loopback_worker_fn, t, w_lcore);
+
+ print_cycles = cycles = rte_get_timer_cycles();
+ while (rte_eal_get_lcore_state(p_lcore) != FINISHED ||
+ rte_eal_get_lcore_state(w_lcore) != FINISHED) {
+
+ rte_event_schedule(t->ev);
+
+ uint64_t new_cycles = rte_get_timer_cycles();
+
+ if (new_cycles - print_cycles > rte_get_timer_hz()) {
+ rte_event_dev_stats_get(t->ev, &stats);
+ printf("%d: \tSched Rx = %" PRIu64 ", Tx = %" PRIu64 "\n",
+ __LINE__, stats.rx_pkts, stats.tx_pkts);
+
+ print_cycles = new_cycles;
+ }
+ if (new_cycles - cycles > rte_get_timer_hz() * 3) {
+ rte_event_dev_stats_get(t->ev, &stats);
+ if (stats.tx_pkts == tx_pkts) {
+ rte_event_dev_dump(stdout, t->ev);
+ printf("%d: \nNo schedules for seconds, deadlock\n", __LINE__);
+ return -1;
+ }
+ tx_pkts = stats.tx_pkts;
+ cycles = new_cycles;
+ }
+ }
+
+ rte_eal_mp_wait_lcore();
+
+ //rte_event_dev_dump(stdout, 0);
+
+ cleanup(t);
+ return 0;
+}
+
+static struct rte_mempool *eventdev_func_mempool;
+
+static int
+test_eventdev(void)
+{
+ struct test *t = malloc(sizeof(struct test));
+ int ret;
+
+ /* Only create mbuf pool once, reuse for each test run */
+ if (!eventdev_func_mempool) {
+ eventdev_func_mempool = rte_pktmbuf_pool_create("EVDEV_SA_MBUF_POOL",
+ (1<<16), /* size */
+ 32 /*MBUF_CACHE_SIZE*/,
+ 0,
+ RTE_MBUF_DEFAULT_BUF_SIZE,
+ rte_socket_id());
+ if (!eventdev_func_mempool) {
+ printf("ERROR creating mempool\n");
+ return -1;
+ }
+ }
+ t->mbuf_pool = eventdev_func_mempool;
+
+ printf("*** Running Single Directed Packet test...\n");
+ ret = test_single_directed_packet(t);
+ if (ret != 0) {
+ printf("ERROR - Single Directed Packet test FAILED.\n");
+ return ret;
+ }
+ printf("*** Running Overload Trip test...\n");
+ ret = test_overload_trip(t);
+ if (ret != 0) {
+ printf("ERROR - Overload Trip test FAILED.\n");
+ return ret;
+ }
+ printf("*** Running Directed Overload test...\n");
+ ret = test_directed_overload(t);
+ if (ret != 0) {
+ printf("ERROR - Directed Overload test FAILED.\n");
+ return ret;
+ }
+ printf("*** Running Prioritized Directed test...\n");
+ ret = test_priority_directed(t);
+ if (ret != 0) {
+ printf("ERROR - Prioritized Directed test FAILED.\n");
+ return ret;
+ }
+ printf("*** Running Prioritized Atomic test...\n");
+ ret = test_priority_atomic(t);
+ if (ret != 0) {
+ printf("ERROR - Prioritized Atomic test FAILED.\n");
+ return ret;
+ }
+
+ printf("*** Running Prioritized Ordered test...\n");
+ ret = test_priority_ordered(t);
+ if (ret != 0) {
+ printf("ERROR - Prioritized Ordered test FAILED.\n");
+ return ret;
+ }
+ printf("*** Running Prioritized Unordered test...\n");
+ ret = test_priority_unordered(t);
+ if (ret != 0) {
+ printf("ERROR - Prioritized Unordered test FAILED.\n");
+ return ret;
+ }
+ printf("*** Running Burst Packets test...\n");
+ ret = burst_packets(t);
+ if (ret != 0) {
+ printf("ERROR - Burst Packets test FAILED.\n");
+ return ret;
+ }
+ printf("*** Running Load Balancing test...\n");
+ ret = load_balancing(t);
+ if (ret != 0) {
+ printf("ERROR - Load Balancing test FAILED.\n");
+ return ret;
+ }
+ printf("*** Running Invalid QID test...\n");
+ ret = invalid_qid(t);
+ if (ret != 0) {
+ printf("ERROR - Invalid QID test FAILED.\n");
+ return ret;
+ }
+ if (rte_lcore_count() >= 3) {
+ printf("*** Running Worker loopback test...\n");
+ ret = worker_loopback(t);
+ if (ret != 0) {
+ printf("ERROR - Worker loopback test FAILED.\n");
+ return ret;
+ }
+ } else {
+ printf("### Not enough cores for worker loopback test. \n");
+ printf("### Need at least 3 cores for test.\n");
+ }
+ /* Free test instance, leaving mempool initialized, and a pointer to it
+ * in the static eventdev_func_mempool variable. It is re-used on re-runs */
+ free(t);
+
+ return 0;
+}
+
+REGISTER_TEST_COMMAND(eventdev_func_autotest, test_eventdev);
diff --git a/app/test/test_eventdev_unit.c b/app/test/test_eventdev_unit.c
new file mode 100644
index 0000000..c145401
--- /dev/null
+++ b/app/test/test_eventdev_unit.c
@@ -0,0 +1,557 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdarg.h>
+#include "test.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string.h>
+
+#include <rte_eventdev.h>
+#include <rte_lcore.h>
+#include <rte_mbuf.h>
+
+typedef enum eventdev_api_ut_ids_s {
+ EVENTDEV_API_UT_001 = 1,
+ EVENTDEV_API_UT_002,
+ EVENTDEV_API_UT_003,
+ EVENTDEV_API_UT_004,
+ EVENTDEV_API_UT_005,
+ EVENTDEV_API_UT_006,
+ EVENTDEV_API_UT_007,
+ EVENTDEV_API_UT_008,
+ EVENTDEV_API_UT_009,
+ EVENTDEV_API_UT_010,
+ EVENTDEV_API_UT_011,
+ EVENTDEV_API_UT_012,
+ EVENTDEV_API_UT_013,
+ EVENTDEV_API_UT_014,
+ EVENTDEV_API_UT_015,
+ EVENTDEV_API_UT_016,
+ EVENTDEV_API_UT_017,
+ EVENTDEV_API_UT_MAX
+} eventdev_api_ut_ids_t;
+
+typedef enum eventdev_tc_status_s {
+ TC_FAILED,
+ TC_PASSED
+} eventdev_tc_status_t;
+
+typedef struct eventdev_api_ut_status_s {
+ bool executed;
+ eventdev_tc_status_t status;
+} eventdev_api_ut_status_t;
+
+eventdev_api_ut_status_t api_ut_status[EVENTDEV_API_UT_MAX];
+
+#define CONFIG_NB_EVENT_QUEUES 2
+#define CONFIG_NB_EVENT_PORTS 2
+#define CONFIG_NB_EVENT_LIMIT 128
+
+uint8_t queues[CONFIG_NB_EVENT_QUEUES];
+uint8_t ports[CONFIG_NB_EVENT_PORTS];
+
+/* FIXME: Check that dependent tests have executed */
+
+static int test_EVENTDEV_API_UT_001_rte_event_dev_count(void)
+{
+ uint8_t count = rte_event_dev_count();
+
+ if (count == 1) {
+ api_ut_status[EVENTDEV_API_UT_001].status = TC_PASSED;
+ return 0;
+ } else {
+ api_ut_status[EVENTDEV_API_UT_001].status = TC_FAILED;
+ return 1;
+ }
+}
+
+static int test_EVENTDEV_API_UT_002_rte_event_dev_get_dev_id(void)
+{
+ int8_t id;
+
+ id = rte_event_dev_get_dev_id("evdev_sw0");
+
+ if (id < 0) {
+ api_ut_status[EVENTDEV_API_UT_002].status = TC_FAILED;
+ return 1;
+ }
+
+ id = rte_event_dev_get_dev_id("evdev_abcd123");
+
+ if (id >= 0) {
+ api_ut_status[EVENTDEV_API_UT_002].status = TC_FAILED;
+ return 1;
+ }
+
+ api_ut_status[EVENTDEV_API_UT_002].status = TC_PASSED;
+ return 0;
+}
+
+static int test_EVENTDEV_API_UT_003_rte_event_dev_info_get(void)
+{
+ struct rte_event_dev_info info;
+ int8_t id;
+ int ret;
+
+ id = rte_event_dev_get_dev_id("evdev_sw0");
+
+ ret = rte_event_dev_info_get(id, &info);
+ if (ret)
+ goto fail;
+
+ if (strncmp(info.driver_name, "evdev_sw", sizeof("evdev_sw")) != 0)
+ goto fail;
+
+ /* FIXME: Add checks for remaining fields */
+
+ api_ut_status[EVENTDEV_API_UT_003].status = TC_PASSED;
+ return 0;
+
+fail:
+ api_ut_status[EVENTDEV_API_UT_003].status = TC_FAILED;
+ return 1;
+}
+
+static int test_EVENTDEV_API_UT_004_rte_event_dev_configure(void)
+{
+ struct rte_event_dev_config config;
+ int8_t id;
+ int ret;
+
+ api_ut_status[EVENTDEV_API_UT_004].executed = true;
+
+ id = rte_event_dev_get_dev_id("evdev_sw0");
+
+ config.nb_event_queues = CONFIG_NB_EVENT_QUEUES; /* FIXME: Test max */
+ config.nb_event_ports = CONFIG_NB_EVENT_PORTS; /* FIXME: Test max */
+ config.nb_events_limit = CONFIG_NB_EVENT_LIMIT; /* FIXME: Test max */
+ config.dequeue_wait_ns = 0; /* FIXME: Test max */
+
+ ret = rte_event_dev_configure(id, &config);
+ if (ret)
+ goto fail;
+
+ api_ut_status[EVENTDEV_API_UT_004].status = TC_PASSED;
+ return 0;
+
+fail:
+ api_ut_status[EVENTDEV_API_UT_004].status = TC_FAILED;
+ return 1;
+}
+
+static int test_EVENTDEV_API_UT_005_rte_event_queue_count_pre(void)
+{
+ int8_t id;
+ uint8_t count;
+
+ if (!api_ut_status[EVENTDEV_API_UT_004].executed)
+ test_EVENTDEV_API_UT_004_rte_event_dev_configure();
+ if (api_ut_status[EVENTDEV_API_UT_004].status == TC_FAILED)
+ goto fail;
+
+ id = rte_event_dev_get_dev_id("evdev_sw0");
+
+ count = rte_event_queue_count(id);
+ if (count != CONFIG_NB_EVENT_QUEUES)
+ goto fail;
+
+ api_ut_status[EVENTDEV_API_UT_005].status = TC_PASSED;
+ return 0;
+
+fail:
+ api_ut_status[EVENTDEV_API_UT_005].status = TC_FAILED;
+ return 1;
+}
+
+static int test_EVENTDEV_API_UT_006_rte_event_queue_setup(void)
+{
+ struct rte_event_queue_conf config;
+ int8_t id;
+ int ret;
+
+ api_ut_status[EVENTDEV_API_UT_006].executed = true;
+
+ if (!api_ut_status[EVENTDEV_API_UT_004].executed)
+ test_EVENTDEV_API_UT_004_rte_event_dev_configure();
+ if (api_ut_status[EVENTDEV_API_UT_004].status == TC_FAILED)
+ goto fail;
+
+ id = rte_event_dev_get_dev_id("evdev_sw0");
+
+ config.event_queue_cfg = 0;
+ config.priority = 0;
+
+ queues[0] = 0;
+
+ ret = rte_event_queue_setup(id, queues[0], &config);
+ if (ret < 0)
+ goto fail;
+
+ config.event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_CONSUMER;
+ config.priority = 0;
+
+ queues[1] = 1;
+
+ ret = rte_event_queue_setup(id, queues[1], &config);
+ if (ret < 0)
+ goto fail;
+
+ api_ut_status[EVENTDEV_API_UT_006].status = TC_PASSED;
+ return 0;
+
+fail:
+ api_ut_status[EVENTDEV_API_UT_006].status = TC_FAILED;
+ return 1;
+}
+
+static int test_EVENTDEV_API_UT_007_rte_event_queue_count_post(void)
+{
+ int8_t id;
+ uint8_t count;
+
+ if (!api_ut_status[EVENTDEV_API_UT_004].executed)
+ test_EVENTDEV_API_UT_004_rte_event_dev_configure();
+ if (api_ut_status[EVENTDEV_API_UT_004].status == TC_FAILED)
+ goto fail;
+
+ if (!api_ut_status[EVENTDEV_API_UT_006].executed)
+ test_EVENTDEV_API_UT_006_rte_event_queue_setup();
+ if (api_ut_status[EVENTDEV_API_UT_006].status == TC_FAILED)
+ goto fail;
+
+ id = rte_event_dev_get_dev_id("evdev_sw0");
+
+ count = rte_event_queue_count(id);
+ if (count != CONFIG_NB_EVENT_QUEUES)
+ goto fail;
+
+ api_ut_status[EVENTDEV_API_UT_007].status = TC_PASSED;
+ return 0;
+
+fail:
+ api_ut_status[EVENTDEV_API_UT_007].status = TC_FAILED;
+ return 1;
+}
+
+static int test_EVENTDEV_API_UT_008_rte_event_port_count_pre(void)
+{
+ int8_t id;
+ uint8_t count;
+
+ if (!api_ut_status[EVENTDEV_API_UT_004].executed)
+ test_EVENTDEV_API_UT_004_rte_event_dev_configure();
+ if (api_ut_status[EVENTDEV_API_UT_004].status == TC_FAILED)
+ goto fail;
+
+ id = rte_event_dev_get_dev_id("evdev_sw0");
+
+ count = rte_event_port_count(id);
+ if (count != CONFIG_NB_EVENT_PORTS)
+ goto fail;
+
+ api_ut_status[EVENTDEV_API_UT_008].status = TC_PASSED;
+ return 0;
+
+fail:
+ api_ut_status[EVENTDEV_API_UT_008].status = TC_FAILED;
+ return 1;
+}
+
+static int test_EVENTDEV_API_UT_009_rte_event_port_setup(void)
+{
+ struct rte_event_port_conf config;
+ int8_t id;
+ int ret;
+
+ if (!api_ut_status[EVENTDEV_API_UT_004].executed)
+ test_EVENTDEV_API_UT_004_rte_event_dev_configure();
+ if (api_ut_status[EVENTDEV_API_UT_004].status == TC_FAILED)
+ goto fail;
+
+ api_ut_status[EVENTDEV_API_UT_009].executed = true;
+
+ id = rte_event_dev_get_dev_id("evdev_sw0");
+
+ config.dequeue_queue_depth = 4;
+ config.enqueue_queue_depth = 4;
+ config.new_event_threshold = 64;
+
+ ports[0] = 0;
+
+ ret = rte_event_port_setup(id, ports[0], &config);
+ if (ret < 0)
+ goto fail;
+
+ config.dequeue_queue_depth = 4;
+ config.enqueue_queue_depth = 4;
+ config.new_event_threshold = 64;
+
+ ports[1] = 1;
+
+ ret = rte_event_port_setup(id, ports[1], &config);
+ if (ret < 0)
+ goto fail;
+
+ api_ut_status[EVENTDEV_API_UT_009].status = TC_PASSED;
+ return 0;
+
+fail:
+ api_ut_status[EVENTDEV_API_UT_009].status = TC_FAILED;
+ return 1;
+}
+
+static int test_EVENTDEV_API_UT_010_rte_event_port_count_post(void)
+{
+ int8_t id;
+ uint8_t count;
+
+ if (!api_ut_status[EVENTDEV_API_UT_004].executed)
+ test_EVENTDEV_API_UT_004_rte_event_dev_configure();
+ if (api_ut_status[EVENTDEV_API_UT_004].status == TC_FAILED)
+ goto fail;
+
+ if (!api_ut_status[EVENTDEV_API_UT_009].executed)
+ test_EVENTDEV_API_UT_009_rte_event_port_setup();
+ if (api_ut_status[EVENTDEV_API_UT_009].status == TC_FAILED)
+ goto fail;
+
+ id = rte_event_dev_get_dev_id("evdev_sw0");
+
+ count = rte_event_port_count(id);
+ if (count != CONFIG_NB_EVENT_PORTS)
+ goto fail;
+
+ api_ut_status[EVENTDEV_API_UT_010].status = TC_PASSED;
+ return 0;
+
+fail:
+ api_ut_status[EVENTDEV_API_UT_010].status = TC_FAILED;
+ return 1;
+}
+
+static int test_EVENTDEV_API_UT_011_rte_event_dev_start(void)
+{
+ int8_t id;
+ int ret;
+
+ if (!api_ut_status[EVENTDEV_API_UT_004].executed)
+ test_EVENTDEV_API_UT_004_rte_event_dev_configure();
+ if (api_ut_status[EVENTDEV_API_UT_004].status == TC_FAILED)
+ goto fail;
+
+ id = rte_event_dev_get_dev_id("evdev_sw0");
+
+ ret = rte_event_dev_start(id);
+ if (ret != 0)
+ goto fail;
+
+ api_ut_status[EVENTDEV_API_UT_011].status = TC_PASSED;
+ return 0;
+
+fail:
+ api_ut_status[EVENTDEV_API_UT_011].status = TC_FAILED;
+ return 1;
+}
+
+static int test_EVENTDEV_API_UT_012_rte_event_port_link(void)
+{
+ struct rte_event_queue_link link;
+ int8_t id;
+ int ret;
+
+ if (!api_ut_status[EVENTDEV_API_UT_004].executed)
+ test_EVENTDEV_API_UT_004_rte_event_dev_configure();
+ if (api_ut_status[EVENTDEV_API_UT_004].status == TC_FAILED)
+ goto fail;
+
+ if (!api_ut_status[EVENTDEV_API_UT_006].executed)
+ test_EVENTDEV_API_UT_006_rte_event_queue_setup();
+ if (api_ut_status[EVENTDEV_API_UT_006].status == TC_FAILED)
+ goto fail;
+
+ if (!api_ut_status[EVENTDEV_API_UT_009].executed)
+ test_EVENTDEV_API_UT_009_rte_event_port_setup();
+ if (api_ut_status[EVENTDEV_API_UT_009].status == TC_FAILED)
+ goto fail;
+
+ id = rte_event_dev_get_dev_id("evdev_sw0");
+
+ link.queue_id = queues[0];
+ link.priority = 0;
+
+ /* Connect port to previously configured scheduled queue */
+ ret = rte_event_port_link(id, ports[0], &link, 1);
+ if (ret != 1) {
+ printf("%d: failed here\n", __LINE__);
+ goto fail;
+ }
+
+ /* Check idempotency of re-linking port to queues[0] */
+ ret = rte_event_port_link(id, ports[0], &link, 1);
+ if (ret != 1) {
+ printf("%d: failed here\n", __LINE__);
+ goto fail;
+ }
+
+ link.queue_id = queues[1];
+ link.priority = 0;
+
+ /* Attempt to connect to FIFO queue as well */
+ ret = rte_event_port_link(id, ports[0], &link, 1);
+ if (ret == 1) {
+ printf("%d: failed here\n", __LINE__);
+ goto fail;
+ }
+
+ link.queue_id = queues[1];
+ link.priority = 0;
+
+ /* Connect port to previously configured FIFO queue */
+ ret = rte_event_port_link(id, ports[1], &link, 1);
+ if (ret != 1) {
+ printf("%d: failed here\n", __LINE__);
+ goto fail;
+ }
+
+ link.queue_id = queues[0];
+ link.priority = 0;
+
+ /* Attempt to connect to scheduled queue as well */
+ ret = rte_event_port_link(id, ports[1], &link, 1);
+ if (ret == 1) {
+ printf("%d: failed here\n", __LINE__);
+ goto fail;
+ }
+
+ /* link to 2nd queue, enabling start() to pass later */
+ link.queue_id = queues[1];
+ link.priority = 0;
+ ret = rte_event_port_link(id, ports[1], &link, 1);
+ if (ret == 1) {
+ printf("%d: failed here\n", __LINE__);
+ goto fail;
+ }
+
+ api_ut_status[EVENTDEV_API_UT_012].status = TC_PASSED;
+ return 0;
+
+fail:
+ api_ut_status[EVENTDEV_API_UT_012].status = TC_FAILED;
+ return 1;
+}
+
+static int test_EVENTDEV_API_UT_014_rte_event_dev_stop(void)
+{
+ int8_t id;
+
+ if (!api_ut_status[EVENTDEV_API_UT_004].executed)
+ test_EVENTDEV_API_UT_004_rte_event_dev_configure();
+ if (api_ut_status[EVENTDEV_API_UT_004].status == TC_FAILED)
+ return 1;
+
+ id = rte_event_dev_get_dev_id("evdev_sw0");
+
+ rte_event_dev_stop(id);
+
+ api_ut_status[EVENTDEV_API_UT_014].status = TC_PASSED;
+ return 0;
+}
+
+static int test_EVENTDEV_API_UT_015_rte_event_dev_close(void)
+{
+ int8_t id;
+ int ret;
+
+ if (!api_ut_status[EVENTDEV_API_UT_004].executed)
+ test_EVENTDEV_API_UT_004_rte_event_dev_configure();
+ if (api_ut_status[EVENTDEV_API_UT_004].status == TC_FAILED)
+ goto fail;
+
+ id = rte_event_dev_get_dev_id("evdev_sw0");
+
+ ret = rte_event_dev_close(id);
+ if (ret != 0)
+ goto fail;
+
+ api_ut_status[EVENTDEV_API_UT_015].status = TC_PASSED;
+ return 0;
+
+fail:
+ api_ut_status[EVENTDEV_API_UT_015].status = TC_FAILED;
+ return 1;
+}
+
+static int
+test_setup(void)
+{
+ return 0;
+}
+
+static struct unit_test_suite eventdev_test_suite = {
+ .setup = test_setup,
+ .suite_name = "Eventdev Test Suite",
+ .unit_test_cases = {
+ /* device aquisition and config */
+ TEST_CASE(test_EVENTDEV_API_UT_001_rte_event_dev_count),
+ TEST_CASE(test_EVENTDEV_API_UT_002_rte_event_dev_get_dev_id),
+ TEST_CASE(test_EVENTDEV_API_UT_003_rte_event_dev_info_get),
+ TEST_CASE(test_EVENTDEV_API_UT_004_rte_event_dev_configure),
+ /* queue config */
+ TEST_CASE(test_EVENTDEV_API_UT_005_rte_event_queue_count_pre),
+ TEST_CASE(test_EVENTDEV_API_UT_006_rte_event_queue_setup),
+ TEST_CASE(test_EVENTDEV_API_UT_007_rte_event_queue_count_post),
+ /* port config */
+ TEST_CASE(test_EVENTDEV_API_UT_008_rte_event_port_count_pre),
+ TEST_CASE(test_EVENTDEV_API_UT_009_rte_event_port_setup),
+ TEST_CASE(test_EVENTDEV_API_UT_010_rte_event_port_count_post),
+ TEST_CASE(test_EVENTDEV_API_UT_012_rte_event_port_link),
+ TEST_CASE(test_EVENTDEV_API_UT_011_rte_event_dev_start),
+ /* device cleanup */
+ TEST_CASE(test_EVENTDEV_API_UT_014_rte_event_dev_stop),
+ TEST_CASE(test_EVENTDEV_API_UT_015_rte_event_dev_close),
+ TEST_CASES_END()
+ }
+};
+
+static int
+test_eventdev_unit(void)
+{
+ return unit_test_suite_runner(&eventdev_test_suite);
+}
+
+REGISTER_TEST_COMMAND(eventdev_unit_autotest, test_eventdev_unit);
--
2.7.4
^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH 6/7] test/eventdev: unit func makefiles
2016-11-16 18:00 [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD Harry van Haaren
` (4 preceding siblings ...)
2016-11-16 18:00 ` [dpdk-dev] [PATCH 5/7] test/eventdev: unit and functional tests Harry van Haaren
@ 2016-11-16 18:00 ` Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 7/7] examples/eventdev_pipeline: adding example Harry van Haaren
2016-11-16 20:19 ` [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD Jerin Jacob
7 siblings, 0 replies; 18+ messages in thread
From: Harry van Haaren @ 2016-11-16 18:00 UTC (permalink / raw)
To: dev; +Cc: Harry van Haaren, Gage Eads, David Hunt
Enable the functional and unit tests in the makefile. To run the unit tests,
apply these patches, and run the test app with the following arguments and
choose the unit or functional test to run:
./test --vdev evdev_sw0
RTE>> eventdev_func_autotest
RTE>> eventdev_unit_autotest
Signed-off-by: Gage Eads <gage.eads@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---
app/test/Makefile | 3 +++
1 file changed, 3 insertions(+)
diff --git a/app/test/Makefile b/app/test/Makefile
index 5be023a..6d43cb7 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -197,6 +197,9 @@ SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_blockcipher.c
SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_perf.c
SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c
+SRCS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += test_eventdev_unit.c
+SRCS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += test_eventdev_func.c
+
SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c
CFLAGS += -O3
--
2.7.4
^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH 7/7] examples/eventdev_pipeline: adding example
2016-11-16 18:00 [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD Harry van Haaren
` (5 preceding siblings ...)
2016-11-16 18:00 ` [dpdk-dev] [PATCH 6/7] test/eventdev: unit func makefiles Harry van Haaren
@ 2016-11-16 18:00 ` Harry van Haaren
2016-11-22 6:02 ` Jerin Jacob
2016-11-16 20:19 ` [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD Jerin Jacob
7 siblings, 1 reply; 18+ messages in thread
From: Harry van Haaren @ 2016-11-16 18:00 UTC (permalink / raw)
To: dev; +Cc: Harry van Haaren, Gage Eads, Bruce Richardson
This patch adds a sample app to the examples/ directory, which can be used
as a reference application and for general testing. The application requires
two ethdev ports and expects traffic to be flowing. The application must be
run with the --vdev flags as follows to indicate to EAL that a virtual
eventdev device called "evdev_sw0" is available to be used:
./build/eventdev_pipeline --vdev evdev_sw0
The general flow of the traffic is as follows:
Rx core -> Atomic Queue => 4 worker cores => TX core
A scheduler core is required to do the packet scheduling, making this
configuration require 7 cores (Rx, Tx, Scheduler, and 4 workers). Finally
a master core brings the core count to 8 for this configuration. The
application can be configured for various numbers of flows and worker
cores. Run the application with -h for details.
Signed-off-by: Gage Eads <gage.eads@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---
examples/eventdev_pipeline/Makefile | 49 +++
examples/eventdev_pipeline/main.c | 718 ++++++++++++++++++++++++++++++++++++
2 files changed, 767 insertions(+)
create mode 100644 examples/eventdev_pipeline/Makefile
create mode 100644 examples/eventdev_pipeline/main.c
diff --git a/examples/eventdev_pipeline/Makefile b/examples/eventdev_pipeline/Makefile
new file mode 100644
index 0000000..bab8916
--- /dev/null
+++ b/examples/eventdev_pipeline/Makefile
@@ -0,0 +1,49 @@
+# BSD LICENSE
+#
+# Copyright(c) 2016 Intel Corporation. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ifeq ($(RTE_SDK),)
+$(error "Please define RTE_SDK environment variable")
+endif
+
+# Default target, can be overriden by command line or environment
+RTE_TARGET ?= x86_64-native-linuxapp-gcc
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# binary name
+APP = eventdev_pipeline
+
+# all source are stored in SRCS-y
+SRCS-y := main.c
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+include $(RTE_SDK)/mk/rte.extapp.mk
diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c
new file mode 100644
index 0000000..6a8052c
--- /dev/null
+++ b/examples/eventdev_pipeline/main.c
@@ -0,0 +1,718 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <getopt.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <signal.h>
+
+#include <rte_eal.h>
+#include <rte_mempool.h>
+#include <rte_mbuf.h>
+#include <rte_launch.h>
+#include <rte_malloc.h>
+#include <rte_cycles.h>
+#include <rte_ethdev.h>
+#include <rte_eventdev.h>
+
+#define BATCH_SIZE 32
+
+static unsigned int num_workers = 4;
+static unsigned long num_packets = (1L << 25); /* do ~32M packets */
+static unsigned int num_fids = 16;
+static unsigned int num_priorities = 1;
+static int sched_type = RTE_SCHED_TYPE_ATOMIC;
+
+struct prod_data {
+ uint8_t event_dev_id;
+ uint8_t event_port_id;
+ int32_t qid;
+ unsigned num_ports;
+};
+
+struct cons_data {
+ uint8_t event_dev_id;
+ uint8_t event_port_id;
+};
+
+struct worker_data {
+ uint8_t event_dev_id;
+ int event_port_id;
+ int32_t qid;
+};
+
+static volatile int done = 0;
+static int quiet = 0;
+struct rte_mempool *mp;
+
+static int
+worker(void *arg)
+{
+ struct rte_event rcv_events[BATCH_SIZE];
+
+ struct worker_data *data = (struct worker_data *)arg;
+ uint8_t event_dev_id = data->event_dev_id;
+ uint8_t event_port_id = data->event_port_id;
+ int32_t qid = data->qid;
+ size_t sent = 0, received = 0;
+
+ while (!done) {
+ uint16_t i;
+
+ uint16_t n = rte_event_dequeue_burst(event_dev_id,
+ event_port_id,
+ rcv_events,
+ RTE_DIM(rcv_events),
+ false);
+ if (n == 0){
+ rte_pause();
+ /* Flush any buffered events */
+ rte_event_dequeue(event_dev_id,
+ event_port_id,
+ NULL,
+ false);
+ continue;
+ }
+ received += n;
+
+ for (i = 0; i < n; i++) {
+ struct ether_hdr *eth;
+ struct ether_addr addr;
+ struct rte_event *ev = &rcv_events[i];
+
+ ev->queue_id = qid;
+ ev->flow_id = 0;
+ ev->priority = 0;
+ ev->sched_type = RTE_SCHED_TYPE_ATOMIC;
+ ev->operation = RTE_EVENT_OP_FORWARD;
+
+ uint64_t now = rte_rdtsc();
+ while(now + 750 > rte_rdtsc()) {}
+
+ /* change mac addresses on packet */
+ eth = rte_pktmbuf_mtod(ev->mbuf, struct ether_hdr *);
+ ether_addr_copy(ð->d_addr, &addr);
+ ether_addr_copy(ð->s_addr, ð->d_addr);
+ ether_addr_copy(&addr, ð->s_addr);
+ }
+ int ret = rte_event_enqueue_burst(event_dev_id, event_port_id,
+ rcv_events, n, false);
+ if (ret != n)
+ rte_panic("worker %u thread failed to enqueue event\n",
+ rte_lcore_id());
+ }
+
+ /* Flush the buffered events */
+ rte_event_dequeue(event_dev_id, event_port_id, NULL, false);
+
+ if (!quiet)
+ printf(" worker %u thread done. RX=%zu TX=%zu\n",
+ rte_lcore_id(), received, sent);
+
+ return 0;
+}
+
+static int
+scheduler(void *arg)
+{
+ RTE_SET_USED(arg);
+ size_t loops = 0;
+
+ while (!done) {
+ /* Assumes an event dev ID of 0 */
+ rte_event_schedule(0);
+ loops++;
+ }
+
+ printf(" scheduler thread done. loops=%zu\n", loops);
+
+ return 0;
+}
+
+static int
+consumer(void *arg)
+{
+ struct rte_event events[BATCH_SIZE];
+
+ struct cons_data *data = (struct cons_data *)arg;
+ uint8_t event_dev_id = data->event_dev_id;
+ uint8_t event_port_id = data->event_port_id;
+ struct rte_eth_dev_tx_buffer *tx_buf[RTE_MAX_ETHPORTS];
+ size_t npackets = num_packets;
+ size_t received = 0;
+ size_t received_printed = 0; /* tracks when we last printed receive count */
+ uint64_t start_time = 0;
+ uint64_t freq_khz = rte_get_timer_hz() / 1000;
+ uint64_t dropped = 0;
+ unsigned i;
+
+ for (i = 0; i < rte_eth_dev_count(); i++) {
+ tx_buf[i] = rte_malloc(NULL, RTE_ETH_TX_BUFFER_SIZE(32), 0);
+ if (tx_buf[i] == NULL)
+ rte_panic("Out of memory\n");
+ rte_eth_tx_buffer_init(tx_buf[i], 32);
+ rte_eth_tx_buffer_set_err_callback(tx_buf[i],
+ rte_eth_tx_buffer_count_callback, &dropped);
+ }
+
+ while (!done) {
+ uint16_t i;
+ uint16_t n = rte_event_dequeue_burst(event_dev_id,
+ event_port_id,
+ events,
+ RTE_DIM(events),
+ false);
+
+ if (n == 0){
+ rte_pause();
+ continue;
+ }
+ if (start_time == 0)
+ start_time = rte_get_timer_cycles();
+
+ received += n;
+ for (i = 0; i < n; i++) {
+ uint8_t outport = events[i].mbuf->port;
+ rte_eth_tx_buffer(outport, 0, tx_buf[outport], events[i].mbuf);
+ }
+
+ if (!quiet && received >= received_printed + (1<<22)) {
+ printf("# consumer RX=%zu, time %"PRIu64"ms\n",
+ received,
+ (rte_get_timer_cycles() - start_time) / freq_khz);
+ received_printed = received;
+ }
+
+ if (num_packets > 0 && npackets > 0) {
+ npackets -= n;
+ if (npackets == 0)
+ done = 1;
+ }
+ }
+
+ for (i = 0; i < rte_eth_dev_count(); i++)
+ rte_eth_tx_buffer_flush(i, 0, tx_buf[i]);
+
+ printf(" consumer done! RX=%zu, time %"PRIu64"ms\n",
+ received,
+ (rte_get_timer_cycles() - start_time) / freq_khz);
+
+ return 0;
+}
+
+static int
+producer(void *arg)
+{
+
+ struct prod_data *data = (struct prod_data *)arg;
+ size_t npackets = num_packets;
+ unsigned i;
+ uint64_t mbuf_seqno = 0;
+ size_t sent = 0;
+ uint8_t eth_port = 0;
+ uint8_t event_dev_id = data->event_dev_id;
+ uint8_t event_port_id = data->event_port_id;
+ int fid_counter = 0;
+
+ while (!done) {
+ int ret;
+ unsigned num_ports = data->num_ports;
+ int32_t qid = data->qid;
+ struct rte_event events[BATCH_SIZE];
+ struct rte_mbuf *mbufs[BATCH_SIZE];
+
+ uint16_t nb_rx = rte_eth_rx_burst(eth_port, 0, mbufs, BATCH_SIZE);
+ if (++eth_port == num_ports)
+ eth_port = 0;
+ if (nb_rx == 0) {
+ rte_pause();
+ /* Flush any buffered events */
+ rte_event_dequeue(event_dev_id,
+ event_port_id,
+ NULL,
+ false);
+ continue;
+ }
+
+ for (i = 0; i < nb_rx; i++) {
+ struct rte_mbuf *m = mbufs[i];
+ struct rte_event *ev = &events[i];
+
+ ev->queue_id = qid;
+ ev->flow_id = fid_counter++ % 6;
+ ev->priority = 0;
+ m->udata64 = mbuf_seqno++;
+ ev->mbuf = m;
+ ev->sched_type = sched_type;
+ ev->operation = RTE_EVENT_OP_NEW;
+ }
+
+ do {
+ ret = rte_event_enqueue_burst(event_dev_id,
+ event_port_id,
+ events,
+ nb_rx,
+ false);
+ } while (ret == -ENOSPC);
+ if (ret != nb_rx)
+ rte_panic("producer thread failed to enqueue *all* events\n");
+
+ sent += nb_rx;
+
+ if (num_packets > 0 && npackets > 0) {
+ npackets -= nb_rx;
+ if (npackets == 0)
+ break;
+ }
+ }
+
+ /* Flush any buffered events */
+ while (!done)
+ rte_event_dequeue(event_dev_id, event_port_id, NULL, false);
+
+ printf(" prod thread done! TX=%zu across %u flows\n", sent, num_fids);
+
+ return 0;
+}
+
+static struct option long_options[] = {
+ {"workers", required_argument, 0, 'w'},
+ {"packets", required_argument, 0, 'n'},
+ {"atomic-flows", required_argument, 0, 'f'},
+ {"priority", required_argument, 0, 'p'},
+ {"ordered", no_argument, 0, 'o'},
+ {"quiet", no_argument, 0, 'q'},
+ {0, 0, 0, 0}
+};
+
+static void
+usage(void)
+{
+ const char *usage_str =
+ " Usage: eventdev_pipeline [options]\n"
+ " Options:\n"
+ " -w, --workers=N Use N workers (default 4)\n"
+ " -n, --packets=N Send N packets (default ~32M), 0 implies no limit\n"
+ " -f, --atomic-flows=N Use N random flows from 1 to N (default 16)\n"
+ " -p, --priority=N Use N number of priorities (default 1)\n"
+ " -o, --ordered Use ordered scheduling\n"
+ " -q, --quiet Minimize printed output\n"
+ "\n";
+
+ fprintf(stderr, "%s", usage_str);
+ exit(1);
+}
+
+static void
+parse_app_args(int argc, char** argv)
+{
+ /* Parse cli options*/
+ int option_index;
+ int c;
+ opterr = 0;
+
+ for (;;) {
+ c = getopt_long(argc, argv, "w:n:f:p:oq", long_options,
+ &option_index);
+ if (c == -1)
+ break;
+
+ switch (c) {
+ case 'w':
+ num_workers = (unsigned int)atoi(optarg);
+ break;
+ case 'n':
+ num_packets = (unsigned long )atol(optarg);
+ break;
+ case 'f':
+ num_fids = (unsigned int)atoi(optarg);
+ break;
+ case 'p':
+ num_priorities = (unsigned int)atoi(optarg);
+ break;
+ case 'o':
+ sched_type = RTE_SCHED_TYPE_ORDERED;
+ break;
+ case 'q':
+ quiet = 1;
+ break;
+ default:
+ usage();
+ }
+ }
+ if (num_workers == 0)
+ usage();
+}
+
+/*
+ * Initializes a given port using global settings and with the RX buffers
+ * coming from the mbuf_pool passed as a parameter.
+ */
+static inline int
+port_init(uint8_t port, struct rte_mempool *mbuf_pool)
+{
+ static const struct rte_eth_conf port_conf_default = {
+ .rxmode = { .max_rx_pkt_len = ETHER_MAX_LEN }
+ };
+ const uint16_t rx_rings = 1, tx_rings = 1;
+ const uint16_t rx_ring_size = 512, tx_ring_size = 512;
+ struct rte_eth_conf port_conf = port_conf_default;
+ int retval;
+ uint16_t q;
+
+ if (port >= rte_eth_dev_count())
+ return -1;
+
+ /* Configure the Ethernet device. */
+ retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf);
+ if (retval != 0)
+ return retval;
+
+ /* Allocate and set up 1 RX queue per Ethernet port. */
+ for (q = 0; q < rx_rings; q++) {
+ retval = rte_eth_rx_queue_setup(port, q, rx_ring_size,
+ rte_eth_dev_socket_id(port), NULL, mbuf_pool);
+ if (retval < 0)
+ return retval;
+ }
+
+ /* Allocate and set up 1 TX queue per Ethernet port. */
+ for (q = 0; q < tx_rings; q++) {
+ retval = rte_eth_tx_queue_setup(port, q, tx_ring_size,
+ rte_eth_dev_socket_id(port), NULL);
+ if (retval < 0)
+ return retval;
+ }
+
+ /* Start the Ethernet port. */
+ retval = rte_eth_dev_start(port);
+ if (retval < 0)
+ return retval;
+
+ /* Display the port MAC address. */
+ struct ether_addr addr;
+ rte_eth_macaddr_get(port, &addr);
+ printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8
+ " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n",
+ (unsigned)port,
+ addr.addr_bytes[0], addr.addr_bytes[1],
+ addr.addr_bytes[2], addr.addr_bytes[3],
+ addr.addr_bytes[4], addr.addr_bytes[5]);
+
+ /* Enable RX in promiscuous mode for the Ethernet device. */
+ rte_eth_promiscuous_enable(port);
+
+ return 0;
+}
+
+static int
+init_ports(unsigned num_ports)
+{
+ uint8_t portid;
+
+ mp = rte_pktmbuf_pool_create("packet_pool",
+ /* mbufs */ 16384 * num_ports,
+ /* cache_size */ 512,
+ /* priv_size*/ 0,
+ /* data_room_size */ RTE_MBUF_DEFAULT_BUF_SIZE,
+ rte_socket_id());
+
+ for (portid = 0; portid < num_ports; portid++)
+ if (port_init(portid, mp) != 0)
+ rte_exit(EXIT_FAILURE, "Cannot init port %"PRIu8 "\n",
+ portid);
+ return 0;
+}
+
+static uint8_t
+setup_event_dev(struct prod_data *prod_data,
+ struct cons_data *cons_data,
+ struct worker_data *worker_data)
+{
+ struct rte_event_dev_config config;
+ struct rte_event_queue_conf queue_config;
+ struct rte_event_port_conf port_config;
+ struct rte_event_queue_link link;
+ int prod_port;
+ int cons_port;
+ int qid0;
+ int cons_qid;
+ int prod_qid;
+ unsigned i;
+ int ret;
+ int8_t id;
+
+ const char *dev_name = "evdev_sw0";
+ id = rte_event_dev_get_dev_id(dev_name);
+ if (id < 0)
+ rte_panic("Failed to get %s device ID\n", dev_name);
+
+ config.nb_event_queues = 3;
+ config.nb_event_ports = num_workers + 2;
+ config.nb_events_limit = 256;
+ config.dequeue_wait_ns = 0;
+
+ ret = rte_event_dev_configure(id, &config);
+ if (ret)
+ rte_panic("Failed to configure the event dev\n");
+
+ /* Create queues */
+ queue_config.event_queue_cfg = RTE_EVENT_QUEUE_CFG_ATOMIC_ONLY;
+ queue_config.priority = 0;
+
+ qid0 = 0;
+ ret = rte_event_queue_setup(id, qid0, &queue_config);
+ if (ret < 0)
+ rte_panic("Failed to create the scheduled QID\n");
+
+ queue_config.event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_CONSUMER;
+ queue_config.priority = 0;
+
+ cons_qid = 1;
+ ret = rte_event_queue_setup(id, cons_qid, &queue_config);
+ if (ret < 0)
+ rte_panic("Failed to create the cons directed QID\n");
+
+ queue_config.event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_CONSUMER;
+ queue_config.priority = 0;
+
+ prod_qid = 2;
+ ret = rte_event_queue_setup(id, prod_qid, &queue_config);
+ if (ret < 0)
+ rte_panic("Failed to create the prod directed QID\n");
+
+ /* Create ports */
+#define LB_PORT_DEPTH 16
+#define DIR_PORT_DEPTH 32
+ port_config.enqueue_queue_depth = LB_PORT_DEPTH;
+ port_config.dequeue_queue_depth = LB_PORT_DEPTH;
+ port_config.new_event_threshold = 255;
+
+ prod_port = 0;
+ ret = rte_event_port_setup(id, prod_port, &port_config);
+ if (ret < 0)
+ rte_panic("Failed to create the producer port\n");
+
+ cons_port = 1;
+ port_config.enqueue_queue_depth = DIR_PORT_DEPTH;
+ port_config.dequeue_queue_depth = DIR_PORT_DEPTH;
+ ret = rte_event_port_setup(id, cons_port, &port_config);
+ if (ret < 0)
+ rte_panic("Failed to create the consumer port\n");
+
+ port_config.enqueue_queue_depth = LB_PORT_DEPTH;
+ port_config.dequeue_queue_depth = LB_PORT_DEPTH;
+ for (i = 0; i < num_workers; i++) {
+ worker_data[i].event_port_id = i + 2;
+ ret = rte_event_port_setup(id, worker_data[i].event_port_id, &port_config);
+ if (ret < 0)
+ rte_panic("Failed to create worker port #%d\n", i);
+ }
+
+ /* Map ports/qids */
+ for (i = 0; i < num_workers; i++) {
+ link.queue_id = qid0;
+ link.priority = 0;
+
+ ret = rte_event_port_link(id, worker_data[i].event_port_id, &link, 1);
+ if (ret != 1)
+ rte_panic("Failed to map worker%d port to qid0\n", i);
+ }
+
+ /* Link consumer port to its QID */
+ link.queue_id = cons_qid;
+ link.priority = 0;
+
+ ret = rte_event_port_link(id, cons_port, &link, 1);
+ if (ret != 1)
+ rte_panic("Failed to map consumer port to cons_qid\n");
+
+ /* Link producer port to its QID */
+ link.queue_id = prod_qid;
+ link.priority = 0;
+
+ ret = rte_event_port_link(id, prod_port, &link, 1);
+ if (ret != 1)
+ rte_panic("Failed to map producer port to prod_qid\n");
+
+ /* Dispatch to slaves */
+ *prod_data = (struct prod_data){.event_dev_id = id,
+ .event_port_id = prod_port,
+ .qid = qid0};
+ *cons_data = (struct cons_data){.event_dev_id = id,
+ .event_port_id = cons_port};
+
+ for (i = 0; i < num_workers; i++) {
+ struct worker_data *w = &worker_data[i];
+ w->event_dev_id = id;
+ w->qid = cons_qid;
+ }
+
+ if (rte_event_dev_start(id) < 0) {
+ printf("%d: Error with start call\n", __LINE__);
+ return -1;
+ }
+
+ return (uint8_t) id;
+}
+
+static void sighndlr(int sig)
+{
+ /* Ctlr-Z to dump stats */
+ if(sig == SIGTSTP) {
+ rte_mempool_dump(stdout, mp);
+ rte_event_dev_dump(stdout, 0);
+ }
+ /* Ctlr-C to exit */
+ if(sig == SIGINT)
+ rte_exit(0, "sigint arrived, quitting\n");
+}
+
+int
+main(int argc, char **argv)
+{
+ signal(SIGINT , sighndlr);
+ signal(SIGTSTP, sighndlr);
+
+ struct prod_data prod_data = {0};
+ struct cons_data cons_data = {0};
+ struct worker_data *worker_data;
+ unsigned nworkers = 0;
+ unsigned num_ports;
+ int lcore_id;
+ int err;
+ int has_prod = 0;
+ int has_cons = 0;
+ int has_scheduler = 0;
+
+ err = rte_eal_init(argc, argv);
+ if (err < 0)
+ rte_panic("Invalid EAL arguments\n");
+
+ argc -= err;
+ argv += err;
+
+ /* Parse cli options*/
+ parse_app_args(argc, argv);
+
+ num_ports = rte_eth_dev_count();
+ if (num_ports == 0)
+ rte_panic("No ethernet ports found\n");
+
+ if (!quiet) {
+ printf(" Config:\n");
+ printf("\tports: %u\n", num_ports);
+ printf("\tworkers: %u\n", num_workers);
+ printf("\tpackets: %lu\n", num_packets);
+ printf("\tflows: %u\n", num_fids);
+ printf("\tpriorities: %u\n", num_priorities);
+ if (sched_type == RTE_SCHED_TYPE_ORDERED)
+ printf("\tqid0 type: ordered\n");
+ if (sched_type == RTE_SCHED_TYPE_ATOMIC)
+ printf("\tqid0 type: atomic\n");
+ printf("\n");
+ }
+
+ const unsigned cores_needed = num_workers +
+ /*main*/1 +
+ /*sched*/1 +
+ /*TX*/1 +
+ /*RX*/1;
+
+ if (!quiet) {
+ printf("Number of cores available: %u\n", rte_lcore_count());
+ printf("Number of cores to be used: %u\n", cores_needed);
+ }
+
+ if (rte_lcore_count() < cores_needed)
+ rte_panic("Too few cores\n");
+
+ const uint8_t ndevs = rte_event_dev_count();
+ if (ndevs == 0)
+ rte_panic("No event devs found. Do you need to pass in a --vdev flag?\n");
+ if (ndevs > 1)
+ fprintf(stderr, "Warning: More than one event dev, using idx 0");
+
+ worker_data = rte_calloc(0, num_workers, sizeof(worker_data[0]), 0);
+ if (worker_data == NULL)
+ rte_panic("rte_calloc failed\n");
+
+ uint8_t id = setup_event_dev(&prod_data, &cons_data, worker_data);
+ RTE_SET_USED(id);
+
+ prod_data.num_ports = num_ports;
+ init_ports(num_ports);
+
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+ if (has_prod && has_cons && has_scheduler && nworkers == num_workers)
+ break;
+
+ if (!has_scheduler) {
+ err = rte_eal_remote_launch(scheduler, NULL, lcore_id);
+ if (err)
+ rte_panic("Failed to launch scheduler\n");
+
+ has_scheduler = 1;
+ continue;
+ }
+
+ if (nworkers < num_workers) {
+ err = rte_eal_remote_launch(worker, &worker_data[nworkers], lcore_id);
+ if (err)
+ rte_panic("Failed to launch worker%d\n", nworkers);
+ nworkers++;
+ continue;
+ }
+
+ if (!has_cons) {
+ err = rte_eal_remote_launch(consumer, &cons_data, lcore_id);
+ if (err)
+ rte_panic("Failed to launch consumer\n");
+ has_cons = 1;
+ continue;
+ }
+
+ if (!has_prod) {
+ err = rte_eal_remote_launch(producer, &prod_data, lcore_id);
+ if (err)
+ rte_panic("Failed to launch producer\n");
+ has_prod = 1;
+ continue;
+ }
+ }
+
+ rte_eal_mp_wait_lcore();
+
+ /* Cleanup done automatically by kernel on app exit */
+
+ return 0;
+}
--
2.7.4
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD
2016-11-16 18:00 [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD Harry van Haaren
` (6 preceding siblings ...)
2016-11-16 18:00 ` [dpdk-dev] [PATCH 7/7] examples/eventdev_pipeline: adding example Harry van Haaren
@ 2016-11-16 20:19 ` Jerin Jacob
2016-11-17 10:05 ` Bruce Richardson
7 siblings, 1 reply; 18+ messages in thread
From: Jerin Jacob @ 2016-11-16 20:19 UTC (permalink / raw)
To: Harry van Haaren; +Cc: dev
On Wed, Nov 16, 2016 at 06:00:00PM +0000, Harry van Haaren wrote:
> This series of RFC patches implements the libeventdev API and a software
> eventdev PMD.
>
> The implementation here is intended to enable the community to use the
> eventdev API, specifically to test if the API serves the purpose that it is
> designed to. It should be noted this is an RFC implementation, and hence
> there should be no performance expectations.
>
> An RFC for the eventdev was sent in August[1] by Jerin Jacob of Cavium,
> which introduced the core concepts of the eventdev to the community. Since
> then there has been extensive discussion[2] on the mailing list, which had
> led to various modifications to the initial proposed API.
>
> The API as presented in the first patch contains a number of changes that
> have not yet been discussed. These changes were noticed during the
> implementation of the software eventdev PMD, and were added to the API to
> enable completion of the PMD. These modifications include a statistics API
> and a dump API. For more details, please refer to the commit message of the
> patch itself.
>
> The functionality provided by each of the patches is as follows:
> 1: Add eventdev API and library infrastructure
> 2: Enable compilation of library
> 3: Add software eventdev PMD
> 4: Enable compilation of PMD
> 5: Add test code
> 6: Enable test code compilation
> 7: Sample application demonstrating basic usage
>
> This breakdown of the patchset hopefully enables the community to experiment
> with the eventdev API, and allows us all to gain first-hand experience in
> using the eventdev API. Note also that this patchset has not passed
> checkpatch testing just yet - will fix for v2 :)
>
> As next steps I see value in discussing the proposed changes included in
> this version of the header file, while welcoming feedback from the community
> on the API in general too.
Thanks. Harry.
Even I was writing the similar stuff.I took a bit different approach on
the common code side, where I was trying to have fat common code(
lib/librte_eventdev/rte_eventdev.c) with start/stop support for the
slow-path code. I will post the implementation in few days and then we
can work on a converged solution.
Following sections of code does not have any overlap at all.
test/eventdev: unit and functional tests
event/sw: software eventdev implementation
examples/eventdev_pipeline: adding example
Some questions and initial feedback
1) I thought RTE_EVENT_OP_DROP and rte_event_release() are same ? No ?
2) device stats API can be based on capability, HW implementations may not
support all the stats
3) From the HW implementation perspective, eventdev_pipeline application
needs to have a lot of changes.I will post the comments in coming days
and we can work together on the converged solution.
Jerin
>
> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
>
> [1] http://dpdk.org/ml/archives/dev/2016-August/045181.html
> [2] http://dpdk.org/ml/archives/dev/2016-October/thread.html#48196
>
> Harry van Haaren (7):
> eventdev: header and implementation
> eventdev: makefiles
> event/sw: software eventdev implementation
> event/sw: makefiles and config
> test/eventdev: unit and functional tests
> test/eventdev: unit func makefiles
> examples/eventdev_pipeline: adding example
>
> app/test/Makefile | 3 +
> app/test/test_eventdev_func.c | 1272 ++++++++++++++++++++++++
> app/test/test_eventdev_unit.c | 557 +++++++++++
> config/common_base | 12 +
> drivers/Makefile | 1 +
> drivers/event/Makefile | 36 +
> drivers/event/sw/Makefile | 59 ++
> drivers/event/sw/event_ring.h | 142 +++
> drivers/event/sw/iq_ring.h | 160 +++
> drivers/event/sw/rte_pmd_evdev_sw_version.map | 3 +
> drivers/event/sw/sw_evdev.c | 619 ++++++++++++
> drivers/event/sw/sw_evdev.h | 234 +++++
> drivers/event/sw/sw_evdev_scheduler.c | 660 +++++++++++++
> drivers/event/sw/sw_evdev_worker.c | 218 +++++
> examples/eventdev_pipeline/Makefile | 49 +
> examples/eventdev_pipeline/main.c | 717 ++++++++++++++
> lib/Makefile | 1 +
> lib/librte_eal/common/include/rte_vdev.h | 1 +
> lib/librte_eventdev/Makefile | 54 ++
> lib/librte_eventdev/rte_eventdev.c | 466 +++++++++
> lib/librte_eventdev/rte_eventdev.h | 1289 +++++++++++++++++++++++++
> lib/librte_eventdev/rte_eventdev_ops.h | 177 ++++
> lib/librte_eventdev/rte_eventdev_pmd.h | 69 ++
> lib/librte_eventdev/rte_eventdev_version.map | 33 +
> mk/rte.app.mk | 5 +
> 25 files changed, 6837 insertions(+)
> create mode 100644 app/test/test_eventdev_func.c
> create mode 100644 app/test/test_eventdev_unit.c
> create mode 100644 drivers/event/Makefile
> create mode 100644 drivers/event/sw/Makefile
> create mode 100644 drivers/event/sw/event_ring.h
> create mode 100644 drivers/event/sw/iq_ring.h
> create mode 100644 drivers/event/sw/rte_pmd_evdev_sw_version.map
> create mode 100644 drivers/event/sw/sw_evdev.c
> create mode 100644 drivers/event/sw/sw_evdev.h
> create mode 100644 drivers/event/sw/sw_evdev_scheduler.c
> create mode 100644 drivers/event/sw/sw_evdev_worker.c
> create mode 100644 examples/eventdev_pipeline/Makefile
> create mode 100644 examples/eventdev_pipeline/main.c
> create mode 100644 lib/librte_eventdev/Makefile
> create mode 100644 lib/librte_eventdev/rte_eventdev.c
> create mode 100644 lib/librte_eventdev/rte_eventdev.h
> create mode 100644 lib/librte_eventdev/rte_eventdev_ops.h
> create mode 100644 lib/librte_eventdev/rte_eventdev_pmd.h
> create mode 100644 lib/librte_eventdev/rte_eventdev_version.map
>
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD
2016-11-16 20:19 ` [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD Jerin Jacob
@ 2016-11-17 10:05 ` Bruce Richardson
2016-11-18 22:23 ` Jerin Jacob
0 siblings, 1 reply; 18+ messages in thread
From: Bruce Richardson @ 2016-11-17 10:05 UTC (permalink / raw)
To: Jerin Jacob; +Cc: Harry van Haaren, dev
On Thu, Nov 17, 2016 at 01:49:25AM +0530, Jerin Jacob wrote:
> On Wed, Nov 16, 2016 at 06:00:00PM +0000, Harry van Haaren wrote:
> > This series of RFC patches implements the libeventdev API and a software
> > eventdev PMD.
> >
> > The implementation here is intended to enable the community to use the
> > eventdev API, specifically to test if the API serves the purpose that it is
> > designed to. It should be noted this is an RFC implementation, and hence
> > there should be no performance expectations.
> >
> > An RFC for the eventdev was sent in August[1] by Jerin Jacob of Cavium,
> > which introduced the core concepts of the eventdev to the community. Since
> > then there has been extensive discussion[2] on the mailing list, which had
> > led to various modifications to the initial proposed API.
> >
> > The API as presented in the first patch contains a number of changes that
> > have not yet been discussed. These changes were noticed during the
> > implementation of the software eventdev PMD, and were added to the API to
> > enable completion of the PMD. These modifications include a statistics API
> > and a dump API. For more details, please refer to the commit message of the
> > patch itself.
> >
> > The functionality provided by each of the patches is as follows:
> > 1: Add eventdev API and library infrastructure
> > 2: Enable compilation of library
> > 3: Add software eventdev PMD
> > 4: Enable compilation of PMD
> > 5: Add test code
> > 6: Enable test code compilation
> > 7: Sample application demonstrating basic usage
> >
> > This breakdown of the patchset hopefully enables the community to experiment
> > with the eventdev API, and allows us all to gain first-hand experience in
> > using the eventdev API. Note also that this patchset has not passed
> > checkpatch testing just yet - will fix for v2 :)
> >
> > As next steps I see value in discussing the proposed changes included in
> > this version of the header file, while welcoming feedback from the community
> > on the API in general too.
>
> Thanks. Harry.
>
> Even I was writing the similar stuff.I took a bit different approach on
> the common code side, where I was trying to have fat common code(
> lib/librte_eventdev/rte_eventdev.c) with start/stop support for the
> slow-path code. I will post the implementation in few days and then we
> can work on a converged solution.
Looking forward to seeing this. Hopefully some of our code can be reused
on your side too, maybe the registration and args parsing bits, perhaps.
>
> Following sections of code does not have any overlap at all.
> test/eventdev: unit and functional tests
> event/sw: software eventdev implementation
> examples/eventdev_pipeline: adding example
>
> Some questions and initial feedback
> 1) I thought RTE_EVENT_OP_DROP and rte_event_release() are same ? No ?
They should be largely equivalent, just that the DROP op can be done as
part of a burst. If they are not, it could be a bug in our
implementation, as it's still an early draft using this eventdev API.
> 2) device stats API can be based on capability, HW implementations may not
> support all the stats
Yes, this is something we were thinking about. It would be nice if we
could at least come up with a common set of stats - maybe even ones
tracked at an eventdev API level, e.g. nb enqueues/dequeues. As well as
that, we think the idea of an xstats API, like in ethdev, might work
well. For our software implementation, having visibility into the
scheduler behaviour can be important, so we'd like a way to report out
things like internal queue depths etc.
> 3) From the HW implementation perspective, eventdev_pipeline application
> needs to have a lot of changes.I will post the comments in coming days
> and we can work together on the converged solution.
Yes, please do. I expect we'll need a good set of guidelines in order to
allow people to write truly portable apps using this API.
Thanks for the feedback.
/Bruce
>
> Jerin
>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD
2016-11-17 10:05 ` Bruce Richardson
@ 2016-11-18 22:23 ` Jerin Jacob
2016-11-21 9:48 ` Bruce Richardson
0 siblings, 1 reply; 18+ messages in thread
From: Jerin Jacob @ 2016-11-18 22:23 UTC (permalink / raw)
To: Bruce Richardson; +Cc: Harry van Haaren, dev
On Thu, Nov 17, 2016 at 10:05:07AM +0000, Bruce Richardson wrote:
> > 2) device stats API can be based on capability, HW implementations may not
> > support all the stats
>
> Yes, this is something we were thinking about. It would be nice if we
> could at least come up with a common set of stats - maybe even ones
> tracked at an eventdev API level, e.g. nb enqueues/dequeues. As well as
> that, we think the idea of an xstats API, like in ethdev, might work
> well. For our software implementation, having visibility into the
> scheduler behaviour can be important, so we'd like a way to report out
> things like internal queue depths etc.
>
Since these are not very generic hardware, I am not sure how much sense
to have generic stats API. But, Something similar to ethdev's xstat(any capability based)
the scheme works well. Look forward to seeing API proposal with common code.
Jerin
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD
2016-11-18 22:23 ` Jerin Jacob
@ 2016-11-21 9:48 ` Bruce Richardson
2016-11-21 20:18 ` Jerin Jacob
0 siblings, 1 reply; 18+ messages in thread
From: Bruce Richardson @ 2016-11-21 9:48 UTC (permalink / raw)
To: Jerin Jacob; +Cc: Harry van Haaren, dev
On Sat, Nov 19, 2016 at 03:53:25AM +0530, Jerin Jacob wrote:
> On Thu, Nov 17, 2016 at 10:05:07AM +0000, Bruce Richardson wrote:
> > > 2) device stats API can be based on capability, HW implementations may not
> > > support all the stats
> >
> > Yes, this is something we were thinking about. It would be nice if we
> > could at least come up with a common set of stats - maybe even ones
> > tracked at an eventdev API level, e.g. nb enqueues/dequeues. As well as
> > that, we think the idea of an xstats API, like in ethdev, might work
> > well. For our software implementation, having visibility into the
> > scheduler behaviour can be important, so we'd like a way to report out
> > things like internal queue depths etc.
> >
>
> Since these are not very generic hardware, I am not sure how much sense
> to have generic stats API. But, Something similar to ethdev's xstat(any capability based)
> the scheme works well. Look forward to seeing API proposal with common code.
>
> Jerin
>
Well, to start off with, some stats that could be tracked at the API
level could be common. What about counts of number of enqueues and
dequeues?
I suppose the other way we can look at this is: once we get a few
implementations of the interface, we can look at the provided xstats
values from each one, and see if there is anything common between them.
/Bruce
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD
2016-11-21 9:48 ` Bruce Richardson
@ 2016-11-21 20:18 ` Jerin Jacob
2016-11-22 14:05 ` Richardson, Bruce
0 siblings, 1 reply; 18+ messages in thread
From: Jerin Jacob @ 2016-11-21 20:18 UTC (permalink / raw)
To: Bruce Richardson; +Cc: Harry van Haaren, dev
On Mon, Nov 21, 2016 at 09:48:56AM +0000, Bruce Richardson wrote:
> On Sat, Nov 19, 2016 at 03:53:25AM +0530, Jerin Jacob wrote:
> > On Thu, Nov 17, 2016 at 10:05:07AM +0000, Bruce Richardson wrote:
> > > > 2) device stats API can be based on capability, HW implementations may not
> > > > support all the stats
> > >
> > > Yes, this is something we were thinking about. It would be nice if we
> > > could at least come up with a common set of stats - maybe even ones
> > > tracked at an eventdev API level, e.g. nb enqueues/dequeues. As well as
> > > that, we think the idea of an xstats API, like in ethdev, might work
> > > well. For our software implementation, having visibility into the
> > > scheduler behaviour can be important, so we'd like a way to report out
> > > things like internal queue depths etc.
> > >
> >
> > Since these are not very generic hardware, I am not sure how much sense
> > to have generic stats API. But, Something similar to ethdev's xstat(any capability based)
> > the scheme works well. Look forward to seeing API proposal with common code.
> >
> > Jerin
> >
> Well, to start off with, some stats that could be tracked at the API
> level could be common. What about counts of number of enqueues and
> dequeues?
>
> I suppose the other way we can look at this is: once we get a few
> implementations of the interface, we can look at the provided xstats
> values from each one, and see if there is anything common between them.
That makes more sense to me as we don't have proposed counts. I think,
Then we should not use stats for functional tests as proposed. We could
verify the functional test by embedding some value in event object on
enqueue and later check the same on dequeue kind of scheme.
Jerin
>
> /Bruce
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH 7/7] examples/eventdev_pipeline: adding example
2016-11-16 18:00 ` [dpdk-dev] [PATCH 7/7] examples/eventdev_pipeline: adding example Harry van Haaren
@ 2016-11-22 6:02 ` Jerin Jacob
2016-11-22 14:04 ` Richardson, Bruce
0 siblings, 1 reply; 18+ messages in thread
From: Jerin Jacob @ 2016-11-22 6:02 UTC (permalink / raw)
To: Harry van Haaren; +Cc: dev, Gage Eads, Bruce Richardson
On Wed, Nov 16, 2016 at 06:00:07PM +0000, Harry van Haaren wrote:
> This patch adds a sample app to the examples/ directory, which can be used
> as a reference application and for general testing. The application requires
> two ethdev ports and expects traffic to be flowing. The application must be
> run with the --vdev flags as follows to indicate to EAL that a virtual
> eventdev device called "evdev_sw0" is available to be used:
>
> ./build/eventdev_pipeline --vdev evdev_sw0
>
> The general flow of the traffic is as follows:
>
> Rx core -> Atomic Queue => 4 worker cores => TX core
>
> A scheduler core is required to do the packet scheduling, making this
> configuration require 7 cores (Rx, Tx, Scheduler, and 4 workers). Finally
> a master core brings the core count to 8 for this configuration. The
Thanks for the example application.I will try to share my views on
ethdev integration and usability perspective. Hope we can converge.
Some of the high level details first before getting into exact details.
1) From the HW and ethdev integration perspective, The integrated NIC controllers
does not need producer core(s) to push the event/packets to event queue. So, I was
thinking to use 6WIND rte_flow spec to create the "ethdev port to event
queue wiring" connection by extending the output ACTION definition, which
specifies event queue its need to enqueued to for the given ethdev port
(something your are doing in application).
I guess, the producer part of this example can be created as common
code, somewhere in rte_flow/ethdev to reuse. We would need this scheme also
where when we deal with external nics + HW event manager use case
The complete event driven model can be verified and exercised without
integrating with eventdev subsystem. So I think, may be we need to
focus on functional applications without ethdev to verify the eventdev
features like(automatic multicore scaling, dynamic load balancing, pipelining,
packet ingress order maintenance and synchronization services) and then
integrate with ethdev
> + const unsigned cores_needed = num_workers +
> + /*main*/1 +
> + /*sched*/1 +
> + /*TX*/1 +
> + /*RX*/1;
> +
2) One of the prime aims of the event driven model is to remove the fixed
function core mappings and enable automatic multicore scaling, dynamic load
balancing etc.I will try to use an example in review section to show the
method for removing "consumer core" in this case.
> application can be configured for various numbers of flows and worker
> cores. Run the application with -h for details.
>
> Signed-off-by: Gage Eads <gage.eads@intel.com>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
> ---
> examples/eventdev_pipeline/Makefile | 49 +++
> examples/eventdev_pipeline/main.c | 718 ++++++++++++++++++++++++++++++++++++
> 2 files changed, 767 insertions(+)
> create mode 100644 examples/eventdev_pipeline/Makefile
> create mode 100644 examples/eventdev_pipeline/main.c
>
> +static int sched_type = RTE_SCHED_TYPE_ATOMIC;
RTE_SCHED_TYPE_ORDERED makes sense as a default. Most common case will
have ORDERD at first stage so that it can scale.
> +
> +
> +static int
> +worker(void *arg)
> +{
> + struct rte_event rcv_events[BATCH_SIZE];
> +
> + struct worker_data *data = (struct worker_data *)arg;
> + uint8_t event_dev_id = data->event_dev_id;
> + uint8_t event_port_id = data->event_port_id;
> + int32_t qid = data->qid;
> + size_t sent = 0, received = 0;
> +
> + while (!done) {
> + uint16_t i;
> +
> + uint16_t n = rte_event_dequeue_burst(event_dev_id,
> + event_port_id,
> + rcv_events,
> + RTE_DIM(rcv_events),
> + false);
> + if (n == 0){
> + rte_pause();
> + /* Flush any buffered events */
> + rte_event_dequeue(event_dev_id,
> + event_port_id,
> + NULL,
> + false);
The above can be done in implementation. May not be the candidate for common code.
> + continue;
> + }
> + received += n;
> +
> + for (i = 0; i < n; i++) {
> + struct ether_hdr *eth;
> + struct ether_addr addr;
> + struct rte_event *ev = &rcv_events[i];
> +
> + ev->queue_id = qid;
> + ev->flow_id = 0;
Another way to deal wit out additional consumer core(it creates issue in
scaling and load balancing) is
in worker:
while(1) {
ev = dequeue(port);
// stage 1 app processing
if (ev.event_type == RTE_EVENT_TYPE_ETHDEV) {
// identify the Ethernet port and tx queue the packet needs to go
// create the flow based on that
ev.flow_id = flow(port_id, tx_queue_id);
ev.sched_type = RTE_SCHED_TYPE_ATOMIC;
ev.operation = RTE_EVENT_OP_FORWARD;
ev.event_type = RTE_EVENT_TYPE_CORE;
} // stage 2 app processing
else if (ev.event_type == RTE_EVENT_TYPE_CORE) {
port_id = function_of(ev.flow_id) ;// look stage 1 processing
tx_queue_id = function_of(ev.flow_id) //look stage 1 processing
remaining ethdev based tx is same as yours
}
enqueue(ev);
}
> + ev->priority = 0;
> + ev->sched_type = RTE_SCHED_TYPE_ATOMIC;
> + ev->operation = RTE_EVENT_OP_FORWARD;
> +
> + uint64_t now = rte_rdtsc();
> + while(now + 750 > rte_rdtsc()) {}
Why delay ?
> +
> + /* change mac addresses on packet */
> + eth = rte_pktmbuf_mtod(ev->mbuf, struct ether_hdr *);
> + ether_addr_copy(ð->d_addr, &addr);
> + ether_addr_copy(ð->s_addr, ð->d_addr);
> + ether_addr_copy(&addr, ð->s_addr);
> + }
> + int ret = rte_event_enqueue_burst(event_dev_id, event_port_id,
> + rcv_events, n, false);
> + if (ret != n)
> + rte_panic("worker %u thread failed to enqueue event\n",
> + rte_lcore_id());
> + }
> +
> + /* Flush the buffered events */
> + rte_event_dequeue(event_dev_id, event_port_id, NULL, false);
> +
> + if (!quiet)
> + printf(" worker %u thread done. RX=%zu TX=%zu\n",
> + rte_lcore_id(), received, sent);
> +
> + return 0;
> +}
> +
> +static int
> +scheduler(void *arg)
> +{
Maybe better to abstract as "service core" or something like I mentioned
earlier, as HW implementation does not need this
> + RTE_SET_USED(arg);
> + size_t loops = 0;
> +
> + while (!done) {
> + /* Assumes an event dev ID of 0 */
> + rte_event_schedule(0);
> + loops++;
> + }
> +
> + printf(" scheduler thread done. loops=%zu\n", loops);
> +
> + return 0;
> +}
> +
> +
> +static int
> +producer(void *arg)
> +{
> +
> + struct prod_data *data = (struct prod_data *)arg;
> + size_t npackets = num_packets;
> + unsigned i;
> + uint64_t mbuf_seqno = 0;
> + size_t sent = 0;
> + uint8_t eth_port = 0;
> + uint8_t event_dev_id = data->event_dev_id;
> + uint8_t event_port_id = data->event_port_id;
> + int fid_counter = 0;
> +
> + while (!done) {
> + int ret;
> + unsigned num_ports = data->num_ports;
> + int32_t qid = data->qid;
> + struct rte_event events[BATCH_SIZE];
> + struct rte_mbuf *mbufs[BATCH_SIZE];
> +
> + uint16_t nb_rx = rte_eth_rx_burst(eth_port, 0, mbufs, BATCH_SIZE);
> + if (++eth_port == num_ports)
> + eth_port = 0;
> + if (nb_rx == 0) {
> + rte_pause();
> + /* Flush any buffered events */
> + rte_event_dequeue(event_dev_id,
> + event_port_id,
> + NULL,
> + false);
> + continue;
> + }
> +
> + for (i = 0; i < nb_rx; i++) {
> + struct rte_mbuf *m = mbufs[i];
> + struct rte_event *ev = &events[i];
> +
> + ev->queue_id = qid;
> + ev->flow_id = fid_counter++ % 6;
To me, flow_id should be a function of port_id and rx queue number here.
right?
> + ev->priority = 0;
> + m->udata64 = mbuf_seqno++;
Why update mbuf_seqno++ here. Shouldn't be something inside the
implementation?
> + ev->mbuf = m;
> + ev->sched_type = sched_type;
> + ev->operation = RTE_EVENT_OP_NEW;
> + }
> +
> + do {
> + ret = rte_event_enqueue_burst(event_dev_id,
> + event_port_id,
> + events,
> + nb_rx,
> + false);
> + } while (ret == -ENOSPC);
I guess, -ENOSPC can be checked inside the implementation. I guess, we
can pass the info required in the configuration stage to decide the timeout. May
not be the candidate for common code.
> + if (ret != nb_rx)
> + rte_panic("producer thread failed to enqueue *all* events\n");
> +
> + sent += nb_rx;
> +
> + if (num_packets > 0 && npackets > 0) {
> + npackets -= nb_rx;
> + if (npackets == 0)
> + break;
> + }
> + }
> +
> + /* Flush any buffered events */
> + while (!done)
> + rte_event_dequeue(event_dev_id, event_port_id, NULL, false);
> +
> + printf(" prod thread done! TX=%zu across %u flows\n", sent, num_fids);
> +
> + return 0;
> +}
> +
> +static uint8_t
> +setup_event_dev(struct prod_data *prod_data,
> + struct cons_data *cons_data,
> + struct worker_data *worker_data)
> +{
> + config.nb_events_limit = 256;
In real application, we may need to pass as command line
> + config.dequeue_wait_ns = 0;
> +
> + ret = rte_event_dev_configure(id, &config);
> + if (ret)
> + rte_panic("Failed to configure the event dev\n");
> +
> + /* Create queues */
> + queue_config.event_queue_cfg = RTE_EVENT_QUEUE_CFG_ATOMIC_ONLY;
> + queue_config.priority = 0;
> +
> + qid0 = 0;
> + ret = rte_event_queue_setup(id, qid0, &queue_config);
> + if (ret < 0)
> + rte_panic("Failed to create the scheduled QID\n");
> +
> + queue_config.event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_CONSUMER;
> + queue_config.priority = 0;
> +
> + cons_qid = 1;
> + ret = rte_event_queue_setup(id, cons_qid, &queue_config);
> + if (ret < 0)
> + rte_panic("Failed to create the cons directed QID\n");
> +
> + queue_config.event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_CONSUMER;
I guess its more of RTE_EVENT_QUEUE_CFG_SINGLE_PRODUCER case, Does it
make sense to add RTE_EVENT_QUEUE_CFG_SINGLE_PRODUCER in spec, if you are
enqueueing only through that port. see next comment.
> + queue_config.priority = 0;
> +
> + prod_qid = 2;
> + ret = rte_event_queue_setup(id, prod_qid, &queue_config);
> + if (ret < 0)
> + rte_panic("Failed to create the prod directed QID\n");
> +
Looks like prod_qid is just created as a dummy, The actual producer is
en-queuing on qid0.Something not adding up.
> + /* Create ports */
> +#define LB_PORT_DEPTH 16
> +#define DIR_PORT_DEPTH 32
> + port_config.enqueue_queue_depth = LB_PORT_DEPTH;
> + port_config.dequeue_queue_depth = LB_PORT_DEPTH;
We need to check the info->max_enqueue_queue_depth.
Jerin
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH 7/7] examples/eventdev_pipeline: adding example
2016-11-22 6:02 ` Jerin Jacob
@ 2016-11-22 14:04 ` Richardson, Bruce
2016-11-23 0:30 ` Jerin Jacob
0 siblings, 1 reply; 18+ messages in thread
From: Richardson, Bruce @ 2016-11-22 14:04 UTC (permalink / raw)
To: Jerin Jacob, Van Haaren, Harry; +Cc: dev, Eads, Gage
> -----Original Message-----
> From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> Sent: Tuesday, November 22, 2016 6:02 AM
> To: Van Haaren, Harry <harry.van.haaren@intel.com>
> Cc: dev@dpdk.org; Eads, Gage <gage.eads@intel.com>; Richardson, Bruce
> <bruce.richardson@intel.com>
> Subject: Re: [dpdk-dev] [PATCH 7/7] examples/eventdev_pipeline: adding
> example
>
> On Wed, Nov 16, 2016 at 06:00:07PM +0000, Harry van Haaren wrote:
> > This patch adds a sample app to the examples/ directory, which can be
> > used as a reference application and for general testing. The
> > application requires two ethdev ports and expects traffic to be
> > flowing. The application must be run with the --vdev flags as follows
> > to indicate to EAL that a virtual eventdev device called "evdev_sw0" is
> available to be used:
> >
> > ./build/eventdev_pipeline --vdev evdev_sw0
> >
> > The general flow of the traffic is as follows:
> >
> > Rx core -> Atomic Queue => 4 worker cores => TX core
> >
> > A scheduler core is required to do the packet scheduling, making this
> > configuration require 7 cores (Rx, Tx, Scheduler, and 4 workers).
> > Finally a master core brings the core count to 8 for this
> > configuration. The
>
> Thanks for the example application.I will try to share my views on ethdev
> integration and usability perspective. Hope we can converge.
Hi Jerin,
thanks for the feedback. We'll take it on board for a subsequent version
we produce. Additional comments and queries on your feedback inline below.
/Bruce
>
> Some of the high level details first before getting into exact details.
>
> 1) From the HW and ethdev integration perspective, The integrated NIC
> controllers does not need producer core(s) to push the event/packets to
> event queue. So, I was thinking to use 6WIND rte_flow spec to create the
> "ethdev port to event queue wiring" connection by extending the output
> ACTION definition, which specifies event queue its need to enqueued to for
> the given ethdev port (something your are doing in application).
>
> I guess, the producer part of this example can be created as common code,
> somewhere in rte_flow/ethdev to reuse. We would need this scheme also
> where when we deal with external nics + HW event manager use case
>
Yes. This is something to consider.
For the pure-software model, we also might want to look at the opposite
approach, where we register an ethdev with the scheduler for it to "pull"
new packets from. This would allow it to bypass the port logic for the new
packets.
An alternative for this is to extend the schedule API to allow a burst of
packets to be passed in to be scheduled immediately as "NEW" packets. The end
results should be the same, saving cycles by bypassing unneeded processing
for the new packets.
> The complete event driven model can be verified and exercised without
> integrating with eventdev subsystem. So I think, may be we need to focus
> on functional applications without ethdev to verify the eventdev features
> like(automatic multicore scaling, dynamic load balancing, pipelining,
> packet ingress order maintenance and synchronization services) and then
> integrate with ethdev
Yes, comprehensive unit tests will be needed too. But an example app that
pulls packets from an external NIC I also think is needed to get a feel
for the performance of the scheduler with real traffic.
>
> > + const unsigned cores_needed = num_workers +
> > + /*main*/1 +
> > + /*sched*/1 +
> > + /*TX*/1 +
> > + /*RX*/1;
> > +
>
> 2) One of the prime aims of the event driven model is to remove the fixed
> function core mappings and enable automatic multicore scaling, dynamic
> load balancing etc.I will try to use an example in review section to show
> the method for removing "consumer core" in this case.
Yes, I agree, but unfortunately, for some tasks, distributing those tasks
across multiple cores can hurt performance overall do to resource contention.
>
> > application can be configured for various numbers of flows and worker
> > cores. Run the application with -h for details.
> >
> > Signed-off-by: Gage Eads <gage.eads@intel.com>
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
> > ---
> > examples/eventdev_pipeline/Makefile | 49 +++
> > examples/eventdev_pipeline/main.c | 718
> ++++++++++++++++++++++++++++++++++++
> > 2 files changed, 767 insertions(+)
> > create mode 100644 examples/eventdev_pipeline/Makefile
> > create mode 100644 examples/eventdev_pipeline/main.c
> >
> > +static int sched_type = RTE_SCHED_TYPE_ATOMIC;
>
> RTE_SCHED_TYPE_ORDERED makes sense as a default. Most common case will
> have ORDERD at first stage so that it can scale.
>
> > +
> > +
> > +static int
> > +worker(void *arg)
> > +{
> > + struct rte_event rcv_events[BATCH_SIZE];
> > +
> > + struct worker_data *data = (struct worker_data *)arg;
> > + uint8_t event_dev_id = data->event_dev_id;
> > + uint8_t event_port_id = data->event_port_id;
> > + int32_t qid = data->qid;
> > + size_t sent = 0, received = 0;
> > +
> > + while (!done) {
> > + uint16_t i;
> > +
> > + uint16_t n = rte_event_dequeue_burst(event_dev_id,
> > + event_port_id,
> > + rcv_events,
> > + RTE_DIM(rcv_events),
> > + false);
> > + if (n == 0){
> > + rte_pause();
> > + /* Flush any buffered events */
> > + rte_event_dequeue(event_dev_id,
> > + event_port_id,
> > + NULL,
> > + false);
>
> The above can be done in implementation. May not be the candidate for
> common code.
>
> > + continue;
> > + }
> > + received += n;
> > +
> > + for (i = 0; i < n; i++) {
> > + struct ether_hdr *eth;
> > + struct ether_addr addr;
> > + struct rte_event *ev = &rcv_events[i];
> > +
> > + ev->queue_id = qid;
> > + ev->flow_id = 0;
>
> Another way to deal wit out additional consumer core(it creates issue in
> scaling and load balancing) is
>
> in worker:
> while(1) {
>
> ev = dequeue(port);
>
> // stage 1 app processing
> if (ev.event_type == RTE_EVENT_TYPE_ETHDEV) {
> // identify the Ethernet port and tx queue the packet needs to
> go
> // create the flow based on that
> ev.flow_id = flow(port_id, tx_queue_id);
> ev.sched_type = RTE_SCHED_TYPE_ATOMIC;
> ev.operation = RTE_EVENT_OP_FORWARD;
> ev.event_type = RTE_EVENT_TYPE_CORE;
> } // stage 2 app processing
> else if (ev.event_type == RTE_EVENT_TYPE_CORE) {
> port_id = function_of(ev.flow_id) ;// look stage 1 processing
> tx_queue_id = function_of(ev.flow_id) //look stage 1
> processing
> remaining ethdev based tx is same as yours
> }
> enqueue(ev);
> }
>
Yes, but you still need some core to do the work of pushing the packets into
the scheduler from the NIC, if you don't have a hardware path from NIC to
HW scheduler. [Features like RSS can obviously help here with distributing that
work if needed]
In the case you do have a HW path - which I assume is the Cavium case - I assume
that the EVENT_TYPE_ETHDEV branch above needs also to take care of desc to mbuf
processing, as is normally done by the PMD?
>
>
> > + ev->priority = 0;
> > + ev->sched_type = RTE_SCHED_TYPE_ATOMIC;
> > + ev->operation = RTE_EVENT_OP_FORWARD;
> > +
> > + uint64_t now = rte_rdtsc();
> > + while(now + 750 > rte_rdtsc()) {}
>
> Why delay ?
Simulate some work being done by the worker, which makes the app slightly more
realistic and also helps the scheduler as there is not so much contention on the
shared cache lines.
>
> > +
> > + /* change mac addresses on packet */
> > + eth = rte_pktmbuf_mtod(ev->mbuf, struct ether_hdr *);
> > + ether_addr_copy(ð->d_addr, &addr);
> > + ether_addr_copy(ð->s_addr, ð->d_addr);
> > + ether_addr_copy(&addr, ð->s_addr);
> > + }
> > + int ret = rte_event_enqueue_burst(event_dev_id, event_port_id,
> > + rcv_events, n, false);
> > + if (ret != n)
> > + rte_panic("worker %u thread failed to enqueue event\n",
> > + rte_lcore_id());
> > + }
> > +
> > + /* Flush the buffered events */
> > + rte_event_dequeue(event_dev_id, event_port_id, NULL, false);
> > +
> > + if (!quiet)
> > + printf(" worker %u thread done. RX=%zu TX=%zu\n",
> > + rte_lcore_id(), received, sent);
> > +
> > + return 0;
> > +}
> > +
> > +static int
> > +scheduler(void *arg)
> > +{
>
> Maybe better to abstract as "service core" or something like I mentioned
> earlier, as HW implementation does not need this
Sure, we can look at this.
>
> > + RTE_SET_USED(arg);
> > + size_t loops = 0;
> > +
> > + while (!done) {
> > + /* Assumes an event dev ID of 0 */
> > + rte_event_schedule(0);
> > + loops++;
> > + }
> > +
> > + printf(" scheduler thread done. loops=%zu\n", loops);
> > +
> > + return 0;
> > +}
> > +
> > +
> > +static int
> > +producer(void *arg)
> > +{
> > +
> > + struct prod_data *data = (struct prod_data *)arg;
> > + size_t npackets = num_packets;
> > + unsigned i;
> > + uint64_t mbuf_seqno = 0;
> > + size_t sent = 0;
> > + uint8_t eth_port = 0;
> > + uint8_t event_dev_id = data->event_dev_id;
> > + uint8_t event_port_id = data->event_port_id;
> > + int fid_counter = 0;
> > +
> > + while (!done) {
> > + int ret;
> > + unsigned num_ports = data->num_ports;
> > + int32_t qid = data->qid;
> > + struct rte_event events[BATCH_SIZE];
> > + struct rte_mbuf *mbufs[BATCH_SIZE];
> > +
> > + uint16_t nb_rx = rte_eth_rx_burst(eth_port, 0, mbufs,
> BATCH_SIZE);
> > + if (++eth_port == num_ports)
> > + eth_port = 0;
> > + if (nb_rx == 0) {
> > + rte_pause();
> > + /* Flush any buffered events */
> > + rte_event_dequeue(event_dev_id,
> > + event_port_id,
> > + NULL,
> > + false);
> > + continue;
> > + }
> > +
> > + for (i = 0; i < nb_rx; i++) {
> > + struct rte_mbuf *m = mbufs[i];
> > + struct rte_event *ev = &events[i];
> > +
> > + ev->queue_id = qid;
> > + ev->flow_id = fid_counter++ % 6;
>
> To me, flow_id should be a function of port_id and rx queue number here.
> right?
I'd view it as app dependent. For a test app on IA, I'd expect to use the
NIC RSS value as an initial flow value.
NOTE: this is just a quick test app to demonstrate the concept for the RFC,
so not everything in it is necessarily realistic or what we'd expect in a
final version app.
>
> > + ev->priority = 0;
> > + m->udata64 = mbuf_seqno++;
>
> Why update mbuf_seqno++ here. Shouldn't be something inside the
> implementation?
I think this was to help verifying the packet ordering. Again, may not be
in a final version.
>
> > + ev->mbuf = m;
> > + ev->sched_type = sched_type;
> > + ev->operation = RTE_EVENT_OP_NEW;
> > + }
> > +
> > + do {
> > + ret = rte_event_enqueue_burst(event_dev_id,
> > + event_port_id,
> > + events,
> > + nb_rx,
> > + false);
> > + } while (ret == -ENOSPC);
>
> I guess, -ENOSPC can be checked inside the implementation. I guess, we can
> pass the info required in the configuration stage to decide the timeout.
> May not be the candidate for common code.
>
> > + if (ret != nb_rx)
> > + rte_panic("producer thread failed to enqueue *all*
> events\n");
> > +
> > + sent += nb_rx;
> > +
> > + if (num_packets > 0 && npackets > 0) {
> > + npackets -= nb_rx;
> > + if (npackets == 0)
> > + break;
> > + }
> > + }
> > +
> > + /* Flush any buffered events */
> > + while (!done)
> > + rte_event_dequeue(event_dev_id, event_port_id, NULL, false);
> > +
> > + printf(" prod thread done! TX=%zu across %u flows\n", sent,
> > +num_fids);
> > +
> > + return 0;
> > +}
> > +
>
> > +static uint8_t
> > +setup_event_dev(struct prod_data *prod_data,
> > + struct cons_data *cons_data,
> > + struct worker_data *worker_data)
> > +{
> > + config.nb_events_limit = 256;
>
> In real application, we may need to pass as command line
>
> > + config.dequeue_wait_ns = 0;
> > +
> > + ret = rte_event_dev_configure(id, &config);
> > + if (ret)
> > + rte_panic("Failed to configure the event dev\n");
> > +
> > + /* Create queues */
> > + queue_config.event_queue_cfg = RTE_EVENT_QUEUE_CFG_ATOMIC_ONLY;
> > + queue_config.priority = 0;
> > +
> > + qid0 = 0;
> > + ret = rte_event_queue_setup(id, qid0, &queue_config);
> > + if (ret < 0)
> > + rte_panic("Failed to create the scheduled QID\n");
> > +
> > + queue_config.event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_CONSUMER;
> > + queue_config.priority = 0;
> > +
> > + cons_qid = 1;
> > + ret = rte_event_queue_setup(id, cons_qid, &queue_config);
> > + if (ret < 0)
> > + rte_panic("Failed to create the cons directed QID\n");
> > +
> > + queue_config.event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_CONSUMER;
>
> I guess its more of RTE_EVENT_QUEUE_CFG_SINGLE_PRODUCER case, Does it make
> sense to add RTE_EVENT_QUEUE_CFG_SINGLE_PRODUCER in spec, if you are
> enqueueing only through that port. see next comment.
>
> > + queue_config.priority = 0;
> > +
> > + prod_qid = 2;
> > + ret = rte_event_queue_setup(id, prod_qid, &queue_config);
> > + if (ret < 0)
> > + rte_panic("Failed to create the prod directed QID\n");
> > +
>
> Looks like prod_qid is just created as a dummy, The actual producer is en-
> queuing on qid0.Something not adding up.
Possibly not. We'll check it out.
>
> > + /* Create ports */
> > +#define LB_PORT_DEPTH 16
> > +#define DIR_PORT_DEPTH 32
> > + port_config.enqueue_queue_depth = LB_PORT_DEPTH;
> > + port_config.dequeue_queue_depth = LB_PORT_DEPTH;
>
> We need to check the info->max_enqueue_queue_depth.
>
> Jerin
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD
2016-11-21 20:18 ` Jerin Jacob
@ 2016-11-22 14:05 ` Richardson, Bruce
0 siblings, 0 replies; 18+ messages in thread
From: Richardson, Bruce @ 2016-11-22 14:05 UTC (permalink / raw)
To: Jerin Jacob; +Cc: Van Haaren, Harry, dev
> -----Original Message-----
> From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> Sent: Monday, November 21, 2016 8:19 PM
> To: Richardson, Bruce <bruce.richardson@intel.com>
> Cc: Van Haaren, Harry <harry.van.haaren@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD
>
> On Mon, Nov 21, 2016 at 09:48:56AM +0000, Bruce Richardson wrote:
> > On Sat, Nov 19, 2016 at 03:53:25AM +0530, Jerin Jacob wrote:
> > > On Thu, Nov 17, 2016 at 10:05:07AM +0000, Bruce Richardson wrote:
> > > > > 2) device stats API can be based on capability, HW
> > > > > implementations may not support all the stats
> > > >
> > > > Yes, this is something we were thinking about. It would be nice if
> > > > we could at least come up with a common set of stats - maybe even
> > > > ones tracked at an eventdev API level, e.g. nb enqueues/dequeues.
> > > > As well as that, we think the idea of an xstats API, like in
> > > > ethdev, might work well. For our software implementation, having
> > > > visibility into the scheduler behaviour can be important, so we'd
> > > > like a way to report out things like internal queue depths etc.
> > > >
> > >
> > > Since these are not very generic hardware, I am not sure how much
> > > sense to have generic stats API. But, Something similar to ethdev's
> > > xstat(any capability based) the scheme works well. Look forward to
> seeing API proposal with common code.
> > >
> > > Jerin
> > >
> > Well, to start off with, some stats that could be tracked at the API
> > level could be common. What about counts of number of enqueues and
> > dequeues?
> >
> > I suppose the other way we can look at this is: once we get a few
> > implementations of the interface, we can look at the provided xstats
> > values from each one, and see if there is anything common between them.
>
> That makes more sense to me as we don't have proposed counts. I think,
> Then we should not use stats for functional tests as proposed. We could
> verify the functional test by embedding some value in event object on
> enqueue and later check the same on dequeue kind of scheme.
>
> Jerin
>
Yes, that can work. Many of the unit tests we are looking at are likely
specific to our software implementation, so we may end up doing a separate
sw-eventdev specific unit test set, as well as a general eventdev set.
/Bruce
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH 7/7] examples/eventdev_pipeline: adding example
2016-11-22 14:04 ` Richardson, Bruce
@ 2016-11-23 0:30 ` Jerin Jacob
0 siblings, 0 replies; 18+ messages in thread
From: Jerin Jacob @ 2016-11-23 0:30 UTC (permalink / raw)
To: Richardson, Bruce; +Cc: Van Haaren, Harry, dev, Eads, Gage
On Tue, Nov 22, 2016 at 02:04:27PM +0000, Richardson, Bruce wrote:
>
>
> > -----Original Message-----
> > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> > Sent: Tuesday, November 22, 2016 6:02 AM
> > To: Van Haaren, Harry <harry.van.haaren@intel.com>
> > Cc: dev@dpdk.org; Eads, Gage <gage.eads@intel.com>; Richardson, Bruce
> > <bruce.richardson@intel.com>
> > Subject: Re: [dpdk-dev] [PATCH 7/7] examples/eventdev_pipeline: adding
> > example
> >
> > On Wed, Nov 16, 2016 at 06:00:07PM +0000, Harry van Haaren wrote:
> > > This patch adds a sample app to the examples/ directory, which can be
> > > used as a reference application and for general testing. The
> > > application requires two ethdev ports and expects traffic to be
> > > flowing. The application must be run with the --vdev flags as follows
> > > to indicate to EAL that a virtual eventdev device called "evdev_sw0" is
> > available to be used:
> > >
> > > ./build/eventdev_pipeline --vdev evdev_sw0
> > >
> > > The general flow of the traffic is as follows:
> > >
> > > Rx core -> Atomic Queue => 4 worker cores => TX core
> > >
> > > A scheduler core is required to do the packet scheduling, making this
> > > configuration require 7 cores (Rx, Tx, Scheduler, and 4 workers).
> > > Finally a master core brings the core count to 8 for this
> > > configuration. The
> >
> > Thanks for the example application.I will try to share my views on ethdev
> > integration and usability perspective. Hope we can converge.
>
> Hi Jerin,
>
> thanks for the feedback. We'll take it on board for a subsequent version
> we produce. Additional comments and queries on your feedback inline below.
Thanks Bruce.
>
> /Bruce
>
> >
> > Some of the high level details first before getting into exact details.
> >
> > 1) From the HW and ethdev integration perspective, The integrated NIC
> > controllers does not need producer core(s) to push the event/packets to
> > event queue. So, I was thinking to use 6WIND rte_flow spec to create the
> > "ethdev port to event queue wiring" connection by extending the output
> > ACTION definition, which specifies event queue its need to enqueued to for
> > the given ethdev port (something your are doing in application).
> >
> > I guess, the producer part of this example can be created as common code,
> > somewhere in rte_flow/ethdev to reuse. We would need this scheme also
> > where when we deal with external nics + HW event manager use case
> >
> Yes. This is something to consider.
>
> For the pure-software model, we also might want to look at the opposite
> approach, where we register an ethdev with the scheduler for it to "pull"
> new packets from. This would allow it to bypass the port logic for the new
> packets.
Not sure,I understand this completely. How different its integrating
with rte_flow specification ?
>
> An alternative for this is to extend the schedule API to allow a burst of
> packets to be passed in to be scheduled immediately as "NEW" packets. The end
> results should be the same, saving cycles by bypassing unneeded processing
> for the new packets.
>
> > The complete event driven model can be verified and exercised without
> > integrating with eventdev subsystem. So I think, may be we need to focus
> > on functional applications without ethdev to verify the eventdev features
> > like(automatic multicore scaling, dynamic load balancing, pipelining,
> > packet ingress order maintenance and synchronization services) and then
> > integrate with ethdev
>
> Yes, comprehensive unit tests will be needed too. But an example app that
> pulls packets from an external NIC I also think is needed to get a feel
> for the performance of the scheduler with real traffic.
I agree, we need to have example to show case with real traffic.
Please check on ethdev integration aspects. Cavium has both server
(that's going to use SW event pmd) and NPU based platform(that's going to
use HW event pmd). So we would like to have common approach that makes
integration of both models with out changing the application.
I was thinking more with "service core" and "rte_flow" based
integration methodology to make that happen.
>
> >
> > > + const unsigned cores_needed = num_workers +
> > > + /*main*/1 +
> > > + /*sched*/1 +
> > > + /*TX*/1 +
> > > + /*RX*/1;
> > > +
> >
> > 2) One of the prime aims of the event driven model is to remove the fixed
> > function core mappings and enable automatic multicore scaling, dynamic
> > load balancing etc.I will try to use an example in review section to show
> > the method for removing "consumer core" in this case.
>
> Yes, I agree, but unfortunately, for some tasks, distributing those tasks
> across multiple cores can hurt performance overall do to resource contention.
May only in SW implementation.
>
> >
> > > application can be configured for various numbers of flows and worker
> > > cores. Run the application with -h for details.
> > >
> >
> > Another way to deal wit out additional consumer core(it creates issue in
> > scaling and load balancing) is
> >
> > in worker:
> > while(1) {
> >
> > ev = dequeue(port);
> >
> > // stage 1 app processing
> > if (ev.event_type == RTE_EVENT_TYPE_ETHDEV) {
> > // identify the Ethernet port and tx queue the packet needs to
> > go
> > // create the flow based on that
> > ev.flow_id = flow(port_id, tx_queue_id);
> > ev.sched_type = RTE_SCHED_TYPE_ATOMIC;
> > ev.operation = RTE_EVENT_OP_FORWARD;
> > ev.event_type = RTE_EVENT_TYPE_CORE;
> > } // stage 2 app processing
> > else if (ev.event_type == RTE_EVENT_TYPE_CORE) {
> > port_id = function_of(ev.flow_id) ;// look stage 1 processing
> > tx_queue_id = function_of(ev.flow_id) //look stage 1
> > processing
> > remaining ethdev based tx is same as yours
> > }
> > enqueue(ev);
> > }
> >
> Yes, but you still need some core to do the work of pushing the packets into
> the scheduler from the NIC, if you don't have a hardware path from NIC to
> HW scheduler. [Features like RSS can obviously help here with distributing that
> work if needed]
Yes. make sense to have producer portion of code as common code.
>
> In the case you do have a HW path - which I assume is the Cavium case - I assume
> that the EVENT_TYPE_ETHDEV branch above needs also to take care of desc to mbuf
> processing, as is normally done by the PMD?
>
> >
> >
> > > + ev->priority = 0;
> > > + ev->sched_type = RTE_SCHED_TYPE_ATOMIC;
> > > + ev->operation = RTE_EVENT_OP_FORWARD;
> > > +
> > > + uint64_t now = rte_rdtsc();
> > > + while(now + 750 > rte_rdtsc()) {}
> >
> > Why delay ?
>
> Simulate some work being done by the worker, which makes the app slightly more
> realistic and also helps the scheduler as there is not so much contention on the
> shared cache lines.
May not for performance test-cases.
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH 5/7] test/eventdev: unit and functional tests
2016-11-16 18:00 ` [dpdk-dev] [PATCH 5/7] test/eventdev: unit and functional tests Harry van Haaren
@ 2016-11-23 3:32 ` Jerin Jacob
0 siblings, 0 replies; 18+ messages in thread
From: Jerin Jacob @ 2016-11-23 3:32 UTC (permalink / raw)
To: Harry van Haaren; +Cc: dev, Gage Eads, David Hunt
On Wed, Nov 16, 2016 at 06:00:05PM +0000, Harry van Haaren wrote:
> This commit adds basic unit and functional tests for the eventdev
> API. The test code is added in this commit, but not yet enabled until
> the next commit.
>
> Signed-off-by: Gage Eads <gage.eads@intel.com>
> Signed-off-by: David Hunt <david.hunt@intel.com>
> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
> ---
A few comments on portability and usage perspective. See below,
> +#include <rte_eal.h>
> +#include <rte_per_lcore.h>
> +#include <rte_lcore.h>
> +#include <rte_debug.h>
> +#include <rte_ethdev.h>
> +#include <rte_cycles.h>
> +
> +#include <rte_eventdev.h>
> +#include "test.h"
> +
> +
> +static inline int
> +create_ports(struct test *t, int num_ports)
> +{
> + int i;
> + static const struct rte_event_port_conf conf = {
> + .dequeue_queue_depth = 32,
> + .enqueue_queue_depth = 64,
> + };
Check the max supported through info get first.
> +
> + for (i = 0; i < num_ports; i++) {
> + if (rte_event_port_setup(t->ev, i, &conf) < 0) {
> + printf("Error setting up port %d\n", i);
> + return -1;
> + }
> + t->port[i] = i;
> + }
> +
> + return 0;
> +}
> +
> +
> +static int
> +run_prio_packet_test(struct test *t)
Run per event enqueue priority test if the platform supports
RTE_EVENT_DEV_CAP_EVENT_QOS
> +{
> + int err;
> + const uint32_t MAGIC_SEQN[] = {4711, 1234};
> + const uint32_t PRIORITY[] = {3, 0};
> + unsigned i;
> + for(i = 0; i < RTE_DIM(MAGIC_SEQN); i++) {
> + /* generate pkt and enqueue */
> + struct rte_event ev;
> + struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool);
> + if (!arp) {
> + printf("%d: gen of pkt failed\n", __LINE__);
> + return -1;
> + }
> + arp->seqn = MAGIC_SEQN[i];
For me, it make sense to don't touch any field in mbuf to make eventdev
model works. use private field to store test specific data
> +
> + ev = (struct rte_event){
> + .priority = PRIORITY[i],
> + .operation = RTE_EVENT_OP_NEW,
> + .queue_id = t->qid[0],
> + .mbuf = arp
> + };
> + err = rte_event_enqueue(t->ev, t->port[0], &ev, 0);
> + if (err < 0) {
> + printf("%d: error failed to enqueue\n", __LINE__);
> + return -1;
> + }
> + }
> +
> + rte_event_schedule(t->ev);
> +
> + struct rte_event_dev_stats stats;
> + err = rte_event_dev_stats_get(t->ev, &stats);
> + if (err) {
> + printf("%d: error failed to get stats\n", __LINE__);
> + return -1;
> + }
> +
> + if (stats.port_rx_pkts[t->port[0]] != 2) {
> + printf("%d: error stats incorrect for directed port\n", __LINE__);
> + rte_event_dev_dump(stdout, t->ev);
> + return -1;
> + }
rely on stats for functional verification may not work in all the
implementation. makes sense to have more concrete functional
verification without stats
> +
> + struct rte_event ev, ev2;
> + uint32_t deq_pkts;
> + deq_pkts = rte_event_dequeue(t->ev, t->port[0], &ev, 0);
> + if (deq_pkts != 1) {
> + printf("%d: error failed to deq\n", __LINE__);
> + rte_event_dev_dump(stdout, t->ev);
> + return -1;
> + }
> + if(ev.mbuf->seqn != MAGIC_SEQN[1]) {
> + printf("%d: first packet out not highest priority\n", __LINE__);
> + rte_event_dev_dump(stdout, t->ev);
> + return -1;
> + }
> + rte_pktmbuf_free(ev.mbuf);
> +
> +
> +static int
> +test_overload_trip(struct test *t)
overload tests wont fail in ddr backed systems.(ddr backed system will
mimic infinite size queue to application). So testing against failure
may not work at all in some implementation
> +{
> + int err;
> +
> + /* Create instance with 3 directed QIDs going to 3 ports */
> + if (init(t, 1, 1) < 0 ||
> + create_ports(t, 1) < 0 ||
> + create_atomic_qids(t, 1) < 0)
> + return -1;
> +
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2016-11-23 3:32 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-16 18:00 [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 1/7] eventdev: header and implementation Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 2/7] eventdev: makefiles Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 3/7] event/sw: software eventdev implementation Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 4/7] event/sw: makefiles and config Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 5/7] test/eventdev: unit and functional tests Harry van Haaren
2016-11-23 3:32 ` Jerin Jacob
2016-11-16 18:00 ` [dpdk-dev] [PATCH 6/7] test/eventdev: unit func makefiles Harry van Haaren
2016-11-16 18:00 ` [dpdk-dev] [PATCH 7/7] examples/eventdev_pipeline: adding example Harry van Haaren
2016-11-22 6:02 ` Jerin Jacob
2016-11-22 14:04 ` Richardson, Bruce
2016-11-23 0:30 ` Jerin Jacob
2016-11-16 20:19 ` [dpdk-dev] [RFC PATCH 0/7] RFC: EventDev Software PMD Jerin Jacob
2016-11-17 10:05 ` Bruce Richardson
2016-11-18 22:23 ` Jerin Jacob
2016-11-21 9:48 ` Bruce Richardson
2016-11-21 20:18 ` Jerin Jacob
2016-11-22 14:05 ` Richardson, Bruce
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).