Let net_tap_set_fd() do only fd-related setup.
Actually, for further fds-incoming migration we'll want to skip
net_tap_set_fd() (as incoming fds are already prepared by source
QEMU). So move tap_read_poll() to net_tap_setup().
Don't care about using_vnet_hdr and vhost_net, the state is
zero-initialized.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
net/tap.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/tap.c b/net/tap.c
index 4ca3cc75d8..29568ce5d2 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -455,7 +455,6 @@ static bool net_tap_set_fd(TAPState *s, int fd, int vnet_hdr, Error **errp)
{
s->fd = fd;
s->host_vnet_hdr_len = vnet_hdr ? sizeof(struct virtio_net_hdr) : 0;
- s->using_vnet_hdr = false;
s->has_ufo = tap_probe_has_ufo(s->fd);
s->has_uso = tap_probe_has_uso(s->fd);
s->enabled = true;
@@ -467,8 +466,6 @@ static bool net_tap_set_fd(TAPState *s, int fd, int vnet_hdr, Error **errp)
if (vnet_hdr) {
tap_fd_set_vnet_hdr_len(s->fd, s->host_vnet_hdr_len);
}
- tap_read_poll(s, true);
- s->vhost_net = NULL;
if (s->sndbuf) {
Error **e = s->sndbuf_required ? errp : NULL;
@@ -772,6 +769,8 @@ static bool net_tap_setup(TAPState *s, int fd, int vnet_hdr, Error **errp)
return false;
}
+ tap_read_poll(s, true);
+
if (s->vhostfd != -1) {
VhostNetOptions options;
--
2.48.1