From: Nariman Sayed <narimansayed28@gmail.com>
To: qemu-devel@nongnu.org
Cc: Jason Wang <jasowangio@gmail.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
Nariman Sayed <narimansayed28@gmail.com>
Subject: [PATCH v2 0/3] net/tap, virtio-net: auto-detect MTU from host tap device
Date: Wed, 7 Oct 2026 08:07:15 +0300 [thread overview]
Message-ID: <20261007050718.926-1-narimansayed28@gmail.com> (raw)
In-Reply-To: <20260816043451.2547-1-narimansayed28@gmail.com>
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 backend's
MTU and uses it for the guest, avoiding the need to specify the
value twice.
v2:
- Addressed feedback from Eugenio Perez Martin: rather than
checking for NET_CLIENT_DRIVER_TAP and calling tap_get_mtu()
directly, added a generic get_mtu callback to NetClientInfo and
a qemu_get_mtu() wrapper, following the existing qemu_has_ufo()
pattern. virtio-net.c now calls qemu_get_mtu() without any
backend-type check, so other backends (e.g. vhost-user,
vhost-vdpa) can implement get_mtu in the future without
requiring any change to virtio-net.c. (patch 2 is new as a
result; patch 3 updated accordingly)
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 adds a generic get_mtu NetClientInfo callback and wires
it up for the tap backend
- 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. Also tested by
Aniket Sahu on ppc64le/POWER10 with a SLES guest.
Nariman Sayed (3):
net/tap: add tap_fd_get_mtu() to query host tap MTU
net: add generic get_mtu NetClientInfo callback
virtio-net: add mtu-from-tap property for automatic MTU detection
hw/net/virtio-net.c | 10 ++++++++++
include/hw/virtio/virtio-net.h | 1 +
include/net/net.h | 3 +++
net/net.c | 9 +++++++++
net/tap-bsd.c | 5 +++++
net/tap-linux.c | 30 ++++++++++++++++++++++++++++++
net/tap-solaris.c | 5 +++++
net/tap-stub.c | 5 +++++
net/tap.c | 8 ++++++++
net/tap_int.h | 1 +
10 files changed, 77 insertions(+)
--
2.34.1
next prev parent reply other threads:[~2026-10-07 9:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
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-26 17:17 ` Aniket Sahu
2026-09-17 10:28 ` Eugenio Pérez
2026-09-17 10:28 ` Eugenio Pérez
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
2026-08-24 13:40 ` [PATCH 0/3] net/tap, virtio-net: auto-detect MTU from host tap device Stefan Hajnoczi
2026-10-07 5:07 ` Nariman Sayed [this message]
2026-10-07 5:07 ` [PATCH v2 1/3] net/tap: add tap_fd_get_mtu() to query host tap MTU Nariman Sayed
2026-10-07 5:07 ` [PATCH v2 2/3] net: add generic get_mtu NetClientInfo callback Nariman Sayed
2026-10-07 5:07 ` [PATCH v2 3/3] virtio-net: add mtu-from-tap property for automatic MTU detection Nariman Sayed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261007050718.926-1-narimansayed28@gmail.com \
--to=narimansayed28@gmail.com \
--cc=jasowangio@gmail.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.