Skip to content

Commit

Permalink
net: sched: drop all special handling of tx_queue_len == 0
Browse files Browse the repository at this point in the history
Those were all workarounds for the formerly double meaning of
tx_queue_len, which broke scheduling algorithms if untreated.

Now that all in-tree drivers have been converted away from setting
tx_queue_len = 0, it should be safe to drop these workarounds for
categorically broken setups.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Phil Sutter authored and David S. Miller committed Aug 18, 2015
1 parent 906470c commit 348e343
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion net/sched/sch_fifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static int fifo_init(struct Qdisc *sch, struct nlattr *opt)
bool is_bfifo = sch->ops == &bfifo_qdisc_ops;

if (opt == NULL) {
u32 limit = qdisc_dev(sch)->tx_queue_len ? : 1;
u32 limit = qdisc_dev(sch)->tx_queue_len;

if (is_bfifo)
limit *= psched_mtu(qdisc_dev(sch));
Expand Down
8 changes: 3 additions & 5 deletions net/sched/sch_gred.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,11 +512,9 @@ static int gred_init(struct Qdisc *sch, struct nlattr *opt)

if (tb[TCA_GRED_LIMIT])
sch->limit = nla_get_u32(tb[TCA_GRED_LIMIT]);
else {
u32 qlen = qdisc_dev(sch)->tx_queue_len ? : 1;

sch->limit = qlen * psched_mtu(qdisc_dev(sch));
}
else
sch->limit = qdisc_dev(sch)->tx_queue_len
* psched_mtu(qdisc_dev(sch));

return gred_change_table_def(sch, tb[TCA_GRED_DPS]);
}
Expand Down
6 changes: 2 additions & 4 deletions net/sched/sch_htb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1048,11 +1048,9 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt)

if (tb[TCA_HTB_DIRECT_QLEN])
q->direct_qlen = nla_get_u32(tb[TCA_HTB_DIRECT_QLEN]);
else {
else
q->direct_qlen = qdisc_dev(sch)->tx_queue_len;
if (q->direct_qlen < 2) /* some devices have zero tx_queue_len */
q->direct_qlen = 2;
}

if ((q->rate2quantum = gopt->rate2quantum) < 1)
q->rate2quantum = 1;
q->defcls = gopt->defcls;
Expand Down
8 changes: 2 additions & 6 deletions net/sched/sch_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,8 @@ static int plug_init(struct Qdisc *sch, struct nlattr *opt)
q->unplug_indefinite = false;

if (opt == NULL) {
/* We will set a default limit of 100 pkts (~150kB)
* in case tx_queue_len is not available. The
* default value is completely arbitrary.
*/
u32 pkt_limit = qdisc_dev(sch)->tx_queue_len ? : 100;
q->limit = pkt_limit * psched_mtu(qdisc_dev(sch));
q->limit = qdisc_dev(sch)->tx_queue_len
* psched_mtu(qdisc_dev(sch));
} else {
struct tc_plug_qopt *ctl = nla_data(opt);

Expand Down
2 changes: 1 addition & 1 deletion net/sched/sch_sfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ static int sfb_change(struct Qdisc *sch, struct nlattr *opt)

limit = ctl->limit;
if (limit == 0)
limit = max_t(u32, qdisc_dev(sch)->tx_queue_len, 1);
limit = qdisc_dev(sch)->tx_queue_len;

child = fifo_create_dflt(sch, &pfifo_qdisc_ops, limit);
if (IS_ERR(child))
Expand Down

0 comments on commit 348e343

Please sign in to comment.