提交 c9f1d038 编写于 作者: P Patrick McHardy 提交者: David S. Miller

net_sched: fix class grafting errno codes

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: NPatrick McHardy <kaber@trash.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 b1f57195
...@@ -728,14 +728,14 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, ...@@ -728,14 +728,14 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
} else { } else {
const struct Qdisc_class_ops *cops = parent->ops->cl_ops; const struct Qdisc_class_ops *cops = parent->ops->cl_ops;
err = -EINVAL; err = -EOPNOTSUPP;
if (cops && cops->graft) {
if (cops) {
unsigned long cl = cops->get(parent, classid); unsigned long cl = cops->get(parent, classid);
if (cl) { if (cl) {
err = cops->graft(parent, cl, new, &old); err = cops->graft(parent, cl, new, &old);
cops->put(parent, cl); cops->put(parent, cl);
} } else
err = -ENOENT;
} }
if (!err) if (!err)
notify_and_destroy(skb, n, classid, old, new); notify_and_destroy(skb, n, classid, old, new);
......
...@@ -22,12 +22,6 @@ struct ingress_qdisc_data { ...@@ -22,12 +22,6 @@ struct ingress_qdisc_data {
/* ------------------------- Class/flow operations ------------------------- */ /* ------------------------- 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) static struct Qdisc *ingress_leaf(struct Qdisc *sch, unsigned long arg)
{ {
return NULL; return NULL;
...@@ -123,7 +117,6 @@ static int ingress_dump(struct Qdisc *sch, struct sk_buff *skb) ...@@ -123,7 +117,6 @@ static int ingress_dump(struct Qdisc *sch, struct sk_buff *skb)
} }
static const struct Qdisc_class_ops ingress_class_ops = { static const struct Qdisc_class_ops ingress_class_ops = {
.graft = ingress_graft,
.leaf = ingress_leaf, .leaf = ingress_leaf,
.get = ingress_get, .get = ingress_get,
.put = ingress_put, .put = ingress_put,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册