From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4EF02A0597; Wed, 8 Apr 2020 19:57:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1A9431C1A9; Wed, 8 Apr 2020 19:57:24 +0200 (CEST) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by dpdk.org (Postfix) with ESMTP id 7FA551C1C0 for ; Wed, 8 Apr 2020 19:57:22 +0200 (CEST) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 0FCED40026 for ; Wed, 8 Apr 2020 19:57:22 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id EFEE040022; Wed, 8 Apr 2020 19:57:21 +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=-0.8 required=5.0 tests=ALL_TRUSTED,AWL autolearn=disabled version=3.4.2 X-Spam-Score: -0.8 Received: from isengard.friendlyfire.se (host-95-205-2-251.mobileonline.telia.com [95.205.2.251]) (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 9088740015; Wed, 8 Apr 2020 19:57:18 +0200 (CEST) From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= To: dev@dpdk.org, Jerin Jacob Cc: Gage Eads , Bruce Richardson , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Date: Wed, 8 Apr 2020 19:56:53 +0200 Message-Id: <20200408175655.18879-1-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.20.1 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 1/3] eventdev: allow for event devices requiring maintenance X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Extend Eventdev API to allow for event devices which require various forms of internal processing to happen, even when events are not enqueued to or dequeued from a port. Signed-off-by: Mattias Rönnblom --- lib/librte_eventdev/rte_eventdev.h | 65 ++++++++++++++++++++++++++ lib/librte_eventdev/rte_eventdev_pmd.h | 14 ++++++ 2 files changed, 79 insertions(+) diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h index 226f352ad..d69150792 100644 --- a/lib/librte_eventdev/rte_eventdev.h +++ b/lib/librte_eventdev/rte_eventdev.h @@ -289,6 +289,15 @@ struct rte_event; * single queue to each port or map a single queue to many port. */ +#define RTE_EVENT_DEV_CAP_REQUIRES_MAINT (1ULL << 9) +/**< Event device requires calls to rte_event_maintain() during + * periods when neither rte_event_dequeue_burst() nor + * rte_event_enqueue_burst() are called on a port. This will allow the + * event device to perform internal processing, such as flushing + * buffered events, return credits to a global pool, or process + * signaling related to load balancing. + */ + /* Event device priority levels */ #define RTE_EVENT_DEV_PRIORITY_HIGHEST 0 /**< Highest priority expressed across eventdev subsystem @@ -1226,6 +1235,9 @@ typedef uint16_t (*event_dequeue_burst_t)(void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); /**< @internal Dequeue burst of events from port of a device */ +typedef void (*maintain_t)(void *port); +/**< @internal Maintains a port */ + typedef uint16_t (*event_tx_adapter_enqueue)(void *port, struct rte_event ev[], uint16_t nb_events); /**< @internal Enqueue burst of events on port of a device */ @@ -1301,6 +1313,8 @@ struct rte_eventdev { /**< Pointer to PMD dequeue function. */ event_dequeue_burst_t dequeue_burst; /**< Pointer to PMD dequeue burst function. */ + event_maintain_t maintain; + /**< Maintains an event port. */ event_tx_adapter_enqueue_same_dest txa_enqueue_same_dest; /**< Pointer to PMD eth Tx adapter burst enqueue function with * events destined to same Eth port & Tx queue. @@ -1634,6 +1648,57 @@ rte_event_dequeue_burst(uint8_t dev_id, uint8_t port_id, struct rte_event ev[], timeout_ticks); } +/** + * Maintain an event device. + * + * This function is only relevant for event devices which has the + * RTE_EVENT_DEV_CAP_REQUIRES_MAINT flag set. Such devices requires + * the application to call rte_event_maintain() on a port during periods + * which it is neither enqueuing nor dequeuing events from this + * port. No port may be left unattended. + * + * An event device's rte_event_maintain() is a low overhead function. In + * situations when rte_event_maintain() must be called, the application + * should do so often. + * + * rte_event_maintain() may be called on event devices which hasn't + * set RTE_EVENT_DEV_CAP_REQUIRES_MAINT flag, in which case it is a + * no-operation. + * + * @param dev_id + * The identifier of the device. + * @param port_id + * The identifier of the event port. + * @return + * - 0 on success. + * - -ENOTSUP if the device doesn't have RTE_EVENT_DEV_CAP_REQUIRES_MAINT set + * - -EINVAL if *dev_id* or *port_id* is invalid + * + * @see RTE_EVENT_DEV_CAP_REQUIRES_MAINT + */ +static inline void +rte_event_maintain(uint8_t dev_id, uint8_t port_id) +{ + struct rte_eventdev *dev = &rte_eventdevs[dev_id]; + event_maintain_t fn; + +#ifdef RTE_LIBRTE_EVENTDEV_DEBUG + if (dev_id >= RTE_EVENT_MAX_DEVS || !rte_eventdevs[dev_id].attached) { + rte_errno = EINVAL; + return; + } + + if (port_id >= dev->data->nb_ports) { + rte_errno = EINVAL; + return; + } +#endif + fn = *dev->maintain; + + if (fn != NULL) + fn(dev->data->ports[port_id]); +} + /** * Link multiple source event queues supplied in *queues* to the destination * event port designated by its *port_id* with associated service priority diff --git a/lib/librte_eventdev/rte_eventdev_pmd.h b/lib/librte_eventdev/rte_eventdev_pmd.h index d118b9e5b..327e4a2ac 100644 --- a/lib/librte_eventdev/rte_eventdev_pmd.h +++ b/lib/librte_eventdev/rte_eventdev_pmd.h @@ -364,6 +364,20 @@ typedef int (*eventdev_port_unlinks_in_progress_t)(struct rte_eventdev *dev, typedef int (*eventdev_dequeue_timeout_ticks_t)(struct rte_eventdev *dev, uint64_t ns, uint64_t *timeout_ticks); +/** + * Maintains an event port for RTE_EVENT_DEV_CAP_REQUIRES_MAINT devices. + * + * @param dev + * Event device pointer + * @param port_id + * Event port index + * + * @return + * Returns 0 on success. + * + */ +typedef int (*eventdev_maintain_t)(struct rte_eventdev *dev, uint8_t port_id); + /** * Dump internal information * -- 2.20.1