aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorCindy Lu <lulu@redhat.com>2020-07-01 22:55:25 +0800
committerMichael S. Tsirkin <mst@redhat.com>2020-07-03 07:57:04 -0400
commit0165daae5c353bd0d2b72fb39993ece8a845ad75 (patch)
tree9b36d433626c07f9e0792242b6e185554561afcf /net
parent8bc43f39a911036467b95abcac59f22240ac1957 (diff)
downloadqemu-0165daae5c353bd0d2b72fb39993ece8a845ad75.zip
qemu-0165daae5c353bd0d2b72fb39993ece8a845ad75.tar.gz
qemu-0165daae5c353bd0d2b72fb39993ece8a845ad75.tar.bz2
net: introduce qemu_get_peer
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>
Diffstat (limited to 'net')
-rw-r--r--net/net.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/net.c b/net/net.c
index d113029..9099a32 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);