From 8f5fef2c78b95de1a636ce27111722b71702212a Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Mon, 21 Dec 2020 08:29:34 +0000 Subject: ip: Path MTU Type: feature Support setting the MTU for a peer on an interface. The minimum value of the path and interface MTU is used at forwarding time. the path MTU is specified for a given peer, by address and table-ID. In the forwarding plane the MTU is enfored either: 1 - if the peer is attached, then the MTU is set on the peer's adjacency 2 - if the peer is not attached, it is remote, then a DPO is added to the peer's FIB entry to perform the necessary fragmentation. Signed-off-by: Neale Ranns Change-Id: I8b9ea6a07868b50e97e2561f18d9335407dea7ae --- src/vnet/adj/adj_nbr.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/vnet/adj/adj_nbr.c') diff --git a/src/vnet/adj/adj_nbr.c b/src/vnet/adj/adj_nbr.c index 921588a7ef7..811d0b8faa2 100644 --- a/src/vnet/adj/adj_nbr.c +++ b/src/vnet/adj/adj_nbr.c @@ -222,6 +222,27 @@ adj_nbr_alloc (fib_protocol_t nh_proto, return (adj); } +void +adj_nbr_set_mtu (adj_index_t adj_index, u16 mtu) +{ + ip_adjacency_t *adj; + + ASSERT(ADJ_INDEX_INVALID != adj_index); + + adj = adj_get(adj_index); + + if (0 == mtu) + vnet_rewrite_update_mtu(vnet_get_main(), adj->ia_link, + &adj->rewrite_header); + else + { + vnet_rewrite_update_mtu(vnet_get_main(), adj->ia_link, + &adj->rewrite_header); + adj->rewrite_header.max_l3_packet_bytes = + clib_min (adj->rewrite_header.max_l3_packet_bytes, mtu); + } +} + /* * adj_nbr_add_or_lock * @@ -268,13 +289,13 @@ adj_nbr_add_or_lock (fib_protocol_t nh_proto, * So ask the interface to do it. */ vnet_update_adjacency_for_sw_interface(vnm, sw_if_index, adj_index); + adj_delegate_adj_created(adj_get(adj_index)); } else { adj_lock(adj_index); } - adj_delegate_adj_created(adj_get(adj_index)); return (adj_index); } @@ -1055,12 +1076,14 @@ const static dpo_vft_t adj_nbr_dpo_vft = { .dv_format = format_adj_nbr, .dv_mem_show = adj_mem_show, .dv_get_urpf = adj_dpo_get_urpf, + .dv_get_mtu = adj_dpo_get_mtu, }; const static dpo_vft_t adj_nbr_incompl_dpo_vft = { .dv_lock = adj_dpo_lock, .dv_unlock = adj_dpo_unlock, .dv_format = format_adj_nbr_incomplete, .dv_get_urpf = adj_dpo_get_urpf, + .dv_get_mtu = adj_dpo_get_mtu, }; /** -- cgit 1.2.3-korg