From: Pavan Nikhilesh <pbhagavat...@marvell.com>

Use new driver interface for the fastpath enqueue/dequeue inline
functions.

Signed-off-by: Pavan Nikhilesh <pbhagavat...@marvell.com>
---
 lib/eventdev/rte_event_crypto_adapter.h | 13 +-----
 lib/eventdev/rte_event_eth_tx_adapter.h | 22 ++-------
 lib/eventdev/rte_eventdev.h             | 61 +++++++------------------
 3 files changed, 22 insertions(+), 74 deletions(-)

diff --git a/lib/eventdev/rte_event_crypto_adapter.h 
b/lib/eventdev/rte_event_crypto_adapter.h
index 431d05b6ed..a91585a369 100644
--- a/lib/eventdev/rte_event_crypto_adapter.h
+++ b/lib/eventdev/rte_event_crypto_adapter.h
@@ -568,20 +568,11 @@ rte_event_crypto_adapter_enqueue(uint8_t dev_id,
                                struct rte_event ev[],
                                uint16_t nb_events)
 {
-       const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
-
-#ifdef RTE_LIBRTE_EVENTDEV_DEBUG
-       RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
-
-       if (port_id >= dev->data->nb_ports) {
-               rte_errno = EINVAL;
-               return 0;
-       }
-#endif
        rte_eventdev_trace_crypto_adapter_enqueue(dev_id, port_id, ev,
                nb_events);
 
-       return dev->ca_enqueue(dev->data->ports[port_id], ev, nb_events);
+       return rte_eventdev_api[dev_id].ca_enqueue(dev_id, port_id, ev,
+                                                  nb_events);
 }
 
 #ifdef __cplusplus
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.h 
b/lib/eventdev/rte_event_eth_tx_adapter.h
index 8c59547165..e3e78a5616 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.h
+++ b/lib/eventdev/rte_event_eth_tx_adapter.h
@@ -355,28 +355,14 @@ rte_event_eth_tx_adapter_enqueue(uint8_t dev_id,
                                uint16_t nb_events,
                                const uint8_t flags)
 {
-       const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
-
-#ifdef RTE_LIBRTE_EVENTDEV_DEBUG
-       if (dev_id >= RTE_EVENT_MAX_DEVS ||
-               !rte_eventdevs[dev_id].attached) {
-               rte_errno = EINVAL;
-               return 0;
-       }
-
-       if (port_id >= dev->data->nb_ports) {
-               rte_errno = EINVAL;
-               return 0;
-       }
-#endif
        rte_eventdev_trace_eth_tx_adapter_enqueue(dev_id, port_id, ev,
                nb_events, flags);
        if (flags)
-               return dev->txa_enqueue_same_dest(dev->data->ports[port_id],
-                                                 ev, nb_events);
+               return rte_eventdev_api[dev_id].txa_enqueue_same_dest(
+                       dev_id, port_id, ev, nb_events);
        else
-               return dev->txa_enqueue(dev->data->ports[port_id], ev,
-                                       nb_events);
+               return rte_eventdev_api[dev_id].txa_enqueue(dev_id, port_id, ev,
+                                                           nb_events);
 }
 
 /**
diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h
index 1b11d4576d..7378597846 100644
--- a/lib/eventdev/rte_eventdev.h
+++ b/lib/eventdev/rte_eventdev.h
@@ -1745,30 +1745,17 @@ rte_event_vector_pool_create(const char *name, unsigned 
int n,
 static __rte_always_inline uint16_t
 __rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id,
                          const struct rte_event ev[], uint16_t nb_events,
-                         const event_enqueue_burst_t fn)
+                         const rte_event_enqueue_burst_t fn)
 {
-       const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
-
-#ifdef RTE_LIBRTE_EVENTDEV_DEBUG
-       if (dev_id >= RTE_EVENT_MAX_DEVS || !rte_eventdevs[dev_id].attached) {
-               rte_errno = EINVAL;
-               return 0;
-       }
-
-       if (port_id >= dev->data->nb_ports) {
-               rte_errno = EINVAL;
-               return 0;
-       }
-#endif
        rte_eventdev_trace_enq_burst(dev_id, port_id, ev, nb_events, fn);
        /*
         * Allow zero cost non burst mode routine invocation if application
         * requests nb_events as const one
         */
        if (nb_events == 1)
-               return (*dev->enqueue)(dev->data->ports[port_id], ev);
+               return rte_eventdev_api[dev_id].enqueue(dev_id, port_id, ev);
        else
-               return fn(dev->data->ports[port_id], ev, nb_events);
+               return fn(dev_id, port_id, ev, nb_events);
 }
 
 /**
@@ -1818,10 +1805,9 @@ static inline uint16_t
 rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id,
                        const struct rte_event ev[], uint16_t nb_events)
 {
-       const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
-
-       return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events,
-                                        dev->enqueue_burst);
+       return __rte_event_enqueue_burst(
+               dev_id, port_id, ev, nb_events,
+               rte_eventdev_api[dev_id].enqueue_burst);
 }
 
 /**
@@ -1869,10 +1855,9 @@ static inline uint16_t
 rte_event_enqueue_new_burst(uint8_t dev_id, uint8_t port_id,
                            const struct rte_event ev[], uint16_t nb_events)
 {
-       const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
-
-       return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events,
-                                        dev->enqueue_new_burst);
+       return __rte_event_enqueue_burst(
+               dev_id, port_id, ev, nb_events,
+               rte_eventdev_api[dev_id].enqueue_new_burst);
 }
 
 /**
@@ -1920,10 +1905,9 @@ static inline uint16_t
 rte_event_enqueue_forward_burst(uint8_t dev_id, uint8_t port_id,
                                const struct rte_event ev[], uint16_t nb_events)
 {
-       const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
-
-       return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events,
-                                        dev->enqueue_forward_burst);
+       return __rte_event_enqueue_burst(
+               dev_id, port_id, ev, nb_events,
+               rte_eventdev_api[dev_id].enqueue_forward_burst);
 }
 
 /**
@@ -1996,30 +1980,17 @@ static inline uint16_t
 rte_event_dequeue_burst(uint8_t dev_id, uint8_t port_id, struct rte_event ev[],
                        uint16_t nb_events, uint64_t timeout_ticks)
 {
-       struct rte_eventdev *dev = &rte_eventdevs[dev_id];
-
-#ifdef RTE_LIBRTE_EVENTDEV_DEBUG
-       if (dev_id >= RTE_EVENT_MAX_DEVS || !rte_eventdevs[dev_id].attached) {
-               rte_errno = EINVAL;
-               return 0;
-       }
-
-       if (port_id >= dev->data->nb_ports) {
-               rte_errno = EINVAL;
-               return 0;
-       }
-#endif
        rte_eventdev_trace_deq_burst(dev_id, port_id, ev, nb_events);
        /*
         * Allow zero cost non burst mode routine invocation if application
         * requests nb_events as const one
         */
        if (nb_events == 1)
-               return (*dev->dequeue)(dev->data->ports[port_id], ev,
-                                      timeout_ticks);
+               return rte_eventdev_api[dev_id].dequeue(dev_id, port_id, ev,
+                                                       timeout_ticks);
        else
-               return (*dev->dequeue_burst)(dev->data->ports[port_id], ev,
-                                            nb_events, timeout_ticks);
+               return rte_eventdev_api[dev_id].dequeue_burst(
+                       dev_id, port_id, ev, nb_events, timeout_ticks);
 }
 
 #ifdef __cplusplus
-- 
2.17.1

Reply via email to