Revision 15ac913b net/tap-linux.c
b/net/tap-linux.c | ||
---|---|---|
76 | 76 |
fcntl(fd, F_SETFL, O_NONBLOCK); |
77 | 77 |
return fd; |
78 | 78 |
} |
79 |
|
|
80 |
/* sndbuf should be set to a value lower than the tx queue |
|
81 |
* capacity of any destination network interface. |
|
82 |
* Ethernet NICs generally have txqueuelen=1000, so 1Mb is |
|
83 |
* a good default, given a 1500 byte MTU. |
|
84 |
*/ |
|
85 |
#define TAP_DEFAULT_SNDBUF 1024*1024 |
|
86 |
|
|
87 |
int tap_set_sndbuf(int fd, QemuOpts *opts) |
|
88 |
{ |
|
89 |
int sndbuf; |
|
90 |
|
|
91 |
sndbuf = qemu_opt_get_size(opts, "sndbuf", TAP_DEFAULT_SNDBUF); |
|
92 |
if (!sndbuf) { |
|
93 |
sndbuf = INT_MAX; |
|
94 |
} |
|
95 |
|
|
96 |
if (ioctl(fd, TUNSETSNDBUF, &sndbuf) == -1 && qemu_opt_get(opts, "sndbuf")) { |
|
97 |
qemu_error("TUNSETSNDBUF ioctl failed: %s\n", strerror(errno)); |
|
98 |
return -1; |
|
99 |
} |
|
100 |
return 0; |
|
101 |
} |
Also available in: Unified diff