From: Alexander Aring <aring@mojatatu.com>
To: jhs@mojatatu.com
Cc: xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net,
netdev@vger.kernel.org, kernel@mojatatu.com,
Alexander Aring <aring@mojatatu.com>,
David Ahern <dsahern@gmail.com>
Subject: [PATCHv4 net-next 10/14] net: sch: api: add extack support in qdisc_alloc
Date: Wed, 20 Dec 2017 12:35:20 -0500 [thread overview]
Message-ID: <20171220173524.25874-11-aring@mojatatu.com> (raw)
In-Reply-To: <20171220173524.25874-1-aring@mojatatu.com>
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: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Alexander Aring <aring@mojatatu.com>
---
include/net/sch_generic.h | 3 ++-
net/sched/sch_api.c | 2 +-
net/sched/sch_generic.c | 6 ++++--
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 3baadac9e7a5..faf6b2dbc1b2 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -471,7 +471,8 @@ void qdisc_destroy(struct Qdisc *qdisc);
void qdisc_tree_reduce_backlog(struct Qdisc *qdisc, unsigned int n,
unsigned int len);
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,
const struct Qdisc_ops *ops, u32 parentid);
void __qdisc_calculate_pkt_len(struct sk_buff *skb,
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 79a9fdf9471d..3a3a1da6b071 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1052,7 +1052,7 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
goto err_out;
}
- sch = qdisc_alloc(dev_queue, ops);
+ sch = qdisc_alloc(dev_queue, ops, extack);
if (IS_ERR(sch)) {
err = PTR_ERR(sch);
goto err_out2;
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 30bc38c5d7ae..34ef4366f8e0 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -755,7 +755,8 @@ static struct lock_class_key qdisc_tx_busylock;
static struct lock_class_key qdisc_running_key;
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;
struct Qdisc *sch;
@@ -764,6 +765,7 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
struct net_device *dev;
if (!dev_queue) {
+ NL_SET_ERR_MSG(extack, "No device queue given");
err = -EINVAL;
goto errout;
}
@@ -835,7 +837,7 @@ struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue,
if (!try_module_get(ops->owner))
return NULL;
- sch = qdisc_alloc(dev_queue, ops);
+ sch = qdisc_alloc(dev_queue, ops, NULL);
if (IS_ERR(sch)) {
module_put(ops->owner);
return NULL;
--
2.11.0
next prev parent reply other threads:[~2017-12-20 17:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-20 17:35 [PATCHv4 net-next 00/14] net: sched: sch: introduce extack support Alexander Aring
2017-12-20 17:35 ` [PATCHv4 net-next 01/14] net: sched: fix coding style issues Alexander Aring
2017-12-20 17:35 ` [PATCHv4 net-next 02/14] net: sched: sch_api: handle generic qdisc errors Alexander Aring
2017-12-26 11:53 ` Jiri Pirko
2017-12-20 17:35 ` [PATCHv4 net-next 03/14] net: sched: sch: add extack for init callback Alexander Aring
2017-12-20 17:35 ` [PATCHv4 net-next 04/14] net: sched: sch: add extack for change qdisc ops Alexander Aring
2017-12-20 17:35 ` [PATCHv4 net-next 05/14] net: sched: sch: add extack to change class Alexander Aring
2017-12-20 17:35 ` [PATCHv4 net-next 06/14] net: sched: sch: add extack for block callback Alexander Aring
2017-12-20 17:35 ` [PATCHv4 net-next 07/14] net: sched: sch: add extack for graft callback Alexander Aring
2017-12-20 17:35 ` [PATCHv4 net-next 08/14] net: sch: api: add extack support in qdisc_get_rtab Alexander Aring
2017-12-20 17:35 ` [PATCHv4 net-next 09/14] net: sch: api: add extack support in tcf_block_get Alexander Aring
2017-12-20 17:35 ` Alexander Aring [this message]
2017-12-20 17:35 ` [PATCHv4 net-next 11/14] net: sch: api: add extack support in qdisc_create_dflt Alexander Aring
2017-12-20 17:35 ` [PATCHv4 net-next 12/14] net: sch: sch_cbq: add extack support Alexander Aring
2017-12-20 17:35 ` [PATCHv4 net-next 13/14] net: sch: sch_cbs: " Alexander Aring
2017-12-20 17:35 ` [PATCHv4 net-next 14/14] net: sch: sch_drr: " Alexander Aring
2017-12-21 17:42 ` [PATCHv4 net-next 00/14] net: sched: sch: introduce " David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171220173524.25874-11-aring@mojatatu.com \
--to=aring@mojatatu.com \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kernel@mojatatu.com \
--cc=netdev@vger.kernel.org \
--cc=xiyou.wangcong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).