tun: disable qdisc queueing
commit 0110d6f22f392f976e84ab49da1b42f85b64a3c5
tun: orphan an skb on tx
Fixed a configuration where skbs get queued
at the tun device forever, blocking senders.
However this fix isn't waterproof:
userspace can control whether the interface
is stopped, and if it is, packets
get queued in the qdisc, again potentially forever.
To complete the fix, this patch sets tun qdisc to 0 when it's registered
to disable qdisc queueing. As user controls this variable to set
queueing within tun as well, set it back to 500 after the
registration.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index bb8c72c..418abd1 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -521,7 +521,6 @@
/* Zero header length */
dev->type = ARPHRD_NONE;
dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
- dev->tx_queue_len = TUN_READQ_SIZE; /* We prefer our own queue length */
break;
case TUN_TAP_DEV:
@@ -531,10 +530,9 @@
dev->priv_flags &= ~IFF_TX_SKB_SHARING;
eth_hw_addr_random(dev);
-
- dev->tx_queue_len = TUN_READQ_SIZE; /* We prefer our own queue length */
break;
}
+ dev->tx_queue_len = 0; /* Disable qdisc queueing */
}
/* Character device part */
@@ -1143,6 +1141,12 @@
if (err < 0)
goto err_free_sk;
+ /*
+ * We (ab)use queue length to limit our amount of buffering.
+ * Set our own default queue length.
+ */
+ dev->tx_queue_len = TUN_READQ_SIZE;
+
if (device_create_file(&tun->dev->dev, &dev_attr_tun_flags) ||
device_create_file(&tun->dev->dev, &dev_attr_owner) ||
device_create_file(&tun->dev->dev, &dev_attr_group))