Commit f157ed20 authored by Michael S. Tsirkin's avatar Michael S. Tsirkin Committed by Anthony Liguori
Browse files

tap: safe sndbuf default



With current sndbuf default value, a blocked
target guest can prevent another guest from
transmitting any packets. While current
sndbuf value (1M) is reported to help some
UDP based workloads, the default should
be safe (0).
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
parent 466b5864
......@@ -82,12 +82,17 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required
return fd;
}
/* sndbuf should be set to a value lower than the tx queue
* capacity of any destination network interface.
/* sndbuf implements a kind of flow control for tap.
* Unfortunately when it's enabled, and packets are sent
* to other guests on the same host, the receiver
* can lock up the transmitter indefinitely.
*
* To avoid packet loss, sndbuf should be set to a value lower than the tx
* queue capacity of any destination network interface.
* Ethernet NICs generally have txqueuelen=1000, so 1Mb is
* a good default, given a 1500 byte MTU.
* a good value, given a 1500 byte MTU.
*/
#define TAP_DEFAULT_SNDBUF 1024*1024
#define TAP_DEFAULT_SNDBUF 0
int tap_set_sndbuf(int fd, QemuOpts *opts)
{
......
......@@ -1057,7 +1057,7 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
" use '[down]script=no' to disable script execution\n"
" use 'fd=h' to connect to an already opened TAP interface\n"
" use 'sndbuf=nbytes' to limit the size of the send buffer (the\n"
" default of 'sndbuf=1048576' can be disabled using 'sndbuf=0')\n"
" default is disabled 'sndbuf=0' to enable flow control set 'sndbuf=1048576')\n"
" use vnet_hdr=off to avoid enabling the IFF_VNET_HDR tap flag\n"
" use vnet_hdr=on to make the lack of IFF_VNET_HDR support an error condition\n"
" use vhost=on to enable experimental in kernel accelerator\n"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment