From patchwork Mon Aug 2 16:14:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 96549 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2A127A0C41; Mon, 2 Aug 2021 18:15:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A702C41178; Mon, 2 Aug 2021 18:15:09 +0200 (CEST) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by mails.dpdk.org (Postfix) with ESMTP id 5E78D41147 for ; Mon, 2 Aug 2021 18:15:07 +0200 (CEST) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 163124001C for ; Mon, 2 Aug 2021 18:15:06 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id E99934000A; Mon, 2 Aug 2021 18:15:05 +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 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 3593240008; Mon, 2 Aug 2021 18:15:05 +0200 (CEST) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: jerinj@marvell.com Cc: dev@dpdk.org, =?utf-8?q?Mattias_R=C3=B6nnblom?= , Richard Eklycke , Liron Himi Date: Mon, 2 Aug 2021 18:14:59 +0200 Message-Id: <20210802161501.155797-1-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <2e645dd4-cb0a-d734-f570-5de7e6c58983@ericsson.com> References: <2e645dd4-cb0a-d734-f570-5de7e6c58983@ericsson.com> MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [RFC v2 1/3] eventdev: allow for event devices requiring maintenance 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" 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. RFC v2: - Change rte_event_maintain() return type to be consistent with the documentation. - Remove unused typedef from eventdev_pmd.h. Signed-off-by: Mattias Rönnblom Tested-by: Richard Eklycke Tested-by: Liron Himi --- lib/eventdev/rte_eventdev.h | 62 +++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h index a9c496fb62..2c17d9272e 100644 --- a/lib/eventdev/rte_eventdev.h +++ b/lib/eventdev/rte_eventdev.h @@ -299,6 +299,15 @@ struct rte_event; * the content of this field is implementation dependent. */ +#define RTE_EVENT_DEV_CAP_REQUIRES_MAINT (1ULL << 10) +/**< 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 @@ -1342,6 +1351,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 (*event_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 */ @@ -1421,6 +1433,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. @@ -1758,6 +1772,54 @@ 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 + * successful no-operation. + * + * @param dev_id + * The identifier of the device. + * @param port_id + * The identifier of the event port. + * @return + * - 0 on success. + * - -EINVAL if *dev_id* or *port_id* is invalid + * + * @see RTE_EVENT_DEV_CAP_REQUIRES_MAINT + */ +static inline int +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) + return -EINVAL; + + if (port_id >= dev->data->nb_ports) + return -EINVAL; +#endif + fn = *dev->maintain; + + if (fn != NULL) + fn(dev->data->ports[port_id]); + + return 0; +} + /** * Link multiple source event queues supplied in *queues* to the destination * event port designated by its *port_id* with associated service priority