FD.io VPP  v21.06
Vector Packet Processing
ad-flow.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef __included_srv6_ad_flow_h__
16 #define __included_srv6_ad_flow_h__
17 
18 #include <vnet/vnet.h>
19 #include <vnet/ip/ip.h>
20 #include <vnet/srv6/sr.h>
21 #include <vnet/srv6/sr_packet.h>
22 
23 #include <vppinfra/error.h>
24 #include <vppinfra/elog.h>
25 
26 #include <vppinfra/dlist.h>
27 #include <vppinfra/bihash_40_8.h>
28 
29 #define AD_TYPE_IP4 IP_PROTOCOL_IP_IN_IP
30 #define AD_TYPE_IP6 IP_PROTOCOL_IPV6
31 
32 #define SRV6_AD_FLOW_DEFAULT_CACHE_SIZE 100
33 #define SRV6_AD_CACHE_TIMEOUT 300
34 
35 /*
36  * Cache entries
37  */
38 typedef struct
39 {
40  /* Cache key (5-tuple) */
41  struct
42  {
43  ip46_address_t s_addr;
44  ip46_address_t d_addr;
48  } key;
49 
50  /* Cached encapsulation headers */
53 
54  /* Index in global LRU list */
56 
57  /* Last update timestamp */
59 
60  /* Last heard timestamp */
63 
64 /*
65  * This is the memory that will be stored per each localsid
66  * the user instantiates
67  */
68 typedef struct
69 {
70  ip46_address_t nh_addr; /**< Proxied device address */
71  u32 sw_if_index_out; /**< Outgoing iface to proxied dev. */
72  u32 nh_adj; /**< Adjacency index for out. iface */
74 
75  u32 sw_if_index_in; /**< Incoming iface from proxied dev. */
76 
80 
81  clib_bihash_40_8_t ftable; /**< Flow table */
82  srv6_ad_flow_entry_t *cache; /**< Cache table */
85 
88 
89 typedef struct
90 {
91  u16 msg_id_base; /**< API message ID base */
92 
93  vlib_main_t *vlib_main; /**< [convenience] vlib main */
94  vnet_main_t *vnet_main; /**< [convenience] vnet main */
95 
97 
98  u32 srv6_localsid_behavior_id; /**< SRv6 LocalSID behavior number */
99 
100  u32 *sw_iface_localsid2; /**< Retrieve local SID from iface */
101  u32 *sw_iface_localsid4; /**< Retrieve local SID from iface */
102  u32 *sw_iface_localsid6; /**< Retrieve local SID from iface */
103 
104  srv6_ad_flow_localsid_t **sids; /**< Pool of AD SID pointers */
105 
107  sid_bypass_counters; /**< Packets/bytes bypassing NF */
108  vlib_combined_counter_main_t sid_punt_counters; /**< Packets/bytes punted */
110 
112  rw_valid_counters; /**< Valid rewrite counters */
114  rw_invalid_counters; /**< Invalid rewrite counters */
116 
117 typedef struct
118 {
122 
124 
127 
128 void srv6_ad_flow_dpo_lock (dpo_id_t *dpo);
130 
132 
133 #endif /* __included_srv6_ad_flow_h__ */
134 
135 /*
136  * fd.io coding-style-patch-verification: ON
137  *
138  * Local Variables:
139  * eval: (c-set-style "gnu")
140  * End:
141  */
dpo_type_t srv6_ad_flow_dpo_type
DPO type.
Definition: ad-flow.h:96
u32 sw_if_index_out
Outgoing iface to proxied dev.
Definition: ad-flow.h:71
f64 now
Definition: ad-flow.h:120
u32 lru_index
Definition: ad-flow.h:55
srv6_ad_flow_entry_t * cache
Cache table.
Definition: ad-flow.h:82
ip46_address_t d_addr
Definition: ad-flow.h:44
unsigned char u8
Definition: types.h:56
double f64
Definition: types.h:142
unsigned int u32
Definition: types.h:88
u8 *() format_function_t(u8 *s, va_list *args)
Definition: format.h:48
f64 last_heard
Definition: ad-flow.h:61
enum dpo_type_t_ dpo_type_t
Common types of data-path objects New types can be dynamically added using dpo_register_new_type() ...
srv6_ad_flow_localsid_t * ls
Definition: ad-flow.h:119
u32 * sw_iface_localsid6
Retrieve local SID from iface.
Definition: ad-flow.h:102
srv6_ad_flow_localsid_t ** sids
Pool of AD SID pointers.
Definition: ad-flow.h:104
vlib_combined_counter_main_t sid_cache_full_counters
Definition: ad-flow.h:109
u8 proto
Definition: ad-flow.h:45
Definition: ad-flow.h:38
u16 s_port
Definition: ad-flow.h:46
u16 msg_id_base
API message ID base.
Definition: ad-flow.h:91
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:172
dlist_elt_t * lru_pool
Definition: ad-flow.h:83
void srv6_ad_flow_dpo_unlock(dpo_id_t *dpo)
Definition: ad-flow.c:402
unsigned short u16
Definition: types.h:57
u8 * rw_data
Definition: ad-flow.h:52
ip46_address_t nh_addr
Proxied device address.
Definition: ad-flow.h:70
f64 last_lru_update
Definition: ad-flow.h:58
uword() unformat_function_t(unformat_input_t *input, va_list *args)
Definition: format.h:225
unformat_function_t unformat_srv6_ad_flow_localsid
Definition: ad-flow.h:126
u32 sw_if_index_in
Incoming iface from proxied dev.
Definition: ad-flow.h:75
The fine-grained event logger allows lightweight, thread-safe event logging at minimum cost...
u32 rw_len
Definition: ad-flow.h:51
u32 srv6_localsid_behavior_id
SRv6 LocalSID behavior number.
Definition: ad-flow.h:98
vlib_combined_counter_main_t sid_bypass_counters
Packets/bytes bypassing NF.
Definition: ad-flow.h:107
vlib_combined_counter_main_t sid_punt_counters
Packets/bytes punted.
Definition: ad-flow.h:108
vnet_main_t * vnet_main
[convenience] vnet main
Definition: ad-flow.h:94
clib_bihash_40_8_t ftable
Flow table.
Definition: ad-flow.h:81
u32 * sw_iface_localsid4
Retrieve local SID from iface.
Definition: ad-flow.h:101
srv6_ad_flow_main_t srv6_ad_flow_main
Definition: ad-flow.c:41
vlib_combined_counter_main_t rw_invalid_counters
Invalid rewrite counters.
Definition: ad-flow.h:114
u32 * sw_iface_localsid2
Retrieve local SID from iface.
Definition: ad-flow.h:100
Definition: ad-flow.h:117
typedef key
Definition: ipsec_types.api:88
struct _vlib_node_registration vlib_node_registration_t
format_function_t format_srv6_ad_flow_localsid
Definition: ad-flow.h:125
ip46_address_t s_addr
Definition: ad-flow.h:43
u64 uword
Definition: types.h:112
void srv6_ad_flow_dpo_lock(dpo_id_t *dpo)
Definition: ad-flow.c:397
A collection of combined counters.
Definition: counter.h:203
Segment Routing data structures definitions.
vlib_node_registration_t srv6_ad_flow_localsid_node
(constructor) VLIB_REGISTER_NODE (srv6_ad_flow_localsid_node)
Definition: node.c:658
u32 nh_adj
Adjacency index for out.
Definition: ad-flow.h:72
u16 d_port
Definition: ad-flow.h:47
vlib_main_t * vlib_main
[convenience] vlib main
Definition: ad-flow.h:93
vlib_combined_counter_main_t rw_valid_counters
Valid rewrite counters.
Definition: ad-flow.h:112