net_sched: remove some unnecessary checks in classful schedulers
The class argument to the ->graft(), ->leaf(), ->dump(), ->dump_stats() all originate from either ->get() or ->walk() and are always valid. Remove unnecessary checks. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committato da
David S. Miller

parent
de6d5cdf88
commit
5b9a9ccfad
@@ -1621,29 +1621,25 @@ static int cbq_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
||||
{
|
||||
struct cbq_class *cl = (struct cbq_class*)arg;
|
||||
|
||||
if (cl) {
|
||||
if (new == NULL) {
|
||||
new = qdisc_create_dflt(qdisc_dev(sch), sch->dev_queue,
|
||||
&pfifo_qdisc_ops,
|
||||
cl->common.classid);
|
||||
if (new == NULL)
|
||||
return -ENOBUFS;
|
||||
} else {
|
||||
if (new == NULL) {
|
||||
new = qdisc_create_dflt(qdisc_dev(sch), sch->dev_queue,
|
||||
&pfifo_qdisc_ops, cl->common.classid);
|
||||
if (new == NULL)
|
||||
return -ENOBUFS;
|
||||
} else {
|
||||
#ifdef CONFIG_NET_CLS_ACT
|
||||
if (cl->police == TC_POLICE_RECLASSIFY)
|
||||
new->reshape_fail = cbq_reshape_fail;
|
||||
if (cl->police == TC_POLICE_RECLASSIFY)
|
||||
new->reshape_fail = cbq_reshape_fail;
|
||||
#endif
|
||||
}
|
||||
sch_tree_lock(sch);
|
||||
*old = cl->q;
|
||||
cl->q = new;
|
||||
qdisc_tree_decrease_qlen(*old, (*old)->q.qlen);
|
||||
qdisc_reset(*old);
|
||||
sch_tree_unlock(sch);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return -ENOENT;
|
||||
sch_tree_lock(sch);
|
||||
*old = cl->q;
|
||||
cl->q = new;
|
||||
qdisc_tree_decrease_qlen(*old, (*old)->q.qlen);
|
||||
qdisc_reset(*old);
|
||||
sch_tree_unlock(sch);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct Qdisc *
|
||||
@@ -1651,7 +1647,7 @@ cbq_leaf(struct Qdisc *sch, unsigned long arg)
|
||||
{
|
||||
struct cbq_class *cl = (struct cbq_class*)arg;
|
||||
|
||||
return cl ? cl->q : NULL;
|
||||
return cl->q;
|
||||
}
|
||||
|
||||
static void cbq_qlen_notify(struct Qdisc *sch, unsigned long arg)
|
||||
|
Fai riferimento in un nuovo problema
Block a user