summaryrefslogtreecommitdiffstats
path: root/src/vnet/interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/interface.c')
-rw-r--r--src/vnet/interface.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/vnet/interface.c b/src/vnet/interface.c
index a34bb7931ae..7516aec0e71 100644
--- a/src/vnet/interface.c
+++ b/src/vnet/interface.c
@@ -122,6 +122,22 @@ unserialize_vnet_sw_interface_set_flags (serialize_main_t * m, va_list * va)
/* helper_flags no redistribution */ 0);
}
+void
+vnet_hw_interface_set_mtu (vnet_main_t * vnm, u32 hw_if_index, u32 mtu)
+{
+ vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, hw_if_index);
+
+ if (hi->max_packet_bytes != mtu)
+ {
+ u16 l3_pad = hi->max_packet_bytes - hi->max_l3_packet_bytes[VLIB_TX];
+ hi->max_packet_bytes = mtu;
+ hi->max_l3_packet_bytes[VLIB_TX] =
+ hi->max_l3_packet_bytes[VLIB_RX] = mtu - l3_pad;
+ ethernet_set_flags (vnm, hw_if_index, ETHERNET_INTERFACE_FLAG_MTU);
+ adj_mtu_update (hw_if_index);
+ }
+}
+
static void
unserialize_vnet_hw_interface_set_flags (serialize_main_t * m, va_list * va)
{