[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 16/18] vdpa: add vhost_vdpa_net_load_setup NetClient callback
|
From: |
Eugenio Pérez |
|
Subject: |
[RFC PATCH 16/18] vdpa: add vhost_vdpa_net_load_setup NetClient callback |
|
Date: |
Thu, 19 Oct 2023 16:34:53 +0200 |
So the vDPA backend knows when a migration incoming starts. NicState
argument is needed so we can get the dma address space.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
include/net/net.h | 4 ++++
net/vhost-vdpa.c | 10 ++++++++++
2 files changed, 14 insertions(+)
diff --git a/include/net/net.h b/include/net/net.h
index 2fb1c9181c..e0ecf85bf6 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -42,6 +42,7 @@ typedef struct NICConf {
/* Net clients */
+struct NICState;
typedef void (NetPoll)(NetClientState *, bool enable);
typedef bool (NetCanReceive)(NetClientState *);
typedef int (NetStart)(NetClientState *);
@@ -69,6 +70,8 @@ typedef void (SocketReadStateFinalize)(SocketReadState *rs);
typedef void (NetAnnounce)(NetClientState *);
typedef bool (SetSteeringEBPF)(NetClientState *, int);
typedef bool (NetCheckPeerType)(NetClientState *, ObjectClass *, Error **);
+/* This can be called before start & pair, so get also the peer */
+typedef int (NetMigrationLoadSetup)(NetClientState *, struct NICState *);
typedef struct NetClientInfo {
NetClientDriver type;
@@ -98,6 +101,7 @@ typedef struct NetClientInfo {
NetAnnounce *announce;
SetSteeringEBPF *set_steering_ebpf;
NetCheckPeerType *check_peer_type;
+ NetMigrationLoadSetup *load_setup;
} NetClientInfo;
struct NetClientState {
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 31df7e91a1..507cb946d2 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -396,6 +396,15 @@ static void vhost_vdpa_net_client_stop(NetClientState *nc)
}
}
+static int vhost_vdpa_net_load_setup(NetClientState *nc, NICState *nic)
+{
+ VhostVDPAState *s = DO_UPCAST(VhostVDPAState, nc, nc);
+ VirtIONet *n = qemu_get_nic_opaque(&nic->ncs[0]);
+
+ vhost_vdpa_load_setup(s->vhost_vdpa.shared, n->parent_obj.dma_as);
+ return 0;
+}
+
static NetClientInfo net_vhost_vdpa_info = {
.type = NET_CLIENT_DRIVER_VHOST_VDPA,
.size = sizeof(VhostVDPAState),
@@ -407,6 +416,7 @@ static NetClientInfo net_vhost_vdpa_info = {
.has_vnet_hdr = vhost_vdpa_has_vnet_hdr,
.has_ufo = vhost_vdpa_has_ufo,
.check_peer_type = vhost_vdpa_check_peer_type,
+ .load_setup = vhost_vdpa_net_load_setup,
};
static int64_t vhost_vdpa_get_vring_group(int device_fd, unsigned vq_index,
--
2.39.3
- [RFC PATCH 03/18] vdpa: move iova_range to vhost_vdpa_shared, (continued)
- [RFC PATCH 03/18] vdpa: move iova_range to vhost_vdpa_shared, Eugenio Pérez, 2023/10/19
- [RFC PATCH 05/18] vdpa: use vdpa shared for tracing, Eugenio Pérez, 2023/10/19
- [RFC PATCH 07/18] vdpa: move iotlb_batch_begin_sent to vhost_vdpa_shared, Eugenio Pérez, 2023/10/19
- [RFC PATCH 06/18] vdpa: move file descriptor to vhost_vdpa_shared, Eugenio Pérez, 2023/10/19
- [RFC PATCH 09/18] vdpa: remove msg type of vhost_vdpa, Eugenio Pérez, 2023/10/19
- [RFC PATCH 10/18] vdpa: move iommu_list to vhost_vdpa_shared, Eugenio Pérez, 2023/10/19
- [RFC PATCH 11/18] vdpa: use VhostVDPAShared in vdpa_dma_map and unmap, Eugenio Pérez, 2023/10/19
- [RFC PATCH 08/18] vdpa: move backend_cap to vhost_vdpa_shared, Eugenio Pérez, 2023/10/19
- [RFC PATCH 13/18] vdpa: move memory listener to vhost_vdpa_shared, Eugenio Pérez, 2023/10/19
- [RFC PATCH 14/18] vdpa: do not set virtio status bits if unneeded, Eugenio Pérez, 2023/10/19
- [RFC PATCH 16/18] vdpa: add vhost_vdpa_net_load_setup NetClient callback,
Eugenio Pérez <=
- [RFC PATCH 15/18] vdpa: add vhost_vdpa_load_setup, Eugenio Pérez, 2023/10/19
- [RFC PATCH 12/18] vdpa: use dev_shared in vdpa_iommu, Eugenio Pérez, 2023/10/19
- [RFC PATCH 17/18] vdpa: use shadow_data instead of first device v->shadow_vqs_enabled, Eugenio Pérez, 2023/10/19
- [RFC PATCH 18/18] virtio_net: register incremental migration handlers, Eugenio Pérez, 2023/10/19