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 DFEB0A0547; Tue, 26 Oct 2021 19:32:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C9D42410D5; Tue, 26 Oct 2021 19:32:09 +0200 (CEST) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00063.outbound.protection.outlook.com [40.107.0.63]) by mails.dpdk.org (Postfix) with ESMTP id 4587040E0F for ; Tue, 26 Oct 2021 19:32:08 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RjR34+5S0JM+O0sNoB4sBAF1x8ljC6XVuKBj+JfrptaS5STMedCQty9MrIM1gH2uc+QY9L/b9wUQ61l00p40Ks4fZieSZxQsu91inD4Kic/VqLcWylzodzGy7JDfzLESbTOT4Nlff4UIii5KTDrWXAQPKWY2dzleNMUNdoIipCoEij6ZRM5huI11RAFsDb7cUjyBrGc9Lax1bFcuT3SDDh7Fj/QUP7jnwGK0b0VNmDt5KMdWfdefdFsRv2qqHhP+KfzOD6YFTIeVUvi0KeG9/U6mQva1UDfomkuBLJOVVixOUymHWowTLguYeucomrg3EpZ9/3vyzOfFgVpP9sF53A== 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=nPViUz3kg+ZiR7B+2mbHhFkde/JoWgQYXLyVezoxHno=; b=CHhOoSDdHON8soCO+1lr0MsS5i0qhcP1RTL9XqWfX5kEZjzeUWLCeICycUV5tpb+MJjY3Zp5bv5XcrQsFJChWALB03E4h6Hs21q2rWTEXVmv/jwWbzzv7Zi/1OWcIP47PWk9JAmpSfGq1Vqz3mC10Mp1rhD+rjjmrKzef+7ttRx6N7Zccp31Sr0UEqoPHlD2J7itiePmGDFb4PqBLvLE3Mz2thRp6X+lAKeiWkRDXPwxq89PfUrZGYsqMY8jKJ0TWsCQ7x9mI0+hwzGu6pyACALZ+gauvz7wHnleGYMZLoZmtUBQXjtGbiK49poj2G8vUAaR3xDtNGLfoj6ni+akHw== 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=nPViUz3kg+ZiR7B+2mbHhFkde/JoWgQYXLyVezoxHno=; b=NOb9BjqGQ56uNWgH0xMO0fpM93a+CoZ1S9kautHWbsmHOfljfXQ//FDryFq7QmZbzuFE74tkh1aYyb65ttyEqD6p4T1KcAOS7ZFOLcmXWx+2N7LuQcso1ct+xs03E0NKqovYUwNvIpo6EE/GXIm0g6Vw/QisLOvU7p3fdu69S2g= Received: from BEXP281CA0017.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10::27) by PA4PR07MB7710.eurprd07.prod.outlook.com (2603:10a6:102:f5::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.12; Tue, 26 Oct 2021 17:32:07 +0000 Received: from HE1EUR02FT055.eop-EUR02.prod.protection.outlook.com (2603:10a6:b10:0:cafe::3c) by BEXP281CA0017.outlook.office365.com (2603:10a6:b10::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.11 via Frontend Transport; Tue, 26 Oct 2021 17:32:07 +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 HE1EUR02FT055.mail.protection.outlook.com (10.152.11.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.4628.16 via Frontend Transport; Tue, 26 Oct 2021 17:32:06 +0000 Received: from ESESSMB504.ericsson.se (153.88.183.165) by ESESSMR502.ericsson.se (153.88.183.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Tue, 26 Oct 2021 19:32:05 +0200 Received: from ESESSMB505.ericsson.se (153.88.183.166) by ESESSMB504.ericsson.se (153.88.183.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Tue, 26 Oct 2021 19:32:05 +0200 Received: from seliiuapp00218.seli.gic.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.193) with Microsoft SMTP Server id 15.1.2242.12 via Frontend Transport; Tue, 26 Oct 2021 19:32:05 +0200 Received: from localhost.localdomain (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliiuapp00218.seli.gic.ericsson.se (Postfix) with ESMTP id 8D602601E6; Tue, 26 Oct 2021 19:32:05 +0200 (CEST) From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= To: , , , CC: , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Date: Tue, 26 Oct 2021 19:31:46 +0200 Message-ID: <20211026173148.19399-1-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <3e8c8bab-783d-d132-a836-51bd4d5533bb@ericsson.com> References: <3e8c8bab-783d-d132-a836-51bd4d5533bb@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: 0c715f3d-5244-489b-3de6-08d998a68845 X-MS-TrafficTypeDiagnostic: PA4PR07MB7710: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5wL7/MLeruXDDVDy+eiZXZCSXDi8pn7O4i+yG/4aQ+q5U4xU7d8X9DV1+h+ApOpJ1EUaQewuEtddBPwCJao39JwM9LQgJtaM+8pwFmhVdJCQaMfYEQE0yqePZp1N1Pq+4mhB381yzb5fZGkeMPYRqgxY5aLHB3mvIbwyC9Tm+JkWNGw/uZz992XDdc09fe/IcvtG011ZKSHUWKfbkSDVauuARRQ07zIjZyRNbe9VecpVkqxXFQDdngGsDk/JSiQRET+FIZYQ+c0rYEKgsrK6k5n1eHelCKfqwvGq+D4aHUFDr9l8/zsmdpueC1wxWkTcWjWIUB+eqUZ3QpljHttjDQi0YPIh+RmygUZ2VGTQ3oZLdMsLYThDo5QY/MN+odyDOBftyTsueedATlPLxRjPRVHgbADvrZnNqN6hu91DIUur12iU8i8OcZmkDazpEsGwmL74dFjzgRQZ3rVOYzMbUpl6DdiTz4QRADrBgDHyy1T8nX5qyOlhQxwB3PAkiib7Eyzz6fyfJxIzN+rdGInV9Sp9eGU6s/r050GWuhAH+QUSjyUobtv78f2CeOoY0cvgGDOexm5uVolkqBSIXwMhZWs2v5j4RADZRMxyxHq+9Tubzq1O8VUS06MtSB09EhUFKbZ02ibX9/54rO0dL/HinoSZPmhvhFVF15rq1bJN24eymItQ4f3RkSoiSLQxIJrxfWBPekW+G6HmqX8kBywtzA== 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)(46966006)(36840700001)(2906002)(5660300002)(47076005)(26005)(107886003)(82960400001)(356005)(316002)(2616005)(110136005)(70586007)(508600001)(66574015)(7636003)(336012)(6666004)(4326008)(54906003)(6266002)(83380400001)(8676002)(36756003)(186003)(8936002)(86362001)(82310400003)(1076003)(70206006)(36860700001); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2021 17:32:06.7508 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c715f3d-5244-489b-3de6-08d998a68845 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: HE1EUR02FT055.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR07MB7710 Subject: [dpdk-dev] [PATCH 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 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 | 63 ++++++++++++++++++++++++++++ lib/eventdev/rte_eventdev_core.h | 5 +++ lib/eventdev/rte_eventdev_trace_fp.h | 7 ++++ 6 files changed, 89 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..6395c21dce 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_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..aad89c66f3 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,60 @@ 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 require the + * application to call rte_event_maintain() on a port during periods + * which it is neither enqueuing nor dequeuing events from that + * port. rte_event_maintain() is a low-overhead function and should be + * called at a high rate (e.g., in the applications poll loop). + * + * No port may be left unmaintained. + * + * rte_event_maintain() may be called on event devices which haven'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. + * - -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) +{ + 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) { + rte_errno = EINVAL; + return 0; + } + + if (port == NULL) { + rte_errno = EINVAL; + return 0; + } +#endif + rte_eventdev_trace_maintain(dev_id, port_id); + + if (fp_ops->maintain != NULL) + fp_ops->maintain(port); + + return 0; +} + #ifdef __cplusplus } #endif diff --git a/lib/eventdev/rte_eventdev_core.h b/lib/eventdev/rte_eventdev_core.h index 61d5ebdc44..61fa65cab3 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); +/**< @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..c5a79a14d8 100644 --- a/lib/eventdev/rte_eventdev_trace_fp.h +++ b/lib/eventdev/rte_eventdev_trace_fp.h @@ -38,6 +38,13 @@ 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), + rte_trace_point_emit_u8(dev_id); + rte_trace_point_emit_u8(port_id); +) + 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