aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShirley Ma <mashirle@us.ibm.com>2010-02-08 09:14:42 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-12 15:27:56 -0500
commit830a8a976ff2236ebc383e9a06f7872ed9243bfb (patch)
treee8feeab919a37d6aaadb2a896c07c734c922967a
parentb25822ca5e3d6551b74506e2c69afada7c29c967 (diff)
virtio_net: remove send queue
Now we have a virtio detach API (in commit f9bfbebf34eab707b065116cdc9699d25ba4252a), we don't need to track xmit skbs in the virio_net driver, which improves transmission performance. Signed-off-by: Shirley Ma <xma@us.ibm.com> Acked-by: Rusty Russell <rusty@rustcorp.com.au> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/virtio_net.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 4c347a3df657..ce35b42cc2cb 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -56,9 +56,6 @@ struct virtnet_info
56 /* Host will merge rx buffers for big packets (shake it! shake it!) */ 56 /* Host will merge rx buffers for big packets (shake it! shake it!) */
57 bool mergeable_rx_bufs; 57 bool mergeable_rx_bufs;
58 58
59 /* Send queue. */
60 struct sk_buff_head send;
61
62 /* Work struct for refilling if we run low on memory. */ 59 /* Work struct for refilling if we run low on memory. */
63 struct delayed_work refill; 60 struct delayed_work refill;
64 61
@@ -505,7 +502,6 @@ static unsigned int free_old_xmit_skbs(struct virtnet_info *vi)
505 502
506 while ((skb = vi->svq->vq_ops->get_buf(vi->svq, &len)) != NULL) { 503 while ((skb = vi->svq->vq_ops->get_buf(vi->svq, &len)) != NULL) {
507 pr_debug("Sent skb %p\n", skb); 504 pr_debug("Sent skb %p\n", skb);
508 __skb_unlink(skb, &vi->send);
509 vi->dev->stats.tx_bytes += skb->len; 505 vi->dev->stats.tx_bytes += skb->len;
510 vi->dev->stats.tx_packets++; 506 vi->dev->stats.tx_packets++;
511 tot_sgs += skb_vnet_hdr(skb)->num_sg; 507 tot_sgs += skb_vnet_hdr(skb)->num_sg;
@@ -588,15 +584,6 @@ again:
588 } 584 }
589 vi->svq->vq_ops->kick(vi->svq); 585 vi->svq->vq_ops->kick(vi->svq);
590 586
591 /*
592 * Put new one in send queue. You'd expect we'd need this before
593 * xmit_skb calls add_buf(), since the callback can be triggered
594 * immediately after that. But since the callback just triggers
595 * another call back here, normal network xmit locking prevents the
596 * race.
597 */
598 __skb_queue_head(&vi->send, skb);
599
600 /* Don't wait up for transmitted skbs to be freed. */ 587 /* Don't wait up for transmitted skbs to be freed. */
601 skb_orphan(skb); 588 skb_orphan(skb);
602 nf_reset(skb); 589 nf_reset(skb);
@@ -980,9 +967,6 @@ static int virtnet_probe(struct virtio_device *vdev)
980 dev->features |= NETIF_F_HW_VLAN_FILTER; 967 dev->features |= NETIF_F_HW_VLAN_FILTER;
981 } 968 }
982 969
983 /* Initialize our empty send queue. */
984 skb_queue_head_init(&vi->send);
985
986 err = register_netdev(dev); 970 err = register_netdev(dev);
987 if (err) { 971 if (err) {
988 pr_debug("virtio_net: registering device failed\n"); 972 pr_debug("virtio_net: registering device failed\n");
@@ -1019,6 +1003,12 @@ static void free_unused_bufs(struct virtnet_info *vi)
1019{ 1003{
1020 void *buf; 1004 void *buf;
1021 while (1) { 1005 while (1) {
1006 buf = vi->svq->vq_ops->detach_unused_buf(vi->svq);
1007 if (!buf)
1008 break;
1009 dev_kfree_skb(buf);
1010 }
1011 while (1) {
1022 buf = vi->rvq->vq_ops->detach_unused_buf(vi->rvq); 1012 buf = vi->rvq->vq_ops->detach_unused_buf(vi->rvq);
1023 if (!buf) 1013 if (!buf)
1024 break; 1014 break;
@@ -1038,11 +1028,11 @@ static void __devexit virtnet_remove(struct virtio_device *vdev)
1038 /* Stop all the virtqueues. */ 1028 /* Stop all the virtqueues. */
1039 vdev->config->reset(vdev); 1029 vdev->config->reset(vdev);
1040 1030
1041 /* Free our skbs in send queue, if any. */
1042 __skb_queue_purge(&vi->send);
1043 1031
1044 unregister_netdev(vi->dev); 1032 unregister_netdev(vi->dev);
1045 cancel_delayed_work_sync(&vi->refill); 1033 cancel_delayed_work_sync(&vi->refill);
1034
1035 /* Free unused buffers in both send and recv, if any. */
1046 free_unused_bufs(vi); 1036 free_unused_bufs(vi);
1047 1037
1048 vdev->config->del_vqs(vi->vdev); 1038 vdev->config->del_vqs(vi->vdev);