All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] net/tap, virtio-net: auto-detect MTU from host tap device
@ 2026-08-16  4:34 Nariman Sayed
  2026-08-16  4:34 ` [PATCH 1/3] net/tap: add tap_fd_get_mtu() to query host tap MTU Nariman Sayed
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Nariman Sayed @ 2026-08-16  4:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Nariman Sayed

This series adds automatic detection of the host tap device's MTU
and exposes it to the guest via VIRTIO_NET_F_MTU, addressing
gitlab.com/qemu-project/qemu/-/issues/3155.

Currently, host_mtu= must be set manually on the virtio-net-pci
device, duplicating the MTU already configured on the host's tap
interface. This series adds a new mtu-from-tap boolean property
(default off) that, when enabled, automatically reads the tap
device's MTU via SIOCGIFMTU and uses it for the guest, avoiding
the need to specify the value twice.

The series is split into three patches:
 - patch 1 adds a helper to query a tap fd's host MTU (Linux only,
   with build-safe stubs for BSD/Solaris/stub backends)
 - patch 2 exposes this via NetClientState for use by device models
 - patch 3 adds the new virtio-net property and wires it up,
   including a note on a config-space sizing timing issue
   discovered during testing

Tested manually with a tap device configured for MTU 9000 and an
Alpine Linux guest, confirming the guest correctly negotiates
VIRTIO_NET_F_MTU and reports the expected MTU.

This patch series is part of my effort to get more familiar with
QEMU's networking stack ahead of GSoC 2027.

Nariman Sayed (3):
  net/tap: add tap_fd_get_mtu() to query host tap MTU
  net/tap: expose tap_get_mtu() via NetClientState
  virtio-net: add mtu-from-tap property for automatic MTU detection

 hw/net/virtio-net.c            | 12 ++++++++++++
 include/hw/virtio/virtio-net.h |  1 +
 include/net/tap.h              |  1 +
 net/tap-bsd.c                  |  5 +++++
 net/tap-linux.c                | 30 ++++++++++++++++++++++++++++++
 net/tap-solaris.c              |  5 +++++
 net/tap-stub.c                 |  5 +++++
 net/tap.c                      |  7 +++++++
 net/tap_int.h                  |  1 +
 9 files changed, 67 insertions(+)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-16 11:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-16  4:34 [PATCH 0/3] net/tap, virtio-net: auto-detect MTU from host tap device Nariman Sayed
2026-08-16  4:34 ` [PATCH 1/3] net/tap: add tap_fd_get_mtu() to query host tap MTU Nariman Sayed
2026-08-16  4:34 ` [PATCH 2/3] net/tap: expose tap_get_mtu() via NetClientState Nariman Sayed
2026-08-16  4:34 ` [PATCH 3/3] virtio-net: add mtu-from-tap property for automatic MTU detection Nariman Sayed

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.