qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: <rongqing.li@windriver.com>
To: qemu-devel@nongnu.org
Cc: stefanha@linux.vnet.ibm.com
Subject: [Qemu-devel] [PATCH 2/2] hub: change hub can_receive() strategy
Date: Fri, 24 Aug 2012 15:56:24 +0800	[thread overview]
Message-ID: <1345794984-10337-2-git-send-email-rongqing.li@windriver.com> (raw)
In-Reply-To: <1345794984-10337-1-git-send-email-rongqing.li@windriver.com>

From: Roy.Li <rongqing.li@windriver.com>

Only one hub port's peer can_receive() returns 1, the source
hub port .can_receive should return 1, to fix the below bug:

    The up state NIC can not receive any packets if guest has
    more than two NICs and only one NIC is in down state.
    http://lists.nongnu.org/archive/html/qemu-discuss/2012-08/msg00036.html

This bug is introduced by 52a3cb8(add the support for hub
own flow control) and 60c07d93 (fix qemu_can_send_packet logic),
they are tried to fix that usb NIC lost packets by blocking hub
receive until all port attached this hub can receive since usb
NIC only can accept one packet at one time, their logic is wrong,
we should fix it by creating a queue for usb NIC.

Signed-off-by: Roy.Li <rongqing.li@windriver.com>
---
 net/hub.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/hub.c b/net/hub.c
index ac157e3..650a8b4 100644
--- a/net/hub.c
+++ b/net/hub.c
@@ -97,12 +97,12 @@ static int net_hub_port_can_receive(NetClientState *nc)
             continue;
         }
 
-        if (!qemu_can_send_packet(&port->nc)) {
-            return 0;
+        if (qemu_can_send_packet(&port->nc)) {
+            return 1;
         }
     }
 
-    return 1;
+    return 0;
 }
 
 static ssize_t net_hub_port_receive(NetClientState *nc,
-- 
1.7.4.1

  reply	other threads:[~2012-08-24  7:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-24  7:56 [Qemu-devel] [PATCH 1/2] Usb: create the receive queue for the virtual USB NIC rongqing.li
2012-08-24  7:56 ` rongqing.li [this message]
2012-08-24  8:20   ` [Qemu-devel] [PATCH 2/2] hub: change hub can_receive() strategy Paolo Bonzini
2012-08-24  8:33     ` Rongqing Li
2012-08-24 10:11       ` Stefan Hajnoczi
2012-08-24 12:25 ` [Qemu-devel] [PATCH 1/2] Usb: create the receive queue for the virtual USB NIC Stefan Hajnoczi

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=1345794984-10337-2-git-send-email-rongqing.li@windriver.com \
    --to=rongqing.li@windriver.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@linux.vnet.ibm.com \
    /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).