Commit d0bd684d authored by Alexander Aring's avatar Alexander Aring Committed by David S. Miller

net: sch: api: add extack support in qdisc_alloc

This patch adds extack support for the function qdisc_alloc which is
a common used function in the tc subsystem. Callers which are interested
in the receiving error can assign extack to get a more detailed
information why qdisc_alloc failed.

Cc: David Ahern <dsahern@gmail.com>
Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: default avatarAlexander Aring <aring@mojatatu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8d1a77f9
...@@ -471,7 +471,8 @@ void qdisc_destroy(struct Qdisc *qdisc); ...@@ -471,7 +471,8 @@ void qdisc_destroy(struct Qdisc *qdisc);
void qdisc_tree_reduce_backlog(struct Qdisc *qdisc, unsigned int n, void qdisc_tree_reduce_backlog(struct Qdisc *qdisc, unsigned int n,
unsigned int len); unsigned int len);
struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
const struct Qdisc_ops *ops); const struct Qdisc_ops *ops,
struct netlink_ext_ack *extack);
struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue, struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue,
const struct Qdisc_ops *ops, u32 parentid); const struct Qdisc_ops *ops, u32 parentid);
void __qdisc_calculate_pkt_len(struct sk_buff *skb, void __qdisc_calculate_pkt_len(struct sk_buff *skb,
......
...@@ -1052,7 +1052,7 @@ static struct Qdisc *qdisc_create(struct net_device *dev, ...@@ -1052,7 +1052,7 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
goto err_out; goto err_out;
} }
sch = qdisc_alloc(dev_queue, ops); sch = qdisc_alloc(dev_queue, ops, extack);
if (IS_ERR(sch)) { if (IS_ERR(sch)) {
err = PTR_ERR(sch); err = PTR_ERR(sch);
goto err_out2; goto err_out2;
......
...@@ -755,7 +755,8 @@ static struct lock_class_key qdisc_tx_busylock; ...@@ -755,7 +755,8 @@ static struct lock_class_key qdisc_tx_busylock;
static struct lock_class_key qdisc_running_key; static struct lock_class_key qdisc_running_key;
struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
const struct Qdisc_ops *ops) const struct Qdisc_ops *ops,
struct netlink_ext_ack *extack)
{ {
void *p; void *p;
struct Qdisc *sch; struct Qdisc *sch;
...@@ -764,6 +765,7 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, ...@@ -764,6 +765,7 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
struct net_device *dev; struct net_device *dev;
if (!dev_queue) { if (!dev_queue) {
NL_SET_ERR_MSG(extack, "No device queue given");
err = -EINVAL; err = -EINVAL;
goto errout; goto errout;
} }
...@@ -835,7 +837,7 @@ struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue, ...@@ -835,7 +837,7 @@ struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue,
if (!try_module_get(ops->owner)) if (!try_module_get(ops->owner))
return NULL; return NULL;
sch = qdisc_alloc(dev_queue, ops); sch = qdisc_alloc(dev_queue, ops, NULL);
if (IS_ERR(sch)) { if (IS_ERR(sch)) {
module_put(ops->owner); module_put(ops->owner);
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment