eventdev: introduce specialized enqueue new op variant
[dpdk.git] / drivers / event / sw / sw_evdev.c
index 8f5192d..951ad1b 100644 (file)
@@ -30,6 +30,7 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <inttypes.h>
 #include <string.h>
 
 #include <rte_vdev.h>
@@ -90,7 +91,8 @@ sw_port_link(struct rte_eventdev *dev, void *port, const uint8_t queues[],
                } else if (q->type == RTE_SCHED_TYPE_ORDERED) {
                        p->num_ordered_qids++;
                        p->num_qids_mapped++;
-               } else if (q->type == RTE_SCHED_TYPE_ATOMIC) {
+               } else if (q->type == RTE_SCHED_TYPE_ATOMIC ||
+                               q->type == RTE_SCHED_TYPE_PARALLEL) {
                        p->num_qids_mapped++;
                }
 
@@ -435,6 +437,7 @@ sw_info_get(struct rte_eventdev *dev, struct rte_event_dev_info *info)
                        .max_event_port_enqueue_depth = MAX_SW_PROD_Q_DEPTH,
                        .max_num_events = SW_INFLIGHT_EVENTS_TOTAL,
                        .event_dev_cap = (RTE_EVENT_DEV_CAP_QUEUE_QOS |
+                                       RTE_EVENT_DEV_CAP_BURST_MODE |
                                        RTE_EVENT_DEV_CAP_EVENT_QOS),
        };
 
@@ -559,12 +562,13 @@ sw_dump(struct rte_eventdev *dev, FILE *f)
                                inflights += qid->fids[flow].pcount;
                        }
 
-               uint32_t cq;
-               fprintf(f, "\tInflights: %u\tFlows pinned per port: ",
-                               inflights);
-               for (cq = 0; cq < sw->port_count; cq++)
-                       fprintf(f, "%d ", affinities_per_port[cq]);
-               fprintf(f, "\n");
+               uint32_t port;
+               fprintf(f, "\tPer Port Stats:\n");
+               for (port = 0; port < sw->port_count; port++) {
+                       fprintf(f, "\t  Port %d: Pkts: %"PRIu64, port,
+                                       qid->to_port[port]);
+                       fprintf(f, "\tFlows: %d\n", affinities_per_port[port]);
+               }
 
                uint32_t iq;
                uint32_t iq_printed = 0;
@@ -624,6 +628,9 @@ sw_start(struct rte_eventdev *dev)
                }
        }
 
+       if (sw_xstats_init(sw) < 0)
+               return -EINVAL;
+
        rte_smp_wmb();
        sw->started = 1;
 
@@ -634,6 +641,7 @@ static void
 sw_stop(struct rte_eventdev *dev)
 {
        struct sw_evdev *sw = sw_pmd_priv(dev);
+       sw_xstats_uninit(sw);
        sw->started = 0;
        rte_smp_wmb();
 }
@@ -692,7 +700,7 @@ set_credit_quanta(const char *key __rte_unused, const char *value, void *opaque)
 }
 
 static int
-sw_probe(const char *name, const char *params)
+sw_probe(struct rte_vdev_device *vdev)
 {
        static const struct rte_eventdev_ops evdev_sw_ops = {
                        .dev_configure = sw_dev_configure,
@@ -710,6 +718,11 @@ sw_probe(const char *name, const char *params)
                        .port_release = sw_port_release,
                        .port_link = sw_port_link,
                        .port_unlink = sw_port_unlink,
+
+                       .xstats_get = sw_xstats_get,
+                       .xstats_get_names = sw_xstats_get_names,
+                       .xstats_get_by_name = sw_xstats_get_by_name,
+                       .xstats_reset = sw_xstats_reset,
        };
 
        static const char *const args[] = {
@@ -718,12 +731,16 @@ sw_probe(const char *name, const char *params)
                CREDIT_QUANTA_ARG,
                NULL
        };
+       const char *name;
+       const char *params;
        struct rte_eventdev *dev;
        struct sw_evdev *sw;
        int socket_id = rte_socket_id();
        int sched_quanta  = SW_DEFAULT_SCHED_QUANTA;
        int credit_quanta = SW_DEFAULT_CREDIT_QUANTA;
 
+       name = rte_vdev_device_name(vdev);
+       params = rte_vdev_device_args(vdev);
        if (params != NULL && params[0] != '\0') {
                struct rte_kvargs *kvlist = rte_kvargs_parse(params, args);
 
@@ -779,6 +796,7 @@ sw_probe(const char *name, const char *params)
        dev->dev_ops = &evdev_sw_ops;
        dev->enqueue = sw_event_enqueue;
        dev->enqueue_burst = sw_event_enqueue_burst;
+       dev->enqueue_new_burst = sw_event_enqueue_burst;
        dev->dequeue = sw_event_dequeue;
        dev->dequeue_burst = sw_event_dequeue_burst;
        dev->schedule = sw_event_schedule;
@@ -797,8 +815,11 @@ sw_probe(const char *name, const char *params)
 }
 
 static int
-sw_remove(const char *name)
+sw_remove(struct rte_vdev_device *vdev)
 {
+       const char *name;
+
+       name = rte_vdev_device_name(vdev);
        if (name == NULL)
                return -EINVAL;