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/dpo/mpls_label_dpo.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/vnet/dpo/mpls_label_dpo.c') diff --git a/src/vnet/dpo/mpls_label_dpo.c b/src/vnet/dpo/mpls_label_dpo.c index 683b5449513..b87cb1efcd2 100644 --- a/src/vnet/dpo/mpls_label_dpo.c +++ b/src/vnet/dpo/mpls_label_dpo.c @@ -18,6 +18,8 @@ #include #include +// clang-format off + #ifndef CLIB_MARCH_VARIANT /* * pool of all MPLS Label DPOs @@ -1213,12 +1215,25 @@ mpls_label_interpose (const dpo_id_t *original, mpls_label_dpo_get_index(mld_clone)); } +static u16 +mpls_label_dpo_get_mtu (const dpo_id_t *dpo) +{ + mpls_label_dpo_t *mld; + + mld = mpls_label_dpo_get(dpo->dpoi_index); + + /* return the parent's MTU minus the amount of header + * this DPO imposes */ + return (dpo_get_mtu (&mld->mld_dpo) - sizeof(mpls_label_t) * mld->mld_n_labels); +} + const static dpo_vft_t mld_vft = { .dv_lock = mpls_label_dpo_lock, .dv_unlock = mpls_label_dpo_unlock, .dv_format = format_mpls_label_dpo, .dv_mem_show = mpls_label_dpo_mem_show, .dv_mk_interpose = mpls_label_interpose, + .dv_get_mtu = mpls_label_dpo_get_mtu, }; const static char* const mpls_label_imp_pipe_ip4_nodes[] = @@ -1337,3 +1352,5 @@ mpls_label_dpo_get_type (mpls_label_dpo_flags_t flags) return (mpls_label_dpo_types[flags]); } #endif /* CLIB_MARCH_VARIANT */ + +// clang-format on -- cgit 1.2.3-korg