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 6BA0545954; Tue, 10 Sep 2024 10:31:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CDF46427C8; Tue, 10 Sep 2024 10:31:45 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 4D0CC427C6 for ; Tue, 10 Sep 2024 10:31:44 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 489KauTo026024; Tue, 10 Sep 2024 01:31:43 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=K YUucr/uPid/f9SOIn4POhU3a3ADxkoKF3Tolg7dcNg=; b=EBI3983T/g9mCSVzA IN9mUWJ6L22OWa0Q9kfHlmo/prAX6qgdWqlc3ljzrvind4nTF8cyZSbDpJqRP3KJ JC0l/y4QR0RWMpoBANtyDKywux5VBwT2OR7Za7Rw7b827lJ4igxZsMl3p6LLopGc P3ln9aG07R078YtjXqzuPb6xLWWOp8VSYTU2eTqUJq966zophvIptWI4Hx4Up9Nm YWmd0flhE3dfbwpXDR65IDi+b6Qm8Oj+QfcorX5v+m/BYAl8wG2K0A7iyB5bYhYn ZSDWG7rrMGjkH66hrjsDSXwPtbYQAOIMhO1tWnKA3a41nfgEwj8aGj+Nxf51KXw1 FB2Hw== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 41gyc081be-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Sep 2024 01:31:43 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 10 Sep 2024 01:31:40 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Tue, 10 Sep 2024 01:31:40 -0700 Received: from MININT-80QBFE8.corp.innovium.com (MININT-80QBFE8.marvell.com [10.28.164.106]) by maili.marvell.com (Postfix) with ESMTP id 5FAA63F709E; Tue, 10 Sep 2024 01:31:37 -0700 (PDT) From: To: , , , , , , , , CC: , Pavan Nikhilesh Subject: [RFC 3/3] eventdev: add SW event prefetch hint Date: Tue, 10 Sep 2024 14:01:17 +0530 Message-ID: <20240910083117.4281-4-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240910083117.4281-1-pbhagavatula@marvell.com> References: <20240910083117.4281-1-pbhagavatula@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: u_r1PelK2tH88WAXd2AZAjUaUJwl07f7 X-Proofpoint-GUID: u_r1PelK2tH88WAXd2AZAjUaUJwl07f7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 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 From: Pavan Nikhilesh Add a new eventdev API to provide a hint to the eventdev PMD to prefetch the next event into the event port, without releasing the current flow context. Event device that support this feature advertises the capability using the RTE_EVENT_DEV_CAP_SW_PREFETCH capability flag. Application can invoke `rte_event_port_prefetch` to hint the PMD. Signed-off-by: Pavan Nikhilesh --- doc/guides/prog_guide/eventdev/eventdev.rst | 8 ++++ lib/eventdev/eventdev_pmd.h | 2 + lib/eventdev/eventdev_private.c | 9 ++++ lib/eventdev/eventdev_trace_points.c | 3 ++ lib/eventdev/rte_eventdev.h | 49 +++++++++++++++++++++ lib/eventdev/rte_eventdev_core.h | 4 ++ lib/eventdev/rte_eventdev_trace_fp.h | 8 ++++ lib/eventdev/version.map | 2 + 8 files changed, 85 insertions(+) diff --git a/doc/guides/prog_guide/eventdev/eventdev.rst b/doc/guides/prog_guide/eventdev/eventdev.rst index 8b6085512d..ea05de53f5 100644 --- a/doc/guides/prog_guide/eventdev/eventdev.rst +++ b/doc/guides/prog_guide/eventdev/eventdev.rst @@ -390,6 +390,14 @@ To enable or disable event prefetching at a given event port, the application ca // Disable prefetching if thread is about to be scheduled out and issue dequeue() to drain // pending events. +Event Prefetch Hint can be used to provide a hint to the eventdev PMD to prefetch the next event +without releasing the current flow context. Event device that support this feature advertises the +capability using the ``RTE_EVENT_DEV_CAP_SW_PREFETCH`` capability flag. +If prefetching is already enabled at a event device or event port level then the hint is ignored. + +.. code-block:: c + + rte_event_port_prefetch(dev_id, port_id, RTE_EVENT_DEV_PREFETCH); Starting the EventDev ~~~~~~~~~~~~~~~~~~~~~ diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h index d93c11e9f1..698bdcc14f 100644 --- a/lib/eventdev/eventdev_pmd.h +++ b/lib/eventdev/eventdev_pmd.h @@ -186,6 +186,8 @@ struct __rte_cache_aligned rte_eventdev { /**< Pointer to PMD Event switch profile function. */ event_prefetch_modify_t prefetch_modify; /**< Pointer to PMD Event port prefetch modify function. */ + event_prefetch_t prefetch; + /**< Pointer to PMD Event port prefetch function. */ uint64_t reserved_64s[3]; /**< Reserved for future fields */ void *reserved_ptrs[3]; /**< Reserved for future fields */ diff --git a/lib/eventdev/eventdev_private.c b/lib/eventdev/eventdev_private.c index 6e8beb29ad..39d5234551 100644 --- a/lib/eventdev/eventdev_private.c +++ b/lib/eventdev/eventdev_private.c @@ -104,6 +104,13 @@ dummy_event_port_prefetch_modify(__rte_unused void *port, return -EINVAL; } +static void +dummy_event_port_prefetch(__rte_unused void *port, + __rte_unused rte_event_dev_prefetch_type_t prefetch) +{ + RTE_EDEV_LOG_ERR("prefetch requested for unconfigured event device"); +} + void event_dev_fp_ops_reset(struct rte_event_fp_ops *fp_op) { @@ -123,6 +130,7 @@ event_dev_fp_ops_reset(struct rte_event_fp_ops *fp_op) .dma_enqueue = dummy_event_dma_adapter_enqueue, .profile_switch = dummy_event_port_profile_switch, .prefetch_modify = dummy_event_port_prefetch_modify, + .prefetch = dummy_event_port_prefetch, .data = dummy_data, }; @@ -146,5 +154,6 @@ event_dev_fp_ops_set(struct rte_event_fp_ops *fp_op, fp_op->dma_enqueue = dev->dma_enqueue; fp_op->profile_switch = dev->profile_switch; fp_op->prefetch_modify = dev->prefetch_modify; + fp_op->prefetch = dev->prefetch; fp_op->data = dev->data->ports; } diff --git a/lib/eventdev/eventdev_trace_points.c b/lib/eventdev/eventdev_trace_points.c index e0547d18c6..199cfa742f 100644 --- a/lib/eventdev/eventdev_trace_points.c +++ b/lib/eventdev/eventdev_trace_points.c @@ -52,6 +52,9 @@ RTE_TRACE_POINT_REGISTER(rte_eventdev_trace_port_profile_switch, RTE_TRACE_POINT_REGISTER(rte_eventdev_trace_port_prefetch_modify, lib.eventdev.port.prefetch.modify) +RTE_TRACE_POINT_REGISTER(rte_eventdev_trace_port_prefetch, + lib.eventdev.port.prefetch) + /* 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 1bc6c48dd3..d487389a2c 100644 --- a/lib/eventdev/rte_eventdev.h +++ b/lib/eventdev/rte_eventdev.h @@ -480,6 +480,15 @@ struct rte_event; * @see rte_event_port_prefetch_modify() */ +#define RTE_EVENT_DEV_CAP_SW_PREFETCH (1ULL << 19) +/**< Event device supports software prefetching. + * + * When this flag is set, the application can issue prefetch request on + * a event port. + * + * @see rte_event_port_prefetch() + */ + /* Event device priority levels */ #define RTE_EVENT_DEV_PRIORITY_HIGHEST 0 /**< Highest priority level for events and queues. @@ -2977,6 +2986,46 @@ rte_event_port_prefetch_modify(uint8_t dev_id, uint8_t port_id, rte_event_dev_pr return fp_ops->prefetch_modify(port, type); } +/** + * Provide a hint to the event device to prefetch events to event port . + * + * Hint the event device to prefetch events to the event port. + * The call doesn't not guarantee that the events will be prefetched. + * The call doesn't release the flow context currently held by the event port. + * The event device should support RTE_EVENT_DEV_CAP_SW_PREFETCH capability. + * + * When prefetching is enabled at an event device or event port level, the hint + * is ignored. + * + * Subsequent calls to rte_event_dequeue_burst() will dequeue the prefetch events + * but prefetch operation is not issued again. + * + * @param dev_id + * The identifier of the device. + * @param port_id + * The identifier of the event port. + * @param type + * The prefetch type to use on the event port. + */ +static inline void +rte_event_port_prefetch(uint8_t dev_id, uint8_t port_id, rte_event_dev_prefetch_type_t type) +{ + 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; + if (port == NULL) + return; +#endif + rte_eventdev_trace_port_prefetch(dev_id, port_id, type); + + fp_ops->prefetch(port, type); +} #ifdef __cplusplus } #endif diff --git a/lib/eventdev/rte_eventdev_core.h b/lib/eventdev/rte_eventdev_core.h index b185fe3654..66edb75649 100644 --- a/lib/eventdev/rte_eventdev_core.h +++ b/lib/eventdev/rte_eventdev_core.h @@ -52,6 +52,9 @@ typedef int (*event_profile_switch_t)(void *port, uint8_t profile); typedef int (*event_prefetch_modify_t)(void *port, rte_event_dev_prefetch_type_t prefetch_type); /**< @internal Modify prefetch type on the event port. */ +typedef void (*event_prefetch_t)(void *port, rte_event_dev_prefetch_type_t prefetch_type); +/**< @internal Issue prefetch on an event port. */ + struct __rte_cache_aligned rte_event_fp_ops { void **data; /**< points to array of internal port data pointers */ @@ -81,6 +84,7 @@ struct __rte_cache_aligned rte_event_fp_ops { /**< PMD Event switch profile function. */ event_prefetch_modify_t prefetch_modify; /**< PMD Event port prefetch switch. */ + event_prefetch_t prefetch; uintptr_t reserved[4]; }; diff --git a/lib/eventdev/rte_eventdev_trace_fp.h b/lib/eventdev/rte_eventdev_trace_fp.h index 06bfd48011..01fa5cba7c 100644 --- a/lib/eventdev/rte_eventdev_trace_fp.h +++ b/lib/eventdev/rte_eventdev_trace_fp.h @@ -63,6 +63,14 @@ RTE_TRACE_POINT_FP( rte_trace_point_emit_int(type); ) +RTE_TRACE_POINT_FP( + rte_eventdev_trace_port_prefetch, + RTE_TRACE_POINT_ARGS(uint8_t dev_id, uint8_t port_id, int type), + rte_trace_point_emit_u8(dev_id); + rte_trace_point_emit_u8(port_id); + rte_trace_point_emit_int(type); +) + 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, diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map index 62c0563fb1..bb291f23e3 100644 --- a/lib/eventdev/version.map +++ b/lib/eventdev/version.map @@ -151,6 +151,8 @@ EXPERIMENTAL { # added in 24.11 rte_event_port_prefetch_modify; __rte_eventdev_trace_port_prefetch_modify; + rte_event_port_prefetch; + __rte_eventdev_trace_port_prefetch; }; INTERNAL { -- 2.25.1