suricata
util-dpdk.h
Go to the documentation of this file.
1 /* Copyright (C) 2021 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Lukas Sismis <lukas.sismis@gmail.com>
22  */
23 
24 #ifndef UTIL_DPDK_H
25 #define UTIL_DPDK_H
26 
27 #ifdef HAVE_DPDK
28 
29 #include <rte_eal.h>
30 #include <rte_ethdev.h>
31 #include <rte_launch.h>
32 #include <rte_lcore.h>
33 #include <rte_log.h>
34 #include <rte_mempool.h>
35 #include <rte_mbuf.h>
36 #include <rte_flow.h>
37 
38 #if RTE_VER_YEAR < 22
39 #define RTE_ETH_MQ_RX_RSS ETH_MQ_RX_RSS
40 
41 #endif
42 
43 #if RTE_VER_YEAR < 21 || RTE_VER_YEAR == 21 && RTE_VER_MONTH < 11
44 #define RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE DEV_TX_OFFLOAD_MBUF_FAST_FREE
45 
46 #define RTE_ETH_RX_OFFLOAD_CHECKSUM DEV_RX_OFFLOAD_CHECKSUM
47 #define RTE_ETH_RX_OFFLOAD_RSS_HASH DEV_RX_OFFLOAD_RSS_HASH
48 
49 #define RTE_ETH_MQ_TX_NONE ETH_MQ_TX_NONE
50 
51 #define RTE_ETH_MQ_RX_NONE ETH_MQ_RX_NONE
52 
53 #define RTE_ETH_RSS_IP ETH_RSS_IP
54 #define RTE_ETH_RSS_UDP ETH_RSS_UDP
55 #define RTE_ETH_RSS_TCP ETH_RSS_TCP
56 #define RTE_ETH_RSS_SCTP ETH_RSS_SCTP
57 #define RTE_ETH_RSS_TUNNEL ETH_RSS_TUNNEL
58 
59 #define RTE_ETH_RSS_L3_SRC_ONLY ETH_RSS_L3_SRC_ONLY
60 #define RTE_ETH_RSS_L3_DST_ONLY ETH_RSS_L3_DST_ONLY
61 #define RTE_ETH_RSS_L4_SRC_ONLY ETH_RSS_L4_SRC_ONLY
62 #define RTE_ETH_RSS_L4_DST_ONLY ETH_RSS_L4_DST_ONLY
63 
64 #define RTE_ETH_RSS_IPV4 ETH_RSS_IPV4
65 #define RTE_ETH_RSS_FRAG_IPV4 ETH_RSS_FRAG_IPV4
66 #define RTE_ETH_RSS_NONFRAG_IPV4_TCP ETH_RSS_NONFRAG_IPV4_TCP
67 #define RTE_ETH_RSS_NONFRAG_IPV4_UDP ETH_RSS_NONFRAG_IPV4_UDP
68 #define RTE_ETH_RSS_NONFRAG_IPV4_SCTP ETH_RSS_NONFRAG_IPV4_SCTP
69 #define RTE_ETH_RSS_NONFRAG_IPV4_OTHER ETH_RSS_NONFRAG_IPV4_OTHER
70 #define RTE_ETH_RSS_IPV6 ETH_RSS_IPV6
71 #define RTE_ETH_RSS_FRAG_IPV6 ETH_RSS_FRAG_IPV6
72 #define RTE_ETH_RSS_NONFRAG_IPV6_TCP ETH_RSS_NONFRAG_IPV6_TCP
73 #define RTE_ETH_RSS_NONFRAG_IPV6_UDP ETH_RSS_NONFRAG_IPV6_UDP
74 #define RTE_ETH_RSS_NONFRAG_IPV6_SCTP ETH_RSS_NONFRAG_IPV6_SCTP
75 #define RTE_ETH_RSS_NONFRAG_IPV6_OTHER ETH_RSS_NONFRAG_IPV6_OTHER
76 #define RTE_ETH_RSS_L2_PAYLOAD ETH_RSS_L2_PAYLOAD
77 #define RTE_ETH_RSS_IPV6_EX ETH_RSS_IPV6_EX
78 #define RTE_ETH_RSS_IPV6_TCP_EX ETH_RSS_IPV6_TCP_EX
79 #define RTE_ETH_RSS_IPV6_UDP_EX ETH_RSS_IPV6_UDP_EX
80 #define RTE_ETH_RSS_PORT ETH_RSS_PORT
81 #define RTE_ETH_RSS_VXLAN ETH_RSS_VXLAN
82 #define RTE_ETH_RSS_GENEVE ETH_RSS_GENEVE
83 #define RTE_ETH_RSS_NVGRE ETH_RSS_NVGRE
84 #define RTE_ETH_RSS_GTPU ETH_RSS_GTPU
85 
86 #define RTE_MBUF_F_RX_IP_CKSUM_MASK PKT_RX_IP_CKSUM_MASK
87 #define RTE_MBUF_F_RX_IP_CKSUM_NONE PKT_RX_IP_CKSUM_NONE
88 #define RTE_MBUF_F_RX_IP_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD
89 #define RTE_MBUF_F_RX_IP_CKSUM_BAD PKT_RX_IP_CKSUM_BAD
90 
91 #define RTE_MBUF_F_RX_L4_CKSUM_MASK PKT_RX_L4_CKSUM_MASK
92 #define RTE_MBUF_F_RX_L4_CKSUM_GOOD PKT_RX_L4_CKSUM_GOOD
93 #define RTE_MBUF_F_RX_L4_CKSUM_BAD PKT_RX_L4_CKSUM_BAD
94 #endif
95 
96 #endif /* HAVE_DPDK */
97 
98 #include "util-device.h"
99 
100 void DPDKCleanupEAL(void);
101 
102 void DPDKCloseDevice(LiveDevice *ldev);
103 
104 #endif /* UTIL_DPDK_H */
DPDKCloseDevice
void DPDKCloseDevice(LiveDevice *ldev)
Definition: util-dpdk.c:39
LiveDevice_
Definition: util-device.h:39
util-device.h
DPDKCleanupEAL
void DPDKCleanupEAL(void)
Definition: util-dpdk.c:28