[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 01/12] vdpa: add back vhost_vdpa_net_first_nc_vdpa
From: |
Si-Wei Liu |
Subject: |
[PATCH 01/12] vdpa: add back vhost_vdpa_net_first_nc_vdpa |
Date: |
Wed, 14 Feb 2024 03:27:51 -0800 |
Previous commits had it removed. Now adding it back because
this function will be needed by future patches.
Reviewed-by: Eugenio PĂ©rez <eperezma@redhat.com>
Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
---
net/vhost-vdpa.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 46e350a..4479ffa 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -280,6 +280,16 @@ static ssize_t vhost_vdpa_receive(NetClientState *nc,
const uint8_t *buf,
return size;
}
+
+/** From any vdpa net client, get the netclient of the first queue pair */
+static VhostVDPAState *vhost_vdpa_net_first_nc_vdpa(VhostVDPAState *s)
+{
+ NICState *nic = qemu_get_nic(s->nc.peer);
+ NetClientState *nc0 = qemu_get_peer(nic->ncs, 0);
+
+ return DO_UPCAST(VhostVDPAState, nc, nc0);
+}
+
static void vhost_vdpa_net_log_global_enable(VhostVDPAState *s, bool enable)
{
struct vhost_vdpa *v = &s->vhost_vdpa;
@@ -492,7 +502,7 @@ dma_map_err:
static int vhost_vdpa_net_cvq_start(NetClientState *nc)
{
- VhostVDPAState *s;
+ VhostVDPAState *s, *s0;
struct vhost_vdpa *v;
int64_t cvq_group;
int r;
@@ -503,7 +513,8 @@ static int vhost_vdpa_net_cvq_start(NetClientState *nc)
s = DO_UPCAST(VhostVDPAState, nc, nc);
v = &s->vhost_vdpa;
- v->shadow_vqs_enabled = v->shared->shadow_data;
+ s0 = vhost_vdpa_net_first_nc_vdpa(s);
+ v->shadow_vqs_enabled = s0->vhost_vdpa.shadow_vqs_enabled;
s->vhost_vdpa.address_space_id = VHOST_VDPA_GUEST_PA_ASID;
if (v->shared->shadow_data) {
--
1.8.3.1
- [PATCH 00/12] Preparatory patches for live migration downtime improvement, Si-Wei Liu, 2024/02/14
- [PATCH 05/12] vdpa: add vhost_vdpa_set_address_space_id trace, Si-Wei Liu, 2024/02/14
- [PATCH 02/12] vdpa: no repeat setting shadow_data, Si-Wei Liu, 2024/02/14
- [PATCH 01/12] vdpa: add back vhost_vdpa_net_first_nc_vdpa,
Si-Wei Liu <=
- [PATCH 07/12] vdpa: add vhost_vdpa_set_dev_vring_base trace for svq mode, Si-Wei Liu, 2024/02/14
- [PATCH 08/12] vdpa: add trace events for vhost_vdpa_net_load_cmd, Si-Wei Liu, 2024/02/14
- [PATCH 09/12] vdpa: add trace event for vhost_vdpa_net_load_mq, Si-Wei Liu, 2024/02/14
- [PATCH 10/12] vdpa: define SVQ transitioning state for mode switching, Si-Wei Liu, 2024/02/14
- [PATCH 11/12] vdpa: indicate transitional state for SVQ switching, Si-Wei Liu, 2024/02/14
- [PATCH 12/12] vdpa: fix network breakage after cancelling migration, Si-Wei Liu, 2024/02/14