mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-10-15 15:32:51 +00:00
net: add qemu_foreach_nic()
Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
665a3b071d
commit
57f9ef173d
20
net.c
20
net.c
|
@ -326,6 +326,26 @@ qemu_find_vlan_client_by_name(Monitor *mon, int vlan_id,
|
||||||
return vc;
|
return vc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qemu_foreach_nic(qemu_nic_foreach func, void *opaque)
|
||||||
|
{
|
||||||
|
VLANClientState *nc;
|
||||||
|
VLANState *vlan;
|
||||||
|
|
||||||
|
QTAILQ_FOREACH(nc, &non_vlan_clients, next) {
|
||||||
|
if (nc->info->type == NET_CLIENT_TYPE_NIC) {
|
||||||
|
func(DO_UPCAST(NICState, nc, nc), opaque);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QTAILQ_FOREACH(vlan, &vlans, next) {
|
||||||
|
QTAILQ_FOREACH(nc, &vlan->clients, next) {
|
||||||
|
if (nc->info->type == NET_CLIENT_TYPE_NIC) {
|
||||||
|
func(DO_UPCAST(NICState, nc, nc), opaque);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int qemu_can_send_packet(VLANClientState *sender)
|
int qemu_can_send_packet(VLANClientState *sender)
|
||||||
{
|
{
|
||||||
VLANState *vlan = sender->vlan;
|
VLANState *vlan = sender->vlan;
|
||||||
|
|
2
net.h
2
net.h
|
@ -95,6 +95,8 @@ NICState *qemu_new_nic(NetClientInfo *info,
|
||||||
void qemu_del_vlan_client(VLANClientState *vc);
|
void qemu_del_vlan_client(VLANClientState *vc);
|
||||||
VLANClientState *qemu_find_vlan_client_by_name(Monitor *mon, int vlan_id,
|
VLANClientState *qemu_find_vlan_client_by_name(Monitor *mon, int vlan_id,
|
||||||
const char *client_str);
|
const char *client_str);
|
||||||
|
typedef void (*qemu_nic_foreach)(NICState *nic, void *opaque);
|
||||||
|
void qemu_foreach_nic(qemu_nic_foreach func, void *opaque);
|
||||||
int qemu_can_send_packet(VLANClientState *vc);
|
int qemu_can_send_packet(VLANClientState *vc);
|
||||||
ssize_t qemu_sendv_packet(VLANClientState *vc, const struct iovec *iov,
|
ssize_t qemu_sendv_packet(VLANClientState *vc, const struct iovec *iov,
|
||||||
int iovcnt);
|
int iovcnt);
|
||||||
|
|
Loading…
Reference in a new issue