FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
snort.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright(c) 2021 Cisco Systems, Inc.
3  */
4 
5 #ifndef __snort_snort_h__
6 #define __snort_snort_h__
7 
8 #include <vppinfra/error.h>
9 #include <vppinfra/socket.h>
10 #include <vlib/vlib.h>
11 #include <snort/daq_vpp.h>
12 
13 typedef struct
14 {
15  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
18  volatile u32 *enq_head;
19  volatile u32 *deq_head;
20  volatile u32 *enq_ring;
21  volatile u32 *deq_ring;
23  int enq_fd, deq_fd;
29 
30  /* temporary storeage used by enqueue node */
32  u16 pending_nexts[VLIB_FRAME_SIZE];
33  u32 pending_buffers[VLIB_FRAME_SIZE];
36 
37 typedef struct
38 {
41  void *shm_base;
43  int shm_fd;
45  u8 *name;
48 
49 typedef struct
50 {
52  int fds[2];
53  int n_fds;
55 
56 typedef struct
57 {
63 
64 typedef struct
65 {
66  /* per-instance dequeue interrupts */
67  void *interrupts;
69 
70 typedef struct
71 {
81 } snort_main_t;
82 
86 
87 typedef enum
88 {
92 
93 #define SNORT_ENQ_NEXT_NODES \
94  { \
95  [SNORT_ENQ_NEXT_DROP] = "error-drop", \
96  }
97 
98 /* functions */
100  u8 log2_queue_sz, u8 drop_on_disconnect);
102  char *instance_name,
103  u32 sw_if_index, int is_enable);
105 
106 always_inline void
108 {
109  for (int j = 0; j < vec_len (fl); j++)
110  fl[j] = j;
111 }
112 
113 #endif /* __snort_snort_h__ */
vlib.h
snort_qpair_t::freelist
u32 * freelist
Definition: snort.h:27
SNORT_ENQ_N_NEXT_NODES
@ SNORT_ENQ_N_NEXT_NODES
Definition: snort.h:90
snort_qpair_t::descriptors
daq_vpp_desc_t * descriptors
Definition: snort.h:17
snort_per_thread_data_t
Definition: snort.h:64
snort_main
snort_main_t snort_main
Definition: main.c:12
snort_qpair_t::buffer_indices
u32 * buffer_indices
Definition: snort.h:25
snort_client_t::msg_queue
snort_client_msg_queue_elt * msg_queue
Definition: snort.h:61
CLIB_CACHE_LINE_ALIGN_MARK
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
Definition: cache.h:60
name
string name[64]
Definition: fib.api:25
VLIB_FRAME_SIZE
#define VLIB_FRAME_SIZE
Definition: node.h:368
snort_main_t::socket_name
u8 * socket_name
Definition: snort.h:80
daq_vpp.h
u16
unsigned short u16
Definition: types.h:57
mode
vl_api_tunnel_mode_t mode
Definition: gre.api:48
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
snort_instance_t::shm_base
void * shm_base
Definition: snort.h:41
daq_vpp_desc_t
Definition: daq_vpp.h:68
snort_instance_t::index
u32 index
Definition: snort.h:39
snort_instance_t::qpairs
snort_qpair_t * qpairs
Definition: snort.h:44
snort_qpair_t::enq_ring
volatile u32 * enq_ring
Definition: snort.h:20
snort_qpair_t::enq_fd
int enq_fd
Definition: snort.h:23
snort_instance_t::client_index
u32 client_index
Definition: snort.h:40
snort_instance_create
clib_error_t * snort_instance_create(vlib_main_t *vm, char *name, u8 log2_queue_sz, u8 drop_on_disconnect)
Definition: main.c:275
snort_main_t::clients
snort_client_t * clients
Definition: snort.h:73
snort_per_thread_data_t::interrupts
void * interrupts
Definition: snort.h:67
snort_main_t
Definition: snort.h:70
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
error.h
snort_instance_t::name
u8 * name
Definition: snort.h:45
snort_main_t::instances
snort_instance_t * instances
Definition: snort.h:74
snort_main_t::listener
clib_socket_t * listener
Definition: snort.h:72
snort_instance_t::shm_size
u32 shm_size
Definition: snort.h:42
daq_vpp_msg_t
Definition: daq_vpp.h:50
uword
u64 uword
Definition: types.h:112
fl
#define fl(x, y)
snort_client_t::instance_index
u32 instance_index
Definition: snort.h:59
snort_deq_node
vlib_node_registration_t snort_deq_node
(constructor) VLIB_REGISTER_NODE (snort_deq_node)
Definition: dequeue.c:354
snort_freelist_init
static void snort_freelist_init(u32 *fl)
Definition: snort.h:107
snort_main_t::per_thread_data
snort_per_thread_data_t * per_thread_data
Definition: snort.h:78
snort_qpair_t::deq_fd_file_index
u32 deq_fd_file_index
Definition: snort.h:24
snort_main_t::instance_by_sw_if_index
u32 * instance_by_sw_if_index
Definition: snort.h:76
snort_qpair_t::enq_head
volatile u32 * enq_head
Definition: snort.h:18
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
snort_enq_node
vlib_node_registration_t snort_enq_node
(constructor) VLIB_REGISTER_NODE (snort_enq_node)
Definition: enqueue.c:214
snort_main_t::input_mode
u32 input_mode
Definition: snort.h:79
snort_qpair_t::next_indices
u16 * next_indices
Definition: snort.h:26
snort_client_msg_queue_elt
Definition: snort.h:49
snort_client_msg_queue_elt::msg
daq_vpp_msg_t msg
Definition: snort.h:51
always_inline
#define always_inline
Definition: rdma_mlx5dv.h:23
snort_instance_t
Definition: snort.h:37
snort_instance_t::drop_on_disconnect
u8 drop_on_disconnect
Definition: snort.h:46
snort_qpair_t
Definition: snort.h:13
snort_interface_enable_disable
clib_error_t * snort_interface_enable_disable(vlib_main_t *vm, char *instance_name, u32 sw_if_index, int is_enable)
Definition: main.c:403
u32
unsigned int u32
Definition: types.h:88
snort_main_t::instance_by_name
uword * instance_by_name
Definition: snort.h:75
snort_enq_next_t
snort_enq_next_t
Definition: snort.h:87
snort_qpair_t::deq_ring
volatile u32 * deq_ring
Definition: snort.h:21
snort_set_node_mode
clib_error_t * snort_set_node_mode(vlib_main_t *vm, u32 mode)
Definition: main.c:465
snort_client_t::file_index
u32 file_index
Definition: snort.h:60
SNORT_ENQ_NEXT_DROP
@ SNORT_ENQ_NEXT_DROP
Definition: snort.h:89
snort_instance_t::shm_fd
int shm_fd
Definition: snort.h:43
snort_qpair_t::ready
u32 ready
Definition: snort.h:28
snort_qpair_t::n_pending
u32 n_pending
Definition: snort.h:31
vlib_main_t
Definition: main.h:102
snort_qpair_t::next_desc
u32 next_desc
Definition: snort.h:22
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
snort_qpair_t::deq_head
volatile u32 * deq_head
Definition: snort.h:19
snort_client_t
Definition: snort.h:56
snort_main_t::buffer_pool_base_addrs
u8 ** buffer_pool_base_addrs
Definition: snort.h:77
socket.h
clib_socket_t
struct _socket_t clib_socket_t
snort_qpair_t::log2_queue_size
u8 log2_queue_size
Definition: snort.h:16
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
snort_client_msg_queue_elt::n_fds
int n_fds
Definition: snort.h:53
snort_client_t::socket
clib_socket_t socket
Definition: snort.h:58