Skip to content
Snippets Groups Projects
Commit 0165daae authored by Cindy Lu's avatar Cindy Lu Committed by Michael S. Tsirkin
Browse files

net: introduce qemu_get_peer


This is a small function that can get the peer
from given NetClientState and queue_index

Signed-off-by: default avatarCindy Lu <lulu@redhat.com>
Message-Id: <20200701145538.22333-2-lulu@redhat.com>
Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
parent 8bc43f39
No related branches found
No related tags found
No related merge requests found
......@@ -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 */
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment