From: Rusty Russell <rusty@rustcorp•com.au>
To: netdev <netdev@vger•kernel.org>
Cc: Amit Shah <amit.shah@redhat•com>,
"Michael S. Tsirkin" <mst@redhat•com>,
Virtualization List <virtualization@lists•linux-foundation.org>
Subject: [PATCH 2/2] virtio: net: Move vq and vq buf removal into separate function
Date: Wed, 04 Jan 2012 13:28:49 +1030 [thread overview]
Message-ID: <87lipocgwm.fsf@rustcorp.com.au> (raw)
In-Reply-To: <87obukcgzi.fsf@rustcorp.com.au>
From: Amit Shah <amit.shah@redhat•com>
The remove and PM freeze functions will share this code.
Signed-off-by: Amit Shah <amit.shah@redhat•com>
Signed-off-by: Rusty Russell <rusty@rustcorp•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);
next prev parent reply other threads:[~2012-01-04 2:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-04 2:57 [PATCH 1/2] virtio: net: Move vq initialization into separate function Rusty Russell
2012-01-04 2:58 ` Rusty Russell [this message]
2012-01-04 3:00 ` [PATCH] (please ack, don't apply!) virtio: net: Add freeze, restore handlers to support S4 Rusty Russell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lipocgwm.fsf@rustcorp.com.au \
--to=rusty@rustcorp$(echo .)com.au \
--cc=amit.shah@redhat$(echo .)com \
--cc=mst@redhat$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=virtualization@lists$(echo .)linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox