mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-26 20:03:54 -06:00
tap: set IFF_ONE_QUEUE per default
historically the kernel queues packets two times. once at the device and second in qdisc. this is believed to cause interface stalls if one of these queues overruns. setting IFF_ONE_QUEUE is the default in kernels >= 3.8. the flag is ignored since then. see kernel commit 5d097109257c03a71845729f8db6b5770c4bbedc Signed-off-by: Peter Lieven <pl@kamp.de> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
ce675a7579
commit
d26e445c80
2 changed files with 11 additions and 8 deletions
|
@ -42,6 +42,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
|
|||
struct ifreq ifr;
|
||||
int fd, ret;
|
||||
int len = sizeof(struct virtio_net_hdr);
|
||||
unsigned int features;
|
||||
|
||||
TFR(fd = open(PATH_NET_TUN, O_RDWR));
|
||||
if (fd < 0) {
|
||||
|
@ -51,9 +52,12 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
|
|||
memset(&ifr, 0, sizeof(ifr));
|
||||
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
|
||||
|
||||
if (*vnet_hdr) {
|
||||
unsigned int features;
|
||||
if (ioctl(fd, TUNGETFEATURES, &features) == 0 &&
|
||||
features & IFF_ONE_QUEUE) {
|
||||
ifr.ifr_flags |= IFF_ONE_QUEUE;
|
||||
}
|
||||
|
||||
if (*vnet_hdr) {
|
||||
if (ioctl(fd, TUNGETFEATURES, &features) == 0 &&
|
||||
features & IFF_VNET_HDR) {
|
||||
*vnet_hdr = 1;
|
||||
|
@ -78,8 +82,6 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
|
|||
}
|
||||
|
||||
if (mq_required) {
|
||||
unsigned int features;
|
||||
|
||||
if ((ioctl(fd, TUNGETFEATURES, &features) != 0) ||
|
||||
!(features & IFF_MULTI_QUEUE)) {
|
||||
error_report("multiqueue required, but no kernel "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue