summaryrefslogtreecommitdiffstats
path: root/src/vnet/dpo/load_balance.c
diff options
context:
space:
mode:
authorNeale Ranns <neale@graphiant.com>2020-12-21 08:29:34 +0000
committerOle Tr�an <otroan@employees.org>2021-02-15 17:27:48 +0000
commit8f5fef2c78b95de1a636ce27111722b71702212a (patch)
treea0ebd0189969ccae1f0bdd7c1a9c18dd7a066f2e /src/vnet/dpo/load_balance.c
parent54be0cc044f445853fae7b8995c477605250af16 (diff)
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 <neale@graphiant.com> Change-Id: I8b9ea6a07868b50e97e2561f18d9335407dea7ae
Diffstat (limited to 'src/vnet/dpo/load_balance.c')
-rw-r--r--src/vnet/dpo/load_balance.c23
1 files changed, 23 insertions, 0 deletions
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 <vnet/ip/ip4_inlines.h>
#include <vnet/ip/ip6_inlines.h>
+// 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