aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeale Ranns <neale@graphiant.com>2021-05-20 16:09:40 +0000
committerMohsin Kazmi <sykazmi@cisco.com>2021-07-08 15:52:46 +0000
commit0cc23b7dde261390b0ffa7a5ba2d11603b40eafa (patch)
tree722360048b4aa9f7e247396c2008b4e66650d69c
parent647acd5eb4e3ff13e75fa712c3685694d2524fa6 (diff)
tap: Set the MTU on the TUN deivce
Type: fix For a TAP device the MTU is set via the ethernet_register for TUN we need to do it explicitly (like we do for other tunnel types). Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: Ie6a13c795acb35b53f8d99b05c70c3e73a7b428e
-rw-r--r--src/vnet/devices/tap/tap.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c
index 5b15f92051d..dfd32588383 100644
--- a/src/vnet/devices/tap/tap.c
+++ b/src/vnet/devices/tap/tap.c
@@ -66,6 +66,10 @@ VNET_HW_INTERFACE_CLASS (tun_device_hw_interface_class, static) =
};
/* *INDENT-ON* */
+#define TUN_MAX_PACKET_BYTES 65355
+#define TUN_MIN_PACKET_BYTES 64
+#define TUN_DEFAULT_PACKET_BYTES 1500
+
static u32
virtio_eth_flag_change (vnet_main_t * vnm, vnet_hw_interface_t * hi,
u32 flags)
@@ -741,6 +745,15 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
{
virtio_set_packet_coalesce (vif);
}
+ if (vif->type == VIRTIO_IF_TYPE_TUN)
+ {
+ hw->max_supported_packet_bytes = TUN_MAX_PACKET_BYTES;
+ hw->min_packet_bytes = hw->min_supported_packet_bytes =
+ TUN_MIN_PACKET_BYTES;
+ hw->max_packet_bytes =
+ args->host_mtu_size ? args->host_mtu_size : TUN_DEFAULT_PACKET_BYTES;
+ vnet_sw_interface_set_mtu (vnm, hw->sw_if_index, hw->max_packet_bytes);
+ }
virtio_vring_set_rx_queues (vm, vif);