]> git.proxmox.com Git - qemu.git/commit - net/queue.c
net: fix unbounded NetQueue
authorLuigi Rizzo <rizzo@iet.unipi.it>
Tue, 5 Feb 2013 17:29:09 +0000 (18:29 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Wed, 27 Feb 2013 15:10:39 +0000 (16:10 +0100)
commit7d91ddd25e3a4e5008a2ac16127d51a34fd56bf1
tree56a3faab8f037bb90724dd20d75a18c33b47fd25
parent199ee608f0d08510b5c6c37f31a7fbff211d63c4
net: fix unbounded NetQueue

In the current implementation of qemu, running without a network
backend will cause the queue to grow unbounded when the guest is
transmitting traffic.

This patch fixes the problem by implementing bounded size NetQueue,
used with an arbitrary limit of 10000 packets, and dropping packets
when the queue is full _and_ the sender does not pass a callback.

The second condition makes sure that we never drop packets that
contains a callback (which would be tricky, because the producer
expects the callback to be run when all previous packets have been
consumed; so we cannot run it when the packet is dropped).

If documentation is correct, producers that submit a callback should
stop sending when their packet is queued, so there is no real risk
that the queue exceeds the max size by large values.

Signed-off-by: Luigi Rizzo <rizzo@iet.unipi.it>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
net/queue.c