examples/l3fwd: add framework for event device
[dpdk.git] / examples / l3fwd / l3fwd_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_malloc.h>
9
10 #include "l3fwd.h"
11 #include "l3fwd_event.h"
12
13 struct l3fwd_event_resources *
14 l3fwd_get_eventdev_rsrc(void)
15 {
16         static struct l3fwd_event_resources *rsrc;
17
18         if (rsrc != NULL)
19                 return rsrc;
20
21         rsrc = rte_zmalloc("l3fwd", sizeof(struct l3fwd_event_resources), 0);
22         if (rsrc != NULL) {
23                 rsrc->sched_type = RTE_SCHED_TYPE_ATOMIC;
24                 rsrc->eth_rx_queues = 1;
25                 return rsrc;
26         }
27
28         rte_exit(EXIT_FAILURE, "Unable to allocate memory for eventdev cfg\n");
29
30         return NULL;
31 }
32
33 void
34 l3fwd_event_resource_setup(void)
35 {
36         struct l3fwd_event_resources *evt_rsrc = l3fwd_get_eventdev_rsrc();
37
38         if (!evt_rsrc->enabled)
39                 return;
40 }