Skip to content

Commit 5f7f750

Browse files
committed
Merge branch 'IFF_NO_QUEUE-semantics'
Jesper Dangaard Brouer says: ==================== qdisc and tx_queue_len cleanups for IFF_NO_QUEUE devices This patchset is a cleanup for IFF_NO_QUEUE devices. It will hopefully help userspace get a more consistent behavior when attaching qdisc to such virtual devices. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents fc13fd3 + 84c46dd commit 5f7f750

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

include/net/pkt_sched.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include <linux/if_vlan.h>
77
#include <net/sch_generic.h>
88

9+
#define DEFAULT_TX_QUEUE_LEN 1000
10+
911
struct qdisc_walker {
1012
int stop;
1113
int skip;

net/core/dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7651,7 +7651,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
76517651

76527652
if (!dev->tx_queue_len) {
76537653
dev->priv_flags |= IFF_NO_QUEUE;
7654-
dev->tx_queue_len = 1;
7654+
dev->tx_queue_len = DEFAULT_TX_QUEUE_LEN;
76557655
}
76567656

76577657
dev->num_tx_queues = txqs;

net/ethernet/eth.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
#include <net/dsa.h>
6363
#include <net/flow_dissector.h>
6464
#include <linux/uaccess.h>
65+
#include <net/pkt_sched.h>
6566

6667
__setup("ether=", netdev_boot_setup);
6768

@@ -359,7 +360,7 @@ void ether_setup(struct net_device *dev)
359360
dev->min_mtu = ETH_MIN_MTU;
360361
dev->max_mtu = ETH_DATA_LEN;
361362
dev->addr_len = ETH_ALEN;
362-
dev->tx_queue_len = 1000; /* Ethernet wants good queues */
363+
dev->tx_queue_len = DEFAULT_TX_QUEUE_LEN;
363364
dev->flags = IFF_BROADCAST|IFF_MULTICAST;
364365
dev->priv_flags |= IFF_TX_SKB_SHARING;
365366

net/sched/sch_api.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,17 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
960960

961961
sch->handle = handle;
962962

963+
/* This exist to keep backward compatible with a userspace
964+
* loophole, what allowed userspace to get IFF_NO_QUEUE
965+
* facility on older kernels by setting tx_queue_len=0 (prior
966+
* to qdisc init), and then forgot to reinit tx_queue_len
967+
* before again attaching a qdisc.
968+
*/
969+
if ((dev->priv_flags & IFF_NO_QUEUE) && (dev->tx_queue_len == 0)) {
970+
dev->tx_queue_len = DEFAULT_TX_QUEUE_LEN;
971+
netdev_info(dev, "Caught tx_queue_len zero misconfig\n");
972+
}
973+
963974
if (!ops->init || (err = ops->init(sch, tca[TCA_OPTIONS])) == 0) {
964975
if (qdisc_is_percpu_stats(sch)) {
965976
sch->cpu_bstats =

0 commit comments

Comments
 (0)