From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lsvp3-0003VB-Hy for qemu-devel@nongnu.org; Sun, 12 Apr 2009 05:17:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lsvoz-0003Rh-2d for qemu-devel@nongnu.org; Sun, 12 Apr 2009 05:17:52 -0400 Received: from [199.232.76.173] (port=48600 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lsvoy-0003RL-Rv for qemu-devel@nongnu.org; Sun, 12 Apr 2009 05:17:48 -0400 Received: from mx1.redhat.com ([66.187.233.31]:38787) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lsvoy-0005DY-H8 for qemu-devel@nongnu.org; Sun, 12 Apr 2009 05:17:48 -0400 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n3C9Hlns031784 for ; Sun, 12 Apr 2009 05:17:47 -0400 From: "Yan Vugenfirer" Date: Sun, 12 Apr 2009 05:17:47 -0400 (EDT) Message-ID: <009201c9bba3$5addabb0$10990310$@com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0093_01C9BB68.AE7ED3B0" Content-Language: en-us Subject: [Qemu-devel] e1000, virtio_net: Check link status in can_receive Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: dlaor@redhat.com This is a multipart message in MIME format. ------=_NextPart_000_0093_01C9BB68.AE7ED3B0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Hello, Fixing the bug of 100% cpu usage by qemu after using "set_link down" monitor command. The fix is for virtio_net and for e1000 emulations. Best regards, Yan Vugenfirer. ------=_NextPart_000_0093_01C9BB68.AE7ED3B0 Content-Type: application/octet-stream; name="0000-cover-letter.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0000-cover-letter.patch" >>From d5d7ca2cb68e76cd89a17768f6e854b38e7f1efa Mon Sep 17 00:00:00 2001=0A= From: Yan Vugenfirer =0A= Date: Sun, 5 Apr 2009 10:21:29 -0400=0A= Subject: [PATCH 0/1] e1000, virtio_net: Check link status in =0A= can_receive=0A= =0A= Fixing the bug of 100% cpu usage by qemu after using "set_link =0A= down"=0A= monitor command. The fix is for virtio_net and for e1000 emulations. =0A= =0A= Yan Vugenfirer (1):=0A= Fixing the bug of 100% cpu usage by qemu after using "set_link =0A= down" monitor command. The fix is for virtio_net and for e1000=0A= emulations.=0A= =0A= hw/e1000.c | 3 ++-=0A= hw/virtio-net.c | 3 ++-=0A= 2 files changed, 4 insertions(+), 2 deletions(-)=0A= =0A= ------=_NextPart_000_0093_01C9BB68.AE7ED3B0 Content-Type: application/octet-stream; name="0001-Fixing-the-bug-of-100-cpu-usage-by-qemu-after-using.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-Fixing-the-bug-of-100-cpu-usage-by-qemu-after-using.patch" >>From d5d7ca2cb68e76cd89a17768f6e854b38e7f1efa Mon Sep 17 00:00:00 2001=0A= From: Yan Vugenfirer =0A= Date: Sun, 5 Apr 2009 10:20:53 -0400=0A= Subject: [PATCH 1/1] e1000, virtio_net: Check link status in can_receive=0A= =0A= Fixing the bug of 100% cpu usage by qemu after using "set_link = down" =0A= monitor command. The fix is for virtio_net and for e1000 emulations.=0A= =0A= ---=0A= hw/e1000.c | 3 ++-=0A= hw/virtio-net.c | 3 ++-=0A= 2 files changed, 4 insertions(+), 2 deletions(-)=0A= =0A= diff --git a/hw/e1000.c b/hw/e1000.c=0A= index 1644201..36878d9 100644=0A= --- a/hw/e1000.c=0A= +++ b/hw/e1000.c=0A= @@ -590,7 +590,8 @@ e1000_can_receive(void *opaque)=0A= {=0A= E1000State *s =3D opaque;=0A= =0A= - return (s->mac_reg[RCTL] & E1000_RCTL_EN);=0A= + return (s->mac_reg[RCTL] & E1000_RCTL_EN) &&=0A= + (s->mac_reg[STATUS] & E1000_STATUS_LU);=0A= }=0A= =0A= static void=0A= diff --git a/hw/virtio-net.c b/hw/virtio-net.c=0A= index ad55bb7..dcd18c1 100644=0A= --- a/hw/virtio-net.c=0A= +++ b/hw/virtio-net.c=0A= @@ -259,7 +259,8 @@ static void virtio_net_handle_rx(VirtIODevice *vdev, = VirtQueue *vq)=0A= static int do_virtio_net_can_receive(VirtIONet *n, int bufsize)=0A= {=0A= if (!virtio_queue_ready(n->rx_vq) ||=0A= - !(n->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK))=0A= + !(n->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK) ||=0A= + !(n->status & VIRTIO_NET_S_LINK_UP))=0A= return 0;=0A= =0A= if (virtio_queue_empty(n->rx_vq) ||=0A= -- =0A= 1.5.5.6=0A= =0A= ------=_NextPart_000_0093_01C9BB68.AE7ED3B0--