qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Yan Vugenfirer" <yvugenfi@redhat.com>
To: qemu-devel@nongnu.org
Cc: dlaor@redhat.com
Subject: [Qemu-devel] e1000, virtio_net: Check link status in can_receive
Date: Sun, 12 Apr 2009 05:17:47 -0400 (EDT)	[thread overview]
Message-ID: <009201c9bba3$5addabb0$10990310$@com> (raw)

[-- Attachment #1: Type: text/plain, Size: 185 bytes --]

Hello,

Fixing the bug of 100% cpu usage by qemu after using "set_link <NIC> down"
monitor command. The fix is for virtio_net and for e1000 emulations.


Best regards,
Yan Vugenfirer.


[-- Attachment #2: 0000-cover-letter.patch --]
[-- Type: application/octet-stream, Size: 675 bytes --]

>From d5d7ca2cb68e76cd89a17768f6e854b38e7f1efa Mon Sep 17 00:00:00 2001
From: Yan Vugenfirer <yvugenfi@redhat.com>
Date: Sun, 5 Apr 2009 10:21:29 -0400
Subject: [PATCH 0/1] e1000, virtio_net: Check link status in 
can_receive

Fixing the bug of 100% cpu usage by qemu after using "set_link <NIC> 
down"
monitor command. The fix is for virtio_net and for e1000 emulations. 

Yan Vugenfirer (1):
  Fixing the bug of 100% cpu usage by qemu after using "set_link <NIC>
    down" monitor command. The fix is for virtio_net and for e1000
    emulations.

 hw/e1000.c      |    3 ++-
 hw/virtio-net.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)


[-- Attachment #3: 0001-Fixing-the-bug-of-100-cpu-usage-by-qemu-after-using.patch --]
[-- Type: application/octet-stream, Size: 1436 bytes --]

>From d5d7ca2cb68e76cd89a17768f6e854b38e7f1efa Mon Sep 17 00:00:00 2001
From: Yan Vugenfirer <yvugenfi@redhat.com>
Date: Sun, 5 Apr 2009 10:20:53 -0400
Subject: [PATCH 1/1] e1000, virtio_net: Check link status in can_receive

Fixing the bug of 100% cpu usage by qemu after using "set_link <NIC> down" 
monitor command. The fix is for virtio_net and for e1000 emulations.

---
 hw/e1000.c      |    3 ++-
 hw/virtio-net.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/e1000.c b/hw/e1000.c
index 1644201..36878d9 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -590,7 +590,8 @@ e1000_can_receive(void *opaque)
 {
     E1000State *s = opaque;
 
-    return (s->mac_reg[RCTL] & E1000_RCTL_EN);
+    return (s->mac_reg[RCTL] & E1000_RCTL_EN) &&
+           (s->mac_reg[STATUS] & E1000_STATUS_LU);
 }
 
 static void
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index ad55bb7..dcd18c1 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -259,7 +259,8 @@ static void virtio_net_handle_rx(VirtIODevice *vdev, VirtQueue *vq)
 static int do_virtio_net_can_receive(VirtIONet *n, int bufsize)
 {
     if (!virtio_queue_ready(n->rx_vq) ||
-        !(n->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK))
+        !(n->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK) ||
+        !(n->status & VIRTIO_NET_S_LINK_UP))
         return 0;
 
     if (virtio_queue_empty(n->rx_vq) ||
-- 
1.5.5.6


             reply	other threads:[~2009-04-12  9:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-12  9:17 Yan Vugenfirer [this message]
2009-04-14  8:18 ` [Qemu-devel] e1000, virtio_net: Check link status in can_receive Mark McLoughlin
2009-04-16 10:10   ` Yan Vugenfirer
2009-04-18 14:52 ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='009201c9bba3$5addabb0$10990310$@com' \
    --to=yvugenfi@redhat.com \
    --cc=dlaor@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).