netdev-dpdk: fix mbuf leaks
[cascardo/ovs.git] / lib / netdev-dpdk.h
1 #ifndef NETDEV_DPDK_H
2 #define NETDEV_DPDK_H
3
4 #include <config.h>
5
6 struct dp_packet;
7
8 #ifdef DPDK_NETDEV
9
10 #include <rte_config.h>
11 #include <rte_eal.h>
12 #include <rte_debug.h>
13 #include <rte_ethdev.h>
14 #include <rte_eth_ring.h>
15 #include <rte_errno.h>
16 #include <rte_memzone.h>
17 #include <rte_memcpy.h>
18 #include <rte_cycles.h>
19 #include <rte_spinlock.h>
20 #include <rte_launch.h>
21 #include <rte_malloc.h>
22
23 #define NON_PMD_CORE_ID LCORE_ID_ANY
24
25 int dpdk_init(int argc, char **argv);
26 void netdev_dpdk_register(void);
27 void free_dpdk_buf(struct dp_packet *);
28 int pmd_thread_setaffinity_cpu(unsigned cpu);
29
30 #else
31
32 #define NON_PMD_CORE_ID UINT32_MAX
33
34 #include "util.h"
35
36 static inline int
37 dpdk_init(int argc, char **argv)
38 {
39     if (argc >= 2 && !strcmp(argv[1], "--dpdk")) {
40         ovs_fatal(0, "DPDK support not built into this copy of Open vSwitch.");
41     }
42     return 0;
43 }
44
45 static inline void
46 netdev_dpdk_register(void)
47 {
48     /* Nothing */
49 }
50
51 static inline void
52 free_dpdk_buf(struct dp_packet *buf OVS_UNUSED)
53 {
54     /* Nothing */
55 }
56
57 static inline int
58 pmd_thread_setaffinity_cpu(unsigned cpu OVS_UNUSED)
59 {
60     return 0;
61 }
62
63 #endif /* DPDK_NETDEV */
64 #endif