From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: jasowang@redhat.com, qemu-devel@nongnu.org, leiyang@redhat.com,
steven.sistare@oracle.com, yc-core@yandex-team.ru,
peterx@redhat.com, mst@redhat.com, farosas@suse.de,
eblake@redhat.com, armbru@redhat.com, thuth@redhat.com,
philmd@linaro.org
Subject: Re: [PATCH v2 5/8] net/tap: implement interfaces for local migration
Date: Wed, 3 Sep 2025 16:34:02 +0200 [thread overview]
Message-ID: <aLhR2unpr2xg2MYl@redhat.com> (raw)
In-Reply-To: <20250903133706.1177633-6-vsementsov@yandex-team.ru>
On Wed, Sep 03, 2025 at 04:37:02PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> Handle local-incoming option:
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> ---
> include/net/tap.h | 4 ++
> net/tap.c | 136 +++++++++++++++++++++++++++++++++++++++-------
> 2 files changed, 119 insertions(+), 21 deletions(-)
>
> diff --git a/include/net/tap.h b/include/net/tap.h
> index 6f34f13eae..3ef2e2dbae 100644
> --- a/include/net/tap.h
> +++ b/include/net/tap.h
> @@ -30,7 +30,11 @@
>
> int tap_enable(NetClientState *nc);
> int tap_disable(NetClientState *nc);
> +bool tap_local_incoming(NetClientState *nc);
>
> int tap_get_fd(NetClientState *nc);
>
> +int tap_load(NetClientState *nc, QEMUFile *f);
> +int tap_save(NetClientState *nc, QEMUFile *f);
> +
> #endif /* QEMU_NET_TAP_H */
> diff --git a/net/tap.c b/net/tap.c
> index a9d955ac5f..499db756ea 100644
> --- a/net/tap.c
> +++ b/net/tap.c
> @@ -35,6 +35,8 @@
> #include "net/eth.h"
> #include "net/net.h"
> #include "clients.h"
> +#include "migration/migration.h"
> +#include "migration/qemu-file.h"
> #include "monitor/monitor.h"
> #include "system/system.h"
> #include "qapi/error.h"
> @@ -82,6 +84,7 @@ typedef struct TAPState {
> VHostNetState *vhost_net;
> unsigned host_vnet_hdr_len;
> Notifier exit;
> + bool local_incoming;
> } TAPState;
>
> static void launch_script(const char *setup_script, const char *ifname,
> @@ -803,6 +806,40 @@ static int net_tap_init_vhost(TAPState *s, Error **errp) {
> return 0;
> }
>
> +int tap_save(NetClientState *nc, QEMUFile *f)
> +{
> + TAPState *s = DO_UPCAST(TAPState, nc, nc);
> +
> + qemu_file_put_fd(f, s->fd);
> + qemu_put_byte(f, s->using_vnet_hdr);
> + qemu_put_byte(f, s->has_ufo);
> + qemu_put_byte(f, s->has_uso);
> + qemu_put_byte(f, s->enabled);
> + qemu_put_be32(f, s->host_vnet_hdr_len);
Is it neccessary to transfer that metadata, or is there perhaps a way
for the other side to query the TAP FD configuration from the kernel
to detect this ?
I'm concerned that this code / wire format is not extensible if we ever
add another similar field to TAPState in the future.
> +
> + return 0;
> +}
> +
> +int tap_load(NetClientState *nc, QEMUFile *f)
> +{
> + TAPState *s = DO_UPCAST(TAPState, nc, nc);
> +
> + s->fd = qemu_file_get_fd(f);
> + if (s->fd < 0) {
> + return -1;
> + }
> +
> + s->using_vnet_hdr = qemu_get_byte(f);
> + s->has_ufo = qemu_get_byte(f);
> + s->has_uso = qemu_get_byte(f);
> + s->enabled = qemu_get_byte(f);
> + qemu_get_be32s(f, &s->host_vnet_hdr_len);
> +
> + tap_read_poll(s, true);
> +
> + return net_tap_init_vhost(s, NULL);
> +}
> +
> static int net_tap_fd_init_common(const Netdev *netdev, NetClientState *peer,
> const char *model, const char *name,
> const char *ifname, const char *script,
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2025-09-03 14:34 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 13:36 [PATCH v2 0/8] virtio-net: live-TAP local migration Vladimir Sementsov-Ogievskiy
2025-09-03 13:36 ` [PATCH v2 1/8] net/tap: add some trace points Vladimir Sementsov-Ogievskiy
2025-09-03 14:11 ` Daniel P. Berrangé
2025-09-03 14:26 ` Vladimir Sementsov-Ogievskiy
2025-09-05 12:33 ` Vladimir Sementsov-Ogievskiy
2025-09-03 13:36 ` [PATCH v2 2/8] net/tap: keep exit notifier only when downscript set Vladimir Sementsov-Ogievskiy
2025-09-03 13:37 ` [PATCH v2 3/8] net/tap: refactor net_tap_setup_vhost() Vladimir Sementsov-Ogievskiy
2025-09-03 13:37 ` [PATCH v2 4/8] qapi: add interface for local TAP migration Vladimir Sementsov-Ogievskiy
2025-09-10 6:28 ` Markus Armbruster
2025-09-10 10:29 ` Vladimir Sementsov-Ogievskiy
2025-09-03 13:37 ` [PATCH v2 5/8] net/tap: implement interfaces for local migration Vladimir Sementsov-Ogievskiy
2025-09-03 14:34 ` Daniel P. Berrangé [this message]
2025-09-03 15:31 ` Vladimir Sementsov-Ogievskiy
2025-09-03 16:09 ` Steven Sistare
2025-09-04 7:41 ` Vladimir Sementsov-Ogievskiy
2025-09-05 10:14 ` Vladimir Sementsov-Ogievskiy
2025-09-05 12:23 ` Steven Sistare
2025-09-03 13:37 ` [PATCH v2 6/8] virtio-net: support local tap migration Vladimir Sementsov-Ogievskiy
2025-09-03 13:37 ` [PATCH v2 7/8] test/functional: exec_command_and_wait_for_pattern: add vm arg Vladimir Sementsov-Ogievskiy
2025-09-03 13:37 ` [PATCH v2 8/8] tests/functional: add test_x86_64_tap_fd_migration Vladimir Sementsov-Ogievskiy
2025-09-03 14:47 ` Daniel P. Berrangé
2025-09-03 15:14 ` Vladimir Sementsov-Ogievskiy
2025-09-03 15:19 ` Daniel P. Berrangé
2025-09-03 15:24 ` Vladimir Sementsov-Ogievskiy
2025-09-04 14:42 ` [PATCH v2 0/8] virtio-net: live-TAP local migration Lei Yang
2025-09-04 15:05 ` Vladimir Sementsov-Ogievskiy
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=aLhR2unpr2xg2MYl@redhat.com \
--to=berrange@redhat.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=farosas@suse.de \
--cc=jasowang@redhat.com \
--cc=leiyang@redhat.com \
--cc=mst@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=steven.sistare@oracle.com \
--cc=thuth@redhat.com \
--cc=vsementsov@yandex-team.ru \
--cc=yc-core@yandex-team.ru \
/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.