diff options
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r-- | drivers/net/virtio_net.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 1edb7a61983c..bb6b67f6b0cc 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -415,7 +415,7 @@ static int add_recvbuf_mergeable(struct virtnet_info *vi, gfp_t gfp) | |||
415 | static bool try_fill_recv(struct virtnet_info *vi, gfp_t gfp) | 415 | static bool try_fill_recv(struct virtnet_info *vi, gfp_t gfp) |
416 | { | 416 | { |
417 | int err; | 417 | int err; |
418 | bool oom = false; | 418 | bool oom; |
419 | 419 | ||
420 | do { | 420 | do { |
421 | if (vi->mergeable_rx_bufs) | 421 | if (vi->mergeable_rx_bufs) |
@@ -425,10 +425,9 @@ static bool try_fill_recv(struct virtnet_info *vi, gfp_t gfp) | |||
425 | else | 425 | else |
426 | err = add_recvbuf_small(vi, gfp); | 426 | err = add_recvbuf_small(vi, gfp); |
427 | 427 | ||
428 | if (err < 0) { | 428 | oom = err == -ENOMEM; |
429 | oom = true; | 429 | if (err < 0) |
430 | break; | 430 | break; |
431 | } | ||
432 | ++vi->num; | 431 | ++vi->num; |
433 | } while (err > 0); | 432 | } while (err > 0); |
434 | if (unlikely(vi->num > vi->max)) | 433 | if (unlikely(vi->num > vi->max)) |
@@ -563,7 +562,6 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
563 | struct virtnet_info *vi = netdev_priv(dev); | 562 | struct virtnet_info *vi = netdev_priv(dev); |
564 | int capacity; | 563 | int capacity; |
565 | 564 | ||
566 | again: | ||
567 | /* Free up any pending old buffers before queueing new ones. */ | 565 | /* Free up any pending old buffers before queueing new ones. */ |
568 | free_old_xmit_skbs(vi); | 566 | free_old_xmit_skbs(vi); |
569 | 567 | ||
@@ -572,14 +570,20 @@ again: | |||
572 | 570 | ||
573 | /* This can happen with OOM and indirect buffers. */ | 571 | /* This can happen with OOM and indirect buffers. */ |
574 | if (unlikely(capacity < 0)) { | 572 | if (unlikely(capacity < 0)) { |
575 | netif_stop_queue(dev); | 573 | if (net_ratelimit()) { |
576 | dev_warn(&dev->dev, "Unexpected full queue\n"); | 574 | if (likely(capacity == -ENOMEM)) { |
577 | if (unlikely(!virtqueue_enable_cb(vi->svq))) { | 575 | dev_warn(&dev->dev, |
578 | virtqueue_disable_cb(vi->svq); | 576 | "TX queue failure: out of memory\n"); |
579 | netif_start_queue(dev); | 577 | } else { |
580 | goto again; | 578 | dev->stats.tx_fifo_errors++; |
579 | dev_warn(&dev->dev, | ||
580 | "Unexpected TX queue failure: %d\n", | ||
581 | capacity); | ||
582 | } | ||
581 | } | 583 | } |
582 | return NETDEV_TX_BUSY; | 584 | dev->stats.tx_dropped++; |
585 | kfree_skb(skb); | ||
586 | return NETDEV_TX_OK; | ||
583 | } | 587 | } |
584 | virtqueue_kick(vi->svq); | 588 | virtqueue_kick(vi->svq); |
585 | 589 | ||