[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/40] vdpa: add back vhost_vdpa_net_first_nc_vdpa
From: |
Si-Wei Liu |
Subject: |
[PATCH 08/40] vdpa: add back vhost_vdpa_net_first_nc_vdpa |
Date: |
Thu, 7 Dec 2023 09:39:21 -0800 |
Previous commits had it removed. Now adding it back because
this function will be needed by next patches.
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 dbfa192..c9bfc6f 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -287,6 +287,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;
@@ -566,7 +576,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;
@@ -577,7 +587,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 14/40] vdpa: convert iova_tree to ref count based, (continued)
- [PATCH 14/40] vdpa: convert iova_tree to ref count based, Si-Wei Liu, 2023/12/07
- [PATCH 15/40] vdpa: add svq_switching and flush_map to header, Si-Wei Liu, 2023/12/07
- [PATCH 12/40] vdpa: check map_thread_enabled before join maps thread, Si-Wei Liu, 2023/12/07
- [PATCH 11/40] vdpa: factor out vhost_vdpa_last_dev, Si-Wei Liu, 2023/12/07
- [PATCH 17/40] vdpa: judge if map can be kept across reset, Si-Wei Liu, 2023/12/07
- [PATCH 18/40] vdpa: unregister listener on last dev cleanup, Si-Wei Liu, 2023/12/07
- [PATCH 08/40] vdpa: add back vhost_vdpa_net_first_nc_vdpa,
Si-Wei Liu <=
- [PATCH 22/40] vdpa: factor out vhost_vdpa_map_batch_begin, Si-Wei Liu, 2023/12/07
- [PATCH 25/40] vdpa: add asid to dma_batch_once API, Si-Wei Liu, 2023/12/07
- [PATCH 19/40] vdpa: should avoid map flushing with persistent iotlb, Si-Wei Liu, 2023/12/07
- [PATCH 21/40] vdpa: vhost_vdpa_dma_batch_end_once rename, Si-Wei Liu, 2023/12/07
- [PATCH 16/40] vdpa: indicate SVQ switching via flag, Si-Wei Liu, 2023/12/07
- [PATCH 24/40] vdpa: factor out vhost_vdpa_dma_batch_end, Si-Wei Liu, 2023/12/07
- [PATCH 26/40] vdpa: return int for dma_batch_once API, Si-Wei Liu, 2023/12/07
- [PATCH 27/40] vdpa: add asid to all dma_batch call sites, Si-Wei Liu, 2023/12/07