FD.io VPP  v21.06
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 */
80  ip_pmtu_flags_t ipt_flags;
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 {
110  return (pool_elt_at_index (ip_pmtu_dpo_pool, index));
111 }
112 
113 extern ip_pmtu_t *ip_pmtu_pool;
116 {
117  return (pool_elt_at_index (ip_pmtu_pool, index));
118 }
119 
120 /*
121  * fd.io coding-style-patch-verification: ON
122  *
123  * Local Variables:
124  * eval: (c-set-style "gnu")
125  * End:
126  */
int ip_path_mtu_replace_begin(void)
Definition: ip_path_mtu.c:718
vl_api_fib_path_nh_t nh
Definition: fib_types.api:126
fib_node_t ipt_node
linkage into the FIB graph
Definition: ip_path_mtu.h:75
unsigned long u64
Definition: types.h:89
void ip_path_mtu_walk(ip_path_mtu_walk_t fn, void *ctx)
Definition: ip_path_mtu.c:760
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
struct ip_pmtu_dpo_t_ ip_pmtu_dpo_t
The Path MTU DPO.
unsigned char u8
Definition: types.h:56
The Path MTU DPO.
Definition: ip_path_mtu.h:26
static_always_inline ip_pmtu_t * ip_path_mtu_get(index_t index)
Definition: ip_path_mtu.h:115
unsigned int u32
Definition: types.h:88
Remote Path MTU tracking object.
Definition: ip_path_mtu.h:72
enum walk_rc_t_ walk_rc_t
Walk return code.
#define static_always_inline
Definition: clib.h:112
walk_rc_t(* ip_path_mtu_walk_t)(index_t ipti, void *ctx)
Definition: ip_path_mtu.h:94
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
u16 ipt_cfg_pmtu
Configured MTU.
Definition: ip_path_mtu.h:83
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
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:553
enum ip_pmtu_flags_t_ ip_pmtu_flags_t
long ctx[MAX_CONNS]
Definition: main.c:144
unsigned short u16
Definition: types.h:57
int ip_path_mtu_replace_end(void)
Definition: ip_path_mtu.c:728
An node in the FIB graph.
Definition: fib_node.h:301
u32 ip_pmtu_get_table_id(const ip_pmtu_t *ipt)
Definition: ip_path_mtu.c:114
dpo_id_t ipm_dpo
Stacked DPO.
Definition: ip_path_mtu.h:48
u32 index
Definition: flow_types.api:221
struct ip_pmtu_t_ ip_pmtu_t
Remote Path MTU tracking object.
STATIC_ASSERT_SIZEOF(ip_pmtu_dpo_t, 2 *sizeof(u64))
int ip_path_mtu_update(const ip_address_t *nh, u32 table_id, u16 pmtu)
Definition: ip_path_mtu.c:647
#define foreach_ip_pmtu_flag
Definition: ip_path_mtu.h:57
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
static_always_inline ip_pmtu_dpo_t * ip_pmtu_dpo_get(index_t index)
Definition: ip_path_mtu.h:108
ip_pmtu_dpo_t * ip_pmtu_dpo_pool
Data-plane accessor functions.
Definition: ip_path_mtu.c:52
u32 ipt_sibling
Definition: ip_path_mtu.h:79
u16 ipt_oper_pmtu
operational MTU; the minimum value of the cfg and parent MTU
Definition: ip_path_mtu.h:89
u16 ipm_pmtu
Configured Path Mtu.
Definition: ip_path_mtu.h:38
vl_api_address_t ip
Definition: l2.api:558
ip_pmtu_flags_t ipt_flags
Definition: ip_path_mtu.h:80
ip_pmtu_flags_t_
Definition: ip_path_mtu.h:62
u32 table_id
Definition: wireguard.api:102
ip_pmtu_t * ip_pmtu_pool
Path MTU tracker pool.
Definition: ip_path_mtu.c:67
void ip_pmtu_get_ip(const ip_pmtu_t *ipt, ip_address_t *ip)
Definition: ip_path_mtu.c:126
fib_node_index_t ipt_fib_entry
Track fib entry.
Definition: ip_path_mtu.h:78
u16 ipm_locks
number of locks.
Definition: ip_path_mtu.h:43
dpo_proto_t ipm_proto
The protocol of packets using this DPO.
Definition: ip_path_mtu.h:31
u16 ipt_parent_pmtu
MTU from the parent MTU.
Definition: ip_path_mtu.h:86