2 *------------------------------------------------------------------
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:
10 * http://www.apache.org/licenses/LICENSE-2.0
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 *------------------------------------------------------------------
20 #include <vnet/ip/ip.h>
24 * The Path MTU DPO. interposed in the forwarding chain of the host prefix.
26 typedef struct ip_pmtu_dpo_t_
29 * The protocol of packets using this DPO
31 dpo_proto_t ipm_proto;
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
55 STATIC_ASSERT_SIZEOF (ip_pmtu_dpo_t, 2 * sizeof (u64));
57 #define foreach_ip_pmtu_flag \
58 _ (ATTACHED, 0, "attached") \
59 _ (REMOTE, 1, "remote") \
62 typedef enum ip_pmtu_flags_t_
64 #define _(a, b, c) IP_PMTU_FLAG_##a = (1 << b),
70 * Remote Path MTU tracking object
72 typedef struct ip_pmtu_t_
74 /** linkage into the FIB graph */
77 /** Track fib entry */
78 fib_node_index_t ipt_fib_entry;
80 ip_pmtu_flags_t ipt_flags;
85 /** MTU from the parent MTU */
88 /** operational MTU; the minimum value of the cfg and parent MTU */
92 extern int ip_path_mtu_update (const ip_address_t *nh, u32 table_id, u16 pmtu);
94 typedef walk_rc_t (*ip_path_mtu_walk_t) (index_t ipti, void *ctx);
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);
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);
103 extern void ip_pmtu_dpo_add_or_lock (u16 pmtu, const dpo_id_t *parent,
107 * Data-plane accessor functions
109 extern ip_pmtu_dpo_t *ip_pmtu_dpo_pool;
110 static_always_inline ip_pmtu_dpo_t *
111 ip_pmtu_dpo_get (index_t index)
113 return (pool_elt_at_index (ip_pmtu_dpo_pool, index));
116 extern ip_pmtu_t *ip_pmtu_pool;
117 static_always_inline ip_pmtu_t *
118 ip_path_mtu_get (index_t index)
120 return (pool_elt_at_index (ip_pmtu_pool, index));
124 * fd.io coding-style-patch-verification: ON
127 * eval: (c-set-style "gnu")