mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
net: fix qemu_flush_queued_packets() in presence of a hub
When frontend and backend are connected through a hub as below (showing only one direction), and the frontend (or in general, all output ports of the hub) cannot accept more traffic, the backend queues packets in queue-A. When the frontend (or in general, one output port) becomes ready again, quemu tries to flush packets from queue-B, which is unfortunately empty. e1000.0 <--[queue B]-- hub0port0(hub)hub0port1 <--[queue A]-- tap.0 To fix this i propose to introduce a new function net_hub_flush() which is called when trying to flush a queue connected to a hub. Signed-off-by: Luigi Rizzo <rizzo@iet.unipi.it> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
ee24aaf356
commit
199ee608f0
3 changed files with 21 additions and 0 deletions
14
net/hub.c
14
net/hub.c
|
@ -338,3 +338,17 @@ void net_hub_check_clients(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool net_hub_flush(NetClientState *nc)
|
||||
{
|
||||
NetHubPort *port;
|
||||
NetHubPort *source_port = DO_UPCAST(NetHubPort, nc, nc);
|
||||
int ret = 0;
|
||||
|
||||
QLIST_FOREACH(port, &source_port->hub->ports, next) {
|
||||
if (port != source_port) {
|
||||
ret += qemu_net_queue_flush(port->nc.send_queue);
|
||||
}
|
||||
}
|
||||
return ret ? true : false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue