Skip to content

Commit

Permalink
net_sched: fix class grafting errno codes
Browse files Browse the repository at this point in the history
If the parent qdisc doesn't support classes, use EOPNOTSUPP.
If the parent class doesn't exist, use ENOENT. Currently EINVAL
is returned in both cases.

Additionally check whether grafting is supported and remove a now
unnecessary graft function from sch_ingress.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Sep 5, 2009
1 parent b1f5719 commit c9f1d03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
8 changes: 4 additions & 4 deletions net/sched/sch_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -728,14 +728,14 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
} else {
const struct Qdisc_class_ops *cops = parent->ops->cl_ops;

err = -EINVAL;

if (cops) {
err = -EOPNOTSUPP;
if (cops && cops->graft) {
unsigned long cl = cops->get(parent, classid);
if (cl) {
err = cops->graft(parent, cl, new, &old);
cops->put(parent, cl);
}
} else
err = -ENOENT;
}
if (!err)
notify_and_destroy(skb, n, classid, old, new);
Expand Down
7 changes: 0 additions & 7 deletions net/sched/sch_ingress.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ struct ingress_qdisc_data {

/* ------------------------- Class/flow operations ------------------------- */

static int ingress_graft(struct Qdisc *sch, unsigned long arg,
struct Qdisc *new, struct Qdisc **old)
{
return -EOPNOTSUPP;
}

static struct Qdisc *ingress_leaf(struct Qdisc *sch, unsigned long arg)
{
return NULL;
Expand Down Expand Up @@ -123,7 +117,6 @@ static int ingress_dump(struct Qdisc *sch, struct sk_buff *skb)
}

static const struct Qdisc_class_ops ingress_class_ops = {
.graft = ingress_graft,
.leaf = ingress_leaf,
.get = ingress_get,
.put = ingress_put,
Expand Down

0 comments on commit c9f1d03

Please sign in to comment.