aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/adj
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/adj')
-rw-r--r--src/vnet/adj/adj.c37
-rw-r--r--src/vnet/adj/adj.h6
-rw-r--r--src/vnet/adj/rewrite.c12
-rw-r--r--src/vnet/adj/rewrite.h3
4 files changed, 55 insertions, 3 deletions
diff --git a/src/vnet/adj/adj.c b/src/vnet/adj/adj.c
index 5f7fe74cd43..d28d5195330 100644
--- a/src/vnet/adj/adj.c
+++ b/src/vnet/adj/adj.c
@@ -338,6 +338,43 @@ adj_feature_update (u32 sw_if_index,
adj_walk (sw_if_index, adj_feature_update_walk_cb, &ctx);
}
+static adj_walk_rc_t
+adj_mtu_update_walk_cb (adj_index_t ai,
+ void *arg)
+{
+ ip_adjacency_t *adj;
+
+ adj = adj_get(ai);
+
+ vnet_rewrite_update_mtu (vnet_get_main(),
+ &adj->rewrite_header);
+
+ return (ADJ_WALK_RC_CONTINUE);
+}
+
+static void
+adj_sw_mtu_update (vnet_main_t * vnm,
+ u32 sw_if_index,
+ void *ctx)
+{
+ /*
+ * Walk all the adjacencies on the interface to update the cached MTU
+ */
+ adj_walk (sw_if_index, adj_mtu_update_walk_cb, NULL);
+}
+
+void
+adj_mtu_update (u32 hw_if_index)
+{
+ /*
+ * Walk all the SW interfaces on the HW interface to update the cached MTU
+ */
+ vnet_hw_interface_walk_sw(vnet_get_main(),
+ hw_if_index,
+ adj_sw_mtu_update,
+ NULL);
+}
+
/**
* @brief Walk the Adjacencies on a given interface
*/
diff --git a/src/vnet/adj/adj.h b/src/vnet/adj/adj.h
index fe77d1634e0..bcf6c041209 100644
--- a/src/vnet/adj/adj.h
+++ b/src/vnet/adj/adj.h
@@ -345,6 +345,12 @@ extern const u8* adj_get_rewrite (adj_index_t ai);
extern void adj_feature_update (u32 sw_if_index, u8 arc_index, u8 is_enable);
/**
+ * @brief Notify the adjacency subsystem that the MTU settings for
+ * an HW interface have changed
+ */
+extern void adj_mtu_update (u32 hw_if_index);
+
+/**
* @brief
* The global adjacnecy pool. Exposed for fast/inline data-plane access
*/
diff --git a/src/vnet/adj/rewrite.c b/src/vnet/adj/rewrite.c
index 9150f2c6c37..c21495a9644 100644
--- a/src/vnet/adj/rewrite.c
+++ b/src/vnet/adj/rewrite.c
@@ -77,15 +77,14 @@ format_vnet_rewrite (u8 * s, va_list * args)
vnet_sw_interface_t *si;
si = vnet_get_sw_interface_safe (vnm, rw->sw_if_index);
if (NULL != si)
- s = format (s, "%U: ", format_vnet_sw_interface_name, vnm, si);
+ s = format (s, "%U:", format_vnet_sw_interface_name, vnm, si);
else
s = format (s, "DELETED:%d", rw->sw_if_index);
}
/* Format rewrite string. */
if (rw->data_bytes > 0)
-
- s = format (s, "%U",
+ s = format (s, " %U",
format_hex_bytes,
rw->data + max_data_bytes - rw->data_bytes, rw->data_bytes);
@@ -111,6 +110,13 @@ vnet_rewrite_init (vnet_main_t * vnm,
}
void
+vnet_rewrite_update_mtu (vnet_main_t * vnm, vnet_rewrite_header_t * rw)
+{
+ rw->max_l3_packet_bytes =
+ vnet_sw_interface_get_mtu (vnm, rw->sw_if_index, VLIB_TX);
+}
+
+void
vnet_rewrite_for_sw_interface (vnet_main_t * vnm,
vnet_link_t link_type,
u32 sw_if_index,
diff --git a/src/vnet/adj/rewrite.h b/src/vnet/adj/rewrite.h
index 1dea72f5ed8..005ac41fe72 100644
--- a/src/vnet/adj/rewrite.h
+++ b/src/vnet/adj/rewrite.h
@@ -328,6 +328,9 @@ void vnet_rewrite_init (struct vnet_main_t *vnm,
u32 this_node,
u32 next_node, vnet_rewrite_header_t * rw);
+void vnet_rewrite_update_mtu (struct vnet_main_t *vnm,
+ vnet_rewrite_header_t * rw);
+
u8 *vnet_build_rewrite_for_sw_interface (struct vnet_main_t *vnm,
u32 sw_if_index,
vnet_link_t packet_type,