Skip to content
Snippets Groups Projects
Commit 7d91ddd2 authored by Luigi Rizzo's avatar Luigi Rizzo Committed by Stefan Hajnoczi
Browse files

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: default avatarLuigi Rizzo <rizzo@iet.unipi.it>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
parent 199ee608
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment