From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E4FD2A0547; Mon, 30 Aug 2021 18:00:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 81D6F410D8; Mon, 30 Aug 2021 18:00:38 +0200 (CEST) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by mails.dpdk.org (Postfix) with ESMTP id 56D7F40142 for ; Mon, 30 Aug 2021 18:00:37 +0200 (CEST) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id EBF6640008 for ; Mon, 30 Aug 2021 18:00:36 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id D815940007; Mon, 30 Aug 2021 18:00:36 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on bernadotte.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,AWL autolearn=disabled version=3.4.2 X-Spam-Score: -1.0 Received: from isengard.friendlyfire.se (h-62-63-215-114.A163.priv.bahnhof.se [62.63.215.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 5FC8840004; Mon, 30 Aug 2021 18:00:32 +0200 (CEST) From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= To: jerinj@marvell.com Cc: pbhagavatula@marvell.com, dev@dpdk.org, bogdan.tanasa@ericsson.com, =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Date: Mon, 30 Aug 2021 18:00:20 +0200 Message-Id: <20210830160020.3225-1-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <316159da-d56d-7a25-00e5-c2004f4e77f7@ericsson.com> References: <316159da-d56d-7a25-00e5-c2004f4e77f7@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [RFC] eventdev: uninline inline API functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Replace the inline functions in the eventdev user application API with regular non-inline API calls. This allows for a cleaner and more simple API/ABI, but might well also cause performance regressions. The purpose of this RFC patch is to allow for performance testing. The rte_eventdev struct declaration should be moved off the public API. Signed-off-by: Mattias Rönnblom --- drivers/net/octeontx/octeontx_ethdev.h | 1 + lib/eventdev/rte_event_eth_rx_adapter.h | 1 + lib/eventdev/rte_event_eth_tx_adapter.c | 31 ++++++++ lib/eventdev/rte_event_eth_tx_adapter.h | 35 ++------- lib/eventdev/rte_eventdev.c | 82 +++++++++++++++++++++ lib/eventdev/rte_eventdev.h | 94 +++---------------------- lib/eventdev/version.map | 4 ++ 7 files changed, 134 insertions(+), 114 deletions(-) diff --git a/drivers/net/octeontx/octeontx_ethdev.h b/drivers/net/octeontx/octeontx_ethdev.h index b73515de37..9402105fcf 100644 --- a/drivers/net/octeontx/octeontx_ethdev.h +++ b/drivers/net/octeontx/octeontx_ethdev.h @@ -9,6 +9,7 @@ #include #include +#include #include #include #include diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h index 182dd2e5dd..79f4822fb0 100644 --- a/lib/eventdev/rte_event_eth_rx_adapter.h +++ b/lib/eventdev/rte_event_eth_rx_adapter.h @@ -84,6 +84,7 @@ extern "C" { #include #include "rte_eventdev.h" +#include "eventdev_pmd.h" #define RTE_EVENT_ETH_RX_ADAPTER_MAX_INSTANCE 32 diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c index 18c0359db7..74f88e6147 100644 --- a/lib/eventdev/rte_event_eth_tx_adapter.c +++ b/lib/eventdev/rte_event_eth_tx_adapter.c @@ -1154,6 +1154,37 @@ rte_event_eth_tx_adapter_start(uint8_t id) return ret; } +uint16_t +rte_event_eth_tx_adapter_enqueue(uint8_t dev_id, + uint8_t port_id, + struct rte_event ev[], + 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); + else + return dev->txa_enqueue(dev->data->ports[port_id], ev, + nb_events); +} + int rte_event_eth_tx_adapter_stats_get(uint8_t id, struct rte_event_eth_tx_adapter_stats *stats) diff --git a/lib/eventdev/rte_event_eth_tx_adapter.h b/lib/eventdev/rte_event_eth_tx_adapter.h index 8c59547165..3cd65e8a09 100644 --- a/lib/eventdev/rte_event_eth_tx_adapter.h +++ b/lib/eventdev/rte_event_eth_tx_adapter.h @@ -79,6 +79,7 @@ extern "C" { #include #include "rte_eventdev.h" +#include "eventdev_pmd.h" /** * Adapter configuration structure @@ -348,36 +349,12 @@ rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id); * one or more events. This error code is only applicable to * closed systems. */ -static inline uint16_t +uint16_t rte_event_eth_tx_adapter_enqueue(uint8_t dev_id, - uint8_t port_id, - struct rte_event ev[], - 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); - else - return dev->txa_enqueue(dev->data->ports[port_id], ev, - nb_events); -} + uint8_t port_id, + struct rte_event ev[], + uint16_t nb_events, + const uint8_t flags); /** * Retrieve statistics for an adapter diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c index 594dd5e759..e2dad8a838 100644 --- a/lib/eventdev/rte_eventdev.c +++ b/lib/eventdev/rte_eventdev.c @@ -1119,6 +1119,65 @@ rte_event_port_links_get(uint8_t dev_id, uint8_t port_id, return count; } +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 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); + else + return fn(dev->data->ports[port_id], ev, nb_events); +} + +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); +} + +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_event_devices[dev_id]; + + return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events, + dev->enqueue_new_burst); +} + +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); +} + int rte_event_dequeue_timeout_ticks(uint8_t dev_id, uint64_t ns, uint64_t *timeout_ticks) @@ -1135,6 +1194,29 @@ rte_event_dequeue_timeout_ticks(uint8_t dev_id, uint64_t ns, return (*dev->dev_ops->timeout_ticks)(dev, ns, timeout_ticks); } +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_event_devices[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); + + return (*dev->dequeue_burst)(dev->data->ports[port_id], ev, nb_events, + timeout_ticks); +} + int rte_event_dev_service_id_get(uint8_t dev_id, uint32_t *service_id) { diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h index a9c496fb62..451e9fb0a0 100644 --- a/lib/eventdev/rte_eventdev.h +++ b/lib/eventdev/rte_eventdev.h @@ -1445,38 +1445,6 @@ struct rte_eventdev { void *reserved_ptrs[3]; /**< Reserved for future fields */ } __rte_cache_aligned; -extern struct rte_eventdev *rte_eventdevs; -/** @internal The pool of rte_eventdev structures. */ - -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 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); - else - return fn(dev->data->ports[port_id], ev, nb_events); -} - /** * Enqueue a burst of events objects or an event object supplied in *rte_event* * structure on an event device designated by its *dev_id* through the event @@ -1520,15 +1488,9 @@ __rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id, * closed systems. * @see rte_event_port_attr_get(), RTE_EVENT_PORT_ATTR_ENQ_DEPTH */ -static inline uint16_t +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); -} + const struct rte_event ev[], uint16_t nb_events); /** * Enqueue a burst of events objects of operation type *RTE_EVENT_OP_NEW* on @@ -1571,15 +1533,9 @@ rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id, * @see rte_event_port_attr_get(), RTE_EVENT_PORT_ATTR_ENQ_DEPTH * @see rte_event_enqueue_burst() */ -static inline uint16_t +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); -} + const struct rte_event ev[], uint16_t nb_events); /** * Enqueue a burst of events objects of operation type *RTE_EVENT_OP_FORWARD* @@ -1622,15 +1578,10 @@ rte_event_enqueue_new_burst(uint8_t dev_id, uint8_t port_id, * @see rte_event_port_attr_get(), RTE_EVENT_PORT_ATTR_ENQ_DEPTH * @see rte_event_enqueue_burst() */ -static inline uint16_t +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); -} + const struct rte_event ev[], + uint16_t nb_events); /** * Converts nanoseconds to *timeout_ticks* value for rte_event_dequeue_burst() @@ -1727,36 +1678,9 @@ rte_event_dequeue_timeout_ticks(uint8_t dev_id, uint64_t ns, * * @see rte_event_port_dequeue_depth() */ -static inline uint16_t +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); - else - return (*dev->dequeue_burst)( - dev->data->ports[port_id], ev, nb_events, - timeout_ticks); -} + uint16_t nb_events, uint64_t timeout_ticks); /** * Link multiple source event queues supplied in *queues* to the destination diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map index 88625621ec..8da79cbdc0 100644 --- a/lib/eventdev/version.map +++ b/lib/eventdev/version.map @@ -13,7 +13,11 @@ DPDK_22 { rte_event_crypto_adapter_stats_get; rte_event_crypto_adapter_stats_reset; rte_event_crypto_adapter_stop; + rte_event_enqueue_burst; + rte_event_enqueue_new_burst; + rte_event_enqueue_forward_burst; rte_event_dequeue_timeout_ticks; + rte_event_dequeue_burst; rte_event_dev_attr_get; rte_event_dev_close; rte_event_dev_configure; -- 2.17.1