[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 04/12] vdpa: factor out vhost_vdpa_net_get_nc_vdpa
From: |
Si-Wei Liu |
Subject: |
[PATCH 04/12] vdpa: factor out vhost_vdpa_net_get_nc_vdpa |
Date: |
Wed, 14 Feb 2024 03:27:54 -0800 |
Introduce new API. No functional change on existing API.
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
---
net/vhost-vdpa.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 06c83b4..4168cad 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -281,13 +281,18 @@ static ssize_t vhost_vdpa_receive(NetClientState *nc,
const uint8_t *buf,
}
-/** From any vdpa net client, get the netclient of the first queue pair */
-static VhostVDPAState *vhost_vdpa_net_first_nc_vdpa(VhostVDPAState *s)
+/** From any vdpa net client, get the netclient of the i-th queue pair */
+static VhostVDPAState *vhost_vdpa_net_get_nc_vdpa(VhostVDPAState *s, int i)
{
NICState *nic = qemu_get_nic(s->nc.peer);
- NetClientState *nc0 = qemu_get_peer(nic->ncs, 0);
+ NetClientState *nc_i = qemu_get_peer(nic->ncs, i);
+
+ return DO_UPCAST(VhostVDPAState, nc, nc_i);
+}
- return DO_UPCAST(VhostVDPAState, nc, nc0);
+static VhostVDPAState *vhost_vdpa_net_first_nc_vdpa(VhostVDPAState *s)
+{
+ return vhost_vdpa_net_get_nc_vdpa(s, 0);
}
static void vhost_vdpa_net_log_global_enable(VhostVDPAState *s, bool enable)
--
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, 2024/02/14
- [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