examples/l2fwd-event: add infra for eventdev
[dpdk.git] / examples / l2fwd-event / l2fwd_event.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2019 Marvell International Ltd.
3  */
4
5 #include <stdbool.h>
6 #include <getopt.h>
7
8 #include <rte_atomic.h>
9 #include <rte_cycles.h>
10 #include <rte_ethdev.h>
11 #include <rte_eventdev.h>
12 #include <rte_event_eth_rx_adapter.h>
13 #include <rte_event_eth_tx_adapter.h>
14 #include <rte_lcore.h>
15 #include <rte_malloc.h>
16 #include <rte_spinlock.h>
17
18 #include "l2fwd_event.h"
19
20 void
21 l2fwd_event_resource_setup(struct l2fwd_resources *rsrc)
22 {
23         struct l2fwd_event_resources *evt_rsrc;
24
25         if (!rte_event_dev_count())
26                 rte_panic("No Eventdev found\n");
27
28         evt_rsrc = rte_zmalloc("l2fwd_event",
29                                  sizeof(struct l2fwd_event_resources), 0);
30         if (evt_rsrc == NULL)
31                 rte_panic("Failed to allocate memory\n");
32
33         rsrc->evt_rsrc = evt_rsrc;
34 }