aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/virtio_net.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r--drivers/net/virtio_net.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 8d009760277..05630f2f693 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -22,7 +22,6 @@
22#include <linux/ethtool.h> 22#include <linux/ethtool.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/virtio.h> 24#include <linux/virtio.h>
25#include <linux/virtio_ids.h>
26#include <linux/virtio_net.h> 25#include <linux/virtio_net.h>
27#include <linux/scatterlist.h> 26#include <linux/scatterlist.h>
28#include <linux/if_vlan.h> 27#include <linux/if_vlan.h>
@@ -454,7 +453,7 @@ static unsigned int free_old_xmit_skbs(struct virtnet_info *vi)
454 vi->dev->stats.tx_bytes += skb->len; 453 vi->dev->stats.tx_bytes += skb->len;
455 vi->dev->stats.tx_packets++; 454 vi->dev->stats.tx_packets++;
456 tot_sgs += skb_vnet_hdr(skb)->num_sg; 455 tot_sgs += skb_vnet_hdr(skb)->num_sg;
457 kfree_skb(skb); 456 dev_kfree_skb_any(skb);
458 } 457 }
459 return tot_sgs; 458 return tot_sgs;
460} 459}
@@ -517,8 +516,7 @@ again:
517 /* Free up any pending old buffers before queueing new ones. */ 516 /* Free up any pending old buffers before queueing new ones. */
518 free_old_xmit_skbs(vi); 517 free_old_xmit_skbs(vi);
519 518
520 /* Put new one in send queue and do transmit */ 519 /* Try to transmit */
521 __skb_queue_head(&vi->send, skb);
522 capacity = xmit_skb(vi, skb); 520 capacity = xmit_skb(vi, skb);
523 521
524 /* This can happen with OOM and indirect buffers. */ 522 /* This can happen with OOM and indirect buffers. */
@@ -532,8 +530,17 @@ again:
532 } 530 }
533 return NETDEV_TX_BUSY; 531 return NETDEV_TX_BUSY;
534 } 532 }
535
536 vi->svq->vq_ops->kick(vi->svq); 533 vi->svq->vq_ops->kick(vi->svq);
534
535 /*
536 * Put new one in send queue. You'd expect we'd need this before
537 * xmit_skb calls add_buf(), since the callback can be triggered
538 * immediately after that. But since the callback just triggers
539 * another call back here, normal network xmit locking prevents the
540 * race.
541 */
542 __skb_queue_head(&vi->send, skb);
543
537 /* Don't wait up for transmitted skbs to be freed. */ 544 /* Don't wait up for transmitted skbs to be freed. */
538 skb_orphan(skb); 545 skb_orphan(skb);
539 nf_reset(skb); 546 nf_reset(skb);