summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/devices')
-rw-r--r--src/vnet/devices/af_packet/af_packet.c10
-rw-r--r--src/vnet/devices/tap/tap.c10
2 files changed, 10 insertions, 10 deletions
diff --git a/src/vnet/devices/af_packet/af_packet.c b/src/vnet/devices/af_packet/af_packet.c
index cf4f91e2fcd..208537996e3 100644
--- a/src/vnet/devices/af_packet/af_packet.c
+++ b/src/vnet/devices/af_packet/af_packet.c
@@ -57,13 +57,15 @@ unsigned int if_nametoindex (const char *ifname);
typedef struct tpacket_req tpacket_req_t;
static clib_error_t *
-af_packet_eth_set_mtu (vnet_main_t *vnm, vnet_hw_interface_t *hi, u32 mtu)
+af_packet_eth_set_max_frame_size (vnet_main_t *vnm, vnet_hw_interface_t *hi,
+ u32 frame_size)
{
clib_error_t *error, *rv;
af_packet_main_t *apm = &af_packet_main;
af_packet_if_t *apif = pool_elt_at_index (apm->interfaces, hi->dev_instance);
- error = vnet_netlink_set_link_mtu (apif->host_if_index, mtu);
+ error = vnet_netlink_set_link_mtu (apif->host_if_index,
+ frame_size + hi->frame_overhead);
if (error)
{
@@ -75,7 +77,7 @@ af_packet_eth_set_mtu (vnet_main_t *vnm, vnet_hw_interface_t *hi, u32 mtu)
return rv;
}
else
- apif->host_mtu = mtu;
+ apif->host_mtu = frame_size + hi->frame_overhead;
return 0;
}
@@ -398,7 +400,7 @@ af_packet_create_if (af_packet_create_if_arg_t *arg)
eir.dev_class_index = af_packet_device_class.index;
eir.dev_instance = if_index;
eir.address = hw_addr;
- eir.cb.set_mtu = af_packet_eth_set_mtu;
+ eir.cb.set_max_frame_size = af_packet_eth_set_max_frame_size;
apif->hw_if_index = vnet_eth_register_interface (vnm, &eir);
}
else
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c
index 2e7ad39f3b4..f5ed30ad7b0 100644
--- a/src/vnet/devices/tap/tap.c
+++ b/src/vnet/devices/tap/tap.c
@@ -683,12 +683,10 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
}
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);
+ hw->min_frame_size = TUN_MIN_PACKET_BYTES;
+ vnet_hw_interface_set_mtu (
+ vnm, hw->sw_if_index,
+ args->host_mtu_size ? args->host_mtu_size : TUN_DEFAULT_PACKET_BYTES);
}
vnet_hw_if_change_caps (vnm, vif->hw_if_index, &cc);