This has been requested several times in #virt on IRC, and on
libvirt-users, and a comment posted to
https://bugzilla.redhat.com/1224348 reminded me that there's even an
open BZ for it, so I finally sat down and wrote the patches for it.
The idea of the patches is that an *empty* bridge device can't have
its MTU directly set to anything higher than 1500, but once there are
any devices on the bridge, its MTU is limited to the smallest of the
MTUs of any attached devices. However, when the very first device is
attached to the bridge, the bridge will *increase* its own MTU to
match if needed. So the trick to setting a high MTU is to set the MTU
of every device to the desired value before it is added (especially
the first). libvirt already sets the MTU of every device to the MTU of
the bridge, so all we need to do is make it so the first device is set
from the network config's "mtu" attribute instead - the bridge will
get the larger MTU, and all future devices added will get the higher
MTU as well.
This doesn't take care of setting the MTU on the guest side of the tap
device; for now that must be done manually, but qemu has recently
added a commandline parameter to send the desired MTU to the guest,
and the virtio-net guest driver at least honors this. An upcoming
patch to libvirt will automatically set this qemu commandline option
so that no intervention will be required (beyond setting the MTU once
in the network config).
Laine Stump (3):
util: add MTU arg to virNetDevTapCreateInBridgePort()
conf: support mtu attribute in a network's <bridge> element
network: honor mtu setting when creating network
docs/formatnetwork.html.in | 8 +++++++-
docs/news.xml | 6 +++++-
docs/schemas/network.rng | 6 ++++++
src/bhyve/bhyve_command.c | 2 +-
src/conf/network_conf.c | 20 ++++++++++++++++++--
src/conf/network_conf.h | 1 +
src/network/bridge_driver.c | 1 +
src/qemu/qemu_interface.c | 2 +-
src/uml/uml_conf.c | 2 +-
src/util/virnetdevtap.c | 20 +++++++++++++++-----
src/util/virnetdevtap.h | 1 +
tests/bhyvexml2argvmock.c | 1 +
tests/networkxml2xmlin/set-mtu.xml | 11 +++++++++++
tests/networkxml2xmlout/set-mtu.xml | 11 +++++++++++
tests/networkxml2xmltest.c | 1 +
15 files changed, 81 insertions(+), 12 deletions(-)
create mode 100644 tests/networkxml2xmlin/set-mtu.xml
create mode 100644 tests/networkxml2xmlout/set-mtu.xml
--
2.9.3