From: Roy.Li <rongqing...@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...@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