[v4,5/6] app/test-eventdev: add pre-scheduling support

Message ID 20241001131901.7920-6-pbhagavatula@marvell.com (mailing list archive)
State Changes Requested, archived
Delegated to: Jerin Jacob
Headers
Series Introduce event pre-scheduling |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Pavan Nikhilesh Bhagavatula Oct. 1, 2024, 1:19 p.m. UTC
From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Add support to configure pre-scheduling for eventdev
test application.
Option `--preschedule`
  0 - Disable pre-scheduling.
  1 - Enable pre-scheduling.
  2 - Enable pre-schedule with adaptive mode (Default).

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 app/test-eventdev/evt_common.h    | 45 ++++++++++++++++++++++++-------
 app/test-eventdev/evt_options.c   | 17 ++++++++++++
 app/test-eventdev/evt_options.h   |  1 +
 doc/guides/tools/testeventdev.rst |  6 +++++
 4 files changed, 59 insertions(+), 10 deletions(-)
  

Patch

diff --git a/app/test-eventdev/evt_common.h b/app/test-eventdev/evt_common.h
index dbe1e5c0c4..176c077e51 100644
--- a/app/test-eventdev/evt_common.h
+++ b/app/test-eventdev/evt_common.h
@@ -64,6 +64,8 @@  struct evt_options {
 	uint8_t nb_timer_adptrs;
 	uint8_t timdev_use_burst;
 	uint8_t per_port_pool;
+	uint8_t preschedule;
+	uint8_t preschedule_opted;
 	uint8_t sched_type_list[EVT_MAX_STAGES];
 	uint16_t mbuf_sz;
 	uint16_t wkr_deq_dep;
@@ -184,6 +186,30 @@  evt_configure_eventdev(struct evt_options *opt, uint8_t nb_queues,
 		return ret;
 	}
 
+	if (opt->preschedule_opted && opt->preschedule) {
+		switch (opt->preschedule) {
+		case RTE_EVENT_DEV_PRESCHEDULE_ADAPTIVE:
+			if (!(info.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE_ADAPTIVE)) {
+				evt_err("Preschedule type %d not supported", opt->preschedule);
+				return -EINVAL;
+			}
+			break;
+		case RTE_EVENT_DEV_PRESCHEDULE:
+			if (!(info.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE)) {
+				evt_err("Preschedule type %d not supported", opt->preschedule);
+				return -EINVAL;
+			}
+			break;
+		default:
+			break;
+		}
+	}
+
+	if (!opt->preschedule_opted) {
+		if (info.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE_ADAPTIVE)
+			opt->preschedule = RTE_EVENT_DEV_PRESCHEDULE_ADAPTIVE;
+	}
+
 	if (opt->deq_tmo_nsec) {
 		if (opt->deq_tmo_nsec < info.min_dequeue_timeout_ns) {
 			opt->deq_tmo_nsec = info.min_dequeue_timeout_ns;
@@ -198,16 +224,15 @@  evt_configure_eventdev(struct evt_options *opt, uint8_t nb_queues,
 	}
 
 	const struct rte_event_dev_config config = {
-			.dequeue_timeout_ns = opt->deq_tmo_nsec,
-			.nb_event_queues = nb_queues,
-			.nb_event_ports = nb_ports,
-			.nb_single_link_event_port_queues = 0,
-			.nb_events_limit  = info.max_num_events,
-			.nb_event_queue_flows = opt->nb_flows,
-			.nb_event_port_dequeue_depth =
-				info.max_event_port_dequeue_depth,
-			.nb_event_port_enqueue_depth =
-				info.max_event_port_enqueue_depth,
+		.dequeue_timeout_ns = opt->deq_tmo_nsec,
+		.nb_event_queues = nb_queues,
+		.nb_event_ports = nb_ports,
+		.nb_single_link_event_port_queues = 0,
+		.nb_events_limit = info.max_num_events,
+		.nb_event_queue_flows = opt->nb_flows,
+		.nb_event_port_dequeue_depth = info.max_event_port_dequeue_depth,
+		.nb_event_port_enqueue_depth = info.max_event_port_enqueue_depth,
+		.preschedule_type = opt->preschedule,
 	};
 
 	return rte_event_dev_configure(opt->dev_id, &config);
diff --git a/app/test-eventdev/evt_options.c b/app/test-eventdev/evt_options.c
index fb5a0a255f..323d1e724d 100644
--- a/app/test-eventdev/evt_options.c
+++ b/app/test-eventdev/evt_options.c
@@ -130,6 +130,17 @@  evt_parse_tx_pkt_sz(struct evt_options *opt, const char *arg __rte_unused)
 	return ret;
 }
 
+static int
+evt_parse_preschedule(struct evt_options *opt, const char *arg __rte_unused)
+{
+	int ret;
+
+	ret = parser_read_uint8(&(opt->preschedule), arg);
+	opt->preschedule_opted = 1;
+
+	return ret;
+}
+
 static int
 evt_parse_timer_prod_type(struct evt_options *opt, const char *arg __rte_unused)
 {
@@ -510,6 +521,10 @@  usage(char *program)
 		"                       across all the ethernet devices before\n"
 		"                       event workers start.\n"
 		"\t--tx_pkt_sz        : Packet size to use with Tx first."
+		"\t--preschedule      : Pre-schedule type to use.\n"
+		"                       0 - disable pre-schedule\n"
+		"                       1 - pre-schedule\n"
+		"                       2 - pre-schedule adaptive (Default)\n"
 		);
 	printf("available tests:\n");
 	evt_test_dump_names();
@@ -598,6 +613,7 @@  static struct option lgopts[] = {
 	{ EVT_HELP,                0, 0, 0 },
 	{ EVT_TX_FIRST,            1, 0, 0 },
 	{ EVT_TX_PKT_SZ,           1, 0, 0 },
+	{ EVT_PRESCHEDULE,         1, 0, 0 },
 	{ NULL,                    0, 0, 0 }
 };
 
@@ -647,6 +663,7 @@  evt_opts_parse_long(int opt_idx, struct evt_options *opt)
 		{ EVT_PER_PORT_POOL, evt_parse_per_port_pool},
 		{ EVT_TX_FIRST, evt_parse_tx_first},
 		{ EVT_TX_PKT_SZ, evt_parse_tx_pkt_sz},
+		{ EVT_PRESCHEDULE, evt_parse_preschedule},
 	};
 
 	for (i = 0; i < RTE_DIM(parsermap); i++) {
diff --git a/app/test-eventdev/evt_options.h b/app/test-eventdev/evt_options.h
index 646060c7c6..18a893b704 100644
--- a/app/test-eventdev/evt_options.h
+++ b/app/test-eventdev/evt_options.h
@@ -59,6 +59,7 @@ 
 #define EVT_PER_PORT_POOL	 ("per_port_pool")
 #define EVT_TX_FIRST		 ("tx_first")
 #define EVT_TX_PKT_SZ		 ("tx_pkt_sz")
+#define EVT_PRESCHEDULE          ("preschedule")
 #define EVT_HELP                 ("help")
 
 void evt_options_default(struct evt_options *opt);
diff --git a/doc/guides/tools/testeventdev.rst b/doc/guides/tools/testeventdev.rst
index 00eb702571..38e2ec0c36 100644
--- a/doc/guides/tools/testeventdev.rst
+++ b/doc/guides/tools/testeventdev.rst
@@ -236,6 +236,12 @@  The following are the application command-line options:
        Packet size to use for `--tx_first`.
        Only applicable for `pipeline_atq` and `pipeline_queue` tests.
 
+* ``--preschedule``
+
+       Enable pre-scheduling of events.
+       0 - Disable pre-scheduling.
+       1 - Enable pre-scheduling.
+       2 - Enable pre-schedule with adaptive mode (Default).
 
 Eventdev Tests
 --------------