summaryrefslogtreecommitdiffstats
path: root/src/source-dpdk.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:39:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:39:49 +0000
commita0aa2307322cd47bbf416810ac0292925e03be87 (patch)
tree37076262a026c4b48c8a0e84f44ff9187556ca35 /src/source-dpdk.h
parentInitial commit. (diff)
downloadsuricata-a0aa2307322cd47bbf416810ac0292925e03be87.tar.xz
suricata-a0aa2307322cd47bbf416810ac0292925e03be87.zip
Adding upstream version 1:7.0.3.upstream/1%7.0.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/source-dpdk.h')
-rw-r--r--src/source-dpdk.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/src/source-dpdk.h b/src/source-dpdk.h
new file mode 100644
index 0000000..3fdb63c
--- /dev/null
+++ b/src/source-dpdk.h
@@ -0,0 +1,94 @@
+/* Copyright (C) 2021 Open Information Security Foundation
+ *
+ * You can copy, redistribute or modify this Program under the terms of
+ * the GNU General Public License version 2 as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+/**
+ * \file
+ *
+ * \author Lukas Sismis <lukas.sismis@gmail.com>
+ */
+
+#ifndef __SOURCE_DPDK_H__
+#define __SOURCE_DPDK_H__
+
+#include "suricata-common.h"
+
+#ifdef HAVE_DPDK
+#include <rte_ethdev.h>
+#endif
+
+typedef enum { DPDK_COPY_MODE_NONE, DPDK_COPY_MODE_TAP, DPDK_COPY_MODE_IPS } DpdkCopyModeEnum;
+
+#define DPDK_BURST_TX_WAIT_US 1
+
+/* DPDK Flags */
+// General flags
+#define DPDK_PROMISC (1 << 0) /**< Promiscuous mode */
+#define DPDK_MULTICAST (1 << 1) /**< Enable multicast packets */
+// Offloads
+#define DPDK_RX_CHECKSUM_OFFLOAD (1 << 4) /**< Enable chsum offload */
+
+void DPDKSetTimevalOfMachineStart(void);
+typedef struct DPDKIfaceConfig_ {
+#ifdef HAVE_DPDK
+ char iface[RTE_ETH_NAME_MAX_LEN];
+ uint16_t port_id;
+ int32_t socket_id;
+ /* number of threads - zero means all available */
+ int threads;
+ /* IPS mode */
+ DpdkCopyModeEnum copy_mode;
+ const char *out_iface;
+ uint16_t out_port_id;
+ /* DPDK flags */
+ uint32_t flags;
+ ChecksumValidationMode checksum_mode;
+ uint64_t rss_hf;
+ /* set maximum transmission unit of the device in bytes */
+ uint16_t mtu;
+ uint16_t nb_rx_queues;
+ uint16_t nb_rx_desc;
+ uint16_t nb_tx_queues;
+ uint16_t nb_tx_desc;
+ uint32_t mempool_size;
+ uint32_t mempool_cache_size;
+ struct rte_mempool *pkt_mempool;
+ SC_ATOMIC_DECLARE(unsigned int, ref);
+ /* threads bind queue id one by one */
+ SC_ATOMIC_DECLARE(uint16_t, queue_id);
+ SC_ATOMIC_DECLARE(uint16_t, inconsitent_numa_cnt);
+ void (*DerefFunc)(void *);
+
+ struct rte_flow *flow[100];
+#endif
+} DPDKIfaceConfig;
+
+/**
+ * \brief per packet DPDK vars
+ *
+ * This structure is used by the release data system and for IPS
+ */
+typedef struct DPDKPacketVars_ {
+ struct rte_mbuf *mbuf;
+ uint16_t out_port_id;
+ uint16_t out_queue_id;
+ uint8_t copy_mode;
+} DPDKPacketVars;
+
+void TmModuleReceiveDPDKRegister(void);
+void TmModuleDecodeDPDKRegister(void);
+
+#endif /* __SOURCE_DPDK_H__ */