remove useless memzone includes
[dpdk.git] / test / test / test_eventdev_sw.c
index 89e17b4..b86b137 100644 (file)
@@ -39,7 +39,6 @@
 #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_debug.h>
 #include <rte_ethdev.h>
 #include <rte_cycles.h>
-
 #include <rte_eventdev.h>
+#include <rte_pause.h>
+#include <rte_service.h>
+#include <rte_service_component.h>
+
 #include "test.h"
 
 #define MAX_PORTS 16
@@ -62,6 +64,7 @@ struct test {
        uint8_t port[MAX_PORTS];
        uint8_t qid[MAX_QIDS];
        int nb_qids;
+       uint32_t service_id;
 };
 
 static struct rte_event release_ev;
@@ -100,6 +103,69 @@ rte_gen_arp(int portid, struct rte_mempool *mp)
        return m;
 }
 
+static void
+xstats_print(void)
+{
+       const uint32_t XSTATS_MAX = 1024;
+       uint32_t i;
+       uint32_t ids[XSTATS_MAX];
+       uint64_t values[XSTATS_MAX];
+       struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
+
+       for (i = 0; i < XSTATS_MAX; i++)
+               ids[i] = i;
+
+       /* Device names / values */
+       int ret = rte_event_dev_xstats_names_get(evdev,
+                                       RTE_EVENT_DEV_XSTATS_DEVICE, 0,
+                                       xstats_names, ids, XSTATS_MAX);
+       if (ret < 0) {
+               printf("%d: xstats names get() returned error\n",
+                       __LINE__);
+               return;
+       }
+       ret = rte_event_dev_xstats_get(evdev,
+                                       RTE_EVENT_DEV_XSTATS_DEVICE,
+                                       0, ids, values, ret);
+       if (ret > (signed int)XSTATS_MAX)
+               printf("%s %d: more xstats available than space\n",
+                               __func__, __LINE__);
+       for (i = 0; (signed int)i < ret; i++) {
+               printf("%d : %s : %"PRIu64"\n",
+                               i, xstats_names[i].name, values[i]);
+       }
+
+       /* Port names / values */
+       ret = rte_event_dev_xstats_names_get(evdev,
+                                       RTE_EVENT_DEV_XSTATS_PORT, 0,
+                                       xstats_names, ids, XSTATS_MAX);
+       ret = rte_event_dev_xstats_get(evdev,
+                                       RTE_EVENT_DEV_XSTATS_PORT, 1,
+                                       ids, values, ret);
+       if (ret > (signed int)XSTATS_MAX)
+               printf("%s %d: more xstats available than space\n",
+                               __func__, __LINE__);
+       for (i = 0; (signed int)i < ret; i++) {
+               printf("%d : %s : %"PRIu64"\n",
+                               i, xstats_names[i].name, values[i]);
+       }
+
+       /* Queue names / values */
+       ret = rte_event_dev_xstats_names_get(evdev,
+                                       RTE_EVENT_DEV_XSTATS_QUEUE, 0,
+                                       xstats_names, ids, XSTATS_MAX);
+       ret = rte_event_dev_xstats_get(evdev,
+                                       RTE_EVENT_DEV_XSTATS_QUEUE,
+                                       1, ids, values, ret);
+       if (ret > (signed int)XSTATS_MAX)
+               printf("%s %d: more xstats available than space\n",
+                               __func__, __LINE__);
+       for (i = 0; (signed int)i < ret; i++) {
+               printf("%d : %s : %"PRIu64"\n",
+                               i, xstats_names[i].name, values[i]);
+       }
+}
+
 /* initialization and config */
 static inline int
 init(struct test *t, int nb_queues, int nb_ports)
@@ -155,7 +221,7 @@ create_lb_qids(struct test *t, int num_qids, uint32_t flags)
 
        /* Q creation */
        const struct rte_event_queue_conf conf = {
-                       .event_queue_cfg = flags,
+                       .schedule_type = flags,
                        .priority = RTE_EVENT_DEV_PRIORITY_NORMAL,
                        .nb_atomic_flows = 1024,
                        .nb_atomic_order_sequences = 1024,
@@ -178,20 +244,20 @@ create_lb_qids(struct test *t, int num_qids, uint32_t flags)
 static inline int
 create_atomic_qids(struct test *t, int num_qids)
 {
-       return create_lb_qids(t, num_qids, RTE_EVENT_QUEUE_CFG_ATOMIC_ONLY);
+       return create_lb_qids(t, num_qids, RTE_SCHED_TYPE_ATOMIC);
 }
 
 static inline int
 create_ordered_qids(struct test *t, int num_qids)
 {
-       return create_lb_qids(t, num_qids, RTE_EVENT_QUEUE_CFG_ORDERED_ONLY);
+       return create_lb_qids(t, num_qids, RTE_SCHED_TYPE_ORDERED);
 }
 
 
 static inline int
 create_unordered_qids(struct test *t, int num_qids)
 {
-       return create_lb_qids(t, num_qids, RTE_EVENT_QUEUE_CFG_PARALLEL_ONLY);
+       return create_lb_qids(t, num_qids, RTE_SCHED_TYPE_PARALLEL);
 }
 
 static inline int
@@ -203,8 +269,6 @@ create_directed_qids(struct test *t, int num_qids, const uint8_t ports[])
        static const struct rte_event_queue_conf conf = {
                        .priority = RTE_EVENT_DEV_PRIORITY_NORMAL,
                        .event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_LINK,
-                       .nb_atomic_flows = 1024,
-                       .nb_atomic_order_sequences = 1024,
        };
 
        for (i = t->nb_qids; i < t->nb_qids + num_qids; i++) {
@@ -353,7 +417,7 @@ run_prio_packet_test(struct test *t)
                }
        }
 
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        struct test_event_dev_stats stats;
        err = test_event_dev_stats_get(evdev, &stats);
@@ -445,7 +509,7 @@ test_single_directed_packet(struct test *t)
        }
 
        /* Run schedule() as dir packets may need to be re-ordered */
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        struct test_event_dev_stats stats;
        err = test_event_dev_stats_get(evdev, &stats);
@@ -485,6 +549,50 @@ test_single_directed_packet(struct test *t)
        return 0;
 }
 
+static int
+test_directed_forward_credits(struct test *t)
+{
+       uint32_t i;
+       int32_t err;
+
+       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(evdev) < 0) {
+               printf("%d: Error with start call\n", __LINE__);
+               return -1;
+       }
+
+       struct rte_event ev = {
+                       .op = RTE_EVENT_OP_NEW,
+                       .queue_id = 0,
+       };
+
+       for (i = 0; i < 1000; i++) {
+               err = rte_event_enqueue_burst(evdev, 0, &ev, 1);
+               if (err < 0) {
+                       printf("%d: error failed to enqueue\n", __LINE__);
+                       return -1;
+               }
+               rte_service_run_iter_on_app_lcore(t->service_id);
+
+               uint32_t deq_pkts;
+               deq_pkts = rte_event_dequeue_burst(evdev, 0, &ev, 1, 0);
+               if (deq_pkts != 1) {
+                       printf("%d: error failed to deq\n", __LINE__);
+                       return -1;
+               }
+
+               /* re-write event to be a forward, and continue looping it */
+               ev.op = RTE_EVENT_OP_FORWARD;
+       }
+
+       cleanup(t);
+       return 0;
+}
+
 
 static int
 test_priority_directed(struct test *t)
@@ -630,7 +738,7 @@ burst_packets(struct test *t)
                        return -1;
                }
        }
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        /* Check stats for all NUM_PKTS arrived to sched core */
        struct test_event_dev_stats stats;
@@ -719,7 +827,7 @@ abuse_inflights(struct test *t)
        }
 
        /* schedule */
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        struct test_event_dev_stats stats;
 
@@ -814,8 +922,8 @@ xstats_tests(struct test *t)
        ret = rte_event_dev_xstats_names_get(evdev,
                                        RTE_EVENT_DEV_XSTATS_QUEUE,
                                        0, xstats_names, ids, XSTATS_MAX);
-       if (ret != 13) {
-               printf("%d: expected 13 stats, got return %d\n", __LINE__, ret);
+       if (ret != 17) {
+               printf("%d: expected 17 stats, got return %d\n", __LINE__, ret);
                return -1;
        }
 
@@ -831,8 +939,8 @@ xstats_tests(struct test *t)
        ret = rte_event_dev_xstats_get(evdev,
                                        RTE_EVENT_DEV_XSTATS_QUEUE,
                                        0, ids, values, ret);
-       if (ret != 13) {
-               printf("%d: expected 13 stats, got return %d\n", __LINE__, ret);
+       if (ret != 17) {
+               printf("%d: expected 17 stats, got return %d\n", __LINE__, ret);
                return -1;
        }
 
@@ -857,7 +965,7 @@ xstats_tests(struct test *t)
                }
        }
 
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        /* Device names / values */
        int num_stats = rte_event_dev_xstats_names_get(evdev,
@@ -996,7 +1104,11 @@ xstats_tests(struct test *t)
                3 /* inflights */,
                512 /* iq size */,
                0, 0, 0, 0, /* iq 0, 1, 2, 3 used */
-               0, 0, 1, 0, /* qid_0_port_X_pinned_flows */
+               /* QID-to-Port: pinned_flows, packets */
+               0, 0,
+               0, 0,
+               1, 3,
+               0, 0,
        };
        for (i = 0; (signed int)i < ret; i++) {
                if (queue_expected[i] != values[i]) {
@@ -1023,7 +1135,11 @@ xstats_tests(struct test *t)
                3 /* inflight */,
                512 /* iq size */,
                0, 0, 0, 0, /* 4 iq used */
-               0, 0, 1, 0, /* qid to port pinned flows */
+               /* QID-to-Port: pinned_flows, packets */
+               0, 0,
+               0, 0,
+               1, 0,
+               0, 0,
        };
 
        ret = rte_event_dev_xstats_get(evdev, RTE_EVENT_DEV_XSTATS_QUEUE, 0,
@@ -1124,7 +1240,7 @@ port_reconfig_credits(struct test *t)
        const uint32_t NUM_ITERS = 32;
        for (i = 0; i < NUM_ITERS; i++) {
                const struct rte_event_queue_conf conf = {
-                       .event_queue_cfg = RTE_EVENT_QUEUE_CFG_ATOMIC_ONLY,
+                       .schedule_type = RTE_SCHED_TYPE_ATOMIC,
                        .priority = RTE_EVENT_DEV_PRIORITY_NORMAL,
                        .nb_atomic_flows = 1024,
                        .nb_atomic_order_sequences = 1024,
@@ -1176,7 +1292,7 @@ port_reconfig_credits(struct test *t)
                        }
                }
 
-               rte_event_schedule(evdev);
+               rte_service_run_iter_on_app_lcore(t->service_id);
 
                struct rte_event ev[NPKTS];
                int deq = rte_event_dequeue_burst(evdev, t->port[0], ev,
@@ -1206,7 +1322,7 @@ port_single_lb_reconfig(struct test *t)
 
        static const struct rte_event_queue_conf conf_lb_atomic = {
                .priority = RTE_EVENT_DEV_PRIORITY_NORMAL,
-               .event_queue_cfg = RTE_EVENT_QUEUE_CFG_ATOMIC_ONLY,
+               .schedule_type = RTE_SCHED_TYPE_ATOMIC,
                .nb_atomic_flows = 1024,
                .nb_atomic_order_sequences = 1024,
        };
@@ -1218,8 +1334,6 @@ port_single_lb_reconfig(struct test *t)
        static const struct rte_event_queue_conf conf_single_link = {
                .priority = RTE_EVENT_DEV_PRIORITY_NORMAL,
                .event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_LINK,
-               .nb_atomic_flows = 1024,
-               .nb_atomic_order_sequences = 1024,
        };
        if (rte_event_queue_setup(evdev, 1, &conf_single_link) < 0) {
                printf("%d: error creating qid\n", __LINE__);
@@ -1404,7 +1518,7 @@ xstats_id_reset_tests(struct test *t)
                }
        }
 
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        static const char * const dev_names[] = {
                "dev_rx", "dev_tx", "dev_drop", "dev_sched_calls",
@@ -1571,7 +1685,7 @@ xstats_id_reset_tests(struct test *t)
                goto fail;
 
 /* num queue stats */
-#define NUM_Q_STATS 13
+#define NUM_Q_STATS 17
 /* queue offset from start of the devices whole xstats.
  * This will break every time we add a statistic to a device/port/queue
  */
@@ -1602,9 +1716,13 @@ xstats_id_reset_tests(struct test *t)
                "qid_0_iq_2_used",
                "qid_0_iq_3_used",
                "qid_0_port_0_pinned_flows",
+               "qid_0_port_0_packets",
                "qid_0_port_1_pinned_flows",
+               "qid_0_port_1_packets",
                "qid_0_port_2_pinned_flows",
+               "qid_0_port_2_packets",
                "qid_0_port_3_pinned_flows",
+               "qid_0_port_3_packets",
        };
        uint64_t queue_expected[] = {
                7, /* rx */
@@ -1616,10 +1734,11 @@ xstats_id_reset_tests(struct test *t)
                0, /* iq 1 used */
                0, /* iq 2 used */
                0, /* iq 3 used */
-               0, /* qid 0 port 0 pinned flows */
-               0, /* qid 0 port 1 pinned flows */
-               1, /* qid 0 port 2 pinned flows */
-               0, /* qid 0 port 4 pinned flows */
+               /* QID-to-Port: pinned_flows, packets */
+               0, 0,
+               0, 0,
+               1, 7,
+               0, 0,
        };
        uint64_t queue_expected_zero[] = {
                0, /* rx */
@@ -1631,12 +1750,14 @@ xstats_id_reset_tests(struct test *t)
                0, /* iq 1 used */
                0, /* iq 2 used */
                0, /* iq 3 used */
-               0, /* qid 0 port 0 pinned flows */
-               0, /* qid 0 port 1 pinned flows */
-               1, /* qid 0 port 2 pinned flows */
-               0, /* qid 0 port 4 pinned flows */
+               /* QID-to-Port: pinned_flows, packets */
+               0, 0,
+               0, 0,
+               1, 0,
+               0, 0,
        };
        if (RTE_DIM(queue_expected) != NUM_Q_STATS ||
+                       RTE_DIM(queue_expected_zero) != NUM_Q_STATS ||
                        RTE_DIM(queue_names) != NUM_Q_STATS) {
                printf("%d : queue array of wrong size\n", __LINE__);
                goto fail;
@@ -1655,9 +1776,9 @@ xstats_id_reset_tests(struct test *t)
                        failed = 1;
                }
                if (val != queue_expected[i]) {
-                       printf("%d: %s value incorrect, expected %"PRIu64
-                               " got %d\n", __LINE__, queue_names[i],
-                               queue_expected[i], id);
+                       printf("%d: %d: %s value , expected %"PRIu64
+                               " got %"PRIu64"\n", i, __LINE__,
+                               queue_names[i], queue_expected[i], val);
                        failed = 1;
                }
                /* reset to zero */
@@ -1699,7 +1820,7 @@ ordered_reconfigure(struct test *t)
        }
 
        const struct rte_event_queue_conf conf = {
-                       .event_queue_cfg = RTE_EVENT_QUEUE_CFG_ORDERED_ONLY,
+                       .schedule_type = RTE_SCHED_TYPE_ORDERED,
                        .priority = RTE_EVENT_DEV_PRIORITY_NORMAL,
                        .nb_atomic_flows = 1024,
                        .nb_atomic_order_sequences = 1024,
@@ -1746,7 +1867,7 @@ qid_priorities(struct test *t)
        for (i = 0; i < 3; i++) {
                /* Create QID */
                const struct rte_event_queue_conf conf = {
-                       .event_queue_cfg = RTE_EVENT_QUEUE_CFG_ATOMIC_ONLY,
+                       .schedule_type = RTE_SCHED_TYPE_ATOMIC,
                        /* increase priority (0 == highest), as we go */
                        .priority = RTE_EVENT_DEV_PRIORITY_NORMAL - i,
                        .nb_atomic_flows = 1024,
@@ -1788,7 +1909,7 @@ qid_priorities(struct test *t)
                }
        }
 
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        /* dequeue packets, verify priority was upheld */
        struct rte_event ev[32];
@@ -1869,7 +1990,7 @@ load_balancing(struct test *t)
                }
        }
 
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        struct test_event_dev_stats stats;
        err = test_event_dev_stats_get(evdev, &stats);
@@ -1969,7 +2090,7 @@ load_balancing_history(struct test *t)
        }
 
        /* call the scheduler */
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        /* Dequeue the flow 0 packet from port 1, so that we can then drop */
        struct rte_event ev;
@@ -1986,7 +2107,7 @@ load_balancing_history(struct test *t)
        rte_event_enqueue_burst(evdev, t->port[1], &release_ev, 1);
 
        /* call the scheduler */
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        /*
         * Set up the next set of flows, first a new flow to fill up
@@ -2019,7 +2140,7 @@ load_balancing_history(struct test *t)
        }
 
        /* schedule */
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        err = test_event_dev_stats_get(evdev, &stats);
        if (err) {
@@ -2063,7 +2184,7 @@ load_balancing_history(struct test *t)
                while (rte_event_dequeue_burst(evdev, i, &ev, 1, 0))
                        rte_event_enqueue_burst(evdev, i, &release_ev, 1);
        }
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        cleanup(t);
        return 0;
@@ -2129,7 +2250,7 @@ invalid_qid(struct test *t)
        }
 
        /* call the scheduler */
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        err = test_event_dev_stats_get(evdev, &stats);
        if (err) {
@@ -2214,7 +2335,7 @@ single_packet(struct test *t)
                return -1;
        }
 
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        err = test_event_dev_stats_get(evdev, &stats);
        if (err) {
@@ -2257,7 +2378,7 @@ single_packet(struct test *t)
                printf("%d: Failed to enqueue\n", __LINE__);
                return -1;
        }
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        err = test_event_dev_stats_get(evdev, &stats);
        if (stats.port_inflight[wrk_enq] != 0) {
@@ -2345,7 +2466,7 @@ inflight_counts(struct test *t)
        }
 
        /* schedule */
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        err = test_event_dev_stats_get(evdev, &stats);
        if (err) {
@@ -2401,7 +2522,7 @@ inflight_counts(struct test *t)
         * As the scheduler core decrements inflights, it needs to run to
         * process packets to act on the drop messages
         */
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        err = test_event_dev_stats_get(evdev, &stats);
        if (stats.port_inflight[p1] != 0) {
@@ -2436,7 +2557,7 @@ inflight_counts(struct test *t)
         * As the scheduler core decrements inflights, it needs to run to
         * process packets to act on the drop messages
         */
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        err = test_event_dev_stats_get(evdev, &stats);
        if (stats.port_inflight[p2] != 0) {
@@ -2463,7 +2584,7 @@ parallel_basic(struct test *t, int check_order)
        int i;
        uint32_t deq_pkts, j;
        struct rte_mbuf *mbufs[3];
-       struct rte_mbuf *mbufs_out[3];
+       struct rte_mbuf *mbufs_out[3] = { 0 };
        const uint32_t MAGIC_SEQN = 1234;
 
        /* Create instance with 4 ports */
@@ -2530,7 +2651,7 @@ parallel_basic(struct test *t, int check_order)
                }
        }
 
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        /* use extra slot to make logic in loops easier */
        struct rte_event deq_ev[w3_port + 1];
@@ -2557,7 +2678,7 @@ parallel_basic(struct test *t, int check_order)
                        return -1;
                }
        }
-       rte_event_schedule(evdev);
+       rte_service_run_iter_on_app_lcore(t->service_id);
 
        /* dequeue from the tx ports, we should get 3 packets */
        deq_pkts = rte_event_dequeue_burst(evdev, t->port[tx_port], deq_ev,
@@ -2600,6 +2721,325 @@ unordered_basic(struct test *t)
        return parallel_basic(t, 0);
 }
 
+static int
+holb(struct test *t) /* test to check we avoid basic head-of-line blocking */
+{
+       const struct rte_event new_ev = {
+                       .op = RTE_EVENT_OP_NEW
+                       /* all other fields zero */
+       };
+       struct rte_event ev = new_ev;
+       unsigned int rx_port = 0; /* port we get the first flow on */
+       char rx_port_used_stat[64];
+       char rx_port_free_stat[64];
+       char other_port_used_stat[64];
+
+       if (init(t, 1, 2) < 0 ||
+                       create_ports(t, 2) < 0 ||
+                       create_atomic_qids(t, 1) < 0) {
+               printf("%d: Error initializing device\n", __LINE__);
+               return -1;
+       }
+       int nb_links = rte_event_port_link(evdev, t->port[1], NULL, NULL, 0);
+       if (rte_event_port_link(evdev, t->port[0], NULL, NULL, 0) != 1 ||
+                       nb_links != 1) {
+               printf("%d: Error links queue to ports\n", __LINE__);
+               goto err;
+       }
+       if (rte_event_dev_start(evdev) < 0) {
+               printf("%d: Error with start call\n", __LINE__);
+               goto err;
+       }
+
+       /* send one packet and see where it goes, port 0 or 1 */
+       if (rte_event_enqueue_burst(evdev, t->port[0], &ev, 1) != 1) {
+               printf("%d: Error doing first enqueue\n", __LINE__);
+               goto err;
+       }
+       rte_service_run_iter_on_app_lcore(t->service_id);
+
+       if (rte_event_dev_xstats_by_name_get(evdev, "port_0_cq_ring_used", NULL)
+                       != 1)
+               rx_port = 1;
+
+       snprintf(rx_port_used_stat, sizeof(rx_port_used_stat),
+                       "port_%u_cq_ring_used", rx_port);
+       snprintf(rx_port_free_stat, sizeof(rx_port_free_stat),
+                       "port_%u_cq_ring_free", rx_port);
+       snprintf(other_port_used_stat, sizeof(other_port_used_stat),
+                       "port_%u_cq_ring_used", rx_port ^ 1);
+       if (rte_event_dev_xstats_by_name_get(evdev, rx_port_used_stat, NULL)
+                       != 1) {
+               printf("%d: Error, first event not scheduled\n", __LINE__);
+               goto err;
+       }
+
+       /* now fill up the rx port's queue with one flow to cause HOLB */
+       do {
+               ev = new_ev;
+               if (rte_event_enqueue_burst(evdev, t->port[0], &ev, 1) != 1) {
+                       printf("%d: Error with enqueue\n", __LINE__);
+                       goto err;
+               }
+               rte_service_run_iter_on_app_lcore(t->service_id);
+       } while (rte_event_dev_xstats_by_name_get(evdev,
+                               rx_port_free_stat, NULL) != 0);
+
+       /* one more packet, which needs to stay in IQ - i.e. HOLB */
+       ev = new_ev;
+       if (rte_event_enqueue_burst(evdev, t->port[0], &ev, 1) != 1) {
+               printf("%d: Error with enqueue\n", __LINE__);
+               goto err;
+       }
+       rte_service_run_iter_on_app_lcore(t->service_id);
+
+       /* check that the other port still has an empty CQ */
+       if (rte_event_dev_xstats_by_name_get(evdev, other_port_used_stat, NULL)
+                       != 0) {
+               printf("%d: Error, second port CQ is not empty\n", __LINE__);
+               goto err;
+       }
+       /* check IQ now has one packet */
+       if (rte_event_dev_xstats_by_name_get(evdev, "qid_0_iq_0_used", NULL)
+                       != 1) {
+               printf("%d: Error, QID does not have exactly 1 packet\n",
+                       __LINE__);
+               goto err;
+       }
+
+       /* send another flow, which should pass the other IQ entry */
+       ev = new_ev;
+       ev.flow_id = 1;
+       if (rte_event_enqueue_burst(evdev, t->port[0], &ev, 1) != 1) {
+               printf("%d: Error with enqueue\n", __LINE__);
+               goto err;
+       }
+       rte_service_run_iter_on_app_lcore(t->service_id);
+
+       if (rte_event_dev_xstats_by_name_get(evdev, other_port_used_stat, NULL)
+                       != 1) {
+               printf("%d: Error, second flow did not pass out first\n",
+                       __LINE__);
+               goto err;
+       }
+
+       if (rte_event_dev_xstats_by_name_get(evdev, "qid_0_iq_0_used", NULL)
+                       != 1) {
+               printf("%d: Error, QID does not have exactly 1 packet\n",
+                       __LINE__);
+               goto err;
+       }
+       cleanup(t);
+       return 0;
+err:
+       rte_event_dev_dump(evdev, stdout);
+       cleanup(t);
+       return -1;
+}
+
+static int
+worker_loopback_worker_fn(void *arg)
+{
+       struct test *t = arg;
+       uint8_t port = t->port[1];
+       int count = 0;
+       int enqd;
+
+       /*
+        * Takes packets from the input port and then loops them back through
+        * the Eventdev. 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_burst(evdev, port, ev,
+                               BURST_SIZE, 0);
+               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].op = RTE_EVENT_OP_FORWARD;
+                               enqd = rte_event_enqueue_burst(evdev, port,
+                                               &ev[i], 1);
+                               if (enqd != 1) {
+                                       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].op = RTE_EVENT_OP_FORWARD;
+                               enqd = rte_event_enqueue_burst(evdev, port,
+                                               &ev[i], 1);
+                               if (enqd != 1) {
+                                       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].op = RTE_EVENT_OP_RELEASE;
+                       enqd = rte_event_enqueue_burst(evdev, port, &ev[i], 1);
+                       if (enqd != 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 = 0;
+               do {
+                       m = rte_pktmbuf_alloc(t->mbuf_pool);
+               } while (m == NULL);
+
+               m->udata64 = 0;
+
+               struct rte_event ev = {
+                               .op = RTE_EVENT_OP_NEW,
+                               .queue_id = t->qid[0],
+                               .flow_id = (uintptr_t)m & 0xFFFF,
+                               .mbuf = m,
+               };
+
+               if (rte_event_enqueue_burst(evdev, port, &ev, 1) != 1) {
+                       while (rte_event_enqueue_burst(evdev, port, &ev, 1) !=
+                                       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 test_event_dev_stats stats;
+       uint64_t print_cycles = 0, cycles = 0;
+       uint64_t tx_pkts = 0;
+       int err;
+       int w_lcore, p_lcore;
+
+       if (init(t, 8, 2) < 0 ||
+                       create_atomic_qids(t, 8) < 0) {
+               printf("%d: Error initializing device\n", __LINE__);
+               return -1;
+       }
+
+       /* RX with low max events */
+       static struct rte_event_port_conf conf = {
+                       .dequeue_depth = 32,
+                       .enqueue_depth = 64,
+       };
+       /* beware: this cannot be initialized in the static above as it would
+        * only be initialized once - and this needs to be set for multiple runs
+        */
+       conf.new_event_threshold = 512;
+
+       if (rte_event_port_setup(evdev, 0, &conf) < 0) {
+               printf("Error setting up RX port\n");
+               return -1;
+       }
+       t->port[0] = 0;
+       /* TX with higher max events */
+       conf.new_event_threshold = 4096;
+       if (rte_event_port_setup(evdev, 1, &conf) < 0) {
+               printf("Error setting up TX port\n");
+               return -1;
+       }
+       t->port[1] = 1;
+
+       /* CQ mapping to QID */
+       err = rte_event_port_link(evdev, t->port[1], NULL, NULL, 0);
+       if (err != 8) { /* should have mapped all queues*/
+               printf("%d: error mapping port 2 to all qids\n", __LINE__);
+               return -1;
+       }
+
+       if (rte_event_dev_start(evdev) < 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_service_run_iter_on_app_lcore(t->service_id);
+
+               uint64_t new_cycles = rte_get_timer_cycles();
+
+               if (new_cycles - print_cycles > rte_get_timer_hz()) {
+                       test_event_dev_stats_get(evdev, &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) {
+                       test_event_dev_stats_get(evdev, &stats);
+                       if (stats.tx_pkts == tx_pkts) {
+                               rte_event_dev_dump(evdev, stdout);
+                               printf("Dumping xstats:\n");
+                               xstats_print();
+                               printf(
+                                       "%d: No schedules for seconds, deadlock\n",
+                                       __LINE__);
+                               return -1;
+                       }
+                       tx_pkts = stats.tx_pkts;
+                       cycles = new_cycles;
+               }
+       }
+       rte_service_run_iter_on_app_lcore(t->service_id);
+       /* ensure all completions are flushed */
+
+       rte_eal_mp_wait_lcore();
+
+       cleanup(t);
+       return 0;
+}
+
 static struct rte_mempool *eventdev_func_mempool;
 
 static int
@@ -2618,7 +3058,7 @@ test_sw_eventdev(void)
        if (evdev < 0) {
                printf("%d: Eventdev %s not found - creating.\n",
                                __LINE__, eventdev_name);
-               if (rte_eal_vdev_init(eventdev_name, NULL) < 0) {
+               if (rte_vdev_init(eventdev_name, NULL) < 0) {
                        printf("Error creating eventdev\n");
                        return -1;
                }
@@ -2629,6 +3069,14 @@ test_sw_eventdev(void)
                }
        }
 
+       if (rte_event_dev_service_id_get(evdev, &t->service_id) < 0) {
+               printf("Failed to get service ID for software event dev\n");
+               return -1;
+       }
+
+       rte_service_runstate_set(t->service_id, 1);
+       rte_service_set_runstate_mapped_check(t->service_id, 0);
+
        /* Only create mbuf pool once, reuse for each test run */
        if (!eventdev_func_mempool) {
                eventdev_func_mempool = rte_pktmbuf_pool_create(
@@ -2644,13 +3092,18 @@ test_sw_eventdev(void)
                }
        }
        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 Directed Forward Credit test...\n");
+       ret = test_directed_forward_credits(t);
+       if (ret != 0) {
+               printf("ERROR - Directed Forward Credit test FAILED.\n");
+               return ret;
+       }
        printf("*** Running Single Load Balanced Packet test...\n");
        ret = single_packet(t);
        if (ret != 0) {
@@ -2778,6 +3231,23 @@ test_sw_eventdev(void)
                printf("ERROR - Port Reconfig Credits Reset test FAILED.\n");
                return ret;
        }
+       printf("*** Running Head-of-line-blocking test...\n");
+       ret = holb(t);
+       if (ret != 0) {
+               printf("ERROR - Head-of-line-blocking 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 static eventdev_func_mempool, as it is re-used on re-runs