#include <stdbool.h>
#include <getopt.h>
-#include <rte_atomic.h>
#include <rte_cycles.h>
#include <rte_ethdev.h>
#include <rte_eventdev.h>
/* Get the core which has least number of services running. */
while (slcore_count--) {
/* Reset default mapping */
- rte_service_map_lcore_set(service_id,
- slcore_array[slcore_count], 0);
+ if (rte_service_map_lcore_set(service_id,
+ slcore_array[slcore_count], 0) != 0)
+ return -ENOENT;
service_count = rte_service_lcore_count_services(
slcore_array[slcore_count]);
if (service_count < min_service_count) {
min_service_count = service_count;
}
}
- if (rte_service_map_lcore_set(service_id, slcore, 1))
+ if (rte_service_map_lcore_set(service_id, slcore, 1) != 0)
return -ENOENT;
rte_service_lcore_start(slcore);
uint32_t service_id, caps;
int ret, i;
+ /* Running eventdev scheduler service on service core. 8< */
rte_event_dev_info_get(evt_rsrc->event_d_id, &evdev_info);
- if (evdev_info.event_dev_cap & RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED) {
+ if (!(evdev_info.event_dev_cap & RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED)) {
ret = rte_event_dev_service_id_get(evt_rsrc->event_d_id,
&service_id);
if (ret != -ESRCH && ret != 0)
rte_panic("Error in starting eventdev service\n");
l2fwd_event_service_enable(service_id);
}
+ /* >8 End of running eventdev scheduler service on service core. */
+ /* Gets service ID for RX/TX adapters. 8< */
for (i = 0; i < evt_rsrc->rx_adptr.nb_rx_adptr; i++) {
ret = rte_event_eth_rx_adapter_caps_get(evt_rsrc->event_d_id,
evt_rsrc->rx_adptr.rx_adptr[i], &caps);
evt_rsrc->tx_adptr.tx_adptr[i]);
l2fwd_event_service_enable(service_id);
}
+ /* >8 End of get service ID for RX/TX adapters. */
}
static void
rte_lcore_id());
while (!rsrc->force_quit) {
- /* Read packet from eventdev */
+ /* Read packet from eventdev. 8< */
nb_rx = rte_event_dequeue_burst(event_d_id, port_id, ev,
deq_len, 0);
if (nb_rx == 0)
l2fwd_event_fwd(rsrc, &ev[i], tx_q_id, timer_period,
flags);
}
+ /* >8 End of reading packets from eventdev. */
if (flags & L2FWD_EVENT_TX_ENQ) {
+ /* Forwarding to destination ports. 8< */
nb_tx = rte_event_enqueue_burst(event_d_id, port_id,
ev, nb_rx);
while (nb_tx < nb_rx && !rsrc->force_quit)
nb_tx += rte_event_enqueue_burst(event_d_id,
port_id, ev + nb_tx,
nb_rx - nb_tx);
+ /* >8 End of forwarding to destination ports. */
}
if (flags & L2FWD_EVENT_TX_DIRECT) {