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/load_balance.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/vnet/dpo/load_balance.c') diff --git a/src/vnet/dpo/load_balance.c b/src/vnet/dpo/load_balance.c index fb876a09ec2..a212532dffd 100644 --- a/src/vnet/dpo/load_balance.c +++ b/src/vnet/dpo/load_balance.c @@ -25,6 +25,8 @@ #include #include +// clang-format off + /* * distribution error tolerance for load-balancing */ @@ -918,11 +920,30 @@ load_balance_mem_show (void) load_balance_map_show_mem(); } +static u16 +load_balance_dpo_get_mtu (const dpo_id_t *dpo) +{ + const dpo_id_t *buckets; + load_balance_t *lb; + u16 i, mtu = 0xffff; + + lb = load_balance_get(dpo->dpoi_index); + buckets = load_balance_get_buckets(lb); + + for (i = 0; i < lb->lb_n_buckets; i++) + { + mtu = clib_min (mtu, dpo_get_mtu (&buckets[i])); + } + + return (mtu); +} + const static dpo_vft_t lb_vft = { .dv_lock = load_balance_lock, .dv_unlock = load_balance_unlock, .dv_format = format_load_balance_dpo, .dv_mem_show = load_balance_mem_show, + .dv_get_mtu = load_balance_dpo_get_mtu, }; /** @@ -1323,3 +1344,5 @@ VLIB_REGISTER_NODE (bier_load_balance_node) = { .format_trace = format_bier_load_balance_trace, .sibling_of = "mpls-load-balance", }; + +// clang-format on -- cgit 1.2.3-korg