aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 12:23:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 12:23:45 -0400
commit1f0918d03ff4b5c94540c71ce889672abdbc2f4a (patch)
treeecee710444fb3405da55933501e339e10e4ac880 /drivers/net
parent4266c97a3ef4604561a22212eb0eab8a3c338971 (diff)
parentca60a42c9be41c07ebcc2ec8c43dd1be53f147bf (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus
* git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus: lguest: don't force VIRTIO_F_NOTIFY_ON_EMPTY lguest: cleanup for map_switcher() lguest: use PGDIR_SHIFT for PAE code to allow different PAGE_OFFSET lguest: use set_pte/set_pmd uniformly for real page table entries lguest: move panic notifier registration to its expected place. virtio_blk: add support for cache flush virtio: add virtio IDs file virtio: get rid of redundant VIRTIO_ID_9P definition virtio: make add_buf return capacity remaining virtio_pci: minor MSI-X cleanups
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/virtio_net.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 32266fb89c20..5c498d2b043f 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -22,6 +22,7 @@
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>
25#include <linux/virtio_net.h> 26#include <linux/virtio_net.h>
26#include <linux/scatterlist.h> 27#include <linux/scatterlist.h>
27#include <linux/if_vlan.h> 28#include <linux/if_vlan.h>
@@ -320,7 +321,7 @@ static bool try_fill_recv_maxbufs(struct virtnet_info *vi, gfp_t gfp)
320 skb_queue_head(&vi->recv, skb); 321 skb_queue_head(&vi->recv, skb);
321 322
322 err = vi->rvq->vq_ops->add_buf(vi->rvq, sg, 0, num, skb); 323 err = vi->rvq->vq_ops->add_buf(vi->rvq, sg, 0, num, skb);
323 if (err) { 324 if (err < 0) {
324 skb_unlink(skb, &vi->recv); 325 skb_unlink(skb, &vi->recv);
325 trim_pages(vi, skb); 326 trim_pages(vi, skb);
326 kfree_skb(skb); 327 kfree_skb(skb);
@@ -373,7 +374,7 @@ static bool try_fill_recv(struct virtnet_info *vi, gfp_t gfp)
373 skb_queue_head(&vi->recv, skb); 374 skb_queue_head(&vi->recv, skb);
374 375
375 err = vi->rvq->vq_ops->add_buf(vi->rvq, sg, 0, 1, skb); 376 err = vi->rvq->vq_ops->add_buf(vi->rvq, sg, 0, 1, skb);
376 if (err) { 377 if (err < 0) {
377 skb_unlink(skb, &vi->recv); 378 skb_unlink(skb, &vi->recv);
378 kfree_skb(skb); 379 kfree_skb(skb);
379 break; 380 break;
@@ -527,7 +528,7 @@ static int xmit_skb(struct virtnet_info *vi, struct sk_buff *skb)
527 num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1; 528 num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1;
528 529
529 err = vi->svq->vq_ops->add_buf(vi->svq, sg, num, 0, skb); 530 err = vi->svq->vq_ops->add_buf(vi->svq, sg, num, 0, skb);
530 if (!err && !vi->free_in_tasklet) 531 if (err >= 0 && !vi->free_in_tasklet)
531 mod_timer(&vi->xmit_free_timer, jiffies + (HZ/10)); 532 mod_timer(&vi->xmit_free_timer, jiffies + (HZ/10));
532 533
533 return err; 534 return err;
@@ -538,7 +539,7 @@ static void xmit_tasklet(unsigned long data)
538 struct virtnet_info *vi = (void *)data; 539 struct virtnet_info *vi = (void *)data;
539 540
540 netif_tx_lock_bh(vi->dev); 541 netif_tx_lock_bh(vi->dev);
541 if (vi->last_xmit_skb && xmit_skb(vi, vi->last_xmit_skb) == 0) { 542 if (vi->last_xmit_skb && xmit_skb(vi, vi->last_xmit_skb) >= 0) {
542 vi->svq->vq_ops->kick(vi->svq); 543 vi->svq->vq_ops->kick(vi->svq);
543 vi->last_xmit_skb = NULL; 544 vi->last_xmit_skb = NULL;
544 } 545 }
@@ -557,7 +558,7 @@ again:
557 558
558 /* If we has a buffer left over from last time, send it now. */ 559 /* If we has a buffer left over from last time, send it now. */
559 if (unlikely(vi->last_xmit_skb) && 560 if (unlikely(vi->last_xmit_skb) &&
560 xmit_skb(vi, vi->last_xmit_skb) != 0) 561 xmit_skb(vi, vi->last_xmit_skb) < 0)
561 goto stop_queue; 562 goto stop_queue;
562 563
563 vi->last_xmit_skb = NULL; 564 vi->last_xmit_skb = NULL;
@@ -565,7 +566,7 @@ again:
565 /* Put new one in send queue and do transmit */ 566 /* Put new one in send queue and do transmit */
566 if (likely(skb)) { 567 if (likely(skb)) {
567 __skb_queue_head(&vi->send, skb); 568 __skb_queue_head(&vi->send, skb);
568 if (xmit_skb(vi, skb) != 0) { 569 if (xmit_skb(vi, skb) < 0) {
569 vi->last_xmit_skb = skb; 570 vi->last_xmit_skb = skb;
570 skb = NULL; 571 skb = NULL;
571 goto stop_queue; 572 goto stop_queue;
@@ -668,7 +669,7 @@ static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd,
668 sg_set_buf(&sg[i + 1], sg_virt(s), s->length); 669 sg_set_buf(&sg[i + 1], sg_virt(s), s->length);
669 sg_set_buf(&sg[out + in - 1], &status, sizeof(status)); 670 sg_set_buf(&sg[out + in - 1], &status, sizeof(status));
670 671
671 BUG_ON(vi->cvq->vq_ops->add_buf(vi->cvq, sg, out, in, vi)); 672 BUG_ON(vi->cvq->vq_ops->add_buf(vi->cvq, sg, out, in, vi) < 0);
672 673
673 vi->cvq->vq_ops->kick(vi->cvq); 674 vi->cvq->vq_ops->kick(vi->cvq);
674 675