[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/68] vdpa: factor out vhost_vdpa_net_get_nc_vdpa
From: |
Michael S. Tsirkin |
Subject: |
[PULL 03/68] vdpa: factor out vhost_vdpa_net_get_nc_vdpa |
Date: |
Tue, 12 Mar 2024 18:25:38 -0400 |
From: Si-Wei Liu <si-wei.liu@oracle.com>
Introduce new API. No functional change on existing API.
Message-Id: <1707910082-10243-5-git-send-email-si-wei.liu@oracle.com>
Reviewed-by: Eugenio PĂ©rez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.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 1d9496cdd9..85efda9e67 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -288,13 +288,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, nc0);
+ return DO_UPCAST(VhostVDPAState, nc, nc_i);
+}
+
+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)
--
MST
- [PULL 00/68] virtio,pc,pci: features, cleanups, fixes, Michael S. Tsirkin, 2024/03/12
- [PULL 03/68] vdpa: factor out vhost_vdpa_net_get_nc_vdpa,
Michael S. Tsirkin <=
- [PULL 02/68] vdpa: factor out vhost_vdpa_last_dev, Michael S. Tsirkin, 2024/03/12
- [PULL 04/68] vdpa: add vhost_vdpa_set_address_space_id trace, Michael S. Tsirkin, 2024/03/12
- [PULL 08/68] vdpa: add trace event for vhost_vdpa_net_load_mq, Michael S. Tsirkin, 2024/03/12
- [PULL 05/68] vdpa: add vhost_vdpa_get_vring_base trace for svq mode, Michael S. Tsirkin, 2024/03/12
- [PULL 09/68] vdpa: define SVQ transitioning state for mode switching, Michael S. Tsirkin, 2024/03/12
- [PULL 10/68] vdpa: indicate transitional state for SVQ switching, Michael S. Tsirkin, 2024/03/12
- [PULL 06/68] vdpa: add vhost_vdpa_set_dev_vring_base trace for svq mode, Michael S. Tsirkin, 2024/03/12
- [PULL 07/68] vdpa: add trace events for vhost_vdpa_net_load_cmd, Michael S. Tsirkin, 2024/03/12
- [PULL 12/68] libvhost-user: Dynamically allocate memory for memory slots, Michael S. Tsirkin, 2024/03/12
- [PULL 01/68] vdpa: add back vhost_vdpa_net_first_nc_vdpa, Michael S. Tsirkin, 2024/03/12