[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 28/41] net: introduce qemu_get_peer
From: |
Michael S. Tsirkin |
Subject: |
[PULL 28/41] net: introduce qemu_get_peer |
Date: |
Fri, 3 Jul 2020 05:04:45 -0400 |
From: Cindy Lu <lulu@redhat.com>
This is a small function that can get the peer
from given NetClientState and queue_index
Signed-off-by: Cindy Lu <lulu@redhat.com>
Message-Id: <20200701145538.22333-2-lulu@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
---
include/net/net.h | 1 +
net/net.c | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/include/net/net.h b/include/net/net.h
index 39085d9444..e7ef42d62b 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -176,6 +176,7 @@ void hmp_info_network(Monitor *mon, const QDict *qdict);
void net_socket_rs_init(SocketReadState *rs,
SocketReadStateFinalize *finalize,
bool vnet_hdr);
+NetClientState *qemu_get_peer(NetClientState *nc, int queue_index);
/* NIC info */
diff --git a/net/net.c b/net/net.c
index d1130296e1..9099a327dd 100644
--- a/net/net.c
+++ b/net/net.c
@@ -325,6 +325,13 @@ void *qemu_get_nic_opaque(NetClientState *nc)
return nic->opaque;
}
+NetClientState *qemu_get_peer(NetClientState *nc, int queue_index)
+{
+ assert(nc != NULL);
+ NetClientState *ncs = nc + queue_index;
+ return ncs->peer;
+}
+
static void qemu_cleanup_net_client(NetClientState *nc)
{
QTAILQ_REMOVE(&net_clients, nc, next);
--
MST
- [PULL 17/41] numa: Handle virtio-mem in NUMA stats, (continued)
- [PULL 17/41] numa: Handle virtio-mem in NUMA stats, Michael S. Tsirkin, 2020/07/03
- [PULL 18/41] pc: Support for virtio-mem-pci, Michael S. Tsirkin, 2020/07/03
- [PULL 20/41] virtio-pci: Send qapi events when the virtio-mem size changes, Michael S. Tsirkin, 2020/07/03
- [PULL 21/41] virtio-mem: Migration sanity checks, Michael S. Tsirkin, 2020/07/03
- [PULL 22/41] virtio-mem: Add trace events, Michael S. Tsirkin, 2020/07/03
- [PULL 23/41] virtio-mem: Exclude unplugged memory during migration, Michael S. Tsirkin, 2020/07/03
- [PULL 25/41] tests/acpi: remove stale allowed tables, Michael S. Tsirkin, 2020/07/03
- [PULL 26/41] docs: vhost-user: add Virtio status protocol feature, Michael S. Tsirkin, 2020/07/03
- [PULL 24/41] numa: Auto-enable NUMA when any memory devices are possible, Michael S. Tsirkin, 2020/07/03
- [PULL 27/41] MAINTAINERS: add VT-d entry, Michael S. Tsirkin, 2020/07/03
- [PULL 28/41] net: introduce qemu_get_peer,
Michael S. Tsirkin <=
- [PULL 29/41] vhost_net: use the function qemu_get_peer, Michael S. Tsirkin, 2020/07/03
- [PULL 30/41] virtio-bus: introduce queue_enabled method, Michael S. Tsirkin, 2020/07/03
- [PULL 31/41] virtio-pci: implement queue_enabled method, Michael S. Tsirkin, 2020/07/03
- [PULL 32/41] vhost: check the existence of vhost_set_iotlb_callback, Michael S. Tsirkin, 2020/07/03
- [PULL 33/41] vhost: introduce new VhostOps vhost_dev_start, Michael S. Tsirkin, 2020/07/03
- [PULL 34/41] vhost: implement vhost_dev_start method, Michael S. Tsirkin, 2020/07/03
- [PULL 35/41] vhost: introduce new VhostOps vhost_vq_get_addr, Michael S. Tsirkin, 2020/07/03
- [PULL 36/41] vhost: implement vhost_vq_get_addr method, Michael S. Tsirkin, 2020/07/03
- [PULL 37/41] vhost: introduce new VhostOps vhost_force_iommu, Michael S. Tsirkin, 2020/07/03
- [PULL 39/41] vhost_net: introduce set_config & get_config, Michael S. Tsirkin, 2020/07/03