Skip to content

Commit

Permalink
net: sch_prio: When ungrafting, replace with FIFO
Browse files Browse the repository at this point in the history
[ Upstream commit 240ce7f6428ff5188b9eedc066e1e4d645b8635f ]

When a child Qdisc is removed from one of the PRIO Qdisc's bands, it is
replaced unconditionally by a NOOP qdisc. As a result, any traffic hitting
that band gets dropped. That is incorrect--no Qdisc was explicitly added
when PRIO was created, and after removal, none should have to be added
either.

Fix PRIO by first attempting to create a default Qdisc and only falling
back to noop when that fails. This pattern of attempting to create an
invisible FIFO, using NOOP only as a fallback, is also seen in other
Qdiscs.

Fixes: 1da177e ("Linux-2.6.12-rc2")
Signed-off-by: Petr Machata <petrm@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
pmachata authored and gregkh committed Jan 12, 2020
1 parent 8ed5bb1 commit f863b71
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions net/sched/sch_prio.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,14 @@ static int prio_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
struct prio_sched_data *q = qdisc_priv(sch);
unsigned long band = arg - 1;

if (new == NULL)
new = &noop_qdisc;
if (!new) {
new = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
TC_H_MAKE(sch->handle, arg));
if (!new)
new = &noop_qdisc;
else
qdisc_hash_add(new);
}

*old = qdisc_replace(sch, new, &q->queues[band]);
return 0;
Expand Down

0 comments on commit f863b71

Please sign in to comment.