FD.io VPP  v18.01.2-1-g9b554f3
Vector Packet Processing
flowprobe.h
Go to the documentation of this file.
1 /*
2  * flowprobe.h - ipfix probe plug-in header file
3  *
4  * Copyright (c) 2016 Cisco and/or its affiliates.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #ifndef __included_flowprobe_h__
18 #define __included_flowprobe_h__
19 
20 #include <vnet/vnet.h>
21 #include <vnet/ip/ip.h>
22 #include <vnet/ethernet/ethernet.h>
23 
24 #include <vppinfra/hash.h>
25 #include <vppinfra/error.h>
26 #include <vnet/flow/flow_report.h>
29 
30 /* Default timers in seconds */
31 #define FLOWPROBE_TIMER_ACTIVE (15)
32 #define FLOWPROBE_TIMER_PASSIVE 120 // XXXX: FOR TESTING (30*60)
33 #define FLOWPROBE_LOG2_HASHSIZE (18)
34 
35 typedef enum
36 {
37  FLOW_RECORD_L2 = 1 << 0,
38  FLOW_RECORD_L3 = 1 << 1,
39  FLOW_RECORD_L4 = 1 << 2,
42  FLOW_N_RECORDS = 1 << 5,
44 
45 /* *INDENT-OFF* */
46 typedef enum __attribute__ ((__packed__))
47 {
55 /* *INDENT-ON* */
56 
57 STATIC_ASSERT (sizeof (flowprobe_variant_t) == 1,
58  "flowprobe_variant_t is expected to be 1 byte, "
59  "revisit padding in flowprobe_key_t");
60 
61 #define FLOW_MAXIMUM_EXPORT_ENTRIES (1024)
62 
63 typedef struct
64 {
65  /* what to collect per variant */
67  /** ipfix buffers under construction, per-worker thread */
69  /** frames containing ipfix buffers, per-worker thread */
71  /** next record offset, per worker thread */
74 
75 /* *INDENT-OFF* */
76 typedef struct __attribute__ ((aligned (8))) {
79  u8 src_mac[6];
80  u8 dst_mac[6];
82  ip46_address_t src_address;
83  ip46_address_t dst_address;
87  flowprobe_variant_t which;
89 /* *INDENT-ON* */
90 
91 typedef struct
92 {
96 
97 typedef struct
98 {
107  union
108  {
109  struct
110  {
112  } tcp;
113  } prot;
115 
116 /**
117  * @file
118  * @brief flow-per-packet plugin header file
119  */
120 typedef struct
121 {
122  /** API message ID base */
124 
126  u16 template_reports[FLOW_N_RECORDS];
127  u16 template_size[FLOW_N_RECORDS];
128 
129  /** Time reference pair */
132 
133  /** Per CPU flow-state */
134  u8 ht_log2len; /* Hash table size is 2^log2len */
137  /* *INDENT-OFF* */
138  TWT (tw_timer_wheel) ** timers_per_worker;
139  /* *INDENT-ON* */
141 
146 
148  bool disabled;
149 
150  u16 template_per_flow[FLOW_N_VARIANTS];
152 
153  /** convenience vlib_main_t pointer */
155  /** convenience vnet_main_t pointer */
158 
160 
161 void flowprobe_flush_callback_ip4 (void);
162 void flowprobe_flush_callback_ip6 (void);
163 void flowprobe_flush_callback_l2 (void);
164 u8 *format_flowprobe_entry (u8 * s, va_list * args);
165 
166 #endif
167 
168 /*
169  * fd.io coding-style-patch-verification: ON
170  *
171  * Local Variables:
172  * eval: (c-set-style "gnu")
173  * End:
174  */
flowprobe_variant_t
Definition: flowprobe.h:46
u32 ** expired_passive_per_worker
Definition: flowprobe.h:140
void flowprobe_flush_callback_ip6(void)
Definition: node.c:892
ip46_address_t src_address
Definition: flowprobe.h:82
flowprobe_key_t key
Definition: flowprobe.h:99
flowprobe_record_t record
Definition: flowprobe.h:142
u8 * format_flowprobe_entry(u8 *s, va_list *args)
Definition: flowprobe.c:763
flowprobe_entry_t * stateless_entry
Definition: flowprobe.h:145
u32 tx_sw_if_index
Definition: flowprobe.h:78
u8 * flow_per_interface
Definition: flowprobe.h:151
flowprobe_entry_t ** pool_per_worker
Definition: flowprobe.h:136
flowprobe_variant_t which
Definition: flowprobe.h:87
vlib_frame_t ** frames_per_worker
frames containing ipfix buffers, per-worker thread
Definition: flowprobe.h:70
u32 ** hash_per_worker
Definition: flowprobe.h:135
unsigned long u64
Definition: types.h:89
void flowprobe_flush_callback_ip4(void)
Definition: node.c:886
u64 nanosecond_time_0
Time reference pair.
Definition: flowprobe.h:130
u8 ht_log2len
Per CPU flow-state.
Definition: flowprobe.h:134
u32 rx_sw_if_index
Definition: flowprobe.h:77
#define TWT(a)
u32 passive_timer_handle
Definition: flowprobe.h:106
u16 flags
Definition: flowprobe.h:111
u64 packetcount
Definition: flowprobe.h:100
f64 last_exported
Definition: flowprobe.h:105
vnet_main_t * vnet_main
convenience vnet_main_t pointer
Definition: flowprobe.h:156
flowprobe_main_t flowprobe_main
Definition: flowprobe.c:53
timestamp_nsec_t flow_start
Definition: flowprobe.h:102
STATIC_ASSERT(sizeof(flowprobe_variant_t)==1,"flowprobe_variant_t is expected to be 1 byte, ""revisit padding in flowprobe_key_t")
flowprobe_record_t
Definition: flowprobe.h:35
unsigned int u32
Definition: types.h:88
vlib_buffer_t ** buffers_per_worker
ipfix buffers under construction, per-worker thread
Definition: flowprobe.h:68
unsigned short u16
Definition: types.h:57
void flowprobe_flush_callback_l2(void)
Definition: node.c:898
double f64
Definition: types.h:142
unsigned char u8
Definition: types.h:56
f64 last_updated
Definition: flowprobe.h:104
u16 msg_id_base
API message ID base.
Definition: flowprobe.h:123
ip46_address_t dst_address
Definition: flowprobe.h:83
u16 * next_record_offset_per_worker
next record offset, per worker thread
Definition: flowprobe.h:72
timestamp_nsec_t flow_end
Definition: flowprobe.h:103
flowprobe_record_t flags
Definition: flowprobe.h:66
u64 octetcount
Definition: flowprobe.h:101
Definition: flowprobe.h:97
vlib_main_t * vlib_main
convenience vlib_main_t pointer
Definition: flowprobe.h:154