diff options
author | Jason Wang | 2013-01-30 12:12:24 +0100 |
---|---|---|
committer | Anthony Liguori | 2013-02-01 18:03:01 +0100 |
commit | 948ecf219c032e3483b35ba4e162e5eee17d8b77 (patch) | |
tree | 610f53d9ed92e5154057a4040a44d3d05c971020 /net | |
parent | net: introduce qemu_get_nic() (diff) | |
download | qemu-948ecf219c032e3483b35ba4e162e5eee17d8b77.tar.gz qemu-948ecf219c032e3483b35ba4e162e5eee17d8b77.tar.xz qemu-948ecf219c032e3483b35ba4e162e5eee17d8b77.zip |
net: intorduce qemu_del_nic()
To support multiqueue nic, this patch separate the nic destructor from
qemu_del_net_client() to a new helper qemu_del_nic() since the mapping bettween
NiCState and NetClientState were not 1:1 in multiqueue. The following patches
would refactor this function to support multiqueue nic.
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/net.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -291,6 +291,15 @@ void qemu_del_net_client(NetClientState *nc) return; } + assert(nc->info->type != NET_CLIENT_OPTIONS_KIND_NIC); + + qemu_cleanup_net_client(nc); + qemu_free_net_client(nc); +} + +void qemu_del_nic(NICState *nic) +{ + NetClientState *nc = qemu_get_queue(nic); /* If this is a peer NIC and peer has already been deleted, free it now. */ if (nc->peer && nc->info->type == NET_CLIENT_OPTIONS_KIND_NIC) { NICState *nic = qemu_get_nic(nc); @@ -931,7 +940,11 @@ void net_cleanup(void) NetClientState *nc, *next_vc; QTAILQ_FOREACH_SAFE(nc, &net_clients, next, next_vc) { - qemu_del_net_client(nc); + if (nc->info->type == NET_CLIENT_OPTIONS_KIND_NIC) { + qemu_del_nic(qemu_get_nic(nc)); + } else { + qemu_del_net_client(nc); + } } } |