[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87lipocgwm.fsf@rustcorp.com.au>
Date: Wed, 04 Jan 2012 13:28:49 +1030
From: Rusty Russell <rusty@...tcorp.com.au>
To: netdev <netdev@...r.kernel.org>
Cc: Virtualization List <virtualization@...ts.linux-foundation.org>,
"Michael S. Tsirkin" <mst@...hat.com>,
Amit Shah <amit.shah@...hat.com>
Subject: [PATCH 2/2] virtio: net: Move vq and vq buf removal into separate function
From: Amit Shah <amit.shah@...hat.com>
The remove and PM freeze functions will share this code.
Signed-off-by: Amit Shah <amit.shah@...hat.com>
Signed-off-by: Rusty Russell <rusty@...tcorp.com.au>
---
drivers/net/virtio_net.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index ec8c400..7a2a5bf 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1134,22 +1134,26 @@ static void free_unused_bufs(struct virtnet_info *vi)
BUG_ON(vi->num != 0);
}
-static void __devexit virtnet_remove(struct virtio_device *vdev)
+static void remove_vq_common(struct virtnet_info *vi)
{
- struct virtnet_info *vi = vdev->priv;
-
- /* Stop all the virtqueues. */
- vdev->config->reset(vdev);
-
- unregister_netdev(vi->dev);
+ vi->vdev->config->reset(vi->vdev);
/* Free unused buffers in both send and recv, if any. */
free_unused_bufs(vi);
- vdev->config->del_vqs(vi->vdev);
+ vi->vdev->config->del_vqs(vi->vdev);
while (vi->pages)
__free_pages(get_a_page(vi, GFP_KERNEL), 0);
+}
+
+static void __devexit virtnet_remove(struct virtio_device *vdev)
+{
+ struct virtnet_info *vi = vdev->priv;
+
+ unregister_netdev(vi->dev);
+
+ remove_vq_common(vi);
free_percpu(vi->stats);
free_netdev(vi->dev);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists