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 45684A0548; Mon, 1 Nov 2021 19:40:32 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 12C2E410E8; Mon, 1 Nov 2021 19:40:32 +0100 (CET) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40079.outbound.protection.outlook.com [40.107.4.79]) by mails.dpdk.org (Postfix) with ESMTP id 006AA40E28 for ; Mon, 1 Nov 2021 19:40:29 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DidJyJNflvZHQ7nhzzwc6R2Zr4boWNMwr6ReUfYBN/Dw59vz/aOmaKO21lDnoSgRj/FqQMsyfvlZoqbm5QFajfmunhindhO5tSznPwgfocoewb4MwFMmI4jBjY+aAC0or6+/3W9Q8n87DZXd3CXxkcS0atWdr7OZ4Ik0sOS4A/TPsQ6w8B3BH2MOJtWnATQk2RrgU18+aGRrZe2wqfPsSSGh96ssTlFSZbplcfTwg6fvsEwXFkCDU4fkxpK0PZzOKomOZOz8epIGH6nhqMCjhUiBDtdXZX75SsWllisy95LB6YCHF2rYyC7Jr/BDa8sMEx+Yoa0URmGReiH3ufXOGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=H1pvVw5Nmc8jqXYSkPsHN80/ZWjdoxrt+0NcItdtVzI=; b=RF1rA+0lGcalNCktt+nfHqMkB9qPzX3zSNDpOMgdIqi+D5R7wkyqFtqU3LSHnpdFvzNdNOxPxJDxujpLv1nsGWHyCaZFzE9TrCblMvgOf8dGYDL8qk5mIywg8lZVnuXE1z/pQiFEuixgRc5B9g9/R3gJj/sWARRpXKwhGNwqUG3jxOKijXWLle53IiPs3A8EpOigXSsrytwhTE8hI+xQD5s0WGrtxIcPeep8R35VldrsfjwUW+CZmeiNPAx4PB9TYNh+dvJCHLr+gkJx0Itk84FQI1hZMffSZouDDFfbW7ibLzzaLMp2HgXW0Jni0OiEb1xfpL1/rBka9giVTRKkYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=dpdk.org smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=H1pvVw5Nmc8jqXYSkPsHN80/ZWjdoxrt+0NcItdtVzI=; b=c34QDJsjkRP4mZD6ZZiRFO660urbuMGVsidIwvf+/dDUn1zYhfjZR2QHxX+MRlOY099G+J0fs7BPeAtb6vsOpc8+CCYXYqPRf/iYpqIyjslyfilh7rOwcQPLo6bt3ax09to8aDHUZT9IcLWtzfJGN6T8sdsUQ3y71IliIRb/rcQ= Received: from SV0P279CA0033.NORP279.PROD.OUTLOOK.COM (2603:10a6:f10:12::20) by AS8PR07MB7702.eurprd07.prod.outlook.com (2603:10a6:20b:252::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.4; Mon, 1 Nov 2021 18:40:28 +0000 Received: from HE1EUR02FT028.eop-EUR02.prod.protection.outlook.com (2603:10a6:f10:12:cafe::d6) by SV0P279CA0033.outlook.office365.com (2603:10a6:f10:12::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.15 via Frontend Transport; Mon, 1 Nov 2021 18:40:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; Received: from oa.msg.ericsson.com (192.176.1.74) by HE1EUR02FT028.mail.protection.outlook.com (10.152.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.4649.14 via Frontend Transport; Mon, 1 Nov 2021 18:40:27 +0000 Received: from ESESSMB501.ericsson.se (153.88.183.162) by ESESBMR506.ericsson.se (153.88.183.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Mon, 1 Nov 2021 19:40:27 +0100 Received: from seliiuapp00218.seli.gic.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.189) with Microsoft SMTP Server id 15.1.2242.12 via Frontend Transport; Mon, 1 Nov 2021 19:40:27 +0100 Received: from localhost.localdomain (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliiuapp00218.seli.gic.ericsson.se (Postfix) with ESMTP id 0C20F6014A; Mon, 1 Nov 2021 19:40:27 +0100 (CET) From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= To: , , , CC: , , , , , , , , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Date: Mon, 1 Nov 2021 19:40:14 +0100 Message-ID: <20211101184016.8073-1-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <3a6d30ca-3335-ee06-c0a9-8f2b0ade2c40@ericsson.com> References: <3a6d30ca-3335-ee06-c0a9-8f2b0ade2c40@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7d2bfe22-4f5c-46b7-e049-08d99d67132b X-MS-TrafficTypeDiagnostic: AS8PR07MB7702: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W0F5KIEV4dm5qwMfxJmdPOvTDWpbKRVQF9z82uF8gZhQjRQiWFJM85YESubrcaTJxgZAS5OE/iuwysJlOQxUGsXtJQkYn9Z5prfLa8Oa4EiMw71RJ5m1X1o3qnV8Y8rtVLuGlsvJ80Ez6Ax1hU6g6oWtAS4CV+LsJ5DsDiN6Q0nfuVHM/LApPyE3coeYABChYYbI8Nktqm2LetMf8pkxjNFaYoJMzW19VBAlMwNen1pFxppbzeBEpEOm2udcuVZurST15MaBbqCEwJlv2v/Lr5gPBsrvgYtlVvSzuosLAYYy8RF6tGFu0OKqtmlKunyOpyNF/HduB0ubvnrTiu1SlgeqBTVjz7DaxT4gi95BQbs8WYVWn8anqOiTvuUGg/hXUT5CdcpxUw/ro0VirohiV6A9MMSZR4XMbtCwWmdr9Zrio+SYSC2m0O12k+gbC6tmb4a61tqVIUPRvGq3cYfEzarYLjw3j0tTuoDphZxOi/9wAyl4/HY5N4sgZWHjXihSxsxHSN7GS5yg4hYboIn0SKZr0kZalhZVgS4vKzo8A1rxKCcK5i1lhOIkmoZc3yGxml4jZS92kU+HfoHtADIy5ALKdT2W2FsFQfbrV12VmD5lyEJd6+GG0zlwLk4kdt5l9rVJzBmke+VRTCnuRYQ6L7i7H+BbKo/3tPNifiEbC/0fKFe8yXFSDj7B11WJ434S+FbPKJ5SmS/cX/+/TRLNzw== X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(1076003)(8676002)(4326008)(36860700001)(70586007)(70206006)(336012)(5660300002)(508600001)(86362001)(2616005)(6666004)(186003)(26005)(66574015)(82960400001)(316002)(83380400001)(54906003)(36756003)(110136005)(2906002)(7416002)(8936002)(356005)(107886003)(47076005)(6266002)(7636003)(82310400003); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2021 18:40:27.8220 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7d2bfe22-4f5c-46b7-e049-08d99d67132b X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-AuthSource: HE1EUR02FT028.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7702 Subject: [dpdk-dev] [PATCH v3 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. PATCH v3: - Introduced 'op' parameter to rte_event_maintain(), to allow for forcing an immediate flush of buffered events (and potentially other future maintenance-related operations). - Return -EINVAL in case rte_event_maintain() is passed invalid arguments. Do not set rte_errno. PATCH v2: - Mark rte_event_maintain() experimental. - Make clear it's the thread that owns the port that needs to call rte_event_maintain(). - Make clear rte_event_maintain() may be called also during periods when enqueue/dequeue operations *are* performed. PATCH v1: - Adapt to the move of fastpath function pointers out of rte_eventdev struct - Attempt to clarify how often the application is expected to call rte_event_maintain() - Add trace point 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/eventdev_pmd.h | 2 + lib/eventdev/eventdev_private.c | 9 ++++ lib/eventdev/eventdev_trace_points.c | 3 ++ lib/eventdev/rte_eventdev.h | 79 ++++++++++++++++++++++++++++ lib/eventdev/rte_eventdev_core.h | 5 ++ lib/eventdev/rte_eventdev_trace_fp.h | 8 +++ 6 files changed, 106 insertions(+) diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h index d009e24309..82a5c4db33 100644 --- a/lib/eventdev/eventdev_pmd.h +++ b/lib/eventdev/eventdev_pmd.h @@ -164,6 +164,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; + /**< Pointer to PMD port maintenance function. */ event_tx_adapter_enqueue_t txa_enqueue_same_dest; /**< Pointer to PMD eth Tx adapter burst enqueue function with * events destined to same Eth port & Tx queue. diff --git a/lib/eventdev/eventdev_private.c b/lib/eventdev/eventdev_private.c index 9084833847..1d3d9d357e 100644 --- a/lib/eventdev/eventdev_private.c +++ b/lib/eventdev/eventdev_private.c @@ -44,6 +44,13 @@ dummy_event_dequeue_burst(__rte_unused void *port, return 0; } +static void +dummy_event_maintain(__rte_unused void *port, __rte_unused int op) +{ + RTE_EDEV_LOG_ERR( + "maintenance requested for unconfigured event device"); +} + static uint16_t dummy_event_tx_adapter_enqueue(__rte_unused void *port, __rte_unused struct rte_event ev[], @@ -85,6 +92,7 @@ event_dev_fp_ops_reset(struct rte_event_fp_ops *fp_op) .enqueue_forward_burst = dummy_event_enqueue_burst, .dequeue = dummy_event_dequeue, .dequeue_burst = dummy_event_dequeue_burst, + .maintain = dummy_event_maintain, .txa_enqueue = dummy_event_tx_adapter_enqueue, .txa_enqueue_same_dest = dummy_event_tx_adapter_enqueue_same_dest, @@ -105,6 +113,7 @@ event_dev_fp_ops_set(struct rte_event_fp_ops *fp_op, fp_op->enqueue_forward_burst = dev->enqueue_forward_burst; fp_op->dequeue = dev->dequeue; fp_op->dequeue_burst = dev->dequeue_burst; + fp_op->maintain = dev->maintain; fp_op->txa_enqueue = dev->txa_enqueue; fp_op->txa_enqueue_same_dest = dev->txa_enqueue_same_dest; fp_op->ca_enqueue = dev->ca_enqueue; diff --git a/lib/eventdev/eventdev_trace_points.c b/lib/eventdev/eventdev_trace_points.c index 237d9383fd..de6b1f4417 100644 --- a/lib/eventdev/eventdev_trace_points.c +++ b/lib/eventdev/eventdev_trace_points.c @@ -37,6 +37,9 @@ RTE_TRACE_POINT_REGISTER(rte_eventdev_trace_enq_burst, RTE_TRACE_POINT_REGISTER(rte_eventdev_trace_deq_burst, lib.eventdev.deq.burst) +RTE_TRACE_POINT_REGISTER(rte_eventdev_trace_maintain, + lib.eventdev.maintain) + /* Eventdev Rx adapter trace points */ RTE_TRACE_POINT_REGISTER(rte_eventdev_trace_eth_rx_adapter_create, lib.eventdev.rx.adapter.create) diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h index 0abed56bef..e026486ca5 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 @@ -2063,6 +2072,76 @@ rte_event_dequeue_burst(uint8_t dev_id, uint8_t port_id, struct rte_event ev[], timeout_ticks); } +#define RTE_EVENT_DEV_MAINT_OP_FLUSH (1 << 0) +/**< Force an immediately flush of any buffered events in the port, + * potentially at the cost of additional overhead. + * + * @see rte_event_maintain() + */ + +/** + * Maintain an event device. + * + * This function is only relevant for event devices which have the + * @ref RTE_EVENT_DEV_CAP_REQUIRES_MAINT flag set. Such devices + * require an application thread using a particular port to + * periodically call rte_event_maintain() on that port during periods + * which it is neither attempting to enqueue events to nor dequeue + * events from the port. rte_event_maintain() is a low-overhead + * function and should be called at a high rate (e.g., in the + * application's poll loop). + * + * No port may be left unmaintained. + * + * At the application thread's convenience, rte_event_maintain() may + * (but is not required to) be called even during periods when enqueue + * or dequeue functions are being called, at the cost of a slight + * increase in overhead. + * + * rte_event_maintain() may be called on event devices which haven't + * set @ref 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. + * @param op + * 0, or @ref RTE_EVENT_DEV_MAINT_OP_FLUSH. + * @return + * - 0 on success. + * - -EINVAL if *dev_id*, *port_id*, or *op* is invalid. + * + * @see RTE_EVENT_DEV_CAP_REQUIRES_MAINT + */ +__rte_experimental +static inline int +rte_event_maintain(uint8_t dev_id, uint8_t port_id, int op) +{ + const struct rte_event_fp_ops *fp_ops; + void *port; + + fp_ops = &rte_event_fp_ops[dev_id]; + port = fp_ops->data[port_id]; +#ifdef RTE_LIBRTE_EVENTDEV_DEBUG + if (dev_id >= RTE_EVENT_MAX_DEVS || + port_id >= RTE_EVENT_MAX_PORTS_PER_DEV) + return -EINVAL; + + if (port == NULL) + return -EINVAL; + + if (op & (~RTE_EVENT_DEV_MAINT_OP_FLUSH)) + return -EINVAL; +#endif + rte_eventdev_trace_maintain(dev_id, port_id, op); + + if (fp_ops->maintain != NULL) + fp_ops->maintain(port, op); + + return 0; +} + #ifdef __cplusplus } #endif diff --git a/lib/eventdev/rte_eventdev_core.h b/lib/eventdev/rte_eventdev_core.h index 61d5ebdc44..c328bdbc82 100644 --- a/lib/eventdev/rte_eventdev_core.h +++ b/lib/eventdev/rte_eventdev_core.h @@ -29,6 +29,9 @@ typedef uint16_t (*event_dequeue_burst_t)(void *port, struct rte_event ev[], uint64_t timeout_ticks); /**< @internal Dequeue burst of events from port of a device */ +typedef void (*event_maintain_t)(void *port, int op); +/**< @internal Maintains a port */ + typedef uint16_t (*event_tx_adapter_enqueue_t)(void *port, struct rte_event ev[], uint16_t nb_events); @@ -54,6 +57,8 @@ struct rte_event_fp_ops { /**< PMD dequeue function. */ event_dequeue_burst_t dequeue_burst; /**< PMD dequeue burst function. */ + event_maintain_t maintain; + /**< PMD port maintenance function. */ event_tx_adapter_enqueue_t txa_enqueue; /**< PMD Tx adapter enqueue function. */ event_tx_adapter_enqueue_t txa_enqueue_same_dest; diff --git a/lib/eventdev/rte_eventdev_trace_fp.h b/lib/eventdev/rte_eventdev_trace_fp.h index 5639e0b83a..af2172d2a5 100644 --- a/lib/eventdev/rte_eventdev_trace_fp.h +++ b/lib/eventdev/rte_eventdev_trace_fp.h @@ -38,6 +38,14 @@ RTE_TRACE_POINT_FP( rte_trace_point_emit_ptr(enq_mode_cb); ) +RTE_TRACE_POINT_FP( + rte_eventdev_trace_maintain, + RTE_TRACE_POINT_ARGS(uint8_t dev_id, uint8_t port_id, int op), + rte_trace_point_emit_u8(dev_id); + rte_trace_point_emit_u8(port_id); + rte_trace_point_emit_int(op); +) + RTE_TRACE_POINT_FP( rte_eventdev_trace_eth_tx_adapter_enqueue, RTE_TRACE_POINT_ARGS(uint8_t dev_id, uint8_t port_id, void *ev_table, -- 2.25.1