Skip to content

Commit 62eaaec

Browse files
PavanNikhileshJerin Jacob
authored andcommitted
app/test-eventdev: add pre-scheduling support
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 <[email protected]> Acked-by: Jerin Jacob <[email protected]>
1 parent 2e9b3fa commit 62eaaec

File tree

4 files changed

+59
-10
lines changed

4 files changed

+59
-10
lines changed

app/test-eventdev/evt_common.h

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ struct evt_options {
6464
uint8_t nb_timer_adptrs;
6565
uint8_t timdev_use_burst;
6666
uint8_t per_port_pool;
67+
uint8_t preschedule;
68+
uint8_t preschedule_opted;
6769
uint8_t sched_type_list[EVT_MAX_STAGES];
6870
uint16_t mbuf_sz;
6971
uint16_t wkr_deq_dep;
@@ -184,6 +186,30 @@ evt_configure_eventdev(struct evt_options *opt, uint8_t nb_queues,
184186
return ret;
185187
}
186188

189+
if (opt->preschedule_opted && opt->preschedule) {
190+
switch (opt->preschedule) {
191+
case RTE_EVENT_PRESCHEDULE_ADAPTIVE:
192+
if (!(info.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE_ADAPTIVE)) {
193+
evt_err("Preschedule type %d not supported", opt->preschedule);
194+
return -EINVAL;
195+
}
196+
break;
197+
case RTE_EVENT_PRESCHEDULE:
198+
if (!(info.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE)) {
199+
evt_err("Preschedule type %d not supported", opt->preschedule);
200+
return -EINVAL;
201+
}
202+
break;
203+
default:
204+
break;
205+
}
206+
}
207+
208+
if (!opt->preschedule_opted) {
209+
if (info.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE_ADAPTIVE)
210+
opt->preschedule = RTE_EVENT_PRESCHEDULE_ADAPTIVE;
211+
}
212+
187213
if (opt->deq_tmo_nsec) {
188214
if (opt->deq_tmo_nsec < info.min_dequeue_timeout_ns) {
189215
opt->deq_tmo_nsec = info.min_dequeue_timeout_ns;
@@ -198,16 +224,15 @@ evt_configure_eventdev(struct evt_options *opt, uint8_t nb_queues,
198224
}
199225

200226
const struct rte_event_dev_config config = {
201-
.dequeue_timeout_ns = opt->deq_tmo_nsec,
202-
.nb_event_queues = nb_queues,
203-
.nb_event_ports = nb_ports,
204-
.nb_single_link_event_port_queues = 0,
205-
.nb_events_limit = info.max_num_events,
206-
.nb_event_queue_flows = opt->nb_flows,
207-
.nb_event_port_dequeue_depth =
208-
info.max_event_port_dequeue_depth,
209-
.nb_event_port_enqueue_depth =
210-
info.max_event_port_enqueue_depth,
227+
.dequeue_timeout_ns = opt->deq_tmo_nsec,
228+
.nb_event_queues = nb_queues,
229+
.nb_event_ports = nb_ports,
230+
.nb_single_link_event_port_queues = 0,
231+
.nb_events_limit = info.max_num_events,
232+
.nb_event_queue_flows = opt->nb_flows,
233+
.nb_event_port_dequeue_depth = info.max_event_port_dequeue_depth,
234+
.nb_event_port_enqueue_depth = info.max_event_port_enqueue_depth,
235+
.preschedule_type = opt->preschedule,
211236
};
212237

213238
return rte_event_dev_configure(opt->dev_id, &config);

app/test-eventdev/evt_options.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,17 @@ evt_parse_tx_pkt_sz(struct evt_options *opt, const char *arg __rte_unused)
130130
return ret;
131131
}
132132

133+
static int
134+
evt_parse_preschedule(struct evt_options *opt, const char *arg __rte_unused)
135+
{
136+
int ret;
137+
138+
ret = parser_read_uint8(&(opt->preschedule), arg);
139+
opt->preschedule_opted = 1;
140+
141+
return ret;
142+
}
143+
133144
static int
134145
evt_parse_timer_prod_type(struct evt_options *opt, const char *arg __rte_unused)
135146
{
@@ -510,6 +521,10 @@ usage(char *program)
510521
" across all the ethernet devices before\n"
511522
" event workers start.\n"
512523
"\t--tx_pkt_sz : Packet size to use with Tx first."
524+
"\t--preschedule : Pre-schedule type to use.\n"
525+
" 0 - disable pre-schedule\n"
526+
" 1 - pre-schedule\n"
527+
" 2 - pre-schedule adaptive (Default)\n"
513528
);
514529
printf("available tests:\n");
515530
evt_test_dump_names();
@@ -598,6 +613,7 @@ static struct option lgopts[] = {
598613
{ EVT_HELP, 0, 0, 0 },
599614
{ EVT_TX_FIRST, 1, 0, 0 },
600615
{ EVT_TX_PKT_SZ, 1, 0, 0 },
616+
{ EVT_PRESCHEDULE, 1, 0, 0 },
601617
{ NULL, 0, 0, 0 }
602618
};
603619

@@ -647,6 +663,7 @@ evt_opts_parse_long(int opt_idx, struct evt_options *opt)
647663
{ EVT_PER_PORT_POOL, evt_parse_per_port_pool},
648664
{ EVT_TX_FIRST, evt_parse_tx_first},
649665
{ EVT_TX_PKT_SZ, evt_parse_tx_pkt_sz},
666+
{ EVT_PRESCHEDULE, evt_parse_preschedule},
650667
};
651668

652669
for (i = 0; i < RTE_DIM(parsermap); i++) {

app/test-eventdev/evt_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
#define EVT_PER_PORT_POOL ("per_port_pool")
6060
#define EVT_TX_FIRST ("tx_first")
6161
#define EVT_TX_PKT_SZ ("tx_pkt_sz")
62+
#define EVT_PRESCHEDULE ("preschedule")
6263
#define EVT_HELP ("help")
6364

6465
void evt_options_default(struct evt_options *opt);

doc/guides/tools/testeventdev.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,12 @@ The following are the application command-line options:
236236
Packet size to use for `--tx_first`.
237237
Only applicable for `pipeline_atq` and `pipeline_queue` tests.
238238

239+
* ``--preschedule``
240+
241+
Enable pre-scheduling of events.
242+
0 - Disable pre-scheduling.
243+
1 - Enable pre-scheduling.
244+
2 - Enable pre-schedule with adaptive mode (Default).
239245

240246
Eventdev Tests
241247
--------------

0 commit comments

Comments
 (0)