Skip to content

Commit

Permalink
examples: use eventdev pre-scheduling
Browse files Browse the repository at this point in the history
Enable event pre-scheduling if supported by the event device.

Signed-off-by: Pavan Nikhilesh <[email protected]>
Acked-by: Jerin Jacob <[email protected]>
  • Loading branch information
PavanNikhilesh authored and jerinjacobk committed Oct 8, 2024
1 parent 7a7a04d commit 6cf329f
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/eventdev_pipeline/pipeline_worker_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ setup_eventdev_generic(struct worker_data *worker_data)
config.nb_event_port_enqueue_depth =
dev_info.max_event_port_enqueue_depth;

if (dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE)
config.preschedule_type = RTE_EVENT_PRESCHEDULE;

if (dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE_ADAPTIVE)
config.preschedule_type = RTE_EVENT_PRESCHEDULE_ADAPTIVE;

ret = rte_event_dev_configure(dev_id, &config);
if (ret < 0) {
printf("%d: Error configuring device\n", __LINE__);
Expand Down
6 changes: 6 additions & 0 deletions examples/eventdev_pipeline/pipeline_worker_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,12 @@ setup_eventdev_worker_tx_enq(struct worker_data *worker_data)
config.nb_event_port_enqueue_depth =
dev_info.max_event_port_enqueue_depth;

if (dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE)
config.preschedule_type = RTE_EVENT_PRESCHEDULE;

if (dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE_ADAPTIVE)
config.preschedule_type = RTE_EVENT_PRESCHEDULE_ADAPTIVE;

ret = rte_event_dev_configure(dev_id, &config);
if (ret < 0) {
printf("%d: Error configuring device\n", __LINE__);
Expand Down
6 changes: 6 additions & 0 deletions examples/ipsec-secgw/event_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,12 @@ eh_initialize_eventdev(struct eventmode_conf *em_conf)
eventdev_conf.nb_event_port_enqueue_depth =
evdev_default_conf.max_event_port_enqueue_depth;

if (evdev_default_conf.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE)
eventdev_conf.preschedule_type = RTE_EVENT_PRESCHEDULE;

if (evdev_default_conf.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE_ADAPTIVE)
eventdev_conf.preschedule_type = RTE_EVENT_PRESCHEDULE_ADAPTIVE;

/* Configure event device */
ret = rte_event_dev_configure(eventdev_id, &eventdev_conf);
if (ret < 0) {
Expand Down
6 changes: 6 additions & 0 deletions examples/l2fwd-event/l2fwd_event_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ l2fwd_event_device_setup_generic(struct l2fwd_resources *rsrc)
evt_rsrc->has_burst = !!(dev_info.event_dev_cap &
RTE_EVENT_DEV_CAP_BURST_MODE);

if (dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE)
event_d_conf.preschedule_type = RTE_EVENT_PRESCHEDULE;

if (dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE_ADAPTIVE)
event_d_conf.preschedule_type = RTE_EVENT_PRESCHEDULE_ADAPTIVE;

ret = rte_event_dev_configure(event_d_id, &event_d_conf);
if (ret < 0)
rte_panic("Error in configuring event device\n");
Expand Down
6 changes: 6 additions & 0 deletions examples/l2fwd-event/l2fwd_event_internal_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ l2fwd_event_device_setup_internal_port(struct l2fwd_resources *rsrc)
evt_rsrc->has_burst = !!(dev_info.event_dev_cap &
RTE_EVENT_DEV_CAP_BURST_MODE);

if (dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE)
event_d_conf.preschedule_type = RTE_EVENT_PRESCHEDULE;

if (dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE_ADAPTIVE)
event_d_conf.preschedule_type = RTE_EVENT_PRESCHEDULE_ADAPTIVE;

ret = rte_event_dev_configure(event_d_id, &event_d_conf);
if (ret < 0)
rte_panic("Error in configuring event device\n");
Expand Down
6 changes: 6 additions & 0 deletions examples/l3fwd/l3fwd_event_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ l3fwd_event_device_setup_generic(void)
evt_rsrc->has_burst = !!(dev_info.event_dev_cap &
RTE_EVENT_DEV_CAP_BURST_MODE);

if (dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE)
event_d_conf.preschedule_type = RTE_EVENT_PRESCHEDULE;

if (dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE_ADAPTIVE)
event_d_conf.preschedule_type = RTE_EVENT_PRESCHEDULE_ADAPTIVE;

ret = rte_event_dev_configure(event_d_id, &event_d_conf);
if (ret < 0)
rte_panic("Error in configuring event device\n");
Expand Down
6 changes: 6 additions & 0 deletions examples/l3fwd/l3fwd_event_internal_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ l3fwd_event_device_setup_internal_port(void)
evt_rsrc->has_burst = !!(dev_info.event_dev_cap &
RTE_EVENT_DEV_CAP_BURST_MODE);

if (dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE)
event_d_conf.preschedule_type = RTE_EVENT_PRESCHEDULE;

if (dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE_ADAPTIVE)
event_d_conf.preschedule_type = RTE_EVENT_PRESCHEDULE_ADAPTIVE;

ret = rte_event_dev_configure(event_d_id, &event_d_conf);
if (ret < 0)
rte_panic("Error in configuring event device\n");
Expand Down

0 comments on commit 6cf329f

Please sign in to comment.