DPDK patches and discussions
 help / color / mirror / Atom feed
From: <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>, <sthotton@marvell.com>,
	<abdullah.sevincer@intel.com>, <hemant.agrawal@nxp.com>,
	<sachin.saxena@oss.nxp.com>, <harry.van.haaren@intel.com>,
	<mattias.ronnblom@ericsson.com>, <liangma@liangbit.com>,
	<peter.mccarthy@intel.com>
Cc: <dev@dpdk.org>, Pavan Nikhilesh <pbhagavatula@marvell.com>
Subject: [PATCH v4 3/6] eventdev: add SW event preschedule hint
Date: Tue, 1 Oct 2024 18:48:58 +0530	[thread overview]
Message-ID: <20241001131901.7920-4-pbhagavatula@marvell.com> (raw)
In-Reply-To: <20241001131901.7920-1-pbhagavatula@marvell.com>

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Add a new eventdev API to provide a hint to the eventdev PMD to
pre-schedule 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_PRESCHEDULE capability flag.

Application can invoke `rte_event_port_preschedule` to hint the PMD.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 doc/guides/prog_guide/eventdev/eventdev.rst |  8 ++++
 doc/guides/rel_notes/release_24_11.rst      |  3 +-
 lib/eventdev/eventdev_pmd.h                 |  2 +
 lib/eventdev/eventdev_private.c             | 21 ++++++++-
 lib/eventdev/eventdev_trace_points.c        |  3 ++
 lib/eventdev/rte_eventdev.h                 | 49 +++++++++++++++++++++
 lib/eventdev/rte_eventdev_core.h            |  5 +++
 lib/eventdev/rte_eventdev_trace_fp.h        |  8 ++++
 lib/eventdev/version.map                    |  2 +
 9 files changed, 98 insertions(+), 3 deletions(-)

diff --git a/doc/guides/prog_guide/eventdev/eventdev.rst b/doc/guides/prog_guide/eventdev/eventdev.rst
index 2deab0333e..1d8b86ab66 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 pre-scheduling at a given event port, the application
    // Disable pre-scheduling if thread is about to be scheduled out and issue dequeue() to drain
    // pending events.
 
+Event Pre-schedule Hint can be used to provide a hint to the eventdev PMD to pre-schedule 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_PRESCHEDULE`` capability flag.
+If pre-scheduling is already enabled at a event device or event port level then the hint is ignored.
+
+.. code-block:: c
+
+   rte_event_port_preschedule(dev_id, port_id, RTE_EVENT_DEV_PRESCHEDULE);
 
 Starting the EventDev
 ~~~~~~~~~~~~~~~~~~~~~
diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst
index 6e36ac7b7e..3ada21c084 100644
--- a/doc/guides/rel_notes/release_24_11.rst
+++ b/doc/guides/rel_notes/release_24_11.rst
@@ -64,7 +64,8 @@ New Features
     level pre-scheduling type.
   * Added ``rte_event_port_preschedule_modify`` to modify pre-scheduling type
     on a given event port.
-
+  * Added ``rte_event_port_preschedule`` to allow applications to decide when
+    to pre-schedule events on an event port.
 
 Removed Items
 -------------
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index 9ea23aa6cd..0bee2347ef 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_preschedule_modify_t preschedule_modify;
 	/**< Pointer to PMD Event port pre-schedule type modify function.  */
+	event_preschedule_t preschedule;
+	/**< Pointer to PMD Event port pre-schedule 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 dc37f736f8..6aed1cba9a 100644
--- a/lib/eventdev/eventdev_private.c
+++ b/lib/eventdev/eventdev_private.c
@@ -111,6 +111,19 @@ dummy_event_port_preschedule_modify_hint(__rte_unused void *port,
 	return -ENOTSUP;
 }
 
+static void
+dummy_event_port_preschedule(__rte_unused void *port,
+			     __rte_unused rte_event_dev_preschedule_type_t preschedule)
+{
+	RTE_EDEV_LOG_ERR("pre-schedule requested for unconfigured event device");
+}
+
+static void
+dummy_event_port_preschedule_hint(__rte_unused void *port,
+			     __rte_unused rte_event_dev_preschedule_type_t preschedule)
+{
+}
+
 void
 event_dev_fp_ops_reset(struct rte_event_fp_ops *fp_op)
 {
@@ -124,12 +137,12 @@ event_dev_fp_ops_reset(struct rte_event_fp_ops *fp_op)
 		.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,
+		.txa_enqueue_same_dest = dummy_event_tx_adapter_enqueue_same_dest,
 		.ca_enqueue = dummy_event_crypto_adapter_enqueue,
 		.dma_enqueue = dummy_event_dma_adapter_enqueue,
 		.profile_switch = dummy_event_port_profile_switch,
 		.preschedule_modify = dummy_event_port_preschedule_modify,
+		.preschedule = dummy_event_port_preschedule,
 		.data = dummy_data,
 	};
 
@@ -153,8 +166,12 @@ 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->preschedule_modify = dev->preschedule_modify;
+	fp_op->preschedule = dev->preschedule;
 	fp_op->data = dev->data->ports;
 
 	if (fp_op->preschedule_modify == NULL)
 		fp_op->preschedule_modify = dummy_event_port_preschedule_modify_hint;
+
+	if (fp_op->preschedule == NULL)
+		fp_op->preschedule = dummy_event_port_preschedule_hint;
 }
diff --git a/lib/eventdev/eventdev_trace_points.c b/lib/eventdev/eventdev_trace_points.c
index e41674123c..e7af1591f7 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_preschedule_modify,
 	lib.eventdev.port.preschedule.modify)
 
+RTE_TRACE_POINT_REGISTER(rte_eventdev_trace_port_preschedule,
+	lib.eventdev.port.preschedule)
+
 /* 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 0add0093ac..8df6a8bee1 100644
--- a/lib/eventdev/rte_eventdev.h
+++ b/lib/eventdev/rte_eventdev.h
@@ -480,6 +480,15 @@ struct rte_event;
  * @see rte_event_port_preschedule_modify()
  */
 
+#define RTE_EVENT_DEV_CAP_SW_PRESCHEDULE (1ULL << 19)
+/**< Event device supports software prescheduling.
+ *
+ * When this flag is set, the application can issue preschedule request on
+ * a event port.
+ *
+ * @see rte_event_port_preschedule()
+ */
+
 /* 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_preschedule_modify(uint8_t dev_id, uint8_t port_id,
 	return fp_ops->preschedule_modify(port, type);
 }
 
+/**
+ * Provide a hint to the event device to pre-schedule events to event port .
+ *
+ * Hint the event device to pre-schedule events to the event port.
+ * The call doesn't not guarantee that the events will be pre-scheduleed.
+ * The call doesn't release the flow context currently held by the event port.
+ * The event device should support RTE_EVENT_DEV_CAP_SW_PRESCHEDULE capability.
+ *
+ * When pre-scheduling is enabled at an event device or event port level, the
+ * hint is ignored.
+ *
+ * Subsequent calls to rte_event_dequeue_burst() will dequeue the pre-schedule
+ * events but pre-schedule 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 pre-schedule type to use on the event port.
+ */
+static inline void
+rte_event_port_preschedule(uint8_t dev_id, uint8_t port_id, rte_event_dev_preschedule_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_preschedule(dev_id, port_id, type);
+
+	fp_ops->preschedule(port, type);
+}
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eventdev/rte_eventdev_core.h b/lib/eventdev/rte_eventdev_core.h
index 2275888a6b..21988abb4f 100644
--- a/lib/eventdev/rte_eventdev_core.h
+++ b/lib/eventdev/rte_eventdev_core.h
@@ -53,6 +53,9 @@ typedef int (*event_preschedule_modify_t)(void *port,
 					  rte_event_dev_preschedule_type_t preschedule_type);
 /**< @internal Modify pre-schedule type on the event port. */
 
+typedef void (*event_preschedule_t)(void *port, rte_event_dev_preschedule_type_t preschedule_type);
+/**< @internal Issue pre-schedule on an event port. */
+
 struct __rte_cache_aligned rte_event_fp_ops {
 	void **data;
 	/**< points to array of internal port data pointers */
@@ -82,6 +85,8 @@ struct __rte_cache_aligned rte_event_fp_ops {
 	/**< PMD Event switch profile function. */
 	event_preschedule_modify_t preschedule_modify;
 	/**< PMD Event port pre-schedule switch. */
+	event_preschedule_t preschedule;
+	/**< PMD Event port pre-schedule. */
 	uintptr_t reserved[4];
 };
 
diff --git a/lib/eventdev/rte_eventdev_trace_fp.h b/lib/eventdev/rte_eventdev_trace_fp.h
index 78baed94de..8290f8a248 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_preschedule,
+	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 b6d63ba576..42a5867aba 100644
--- a/lib/eventdev/version.map
+++ b/lib/eventdev/version.map
@@ -151,6 +151,8 @@ EXPERIMENTAL {
 	# added in 24.11
 	rte_event_port_preschedule_modify;
 	__rte_eventdev_trace_port_preschedule_modify;
+	rte_event_port_preschedule;
+	__rte_eventdev_trace_port_preschedule;
 };
 
 INTERNAL {
-- 
2.25.1


  parent reply	other threads:[~2024-10-01 13:19 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-10  8:31 [RFC 0/3] Introduce event prefetching pbhagavatula
2024-09-10  8:31 ` [RFC 1/3] eventdev: introduce " pbhagavatula
2024-09-10  8:31 ` [RFC 2/3] eventdev: allow event ports to modified prefetches pbhagavatula
2024-09-10  8:31 ` [RFC 3/3] eventdev: add SW event prefetch hint pbhagavatula
2024-09-10  9:08 ` [RFC 0/3] Introduce event prefetching Mattias Rönnblom
2024-09-10 11:53   ` [EXTERNAL] " Pavan Nikhilesh Bhagavatula
2024-09-17  7:11 ` [PATCH v2 0/3] Introduce event pre-scheduling pbhagavatula
2024-09-17  7:11   ` [PATCH v2 1/3] eventdev: introduce " pbhagavatula
2024-09-18 22:38     ` Pathak, Pravin
2024-09-19 13:13       ` Pavan Nikhilesh Bhagavatula
2024-09-23  8:57         ` Mattias Rönnblom
2024-09-25 10:30           ` [EXTERNAL] " Pavan Nikhilesh Bhagavatula
2024-09-26  2:54             ` Pathak, Pravin
2024-09-26 10:03               ` Pavan Nikhilesh Bhagavatula
2024-09-27  3:31                 ` Pathak, Pravin
2024-09-17  7:11   ` [PATCH v2 2/3] eventdev: add event port pre-schedule modify pbhagavatula
2024-09-17  7:11   ` [PATCH v2 3/3] eventdev: add SW event preschedule hint pbhagavatula
2024-10-01  6:14   ` [PATCH v3 0/6] Introduce event pre-scheduling pbhagavatula
2024-10-01  6:14     ` [PATCH v3 1/6] eventdev: introduce " pbhagavatula
2024-10-01  6:14     ` [PATCH v3 2/6] eventdev: add event port pre-schedule modify pbhagavatula
2024-10-01  6:14     ` [PATCH v3 3/6] eventdev: add SW event preschedule hint pbhagavatula
2024-10-01  6:14     ` [PATCH v3 4/6] event/cnkx: add pre-schedule support pbhagavatula
2024-10-01  6:14     ` [PATCH v3 5/6] app/test-eventdev: add pre-scheduling support pbhagavatula
2024-10-01  6:14     ` [PATCH v3 6/6] examples: use eventdev pre-scheduling pbhagavatula
2024-10-01 13:18     ` [PATCH v4 0/6] Introduce event pre-scheduling pbhagavatula
2024-10-01 13:18       ` [PATCH v4 1/6] eventdev: introduce " pbhagavatula
2024-10-04  4:47         ` Jerin Jacob
2024-10-01 13:18       ` [PATCH v4 2/6] eventdev: add event port pre-schedule modify pbhagavatula
2024-10-04  5:02         ` Jerin Jacob
2024-10-01 13:18       ` pbhagavatula [this message]
2024-10-04  5:14         ` [PATCH v4 3/6] eventdev: add SW event preschedule hint Jerin Jacob
2024-10-01 13:18       ` [PATCH v4 4/6] event/cnkx: add pre-schedule support pbhagavatula
2024-10-01 13:19       ` [PATCH v4 5/6] app/test-eventdev: add pre-scheduling support pbhagavatula
2024-10-01 13:19       ` [PATCH v4 6/6] examples: use eventdev pre-scheduling pbhagavatula
2024-10-01 15:33       ` [PATCH v4 0/6] Introduce event pre-scheduling Stephen Hemminger
2024-10-03  5:46         ` [EXTERNAL] " Pavan Nikhilesh Bhagavatula
2024-10-04 16:24       ` [PATCH v5 " pbhagavatula
2024-10-04 16:24         ` [PATCH v5 1/6] eventdev: introduce " pbhagavatula
2024-10-04 16:24         ` [PATCH v5 2/6] eventdev: add event port pre-schedule modify pbhagavatula
2024-10-04 16:24         ` [PATCH v5 3/6] eventdev: add event preschedule hint pbhagavatula
2024-10-04 16:24         ` [PATCH v5 4/6] event/cnkx: add pre-schedule support pbhagavatula
2024-10-04 16:24         ` [PATCH v5 5/6] app/test-eventdev: add pre-scheduling support pbhagavatula
2024-10-04 16:24         ` [PATCH v5 6/6] examples: use eventdev pre-scheduling pbhagavatula
2024-10-04 16:35         ` [PATCH v5 0/6] Introduce event pre-scheduling Stephen Hemminger
2024-10-04 16:50           ` [EXTERNAL] " Pavan Nikhilesh Bhagavatula
2024-10-05  7:25         ` [PATCH v6 " pbhagavatula
2024-10-05  7:25           ` [PATCH v6 1/6] eventdev: introduce " pbhagavatula
2024-10-05  7:25           ` [PATCH v6 2/6] eventdev: add event port pre-schedule modify pbhagavatula
2024-10-05  7:25           ` [PATCH v6 3/6] eventdev: add event preschedule hint pbhagavatula
2024-10-05  7:25           ` [PATCH v6 4/6] event/cnkx: add pre-schedule support pbhagavatula
2024-10-05  7:25           ` [PATCH v6 5/6] app/test-eventdev: add pre-scheduling support pbhagavatula
2024-10-05  7:26           ` [PATCH v6 6/6] examples: use eventdev pre-scheduling pbhagavatula
2024-10-05  7:59           ` [PATCH v7 0/6] Introduce event pre-scheduling pbhagavatula
2024-10-05  7:59             ` [PATCH v7 1/6] eventdev: introduce " pbhagavatula
2024-10-05 16:11               ` Stephen Hemminger
2024-10-06 17:03                 ` [EXTERNAL] " Pavan Nikhilesh Bhagavatula
2024-10-05  7:59             ` [PATCH v7 2/6] eventdev: add event port pre-schedule modify pbhagavatula
2024-10-05  7:59             ` [PATCH v7 3/6] eventdev: add event preschedule hint pbhagavatula
2024-10-05  7:59             ` [PATCH v7 4/6] event/cnkx: add pre-schedule support pbhagavatula
2024-10-05  8:00             ` [PATCH v7 5/6] app/test-eventdev: add pre-scheduling support pbhagavatula
2024-10-05  8:00             ` [PATCH v7 6/6] examples: use eventdev pre-scheduling pbhagavatula
2024-10-06 17:06             ` [PATCH v8 0/6] Introduce event pre-scheduling pbhagavatula
2024-10-06 17:06               ` [PATCH v8 1/6] eventdev: introduce " pbhagavatula
2024-10-06 17:06               ` [PATCH v8 2/6] eventdev: add event port pre-schedule modify pbhagavatula
2024-10-06 17:06               ` [PATCH v8 3/6] eventdev: add event preschedule hint pbhagavatula
2024-10-07 12:24                 ` Jerin Jacob
2024-10-06 17:06               ` [PATCH v8 4/6] event/cnkx: add pre-schedule support pbhagavatula
2024-10-06 17:06               ` [PATCH v8 5/6] app/test-eventdev: add pre-scheduling support pbhagavatula
2024-10-06 17:06               ` [PATCH v8 6/6] examples: use eventdev pre-scheduling pbhagavatula
2024-10-07 13:09               ` [PATCH v9 0/6] Introduce event pre-scheduling pbhagavatula
2024-10-07 13:09                 ` [PATCH v9 1/6] eventdev: introduce " pbhagavatula
2024-10-07 13:09                 ` [PATCH v9 2/6] eventdev: add event port pre-schedule modify pbhagavatula
2024-10-07 13:09                 ` [PATCH v9 3/6] eventdev: add event preschedule hint pbhagavatula
2024-10-07 13:09                 ` [PATCH v9 4/6] event/cnkx: add pre-schedule support pbhagavatula
2024-10-07 13:09                 ` [PATCH v9 5/6] app/test-eventdev: add pre-scheduling support pbhagavatula
2024-10-07 13:09                 ` [PATCH v9 6/6] examples: use eventdev pre-scheduling pbhagavatula
2024-10-08  5:17                 ` [PATCH v9 0/6] Introduce event pre-scheduling Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241001131901.7920-4-pbhagavatula@marvell.com \
    --to=pbhagavatula@marvell.com \
    --cc=abdullah.sevincer@intel.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerinj@marvell.com \
    --cc=liangma@liangbit.com \
    --cc=mattias.ronnblom@ericsson.com \
    --cc=peter.mccarthy@intel.com \
    --cc=sachin.saxena@oss.nxp.com \
    --cc=sthotton@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).