diff options
author | Damjan Marion <damarion@cisco.com> | 2021-01-27 21:17:48 +0100 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2021-07-16 11:36:32 +0000 |
commit | 839b1473e96800f577d06b14234aef9b573bb303 (patch) | |
tree | 7e87c52cafc49a1a66c2ba3e56af1e8e22f92144 /src/plugins/snort/daq_vpp.h | |
parent | 0ec7dad7a00852663eb88554561347987f87bb53 (diff) |
snort: snort3 plugin and DAQ
Zero copy interface which exposes VPP buffers to snort instance(s).
Includes VPP DAQ which is compiled only if libdaq 3 API headers are
available.
Type: feature
Change-Id: I96611b43f94fbae091e7391589e0454ae66de88b
Signed-off-by: Damjan Marion <damarion@cisco.com>
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/plugins/snort/daq_vpp.h')
-rw-r--r-- | src/plugins/snort/daq_vpp.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/plugins/snort/daq_vpp.h b/src/plugins/snort/daq_vpp.h new file mode 100644 index 00000000000..3b875aa15ad --- /dev/null +++ b/src/plugins/snort/daq_vpp.h @@ -0,0 +1,77 @@ +/* SPDX-License-Identifier: Apache-2.0 + * Copyright(c) 2021 Cisco Systems, Inc. + */ + +#ifndef __DAQ_VPP_H__ +#define __DAQ_VPP_H__ + +#include <stdint.h> + +#define DAQ_VPP_DEFAULT_SOCKET_FILE "snort.sock" +#define DAQ_VPP_DEFAULT_SOCKET_PATH "/run/vpp/" DAQ_VPP_DEFAULT_SOCKET_FILE +#define DAQ_VPP_INST_NAME_LEN 32 + +typedef enum memif_msg_type +{ + DAQ_VPP_MSG_TYPE_NONE = 0, + DAQ_VPP_MSG_TYPE_HELLO = 1, + DAQ_VPP_MSG_TYPE_CONFIG = 2, + DAQ_VPP_MSG_TYPE_BPOOL = 3, + DAQ_VPP_MSG_TYPE_QPAIR = 4, +} daq_vpp_msg_type_t; + +typedef struct +{ + char inst_name[DAQ_VPP_INST_NAME_LEN]; +} daq_vpp_msg_hello_t; + +typedef struct +{ + uint32_t shm_size; + uint16_t num_bpools; + uint16_t num_qpairs; +} daq_vpp_msg_config_t; + +typedef struct +{ + uint32_t size; +} daq_vpp_msg_bpool_t; + +typedef struct +{ + uint8_t log2_queue_size; + uint32_t desc_table_offset; + uint32_t enq_head_offset; + uint32_t deq_head_offset; + uint32_t enq_ring_offset; + uint32_t deq_ring_offset; +} daq_vpp_msg_qpair_t; + +typedef struct +{ + daq_vpp_msg_type_t type : 8; + union + { + daq_vpp_msg_hello_t hello; + daq_vpp_msg_config_t config; + daq_vpp_msg_bpool_t bpool; + daq_vpp_msg_qpair_t qpair; + }; +} daq_vpp_msg_t; + +typedef enum +{ + DAQ_VPP_ACTION_DROP, + DAQ_VPP_ACTION_FORWARD, +} daq_vpp_action_t; + +typedef struct +{ + uint32_t offset; + uint16_t length; + uint16_t address_space_id; + uint8_t buffer_pool; + daq_vpp_action_t action : 8; +} daq_vpp_desc_t; + +#endif /* __DAQ_VPP_H__ */ |