FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
ip_path_mtu.h
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * ip_path_mtu.h
4  *
5  * Copyright (c) 2021 Graphiant.
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *------------------------------------------------------------------
18  */
19 
20 #include <vnet/ip/ip.h>
21 
22 /**
23  * @brief
24  * The Path MTU DPO. interposed in the forwarding chain of the host prefix.
25  */
26 typedef struct ip_pmtu_dpo_t_
27 {
28  /**
29  * The protocol of packets using this DPO
30  */
32 
33  u8 __pad8;
34 
35  /**
36  * Configured Path Mtu
37  */
39 
40  /**
41  * number of locks.
42  */
44 
45  /**
46  * Stacked DPO
47  */
50 
51 /*
52  * PMTU DPOs are accessed in the data-path so they should not straddle a cache
53  * line. Align to a integer factor of a cacheline
54  */
55 STATIC_ASSERT_SIZEOF (ip_pmtu_dpo_t, 2 * sizeof (u64));
56 
57 #define foreach_ip_pmtu_flag \
58  _ (ATTACHED, 0, "attached") \
59  _ (REMOTE, 1, "remote") \
60  _ (STALE, 2, "stale")
61 
62 typedef enum ip_pmtu_flags_t_
63 {
64 #define _(a, b, c) IP_PMTU_FLAG_##a = (1 << b),
66 #undef _
68 
69 /**
70  * Remote Path MTU tracking object
71  */
72 typedef struct ip_pmtu_t_
73 {
74  /** linkage into the FIB graph */
76 
77  /** Track fib entry */
81 
82  /** Configured MTU */
84 
85  /** MTU from the parent MTU */
87 
88  /** operational MTU; the minimum value of the cfg and parent MTU */
90 } ip_pmtu_t;
91 
92 extern int ip_path_mtu_update (const ip_address_t *nh, u32 table_id, u16 pmtu);
93 
94 typedef walk_rc_t (*ip_path_mtu_walk_t) (index_t ipti, void *ctx);
95 
96 extern void ip_path_mtu_walk (ip_path_mtu_walk_t fn, void *ctx);
97 extern int ip_path_mtu_replace_begin (void);
98 extern int ip_path_mtu_replace_end (void);
99 
100 extern u32 ip_pmtu_get_table_id (const ip_pmtu_t *ipt);
101 extern void ip_pmtu_get_ip (const ip_pmtu_t *ipt, ip_address_t *ip);
102 
103 /**
104  * Data-plane accessor functions
105  */
109 {
111 }
112 
113 extern ip_pmtu_t *ip_pmtu_pool;
116 {
118 }
119 
120 /*
121  * fd.io coding-style-patch-verification: ON
122  *
123  * Local Variables:
124  * eval: (c-set-style "gnu")
125  * End:
126  */
ip_address
Definition: ip_types.h:79
ip_pmtu_t_::ipt_flags
ip_pmtu_flags_t ipt_flags
Definition: ip_path_mtu.h:80
dpo_proto_t
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:553
ip_pmtu_flags_t
enum ip_pmtu_flags_t_ ip_pmtu_flags_t
ip_path_mtu_replace_begin
int ip_path_mtu_replace_begin(void)
Definition: ip_path_mtu.c:718
u16
unsigned short u16
Definition: types.h:57
ip_path_mtu_get
static_always_inline ip_pmtu_t * ip_path_mtu_get(index_t index)
Definition: ip_path_mtu.h:115
ip_path_mtu_walk
void ip_path_mtu_walk(ip_path_mtu_walk_t fn, void *ctx)
Definition: ip_path_mtu.c:760
ip_pmtu_t_
Remote Path MTU tracking object.
Definition: ip_path_mtu.h:72
ip_path_mtu_replace_end
int ip_path_mtu_replace_end(void)
Definition: ip_path_mtu.c:728
index_t
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:43
static_always_inline
#define static_always_inline
Definition: clib.h:112
fib_node_index_t
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
ip_path_mtu_walk_t
walk_rc_t(* ip_path_mtu_walk_t)(index_t ipti, void *ctx)
Definition: ip_path_mtu.h:94
nh
vl_api_fib_path_nh_t nh
Definition: fib_types.api:126
ip_pmtu_t_::ipt_oper_pmtu
u16 ipt_oper_pmtu
operational MTU; the minimum value of the cfg and parent MTU
Definition: ip_path_mtu.h:89
ip_pmtu_t_::ipt_fib_entry
fib_node_index_t ipt_fib_entry
Track fib entry.
Definition: ip_path_mtu.h:78
STATIC_ASSERT_SIZEOF
STATIC_ASSERT_SIZEOF(ip_pmtu_dpo_t, 2 *sizeof(u64))
ip_pmtu_dpo_t_::ipm_proto
dpo_proto_t ipm_proto
The protocol of packets using this DPO.
Definition: ip_path_mtu.h:31
ip_pmtu_t_::ipt_parent_pmtu
u16 ipt_parent_pmtu
MTU from the parent MTU.
Definition: ip_path_mtu.h:86
ip_pmtu_t_::ipt_node
fib_node_t ipt_node
linkage into the FIB graph
Definition: ip_path_mtu.h:75
ip_pmtu_get_table_id
u32 ip_pmtu_get_table_id(const ip_pmtu_t *ipt)
Definition: ip_path_mtu.c:114
ip_pmtu_dpo_get
static_always_inline ip_pmtu_dpo_t * ip_pmtu_dpo_get(index_t index)
Definition: ip_path_mtu.h:108
ip_pmtu_dpo_t_::ipm_pmtu
u16 ipm_pmtu
Configured Path Mtu.
Definition: ip_path_mtu.h:38
ip_pmtu_dpo_t_::ipm_dpo
dpo_id_t ipm_dpo
Stacked DPO.
Definition: ip_path_mtu.h:48
ip_path_mtu_update
int ip_path_mtu_update(const ip_address_t *nh, u32 table_id, u16 pmtu)
Definition: ip_path_mtu.c:647
index
u32 index
Definition: flow_types.api:221
u64
unsigned long u64
Definition: types.h:89
ip.h
u32
unsigned int u32
Definition: types.h:88
ip_pmtu_dpo_t_::ipm_locks
u16 ipm_locks
number of locks.
Definition: ip_path_mtu.h:43
ip_pmtu_t
struct ip_pmtu_t_ ip_pmtu_t
Remote Path MTU tracking object.
table_id
u32 table_id
Definition: wireguard.api:102
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
foreach_ip_pmtu_flag
#define foreach_ip_pmtu_flag
Definition: ip_path_mtu.h:57
fib_node_t_
An node in the FIB graph.
Definition: fib_node.h:301
ip_pmtu_dpo_pool
ip_pmtu_dpo_t * ip_pmtu_dpo_pool
Data-plane accessor functions.
Definition: ip_path_mtu.c:52
ip_pmtu_pool
ip_pmtu_t * ip_pmtu_pool
Path MTU tracker pool.
Definition: ip_path_mtu.c:67
ip_pmtu_get_ip
void ip_pmtu_get_ip(const ip_pmtu_t *ipt, ip_address_t *ip)
Definition: ip_path_mtu.c:126
u8
unsigned char u8
Definition: types.h:56
ip
vl_api_address_t ip
Definition: l2.api:558
ip_pmtu_t_::ipt_cfg_pmtu
u16 ipt_cfg_pmtu
Configured MTU.
Definition: ip_path_mtu.h:83
ip_pmtu_dpo_t
struct ip_pmtu_dpo_t_ ip_pmtu_dpo_t
The Path MTU DPO.
dpo_id_t_
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
ip_pmtu_t_::ipt_sibling
u32 ipt_sibling
Definition: ip_path_mtu.h:79
walk_rc_t
enum walk_rc_t_ walk_rc_t
Walk return code.
ip_pmtu_flags_t_
ip_pmtu_flags_t_
Definition: ip_path_mtu.h:62
ip_pmtu_dpo_t_
The Path MTU DPO.
Definition: ip_path_mtu.h:26