提交 61518a74 编写于 作者: S Stefan Hajnoczi 提交者: Stefan Hajnoczi

net: broadcast hub packets if at least one port can receive

In commit 60c07d93 ("net: fix
qemu_can_send_packet logic") the "VLAN" broadcast behavior was changed
to queue packets if any net client cannot receive.  It turns out that
this was not actually the right fix and just hides the real bug that
hw/usb/dev-network.c:usbnet_receive() clobbers its receive buffer when
called multiple times in a row.  The commit also introduced a new bug
that "VLAN" packets would not be sent if one of multiple net clients was
down.

The hw/usb/dev-network.c bug has since been fixed, so this patch reverts
broadcast behavior to send packets as long as one net client can
receive.  Packets simply get queued for the net clients that are
temporarily unable to receive.
Reported-by: NRoy.Li <rongqing.li@windriver.com>
Signed-off-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
上级 190563f9
...@@ -97,12 +97,12 @@ static int net_hub_port_can_receive(NetClientState *nc) ...@@ -97,12 +97,12 @@ static int net_hub_port_can_receive(NetClientState *nc)
continue; continue;
} }
if (!qemu_can_send_packet(&port->nc)) { if (qemu_can_send_packet(&port->nc)) {
return 0; return 1;
} }
} }
return 1; return 0;
} }
static ssize_t net_hub_port_receive(NetClientState *nc, static ssize_t net_hub_port_receive(NetClientState *nc,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册