Skip to content

Commit

Permalink
app/eventdev: add pre-scheduling
Browse files Browse the repository at this point in the history
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>
Acked-by: Jerin Jacob <jerinj@marvell.com>
  • Loading branch information
PavanNikhilesh authored and jerinjacobk committed Oct 8, 2024
1 parent 53e736a commit 7a7a04d
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 10 deletions.
45 changes: 35 additions & 10 deletions app/test-eventdev/evt_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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_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_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_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;
Expand All @@ -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);
Expand Down
17 changes: 17 additions & 0 deletions app/test-eventdev/evt_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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 }
};

Expand Down Expand Up @@ -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++) {
Expand Down
1 change: 1 addition & 0 deletions app/test-eventdev/evt_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions doc/guides/tools/testeventdev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,13 @@ 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
--------------
Expand Down

0 comments on commit 7a7a04d

Please sign in to comment.