aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/dpo
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
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')
-rw-r--r--src/vnet/dpo/dpo.c16
-rw-r--r--src/vnet/dpo/dpo.h23
-rw-r--r--src/vnet/dpo/load_balance.c23
-rw-r--r--src/vnet/dpo/mpls_label_dpo.c17
4 files changed, 79 insertions, 0 deletions
diff --git a/src/vnet/dpo/dpo.c b/src/vnet/dpo/dpo.c
index 1331b5501bc..d8342ff17ae 100644
--- a/src/vnet/dpo/dpo.c
+++ b/src/vnet/dpo/dpo.c
@@ -23,6 +23,8 @@
* The VLIB graph nodes are graph of types, the DPO graph is a graph of instances.
*/
+// clang-format off
+
#include <vnet/dpo/dpo.h>
#include <vnet/ip/lookup.h>
#include <vnet/ip/format.h>
@@ -395,6 +397,18 @@ dpo_get_urpf(const dpo_id_t *dpo)
return (~0);
}
+u16
+dpo_get_mtu(const dpo_id_t *dpo)
+{
+ if (dpo_id_is_valid(dpo) &&
+ (NULL != dpo_vfts[dpo->dpoi_type].dv_get_mtu))
+ {
+ return (dpo_vfts[dpo->dpoi_type].dv_get_mtu(dpo));
+ }
+
+ return (0xffff);
+}
+
static u32
dpo_get_next_node (dpo_type_t child_type,
dpo_proto_t child_proto,
@@ -649,3 +663,5 @@ VLIB_CLI_COMMAND (show_fib_memory, static) = {
.short_help = "show dpo memory",
};
/* *INDENT-ON* */
+
+// clang-format on
diff --git a/src/vnet/dpo/dpo.h b/src/vnet/dpo/dpo.h
index ee4990d0058..e9976c2dd87 100644
--- a/src/vnet/dpo/dpo.h
+++ b/src/vnet/dpo/dpo.h
@@ -24,6 +24,8 @@
* instances.
*/
+// clang-format off
+
#ifndef __DPO_H__
#define __DPO_H__
@@ -362,6 +364,16 @@ extern void dpo_stack_from_node(u32 child_node,
extern u32 dpo_get_urpf(const dpo_id_t *dpo);
/**
+ * Get the MTU DPO
+ *
+ * @param dpo
+ * The DPO from which to get the MTU
+ *
+ * @return MTU (0xffff if something more usefull was unavailable)
+ */
+extern u16 dpo_get_mtu(const dpo_id_t *dpo);
+
+/**
* @brief A lock function registered for a DPO type
*/
typedef void (*dpo_lock_fn_t)(dpo_id_t *dpo);
@@ -389,6 +401,11 @@ typedef u32* (*dpo_get_next_node_t)(const dpo_id_t *dpo);
typedef u32 (*dpo_get_urpf_t)(const dpo_id_t *dpo);
/**
+ * @brief Given a DPO instance return the MTU
+ */
+typedef u16 (*dpo_get_mtu_t)(const dpo_id_t *dpo);
+
+/**
* @brief Called during FIB interposition when the originally
* registered DPO is used to 'clone' an instance for interposition
* at a particular location in the FIB graph.
@@ -433,6 +450,10 @@ typedef struct dpo_vft_t_
*/
dpo_get_urpf_t dv_get_urpf;
/**
+ * Get MTU
+ */
+ dpo_get_mtu_t dv_get_mtu;
+ /**
* Signal on an interposed child that the parent has changed
*/
dpo_mk_interpose_t dv_mk_interpose;
@@ -548,3 +569,5 @@ do { \
if ((YESNO)) vlib_worker_thread_barrier_release((VM));
#endif
+
+// clang-format on
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
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 <vnet/mpls/mpls.h>
#include <vnet/dpo/drop_dpo.h>
+// 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