peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0195-net-broadcast-hub-packets-if-at-least-one-port-can-r.patch

5544c1
From 25ade2154673396e432de2b3c413865d1552c9b3 Mon Sep 17 00:00:00 2001
5544c1
From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
5544c1
Date: Fri, 24 Aug 2012 13:50:30 +0100
5544c1
Subject: [PATCH] net: broadcast hub packets if at least one port can receive
5544c1
5544c1
In commit 60c07d933c66c4b30a83b7ccbc8a0cb3df1b2d0e ("net: fix
5544c1
qemu_can_send_packet logic") the "VLAN" broadcast behavior was changed
5544c1
to queue packets if any net client cannot receive.  It turns out that
5544c1
this was not actually the right fix and just hides the real bug that
5544c1
hw/usb/dev-network.c:usbnet_receive() clobbers its receive buffer when
5544c1
called multiple times in a row.  The commit also introduced a new bug
5544c1
that "VLAN" packets would not be sent if one of multiple net clients was
5544c1
down.
5544c1
5544c1
The hw/usb/dev-network.c bug has since been fixed, so this patch reverts
5544c1
broadcast behavior to send packets as long as one net client can
5544c1
receive.  Packets simply get queued for the net clients that are
5544c1
temporarily unable to receive.
5544c1
5544c1
Reported-by: Roy.Li <rongqing.li@windriver.com>
5544c1
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
5544c1
(cherry picked from commit 61518a74ca98870e8ff132f91dd5dda252e31f58)
5544c1
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1
---
5544c1
 net/hub.c | 6 +++---
5544c1
 1 file changed, 3 insertions(+), 3 deletions(-)
5544c1
5544c1
diff --git a/net/hub.c b/net/hub.c
5544c1
index ac157e3..650a8b4 100644
5544c1
--- a/net/hub.c
5544c1
+++ b/net/hub.c
5544c1
@@ -97,12 +97,12 @@ static int net_hub_port_can_receive(NetClientState *nc)
5544c1
             continue;
5544c1
         }
5544c1
 
5544c1
-        if (!qemu_can_send_packet(&port->nc)) {
5544c1
-            return 0;
5544c1
+        if (qemu_can_send_packet(&port->nc)) {
5544c1
+            return 1;
5544c1
         }
5544c1
     }
5544c1
 
5544c1
-    return 1;
5544c1
+    return 0;
5544c1
 }
5544c1
 
5544c1
 static ssize_t net_hub_port_receive(NetClientState *nc,
5544c1
-- 
5544c1
1.7.12.1
5544c1