Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 184011
b: refs/heads/master
c: 830a8a9
h: refs/heads/master
i:
  184009: ae393e9
  184007: 8545ee6
v: v3
  • Loading branch information
Shirley Ma authored and David S. Miller committed Feb 12, 2010
1 parent 86007b5 commit b179b70
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b25822ca5e3d6551b74506e2c69afada7c29c967
refs/heads/master: 830a8a976ff2236ebc383e9a06f7872ed9243bfb
26 changes: 8 additions & 18 deletions trunk/drivers/net/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ struct virtnet_info
/* Host will merge rx buffers for big packets (shake it! shake it!) */
bool mergeable_rx_bufs;

/* Send queue. */
struct sk_buff_head send;

/* Work struct for refilling if we run low on memory. */
struct delayed_work refill;

Expand Down Expand Up @@ -505,7 +502,6 @@ static unsigned int free_old_xmit_skbs(struct virtnet_info *vi)

while ((skb = vi->svq->vq_ops->get_buf(vi->svq, &len)) != NULL) {
pr_debug("Sent skb %p\n", skb);
__skb_unlink(skb, &vi->send);
vi->dev->stats.tx_bytes += skb->len;
vi->dev->stats.tx_packets++;
tot_sgs += skb_vnet_hdr(skb)->num_sg;
Expand Down Expand Up @@ -588,15 +584,6 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
}
vi->svq->vq_ops->kick(vi->svq);

/*
* Put new one in send queue. You'd expect we'd need this before
* xmit_skb calls add_buf(), since the callback can be triggered
* immediately after that. But since the callback just triggers
* another call back here, normal network xmit locking prevents the
* race.
*/
__skb_queue_head(&vi->send, skb);

/* Don't wait up for transmitted skbs to be freed. */
skb_orphan(skb);
nf_reset(skb);
Expand Down Expand Up @@ -980,9 +967,6 @@ static int virtnet_probe(struct virtio_device *vdev)
dev->features |= NETIF_F_HW_VLAN_FILTER;
}

/* Initialize our empty send queue. */
skb_queue_head_init(&vi->send);

err = register_netdev(dev);
if (err) {
pr_debug("virtio_net: registering device failed\n");
Expand Down Expand Up @@ -1018,6 +1002,12 @@ static int virtnet_probe(struct virtio_device *vdev)
static void free_unused_bufs(struct virtnet_info *vi)
{
void *buf;
while (1) {
buf = vi->svq->vq_ops->detach_unused_buf(vi->svq);
if (!buf)
break;
dev_kfree_skb(buf);
}
while (1) {
buf = vi->rvq->vq_ops->detach_unused_buf(vi->rvq);
if (!buf)
Expand All @@ -1038,11 +1028,11 @@ static void __devexit virtnet_remove(struct virtio_device *vdev)
/* Stop all the virtqueues. */
vdev->config->reset(vdev);

/* Free our skbs in send queue, if any. */
__skb_queue_purge(&vi->send);

unregister_netdev(vi->dev);
cancel_delayed_work_sync(&vi->refill);

/* Free unused buffers in both send and recv, if any. */
free_unused_bufs(vi);

vdev->config->del_vqs(vi->vdev);
Expand Down

0 comments on commit b179b70

Please sign in to comment.