|
|
586cba |
From 6a5c236b95ce475c556ccd92c2135ad48474e8fb Mon Sep 17 00:00:00 2001
|
|
|
586cba |
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
|
|
|
586cba |
Date: Tue, 23 Aug 2022 20:30:35 +0200
|
|
|
586cba |
Subject: [PATCH 20/23] vhost_net: add NetClientState->load() callback
|
|
|
586cba |
MIME-Version: 1.0
|
|
|
586cba |
Content-Type: text/plain; charset=UTF-8
|
|
|
586cba |
Content-Transfer-Encoding: 8bit
|
|
|
586cba |
|
|
|
586cba |
RH-Author: Eugenio Pérez <eperezma@redhat.com>
|
|
|
586cba |
RH-MergeRequest: 116: vdpa: Restore device state on destination
|
|
|
586cba |
RH-Bugzilla: 2114060
|
|
|
586cba |
RH-Acked-by: Cindy Lu <lulu@redhat.com>
|
|
|
586cba |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
586cba |
RH-Commit: [19/21] 439b4133a757b2f1c5f4a1441eca25329896491a (eperezmartin/qemu-kvm)
|
|
|
586cba |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2114060
|
|
|
586cba |
Upstream status: git@github.com:jasowang/qemu.git net-next
|
|
|
586cba |
|
|
|
586cba |
It allows per-net client operations right after device's successful
|
|
|
586cba |
start. In particular, to load the device status.
|
|
|
586cba |
|
|
|
586cba |
Vhost-vdpa net will use it to add the CVQ buffers to restore the device
|
|
|
586cba |
status.
|
|
|
586cba |
|
|
|
586cba |
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
|
|
|
586cba |
Acked-by: Jason Wang <jasowang@redhat.com>
|
|
|
586cba |
Signed-off-by: Jason Wang <jasowang@redhat.com>
|
|
|
586cba |
(cherry picked from commit 302f3d20e68a8a120d431f7ff7cb02a75917f54c)
|
|
|
586cba |
---
|
|
|
586cba |
hw/net/vhost_net.c | 7 +++++++
|
|
|
586cba |
include/net/net.h | 2 ++
|
|
|
586cba |
2 files changed, 9 insertions(+)
|
|
|
586cba |
|
|
|
586cba |
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
|
|
|
586cba |
index 275ece5324..ea3a8be1c9 100644
|
|
|
586cba |
--- a/hw/net/vhost_net.c
|
|
|
586cba |
+++ b/hw/net/vhost_net.c
|
|
|
586cba |
@@ -281,6 +281,13 @@ static int vhost_net_start_one(struct vhost_net *net,
|
|
|
586cba |
}
|
|
|
586cba |
}
|
|
|
586cba |
}
|
|
|
586cba |
+
|
|
|
586cba |
+ if (net->nc->info->load) {
|
|
|
586cba |
+ r = net->nc->info->load(net->nc);
|
|
|
586cba |
+ if (r < 0) {
|
|
|
586cba |
+ goto fail;
|
|
|
586cba |
+ }
|
|
|
586cba |
+ }
|
|
|
586cba |
return 0;
|
|
|
586cba |
fail:
|
|
|
586cba |
file.fd = -1;
|
|
|
586cba |
diff --git a/include/net/net.h b/include/net/net.h
|
|
|
586cba |
index 476ad45b9a..81d0b21def 100644
|
|
|
586cba |
--- a/include/net/net.h
|
|
|
586cba |
+++ b/include/net/net.h
|
|
|
586cba |
@@ -45,6 +45,7 @@ typedef struct NICConf {
|
|
|
586cba |
typedef void (NetPoll)(NetClientState *, bool enable);
|
|
|
586cba |
typedef bool (NetCanReceive)(NetClientState *);
|
|
|
586cba |
typedef int (NetStart)(NetClientState *);
|
|
|
586cba |
+typedef int (NetLoad)(NetClientState *);
|
|
|
586cba |
typedef void (NetStop)(NetClientState *);
|
|
|
586cba |
typedef ssize_t (NetReceive)(NetClientState *, const uint8_t *, size_t);
|
|
|
586cba |
typedef ssize_t (NetReceiveIOV)(NetClientState *, const struct iovec *, int);
|
|
|
586cba |
@@ -74,6 +75,7 @@ typedef struct NetClientInfo {
|
|
|
586cba |
NetReceiveIOV *receive_iov;
|
|
|
586cba |
NetCanReceive *can_receive;
|
|
|
586cba |
NetStart *start;
|
|
|
586cba |
+ NetLoad *load;
|
|
|
586cba |
NetStop *stop;
|
|
|
586cba |
NetCleanup *cleanup;
|
|
|
586cba |
LinkStatusChanged *link_status_changed;
|
|
|
586cba |
--
|
|
|
586cba |
2.31.1
|
|
|
586cba |
|