aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/event/sw
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/event/sw')
-rw-r--r--drivers/event/sw/Makefile4
-rw-r--r--drivers/event/sw/rte_pmd_sw_event_version.map (renamed from drivers/event/sw/rte_pmd_evdev_sw_version.map)0
-rw-r--r--drivers/event/sw/sw_evdev.c61
-rw-r--r--drivers/event/sw/sw_evdev.h1
-rw-r--r--drivers/event/sw/sw_evdev_worker.c14
-rw-r--r--drivers/event/sw/sw_evdev_xstats.c2
6 files changed, 47 insertions, 35 deletions
diff --git a/drivers/event/sw/Makefile b/drivers/event/sw/Makefile
index 857a87cc..2f2b67ba 100644
--- a/drivers/event/sw/Makefile
+++ b/drivers/event/sw/Makefile
@@ -43,12 +43,14 @@ ifeq ($(shell test $(GCC_VERSION) -le 50 && echo 1), 1)
CFLAGS += -Wno-missing-field-initializers
endif
endif
+LDLIBS += -lrte_eal -lrte_eventdev -lrte_kvargs -lrte_ring
+LDLIBS += -lrte_bus_vdev
# library version
LIBABIVER := 1
# versioning export map
-EXPORT_MAP := rte_pmd_evdev_sw_version.map
+EXPORT_MAP := rte_pmd_sw_event_version.map
# library source files
SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev.c
diff --git a/drivers/event/sw/rte_pmd_evdev_sw_version.map b/drivers/event/sw/rte_pmd_sw_event_version.map
index 5352e7e3..5352e7e3 100644
--- a/drivers/event/sw/rte_pmd_evdev_sw_version.map
+++ b/drivers/event/sw/rte_pmd_sw_event_version.map
diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c
index 9c534b7f..fd110797 100644
--- a/drivers/event/sw/sw_evdev.c
+++ b/drivers/event/sw/sw_evdev.c
@@ -33,8 +33,7 @@
#include <inttypes.h>
#include <string.h>
-#include <rte_vdev.h>
-#include <rte_memzone.h>
+#include <rte_bus_vdev.h>
#include <rte_kvargs.h>
#include <rte_ring.h>
#include <rte_errno.h>
@@ -345,28 +344,14 @@ sw_queue_setup(struct rte_eventdev *dev, uint8_t queue_id,
{
int type;
- /* SINGLE_LINK can be OR-ed with other types, so handle first */
+ type = conf->schedule_type;
+
if (RTE_EVENT_QUEUE_CFG_SINGLE_LINK & conf->event_queue_cfg) {
type = SW_SCHED_TYPE_DIRECT;
- } else {
- switch (conf->event_queue_cfg) {
- case RTE_EVENT_QUEUE_CFG_ATOMIC_ONLY:
- type = RTE_SCHED_TYPE_ATOMIC;
- break;
- case RTE_EVENT_QUEUE_CFG_ORDERED_ONLY:
- type = RTE_SCHED_TYPE_ORDERED;
- break;
- case RTE_EVENT_QUEUE_CFG_PARALLEL_ONLY:
- type = RTE_SCHED_TYPE_PARALLEL;
- break;
- case RTE_EVENT_QUEUE_CFG_ALL_TYPES:
- SW_LOG_ERR("QUEUE_CFG_ALL_TYPES not supported\n");
- return -ENOTSUP;
- default:
- SW_LOG_ERR("Unknown queue type %d requested\n",
- conf->event_queue_cfg);
- return -EINVAL;
- }
+ } else if (RTE_EVENT_QUEUE_CFG_ALL_TYPES
+ & conf->event_queue_cfg) {
+ SW_LOG_ERR("QUEUE_CFG_ALL_TYPES not supported\n");
+ return -ENOTSUP;
}
struct sw_evdev *sw = sw_pmd_priv(dev);
@@ -400,7 +385,7 @@ sw_queue_def_conf(struct rte_eventdev *dev, uint8_t queue_id,
static const struct rte_event_queue_conf default_conf = {
.nb_atomic_flows = 4096,
.nb_atomic_order_sequences = 1,
- .event_queue_cfg = RTE_EVENT_QUEUE_CFG_ATOMIC_ONLY,
+ .schedule_type = RTE_SCHED_TYPE_ATOMIC,
.priority = RTE_EVENT_DEV_PRIORITY_NORMAL,
};
@@ -437,6 +422,19 @@ sw_dev_configure(const struct rte_eventdev *dev)
return 0;
}
+struct rte_eth_dev;
+
+static int
+sw_eth_rx_adapter_caps_get(const struct rte_eventdev *dev,
+ const struct rte_eth_dev *eth_dev,
+ uint32_t *caps)
+{
+ RTE_SET_USED(dev);
+ RTE_SET_USED(eth_dev);
+ *caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
+ return 0;
+}
+
static void
sw_info_get(struct rte_eventdev *dev, struct rte_event_dev_info *info)
{
@@ -616,11 +614,14 @@ sw_start(struct rte_eventdev *dev)
unsigned int i, j;
struct sw_evdev *sw = sw_pmd_priv(dev);
+ rte_service_component_runstate_set(sw->service_id, 1);
+
/* check a service core is mapped to this service */
- struct rte_service_spec *s = rte_service_get_by_name(sw->service_name);
- if (!rte_service_is_running(s))
+ if (!rte_service_runstate_get(sw->service_id)) {
SW_LOG_ERR("Warning: No Service core enabled on service %s\n",
- s->name);
+ sw->service_name);
+ return -ENOENT;
+ }
/* check all ports are set up */
for (i = 0; i < sw->port_count; i++)
@@ -752,6 +753,8 @@ sw_probe(struct rte_vdev_device *vdev)
.port_link = sw_port_link,
.port_unlink = sw_port_unlink,
+ .eth_rx_adapter_caps_get = sw_eth_rx_adapter_caps_get,
+
.xstats_get = sw_xstats_get,
.xstats_get_names = sw_xstats_get_names,
.xstats_get_by_name = sw_xstats_get_by_name,
@@ -833,7 +836,6 @@ sw_probe(struct rte_vdev_device *vdev)
dev->enqueue_forward_burst = sw_event_enqueue_burst;
dev->dequeue = sw_event_dequeue;
dev->dequeue_burst = sw_event_dequeue_burst;
- dev->schedule = sw_event_schedule;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
@@ -855,12 +857,15 @@ sw_probe(struct rte_vdev_device *vdev)
service.callback = sw_sched_service_func;
service.callback_userdata = (void *)dev;
- int32_t ret = rte_service_register(&service);
+ int32_t ret = rte_service_component_register(&service, &sw->service_id);
if (ret) {
SW_LOG_ERR("service register() failed");
return -ENOEXEC;
}
+ dev->data->service_inited = 1;
+ dev->data->service_id = sw->service_id;
+
return 0;
}
diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h
index 71de3c14..e0dec910 100644
--- a/drivers/event/sw/sw_evdev.h
+++ b/drivers/event/sw/sw_evdev.h
@@ -278,6 +278,7 @@ struct sw_evdev {
uint16_t xstats_count_per_qid[RTE_EVENT_MAX_QUEUES_PER_DEV];
uint16_t xstats_offset_for_qid[RTE_EVENT_MAX_QUEUES_PER_DEV];
+ uint32_t service_id;
char service_name[SW_PMD_NAME_MAX];
};
diff --git a/drivers/event/sw/sw_evdev_worker.c b/drivers/event/sw/sw_evdev_worker.c
index d76d3d5c..b3b3b17e 100644
--- a/drivers/event/sw/sw_evdev_worker.c
+++ b/drivers/event/sw/sw_evdev_worker.c
@@ -85,14 +85,18 @@ sw_event_enqueue_burst(void *port, const struct rte_event ev[], uint16_t num)
struct sw_port *p = port;
struct sw_evdev *sw = (void *)p->sw;
uint32_t sw_inflights = rte_atomic32_read(&sw->inflights);
-
- if (unlikely(p->inflight_max < sw_inflights))
- return 0;
+ int new = 0;
if (num > PORT_ENQUEUE_MAX_BURST_SIZE)
num = PORT_ENQUEUE_MAX_BURST_SIZE;
- if (p->inflight_credits < num) {
+ for (i = 0; i < num; i++)
+ new += (ev[i].op == RTE_EVENT_OP_NEW);
+
+ if (unlikely(new > 0 && p->inflight_max < sw_inflights))
+ return 0;
+
+ if (p->inflight_credits < new) {
/* check if event enqueue brings port over max threshold */
uint32_t credit_update_quanta = sw->credit_update_quanta;
if (sw_inflights + credit_update_quanta > sw->nb_events_limit)
@@ -101,7 +105,7 @@ sw_event_enqueue_burst(void *port, const struct rte_event ev[], uint16_t num)
rte_atomic32_add(&sw->inflights, credit_update_quanta);
p->inflight_credits += (credit_update_quanta);
- if (p->inflight_credits < num)
+ if (p->inflight_credits < new)
return 0;
}
diff --git a/drivers/event/sw/sw_evdev_xstats.c b/drivers/event/sw/sw_evdev_xstats.c
index 8cb6d88d..61a5c33b 100644
--- a/drivers/event/sw/sw_evdev_xstats.c
+++ b/drivers/event/sw/sw_evdev_xstats.c
@@ -538,7 +538,7 @@ sw_xstats_get(const struct rte_eventdev *dev,
{
struct sw_evdev *sw = sw_pmd_priv(dev);
const uint32_t reset = 0;
- const uint32_t ret_n_lt_stats = 1;
+ const uint32_t ret_n_lt_stats = 0;
return sw_xstats_update(sw, mode, queue_port_id, ids, values, n,
reset, ret_n_lt_stats);
}