Merge branch 'net-sched-extack'
Alexander Aring says: ==================== net: sched: sch: introduce extack support this patch series basically add support for extack in common qdisc handling. Additional it adds extack pointer to common qdisc callback handling this offers per qdisc implementation to setting the extack message for each failure over netlink. The extack message will be set deeper in qdisc functions but going not deeper as net core api. For qdisc module callback handling, the extack will not be set. This will be part of per qdisc extack handling. I also want to prepare patches to handle extack per qdisc module... so there will come a lot of more patches, just cut them down to make it reviewable. There are some above 80-chars width warnings, which I ignore because it looks more ugly otherwise. This patch-series based on patches by David Ahern which gave me some hints how to deal with extack support. Cc: David Ahern <dsahern@gmail.com> changes since v4: - rebase on current net-next/master - fix several typos (also David Ahren to Ahern, I am sorry) - Add acked by Jamal changes since v3: - remove patch 2/2 lib: nlattr: set extack msg if validate_nla fails since David Ahern has a better solution - Remove check on net admin permission since -EPERM indicates it already - Change rtab to "rate table" - this is what it's stands for - Fix cbs *not* support messages - Fix tcf block error message for allocation, allocation will be still there because there are multiple places which returns -ENOMEM - Finnally also took care about sch_atm, sorry somehow I forgot this one and I hope I didn't forgot any sch implementation to add new callback parameters changes since v2: - add fix coding style patch to catch all checkpatch warnings - add patch for setting netlink extack msg if validate_nla fails - changes in handle generic qdisc errors - remove NL_SET_ERR_MSG from memory allocation errors - remove NL_SET_ERR_MSG from device not found - change STAB to table size - add various new patches to add extack support for common TC functions like qdisc_get_rtab, tcf_block_get, qdisc_alloc and qdisc_create_dflt - users which are interessted in the detailed error messages can assign extack, otherwise NULL. - Add sch_cbq as example for qdisc_ops callback: init, qdisc_class_ops callbacks: change and graft - Add sch_cbs as example for qdisc_ops callback: change - Add sch_drr as example for qdisc_class ops callbacks: tcf_block ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
90bbec0f91
@ -39,9 +39,11 @@ struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index,
|
|||||||
bool create);
|
bool create);
|
||||||
void tcf_chain_put(struct tcf_chain *chain);
|
void tcf_chain_put(struct tcf_chain *chain);
|
||||||
int tcf_block_get(struct tcf_block **p_block,
|
int tcf_block_get(struct tcf_block **p_block,
|
||||||
struct tcf_proto __rcu **p_filter_chain, struct Qdisc *q);
|
struct tcf_proto __rcu **p_filter_chain, struct Qdisc *q,
|
||||||
|
struct netlink_ext_ack *extack);
|
||||||
int tcf_block_get_ext(struct tcf_block **p_block, struct Qdisc *q,
|
int tcf_block_get_ext(struct tcf_block **p_block, struct Qdisc *q,
|
||||||
struct tcf_block_ext_info *ei);
|
struct tcf_block_ext_info *ei,
|
||||||
|
struct netlink_ext_ack *extack);
|
||||||
void tcf_block_put(struct tcf_block *block);
|
void tcf_block_put(struct tcf_block *block);
|
||||||
void tcf_block_put_ext(struct tcf_block *block, struct Qdisc *q,
|
void tcf_block_put_ext(struct tcf_block *block, struct Qdisc *q,
|
||||||
struct tcf_block_ext_info *ei);
|
struct tcf_block_ext_info *ei);
|
||||||
|
@ -89,7 +89,8 @@ extern struct Qdisc_ops pfifo_head_drop_qdisc_ops;
|
|||||||
|
|
||||||
int fifo_set_limit(struct Qdisc *q, unsigned int limit);
|
int fifo_set_limit(struct Qdisc *q, unsigned int limit);
|
||||||
struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops,
|
struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops,
|
||||||
unsigned int limit);
|
unsigned int limit,
|
||||||
|
struct netlink_ext_ack *extack);
|
||||||
|
|
||||||
int register_qdisc(struct Qdisc_ops *qops);
|
int register_qdisc(struct Qdisc_ops *qops);
|
||||||
int unregister_qdisc(struct Qdisc_ops *qops);
|
int unregister_qdisc(struct Qdisc_ops *qops);
|
||||||
@ -101,7 +102,8 @@ void qdisc_hash_del(struct Qdisc *q);
|
|||||||
struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle);
|
struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle);
|
||||||
struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle);
|
struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle);
|
||||||
struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
|
struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
|
||||||
struct nlattr *tab);
|
struct nlattr *tab,
|
||||||
|
struct netlink_ext_ack *extack);
|
||||||
void qdisc_put_rtab(struct qdisc_rate_table *tab);
|
void qdisc_put_rtab(struct qdisc_rate_table *tab);
|
||||||
void qdisc_put_stab(struct qdisc_size_table *tab);
|
void qdisc_put_stab(struct qdisc_size_table *tab);
|
||||||
void qdisc_warn_nonwc(const char *txt, struct Qdisc *qdisc);
|
void qdisc_warn_nonwc(const char *txt, struct Qdisc *qdisc);
|
||||||
|
@ -151,20 +151,23 @@ struct Qdisc_class_ops {
|
|||||||
/* Child qdisc manipulation */
|
/* Child qdisc manipulation */
|
||||||
struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *);
|
struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *);
|
||||||
int (*graft)(struct Qdisc *, unsigned long cl,
|
int (*graft)(struct Qdisc *, unsigned long cl,
|
||||||
struct Qdisc *, struct Qdisc **);
|
struct Qdisc *, struct Qdisc **,
|
||||||
|
struct netlink_ext_ack *extack);
|
||||||
struct Qdisc * (*leaf)(struct Qdisc *, unsigned long cl);
|
struct Qdisc * (*leaf)(struct Qdisc *, unsigned long cl);
|
||||||
void (*qlen_notify)(struct Qdisc *, unsigned long);
|
void (*qlen_notify)(struct Qdisc *, unsigned long);
|
||||||
|
|
||||||
/* Class manipulation routines */
|
/* Class manipulation routines */
|
||||||
unsigned long (*find)(struct Qdisc *, u32 classid);
|
unsigned long (*find)(struct Qdisc *, u32 classid);
|
||||||
int (*change)(struct Qdisc *, u32, u32,
|
int (*change)(struct Qdisc *, u32, u32,
|
||||||
struct nlattr **, unsigned long *);
|
struct nlattr **, unsigned long *,
|
||||||
|
struct netlink_ext_ack *);
|
||||||
int (*delete)(struct Qdisc *, unsigned long);
|
int (*delete)(struct Qdisc *, unsigned long);
|
||||||
void (*walk)(struct Qdisc *, struct qdisc_walker * arg);
|
void (*walk)(struct Qdisc *, struct qdisc_walker * arg);
|
||||||
|
|
||||||
/* Filter manipulation */
|
/* Filter manipulation */
|
||||||
struct tcf_block * (*tcf_block)(struct Qdisc *sch,
|
struct tcf_block * (*tcf_block)(struct Qdisc *sch,
|
||||||
unsigned long arg);
|
unsigned long arg,
|
||||||
|
struct netlink_ext_ack *extack);
|
||||||
unsigned long (*bind_tcf)(struct Qdisc *, unsigned long,
|
unsigned long (*bind_tcf)(struct Qdisc *, unsigned long,
|
||||||
u32 classid);
|
u32 classid);
|
||||||
void (*unbind_tcf)(struct Qdisc *, unsigned long);
|
void (*unbind_tcf)(struct Qdisc *, unsigned long);
|
||||||
@ -189,11 +192,13 @@ struct Qdisc_ops {
|
|||||||
struct sk_buff * (*dequeue)(struct Qdisc *);
|
struct sk_buff * (*dequeue)(struct Qdisc *);
|
||||||
struct sk_buff * (*peek)(struct Qdisc *);
|
struct sk_buff * (*peek)(struct Qdisc *);
|
||||||
|
|
||||||
int (*init)(struct Qdisc *sch, struct nlattr *arg);
|
int (*init)(struct Qdisc *sch, struct nlattr *arg,
|
||||||
|
struct netlink_ext_ack *extack);
|
||||||
void (*reset)(struct Qdisc *);
|
void (*reset)(struct Qdisc *);
|
||||||
void (*destroy)(struct Qdisc *);
|
void (*destroy)(struct Qdisc *);
|
||||||
int (*change)(struct Qdisc *sch,
|
int (*change)(struct Qdisc *sch,
|
||||||
struct nlattr *arg);
|
struct nlattr *arg,
|
||||||
|
struct netlink_ext_ack *extack);
|
||||||
void (*attach)(struct Qdisc *sch);
|
void (*attach)(struct Qdisc *sch);
|
||||||
|
|
||||||
int (*dump)(struct Qdisc *, struct sk_buff *);
|
int (*dump)(struct Qdisc *, struct sk_buff *);
|
||||||
@ -466,9 +471,11 @@ 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,
|
||||||
|
struct netlink_ext_ack *extack);
|
||||||
void __qdisc_calculate_pkt_len(struct sk_buff *skb,
|
void __qdisc_calculate_pkt_len(struct sk_buff *skb,
|
||||||
const struct qdisc_size_table *stab);
|
const struct qdisc_size_table *stab);
|
||||||
int skb_do_redirect(struct sk_buff *);
|
int skb_do_redirect(struct sk_buff *);
|
||||||
|
@ -118,13 +118,13 @@ static int tcf_act_police_init(struct net *net, struct nlattr *nla,
|
|||||||
police = to_police(*a);
|
police = to_police(*a);
|
||||||
if (parm->rate.rate) {
|
if (parm->rate.rate) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
R_tab = qdisc_get_rtab(&parm->rate, tb[TCA_POLICE_RATE]);
|
R_tab = qdisc_get_rtab(&parm->rate, tb[TCA_POLICE_RATE], NULL);
|
||||||
if (R_tab == NULL)
|
if (R_tab == NULL)
|
||||||
goto failure;
|
goto failure;
|
||||||
|
|
||||||
if (parm->peakrate.rate) {
|
if (parm->peakrate.rate) {
|
||||||
P_tab = qdisc_get_rtab(&parm->peakrate,
|
P_tab = qdisc_get_rtab(&parm->peakrate,
|
||||||
tb[TCA_POLICE_PEAKRATE]);
|
tb[TCA_POLICE_PEAKRATE], NULL);
|
||||||
if (P_tab == NULL)
|
if (P_tab == NULL)
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
@ -281,20 +281,24 @@ static void tcf_block_offload_unbind(struct tcf_block *block, struct Qdisc *q,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int tcf_block_get_ext(struct tcf_block **p_block, struct Qdisc *q,
|
int tcf_block_get_ext(struct tcf_block **p_block, struct Qdisc *q,
|
||||||
struct tcf_block_ext_info *ei)
|
struct tcf_block_ext_info *ei,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct tcf_block *block = kzalloc(sizeof(*block), GFP_KERNEL);
|
struct tcf_block *block = kzalloc(sizeof(*block), GFP_KERNEL);
|
||||||
struct tcf_chain *chain;
|
struct tcf_chain *chain;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!block)
|
if (!block) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Memory allocation for block failed");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
}
|
||||||
INIT_LIST_HEAD(&block->chain_list);
|
INIT_LIST_HEAD(&block->chain_list);
|
||||||
INIT_LIST_HEAD(&block->cb_list);
|
INIT_LIST_HEAD(&block->cb_list);
|
||||||
|
|
||||||
/* Create chain 0 by default, it has to be always present. */
|
/* Create chain 0 by default, it has to be always present. */
|
||||||
chain = tcf_chain_create(block, 0);
|
chain = tcf_chain_create(block, 0);
|
||||||
if (!chain) {
|
if (!chain) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Failed to create new tcf chain");
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto err_chain_create;
|
goto err_chain_create;
|
||||||
}
|
}
|
||||||
@ -321,7 +325,8 @@ static void tcf_chain_head_change_dflt(struct tcf_proto *tp_head, void *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int tcf_block_get(struct tcf_block **p_block,
|
int tcf_block_get(struct tcf_block **p_block,
|
||||||
struct tcf_proto __rcu **p_filter_chain, struct Qdisc *q)
|
struct tcf_proto __rcu **p_filter_chain, struct Qdisc *q,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct tcf_block_ext_info ei = {
|
struct tcf_block_ext_info ei = {
|
||||||
.chain_head_change = tcf_chain_head_change_dflt,
|
.chain_head_change = tcf_chain_head_change_dflt,
|
||||||
@ -329,7 +334,7 @@ int tcf_block_get(struct tcf_block **p_block,
|
|||||||
};
|
};
|
||||||
|
|
||||||
WARN_ON(!p_filter_chain);
|
WARN_ON(!p_filter_chain);
|
||||||
return tcf_block_get_ext(p_block, q, &ei);
|
return tcf_block_get_ext(p_block, q, &ei, extack);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(tcf_block_get);
|
EXPORT_SYMBOL(tcf_block_get);
|
||||||
|
|
||||||
@ -793,7 +798,7 @@ replay:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* And the last stroke */
|
/* And the last stroke */
|
||||||
block = cops->tcf_block(q, cl);
|
block = cops->tcf_block(q, cl, extack);
|
||||||
if (!block) {
|
if (!block) {
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto errout;
|
goto errout;
|
||||||
@ -1040,7 +1045,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
|
|||||||
if (cl == 0)
|
if (cl == 0)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
block = cops->tcf_block(q, cl);
|
block = cops->tcf_block(q, cl, NULL);
|
||||||
if (!block)
|
if (!block)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
@ -393,13 +393,16 @@ static __u8 __detect_linklayer(struct tc_ratespec *r, __u32 *rtab)
|
|||||||
static struct qdisc_rate_table *qdisc_rtab_list;
|
static struct qdisc_rate_table *qdisc_rtab_list;
|
||||||
|
|
||||||
struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
|
struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
|
||||||
struct nlattr *tab)
|
struct nlattr *tab,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct qdisc_rate_table *rtab;
|
struct qdisc_rate_table *rtab;
|
||||||
|
|
||||||
if (tab == NULL || r->rate == 0 || r->cell_log == 0 ||
|
if (tab == NULL || r->rate == 0 || r->cell_log == 0 ||
|
||||||
nla_len(tab) != TC_RTAB_SIZE)
|
nla_len(tab) != TC_RTAB_SIZE) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Invalid rate table parameters for searching");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
for (rtab = qdisc_rtab_list; rtab; rtab = rtab->next) {
|
for (rtab = qdisc_rtab_list; rtab; rtab = rtab->next) {
|
||||||
if (!memcmp(&rtab->rate, r, sizeof(struct tc_ratespec)) &&
|
if (!memcmp(&rtab->rate, r, sizeof(struct tc_ratespec)) &&
|
||||||
@ -418,6 +421,8 @@ struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
|
|||||||
r->linklayer = __detect_linklayer(r, rtab->data);
|
r->linklayer = __detect_linklayer(r, rtab->data);
|
||||||
rtab->next = qdisc_rtab_list;
|
rtab->next = qdisc_rtab_list;
|
||||||
qdisc_rtab_list = rtab;
|
qdisc_rtab_list = rtab;
|
||||||
|
} else {
|
||||||
|
NL_SET_ERR_MSG(extack, "Failed to allocate new qdisc rate table");
|
||||||
}
|
}
|
||||||
return rtab;
|
return rtab;
|
||||||
}
|
}
|
||||||
@ -449,7 +454,8 @@ static const struct nla_policy stab_policy[TCA_STAB_MAX + 1] = {
|
|||||||
[TCA_STAB_DATA] = { .type = NLA_BINARY },
|
[TCA_STAB_DATA] = { .type = NLA_BINARY },
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct qdisc_size_table *qdisc_get_stab(struct nlattr *opt)
|
static struct qdisc_size_table *qdisc_get_stab(struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct nlattr *tb[TCA_STAB_MAX + 1];
|
struct nlattr *tb[TCA_STAB_MAX + 1];
|
||||||
struct qdisc_size_table *stab;
|
struct qdisc_size_table *stab;
|
||||||
@ -458,23 +464,29 @@ static struct qdisc_size_table *qdisc_get_stab(struct nlattr *opt)
|
|||||||
u16 *tab = NULL;
|
u16 *tab = NULL;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = nla_parse_nested(tb, TCA_STAB_MAX, opt, stab_policy, NULL);
|
err = nla_parse_nested(tb, TCA_STAB_MAX, opt, stab_policy, extack);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
if (!tb[TCA_STAB_BASE])
|
if (!tb[TCA_STAB_BASE]) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Size table base attribute is missing");
|
||||||
return ERR_PTR(-EINVAL);
|
return ERR_PTR(-EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
s = nla_data(tb[TCA_STAB_BASE]);
|
s = nla_data(tb[TCA_STAB_BASE]);
|
||||||
|
|
||||||
if (s->tsize > 0) {
|
if (s->tsize > 0) {
|
||||||
if (!tb[TCA_STAB_DATA])
|
if (!tb[TCA_STAB_DATA]) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Size table data attribute is missing");
|
||||||
return ERR_PTR(-EINVAL);
|
return ERR_PTR(-EINVAL);
|
||||||
|
}
|
||||||
tab = nla_data(tb[TCA_STAB_DATA]);
|
tab = nla_data(tb[TCA_STAB_DATA]);
|
||||||
tsize = nla_len(tb[TCA_STAB_DATA]) / sizeof(u16);
|
tsize = nla_len(tb[TCA_STAB_DATA]) / sizeof(u16);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsize != s->tsize || (!tab && tsize > 0))
|
if (tsize != s->tsize || (!tab && tsize > 0)) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Invalid size of size table");
|
||||||
return ERR_PTR(-EINVAL);
|
return ERR_PTR(-EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
list_for_each_entry(stab, &qdisc_stab_list, list) {
|
list_for_each_entry(stab, &qdisc_stab_list, list) {
|
||||||
if (memcmp(&stab->szopts, s, sizeof(*s)))
|
if (memcmp(&stab->szopts, s, sizeof(*s)))
|
||||||
@ -669,7 +681,7 @@ int qdisc_class_hash_init(struct Qdisc_class_hash *clhash)
|
|||||||
unsigned int size = 4;
|
unsigned int size = 4;
|
||||||
|
|
||||||
clhash->hash = qdisc_class_hash_alloc(size);
|
clhash->hash = qdisc_class_hash_alloc(size);
|
||||||
if (clhash->hash == NULL)
|
if (!clhash->hash)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
clhash->hashsize = size;
|
clhash->hashsize = size;
|
||||||
clhash->hashmask = size - 1;
|
clhash->hashmask = size - 1;
|
||||||
@ -899,7 +911,8 @@ static void notify_and_destroy(struct net *net, struct sk_buff *skb,
|
|||||||
|
|
||||||
static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
|
static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
|
||||||
struct sk_buff *skb, struct nlmsghdr *n, u32 classid,
|
struct sk_buff *skb, struct nlmsghdr *n, u32 classid,
|
||||||
struct Qdisc *new, struct Qdisc *old)
|
struct Qdisc *new, struct Qdisc *old,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct Qdisc *q = old;
|
struct Qdisc *q = old;
|
||||||
struct net *net = dev_net(dev);
|
struct net *net = dev_net(dev);
|
||||||
@ -914,8 +927,10 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
|
|||||||
(new && new->flags & TCQ_F_INGRESS)) {
|
(new && new->flags & TCQ_F_INGRESS)) {
|
||||||
num_q = 1;
|
num_q = 1;
|
||||||
ingress = 1;
|
ingress = 1;
|
||||||
if (!dev_ingress_queue(dev))
|
if (!dev_ingress_queue(dev)) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Device does not have an ingress queue");
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->flags & IFF_UP)
|
if (dev->flags & IFF_UP)
|
||||||
@ -966,10 +981,13 @@ skip:
|
|||||||
if (cops && cops->graft) {
|
if (cops && cops->graft) {
|
||||||
unsigned long cl = cops->find(parent, classid);
|
unsigned long cl = cops->find(parent, classid);
|
||||||
|
|
||||||
if (cl)
|
if (cl) {
|
||||||
err = cops->graft(parent, cl, new, &old);
|
err = cops->graft(parent, cl, new, &old,
|
||||||
else
|
extack);
|
||||||
|
} else {
|
||||||
|
NL_SET_ERR_MSG(extack, "Specified class not found");
|
||||||
err = -ENOENT;
|
err = -ENOENT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!err)
|
if (!err)
|
||||||
notify_and_destroy(net, skb, n, classid, old, new);
|
notify_and_destroy(net, skb, n, classid, old, new);
|
||||||
@ -990,7 +1008,8 @@ static struct lock_class_key qdisc_rx_lock;
|
|||||||
static struct Qdisc *qdisc_create(struct net_device *dev,
|
static struct Qdisc *qdisc_create(struct net_device *dev,
|
||||||
struct netdev_queue *dev_queue,
|
struct netdev_queue *dev_queue,
|
||||||
struct Qdisc *p, u32 parent, u32 handle,
|
struct Qdisc *p, u32 parent, u32 handle,
|
||||||
struct nlattr **tca, int *errp)
|
struct nlattr **tca, int *errp,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct nlattr *kind = tca[TCA_KIND];
|
struct nlattr *kind = tca[TCA_KIND];
|
||||||
@ -1028,10 +1047,12 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
err = -ENOENT;
|
err = -ENOENT;
|
||||||
if (!ops)
|
if (!ops) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Specified qdisc not found");
|
||||||
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;
|
||||||
@ -1069,7 +1090,7 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ops->init) {
|
if (ops->init) {
|
||||||
err = ops->init(sch, tca[TCA_OPTIONS]);
|
err = ops->init(sch, tca[TCA_OPTIONS], extack);
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
goto err_out5;
|
goto err_out5;
|
||||||
}
|
}
|
||||||
@ -1086,7 +1107,7 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tca[TCA_STAB]) {
|
if (tca[TCA_STAB]) {
|
||||||
stab = qdisc_get_stab(tca[TCA_STAB]);
|
stab = qdisc_get_stab(tca[TCA_STAB], extack);
|
||||||
if (IS_ERR(stab)) {
|
if (IS_ERR(stab)) {
|
||||||
err = PTR_ERR(stab);
|
err = PTR_ERR(stab);
|
||||||
goto err_out4;
|
goto err_out4;
|
||||||
@ -1097,8 +1118,10 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
|
|||||||
seqcount_t *running;
|
seqcount_t *running;
|
||||||
|
|
||||||
err = -EOPNOTSUPP;
|
err = -EOPNOTSUPP;
|
||||||
if (sch->flags & TCQ_F_MQROOT)
|
if (sch->flags & TCQ_F_MQROOT) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Cannot attach rate estimator to a multi-queue root qdisc");
|
||||||
goto err_out4;
|
goto err_out4;
|
||||||
|
}
|
||||||
|
|
||||||
if (sch->parent != TC_H_ROOT &&
|
if (sch->parent != TC_H_ROOT &&
|
||||||
!(sch->flags & TCQ_F_INGRESS) &&
|
!(sch->flags & TCQ_F_INGRESS) &&
|
||||||
@ -1113,8 +1136,10 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
|
|||||||
NULL,
|
NULL,
|
||||||
running,
|
running,
|
||||||
tca[TCA_RATE]);
|
tca[TCA_RATE]);
|
||||||
if (err)
|
if (err) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Failed to generate new estimator");
|
||||||
goto err_out4;
|
goto err_out4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qdisc_hash_add(sch, false);
|
qdisc_hash_add(sch, false);
|
||||||
@ -1147,21 +1172,24 @@ err_out4:
|
|||||||
goto err_out3;
|
goto err_out3;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qdisc_change(struct Qdisc *sch, struct nlattr **tca)
|
static int qdisc_change(struct Qdisc *sch, struct nlattr **tca,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct qdisc_size_table *ostab, *stab = NULL;
|
struct qdisc_size_table *ostab, *stab = NULL;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (tca[TCA_OPTIONS]) {
|
if (tca[TCA_OPTIONS]) {
|
||||||
if (!sch->ops->change)
|
if (!sch->ops->change) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Change operation not supported by specified qdisc");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
err = sch->ops->change(sch, tca[TCA_OPTIONS]);
|
}
|
||||||
|
err = sch->ops->change(sch, tca[TCA_OPTIONS], extack);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tca[TCA_STAB]) {
|
if (tca[TCA_STAB]) {
|
||||||
stab = qdisc_get_stab(tca[TCA_STAB]);
|
stab = qdisc_get_stab(tca[TCA_STAB], extack);
|
||||||
if (IS_ERR(stab))
|
if (IS_ERR(stab))
|
||||||
return PTR_ERR(stab);
|
return PTR_ERR(stab);
|
||||||
}
|
}
|
||||||
@ -1259,8 +1287,10 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
|
|||||||
if (clid != TC_H_ROOT) {
|
if (clid != TC_H_ROOT) {
|
||||||
if (TC_H_MAJ(clid) != TC_H_MAJ(TC_H_INGRESS)) {
|
if (TC_H_MAJ(clid) != TC_H_MAJ(TC_H_INGRESS)) {
|
||||||
p = qdisc_lookup(dev, TC_H_MAJ(clid));
|
p = qdisc_lookup(dev, TC_H_MAJ(clid));
|
||||||
if (!p)
|
if (!p) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Failed to find qdisc with specified classid");
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
}
|
||||||
q = qdisc_leaf(p, clid);
|
q = qdisc_leaf(p, clid);
|
||||||
} else if (dev_ingress_queue(dev)) {
|
} else if (dev_ingress_queue(dev)) {
|
||||||
q = dev_ingress_queue(dev)->qdisc_sleeping;
|
q = dev_ingress_queue(dev)->qdisc_sleeping;
|
||||||
@ -1268,26 +1298,38 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
|
|||||||
} else {
|
} else {
|
||||||
q = dev->qdisc;
|
q = dev->qdisc;
|
||||||
}
|
}
|
||||||
if (!q)
|
if (!q) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Cannot find specified qdisc on specified device");
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
}
|
||||||
|
|
||||||
if (tcm->tcm_handle && q->handle != tcm->tcm_handle)
|
if (tcm->tcm_handle && q->handle != tcm->tcm_handle) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Invalid handle");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
q = qdisc_lookup(dev, tcm->tcm_handle);
|
q = qdisc_lookup(dev, tcm->tcm_handle);
|
||||||
if (!q)
|
if (!q) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Failed to find qdisc with specified handle");
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], q->ops->id))
|
if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], q->ops->id)) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Invalid qdisc name");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
if (n->nlmsg_type == RTM_DELQDISC) {
|
if (n->nlmsg_type == RTM_DELQDISC) {
|
||||||
if (!clid)
|
if (!clid) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Classid cannot be zero");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (q->handle == 0)
|
}
|
||||||
|
if (q->handle == 0) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Cannot delete qdisc with handle of zero");
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
err = qdisc_graft(dev, p, skb, n, clid, NULL, q);
|
}
|
||||||
|
err = qdisc_graft(dev, p, skb, n, clid, NULL, q, extack);
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
return err;
|
return err;
|
||||||
} else {
|
} else {
|
||||||
@ -1333,8 +1375,10 @@ replay:
|
|||||||
if (clid != TC_H_ROOT) {
|
if (clid != TC_H_ROOT) {
|
||||||
if (clid != TC_H_INGRESS) {
|
if (clid != TC_H_INGRESS) {
|
||||||
p = qdisc_lookup(dev, TC_H_MAJ(clid));
|
p = qdisc_lookup(dev, TC_H_MAJ(clid));
|
||||||
if (!p)
|
if (!p) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Failed to find specified qdisc");
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
}
|
||||||
q = qdisc_leaf(p, clid);
|
q = qdisc_leaf(p, clid);
|
||||||
} else if (dev_ingress_queue_create(dev)) {
|
} else if (dev_ingress_queue_create(dev)) {
|
||||||
q = dev_ingress_queue(dev)->qdisc_sleeping;
|
q = dev_ingress_queue(dev)->qdisc_sleeping;
|
||||||
@ -1349,21 +1393,33 @@ replay:
|
|||||||
|
|
||||||
if (!q || !tcm->tcm_handle || q->handle != tcm->tcm_handle) {
|
if (!q || !tcm->tcm_handle || q->handle != tcm->tcm_handle) {
|
||||||
if (tcm->tcm_handle) {
|
if (tcm->tcm_handle) {
|
||||||
if (q && !(n->nlmsg_flags & NLM_F_REPLACE))
|
if (q && !(n->nlmsg_flags & NLM_F_REPLACE)) {
|
||||||
|
NL_SET_ERR_MSG(extack, "NLM_F_REPLACE needed to override");
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
if (TC_H_MIN(tcm->tcm_handle))
|
}
|
||||||
|
if (TC_H_MIN(tcm->tcm_handle)) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Invalid minor handle");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
q = qdisc_lookup(dev, tcm->tcm_handle);
|
q = qdisc_lookup(dev, tcm->tcm_handle);
|
||||||
if (!q)
|
if (!q) {
|
||||||
|
NL_SET_ERR_MSG(extack, "No qdisc found for specified handle");
|
||||||
goto create_n_graft;
|
goto create_n_graft;
|
||||||
if (n->nlmsg_flags & NLM_F_EXCL)
|
}
|
||||||
|
if (n->nlmsg_flags & NLM_F_EXCL) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Exclusivity flag on, cannot override");
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
|
}
|
||||||
if (tca[TCA_KIND] &&
|
if (tca[TCA_KIND] &&
|
||||||
nla_strcmp(tca[TCA_KIND], q->ops->id))
|
nla_strcmp(tca[TCA_KIND], q->ops->id)) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Invalid qdisc name");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
if (q == p ||
|
if (q == p ||
|
||||||
(p && check_loop(q, p, 0)))
|
(p && check_loop(q, p, 0))) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Qdisc parent/child loop detected");
|
||||||
return -ELOOP;
|
return -ELOOP;
|
||||||
|
}
|
||||||
qdisc_refcount_inc(q);
|
qdisc_refcount_inc(q);
|
||||||
goto graft;
|
goto graft;
|
||||||
} else {
|
} else {
|
||||||
@ -1398,33 +1454,45 @@ replay:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!tcm->tcm_handle)
|
if (!tcm->tcm_handle) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Handle cannot be zero");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
q = qdisc_lookup(dev, tcm->tcm_handle);
|
q = qdisc_lookup(dev, tcm->tcm_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Change qdisc parameters */
|
/* Change qdisc parameters */
|
||||||
if (!q)
|
if (!q) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Specified qdisc not found");
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
if (n->nlmsg_flags & NLM_F_EXCL)
|
}
|
||||||
|
if (n->nlmsg_flags & NLM_F_EXCL) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Exclusivity flag on, cannot modify");
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], q->ops->id))
|
}
|
||||||
|
if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], q->ops->id)) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Invalid qdisc name");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
err = qdisc_change(q, tca);
|
}
|
||||||
|
err = qdisc_change(q, tca, extack);
|
||||||
if (err == 0)
|
if (err == 0)
|
||||||
qdisc_notify(net, skb, n, clid, NULL, q);
|
qdisc_notify(net, skb, n, clid, NULL, q);
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
create_n_graft:
|
create_n_graft:
|
||||||
if (!(n->nlmsg_flags & NLM_F_CREATE))
|
if (!(n->nlmsg_flags & NLM_F_CREATE)) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Qdisc not found. To create specify NLM_F_CREATE flag");
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
}
|
||||||
if (clid == TC_H_INGRESS) {
|
if (clid == TC_H_INGRESS) {
|
||||||
if (dev_ingress_queue(dev))
|
if (dev_ingress_queue(dev)) {
|
||||||
q = qdisc_create(dev, dev_ingress_queue(dev), p,
|
q = qdisc_create(dev, dev_ingress_queue(dev), p,
|
||||||
tcm->tcm_parent, tcm->tcm_parent,
|
tcm->tcm_parent, tcm->tcm_parent,
|
||||||
tca, &err);
|
tca, &err, extack);
|
||||||
else
|
} else {
|
||||||
|
NL_SET_ERR_MSG(extack, "Cannot find ingress queue for specified device");
|
||||||
err = -ENOENT;
|
err = -ENOENT;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
struct netdev_queue *dev_queue;
|
struct netdev_queue *dev_queue;
|
||||||
|
|
||||||
@ -1437,7 +1505,7 @@ create_n_graft:
|
|||||||
|
|
||||||
q = qdisc_create(dev, dev_queue, p,
|
q = qdisc_create(dev, dev_queue, p,
|
||||||
tcm->tcm_parent, tcm->tcm_handle,
|
tcm->tcm_parent, tcm->tcm_handle,
|
||||||
tca, &err);
|
tca, &err, extack);
|
||||||
}
|
}
|
||||||
if (q == NULL) {
|
if (q == NULL) {
|
||||||
if (err == -EAGAIN)
|
if (err == -EAGAIN)
|
||||||
@ -1446,7 +1514,7 @@ create_n_graft:
|
|||||||
}
|
}
|
||||||
|
|
||||||
graft:
|
graft:
|
||||||
err = qdisc_graft(dev, p, skb, n, clid, q, NULL);
|
err = qdisc_graft(dev, p, skb, n, clid, q, NULL, extack);
|
||||||
if (err) {
|
if (err) {
|
||||||
if (q)
|
if (q)
|
||||||
qdisc_destroy(q);
|
qdisc_destroy(q);
|
||||||
@ -1698,7 +1766,7 @@ static void tc_bind_tclass(struct Qdisc *q, u32 portid, u32 clid,
|
|||||||
cl = cops->find(q, portid);
|
cl = cops->find(q, portid);
|
||||||
if (!cl)
|
if (!cl)
|
||||||
return;
|
return;
|
||||||
block = cops->tcf_block(q, cl);
|
block = cops->tcf_block(q, cl, NULL);
|
||||||
if (!block)
|
if (!block)
|
||||||
return;
|
return;
|
||||||
list_for_each_entry(chain, &block->chain_list, list) {
|
list_for_each_entry(chain, &block->chain_list, list) {
|
||||||
@ -1845,7 +1913,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n,
|
|||||||
new_cl = cl;
|
new_cl = cl;
|
||||||
err = -EOPNOTSUPP;
|
err = -EOPNOTSUPP;
|
||||||
if (cops->change)
|
if (cops->change)
|
||||||
err = cops->change(q, clid, portid, tca, &new_cl);
|
err = cops->change(q, clid, portid, tca, &new_cl, extack);
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
tclass_notify(net, skb, n, q, new_cl, RTM_NEWTCLASS);
|
tclass_notify(net, skb, n, q, new_cl, RTM_NEWTCLASS);
|
||||||
/* We just create a new class, need to do reverse binding. */
|
/* We just create a new class, need to do reverse binding. */
|
||||||
|
@ -82,7 +82,8 @@ static inline struct atm_flow_data *lookup_flow(struct Qdisc *sch, u32 classid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int atm_tc_graft(struct Qdisc *sch, unsigned long arg,
|
static int atm_tc_graft(struct Qdisc *sch, unsigned long arg,
|
||||||
struct Qdisc *new, struct Qdisc **old)
|
struct Qdisc *new, struct Qdisc **old,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct atm_qdisc_data *p = qdisc_priv(sch);
|
struct atm_qdisc_data *p = qdisc_priv(sch);
|
||||||
struct atm_flow_data *flow = (struct atm_flow_data *)arg;
|
struct atm_flow_data *flow = (struct atm_flow_data *)arg;
|
||||||
@ -191,7 +192,8 @@ static const struct nla_policy atm_policy[TCA_ATM_MAX + 1] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent,
|
static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent,
|
||||||
struct nlattr **tca, unsigned long *arg)
|
struct nlattr **tca, unsigned long *arg,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct atm_qdisc_data *p = qdisc_priv(sch);
|
struct atm_qdisc_data *p = qdisc_priv(sch);
|
||||||
struct atm_flow_data *flow = (struct atm_flow_data *)*arg;
|
struct atm_flow_data *flow = (struct atm_flow_data *)*arg;
|
||||||
@ -281,13 +283,15 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent,
|
|||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = tcf_block_get(&flow->block, &flow->filter_list, sch);
|
error = tcf_block_get(&flow->block, &flow->filter_list, sch,
|
||||||
|
extack);
|
||||||
if (error) {
|
if (error) {
|
||||||
kfree(flow);
|
kfree(flow);
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
flow->q = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops, classid);
|
flow->q = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops, classid,
|
||||||
|
extack);
|
||||||
if (!flow->q)
|
if (!flow->q)
|
||||||
flow->q = &noop_qdisc;
|
flow->q = &noop_qdisc;
|
||||||
pr_debug("atm_tc_change: qdisc %p\n", flow->q);
|
pr_debug("atm_tc_change: qdisc %p\n", flow->q);
|
||||||
@ -356,7 +360,8 @@ static void atm_tc_walk(struct Qdisc *sch, struct qdisc_walker *walker)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tcf_block *atm_tc_tcf_block(struct Qdisc *sch, unsigned long cl)
|
static struct tcf_block *atm_tc_tcf_block(struct Qdisc *sch, unsigned long cl,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct atm_qdisc_data *p = qdisc_priv(sch);
|
struct atm_qdisc_data *p = qdisc_priv(sch);
|
||||||
struct atm_flow_data *flow = (struct atm_flow_data *)cl;
|
struct atm_flow_data *flow = (struct atm_flow_data *)cl;
|
||||||
@ -531,7 +536,8 @@ static struct sk_buff *atm_tc_peek(struct Qdisc *sch)
|
|||||||
return p->link.q->ops->peek(p->link.q);
|
return p->link.q->ops->peek(p->link.q);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int atm_tc_init(struct Qdisc *sch, struct nlattr *opt)
|
static int atm_tc_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct atm_qdisc_data *p = qdisc_priv(sch);
|
struct atm_qdisc_data *p = qdisc_priv(sch);
|
||||||
int err;
|
int err;
|
||||||
@ -541,12 +547,13 @@ static int atm_tc_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
INIT_LIST_HEAD(&p->link.list);
|
INIT_LIST_HEAD(&p->link.list);
|
||||||
list_add(&p->link.list, &p->flows);
|
list_add(&p->link.list, &p->flows);
|
||||||
p->link.q = qdisc_create_dflt(sch->dev_queue,
|
p->link.q = qdisc_create_dflt(sch->dev_queue,
|
||||||
&pfifo_qdisc_ops, sch->handle);
|
&pfifo_qdisc_ops, sch->handle, extack);
|
||||||
if (!p->link.q)
|
if (!p->link.q)
|
||||||
p->link.q = &noop_qdisc;
|
p->link.q = &noop_qdisc;
|
||||||
pr_debug("atm_tc_init: link (%p) qdisc %p\n", &p->link, p->link.q);
|
pr_debug("atm_tc_init: link (%p) qdisc %p\n", &p->link, p->link.q);
|
||||||
|
|
||||||
err = tcf_block_get(&p->link.block, &p->link.filter_list, sch);
|
err = tcf_block_get(&p->link.block, &p->link.filter_list, sch,
|
||||||
|
extack);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
@ -1132,7 +1132,8 @@ static const struct nla_policy cbq_policy[TCA_CBQ_MAX + 1] = {
|
|||||||
[TCA_CBQ_POLICE] = { .len = sizeof(struct tc_cbq_police) },
|
[TCA_CBQ_POLICE] = { .len = sizeof(struct tc_cbq_police) },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
|
static int cbq_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct cbq_sched_data *q = qdisc_priv(sch);
|
struct cbq_sched_data *q = qdisc_priv(sch);
|
||||||
struct nlattr *tb[TCA_CBQ_MAX + 1];
|
struct nlattr *tb[TCA_CBQ_MAX + 1];
|
||||||
@ -1143,22 +1144,27 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
hrtimer_init(&q->delay_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED);
|
hrtimer_init(&q->delay_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED);
|
||||||
q->delay_timer.function = cbq_undelay;
|
q->delay_timer.function = cbq_undelay;
|
||||||
|
|
||||||
if (!opt)
|
if (!opt) {
|
||||||
|
NL_SET_ERR_MSG(extack, "CBQ options are required for this operation");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy, NULL);
|
err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy, extack);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (tb[TCA_CBQ_RTAB] == NULL || tb[TCA_CBQ_RATE] == NULL)
|
if (!tb[TCA_CBQ_RTAB] || !tb[TCA_CBQ_RATE]) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Rate specification missing or incomplete");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
r = nla_data(tb[TCA_CBQ_RATE]);
|
r = nla_data(tb[TCA_CBQ_RATE]);
|
||||||
|
|
||||||
if ((q->link.R_tab = qdisc_get_rtab(r, tb[TCA_CBQ_RTAB])) == NULL)
|
q->link.R_tab = qdisc_get_rtab(r, tb[TCA_CBQ_RTAB], extack);
|
||||||
|
if (!q->link.R_tab)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
err = tcf_block_get(&q->link.block, &q->link.filter_list, sch);
|
err = tcf_block_get(&q->link.block, &q->link.filter_list, sch, extack);
|
||||||
if (err)
|
if (err)
|
||||||
goto put_rtab;
|
goto put_rtab;
|
||||||
|
|
||||||
@ -1170,7 +1176,7 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
q->link.common.classid = sch->handle;
|
q->link.common.classid = sch->handle;
|
||||||
q->link.qdisc = sch;
|
q->link.qdisc = sch;
|
||||||
q->link.q = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
q->link.q = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
||||||
sch->handle);
|
sch->handle, NULL);
|
||||||
if (!q->link.q)
|
if (!q->link.q)
|
||||||
q->link.q = &noop_qdisc;
|
q->link.q = &noop_qdisc;
|
||||||
else
|
else
|
||||||
@ -1369,13 +1375,13 @@ cbq_dump_class_stats(struct Qdisc *sch, unsigned long arg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int cbq_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
static int cbq_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
||||||
struct Qdisc **old)
|
struct Qdisc **old, struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct cbq_class *cl = (struct cbq_class *)arg;
|
struct cbq_class *cl = (struct cbq_class *)arg;
|
||||||
|
|
||||||
if (new == NULL) {
|
if (new == NULL) {
|
||||||
new = qdisc_create_dflt(sch->dev_queue,
|
new = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
||||||
&pfifo_qdisc_ops, cl->common.classid);
|
cl->common.classid, extack);
|
||||||
if (new == NULL)
|
if (new == NULL)
|
||||||
return -ENOBUFS;
|
return -ENOBUFS;
|
||||||
}
|
}
|
||||||
@ -1450,7 +1456,7 @@ static void cbq_destroy(struct Qdisc *sch)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **tca,
|
cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **tca,
|
||||||
unsigned long *arg)
|
unsigned long *arg, struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct cbq_sched_data *q = qdisc_priv(sch);
|
struct cbq_sched_data *q = qdisc_priv(sch);
|
||||||
@ -1460,29 +1466,37 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
|
|||||||
struct cbq_class *parent;
|
struct cbq_class *parent;
|
||||||
struct qdisc_rate_table *rtab = NULL;
|
struct qdisc_rate_table *rtab = NULL;
|
||||||
|
|
||||||
if (opt == NULL)
|
if (!opt) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Mandatory qdisc options missing");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy, NULL);
|
err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy, extack);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (tb[TCA_CBQ_OVL_STRATEGY] || tb[TCA_CBQ_POLICE])
|
if (tb[TCA_CBQ_OVL_STRATEGY] || tb[TCA_CBQ_POLICE]) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Neither overlimit strategy nor policing attributes can be used for changing class params");
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
if (cl) {
|
if (cl) {
|
||||||
/* Check parent */
|
/* Check parent */
|
||||||
if (parentid) {
|
if (parentid) {
|
||||||
if (cl->tparent &&
|
if (cl->tparent &&
|
||||||
cl->tparent->common.classid != parentid)
|
cl->tparent->common.classid != parentid) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Invalid parent id");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (!cl->tparent && parentid != TC_H_ROOT)
|
}
|
||||||
|
if (!cl->tparent && parentid != TC_H_ROOT) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Parent must be root");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tb[TCA_CBQ_RATE]) {
|
if (tb[TCA_CBQ_RATE]) {
|
||||||
rtab = qdisc_get_rtab(nla_data(tb[TCA_CBQ_RATE]),
|
rtab = qdisc_get_rtab(nla_data(tb[TCA_CBQ_RATE]),
|
||||||
tb[TCA_CBQ_RTAB]);
|
tb[TCA_CBQ_RTAB], extack);
|
||||||
if (rtab == NULL)
|
if (rtab == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@ -1494,6 +1508,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
|
|||||||
qdisc_root_sleeping_running(sch),
|
qdisc_root_sleeping_running(sch),
|
||||||
tca[TCA_RATE]);
|
tca[TCA_RATE]);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Failed to replace specified rate estimator");
|
||||||
qdisc_put_rtab(rtab);
|
qdisc_put_rtab(rtab);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -1532,19 +1547,23 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
|
|||||||
if (parentid == TC_H_ROOT)
|
if (parentid == TC_H_ROOT)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (tb[TCA_CBQ_WRROPT] == NULL || tb[TCA_CBQ_RATE] == NULL ||
|
if (!tb[TCA_CBQ_WRROPT] || !tb[TCA_CBQ_RATE] || !tb[TCA_CBQ_LSSOPT]) {
|
||||||
tb[TCA_CBQ_LSSOPT] == NULL)
|
NL_SET_ERR_MSG(extack, "One of the following attributes MUST be specified: WRR, rate or link sharing");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
rtab = qdisc_get_rtab(nla_data(tb[TCA_CBQ_RATE]), tb[TCA_CBQ_RTAB]);
|
rtab = qdisc_get_rtab(nla_data(tb[TCA_CBQ_RATE]), tb[TCA_CBQ_RTAB],
|
||||||
|
extack);
|
||||||
if (rtab == NULL)
|
if (rtab == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (classid) {
|
if (classid) {
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
if (TC_H_MAJ(classid ^ sch->handle) ||
|
if (TC_H_MAJ(classid ^ sch->handle) ||
|
||||||
cbq_class_lookup(q, classid))
|
cbq_class_lookup(q, classid)) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Specified class not found");
|
||||||
goto failure;
|
goto failure;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
int i;
|
int i;
|
||||||
classid = TC_H_MAKE(sch->handle, 0x8000);
|
classid = TC_H_MAKE(sch->handle, 0x8000);
|
||||||
@ -1556,8 +1575,10 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
err = -ENOSR;
|
err = -ENOSR;
|
||||||
if (i >= 0x8000)
|
if (i >= 0x8000) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Unable to generate classid");
|
||||||
goto failure;
|
goto failure;
|
||||||
|
}
|
||||||
classid = classid|q->hgenerator;
|
classid = classid|q->hgenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1565,8 +1586,10 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
|
|||||||
if (parentid) {
|
if (parentid) {
|
||||||
parent = cbq_class_lookup(q, parentid);
|
parent = cbq_class_lookup(q, parentid);
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
if (parent == NULL)
|
if (!parent) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Failed to find parentid");
|
||||||
goto failure;
|
goto failure;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = -ENOBUFS;
|
err = -ENOBUFS;
|
||||||
@ -1574,7 +1597,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
|
|||||||
if (cl == NULL)
|
if (cl == NULL)
|
||||||
goto failure;
|
goto failure;
|
||||||
|
|
||||||
err = tcf_block_get(&cl->block, &cl->filter_list, sch);
|
err = tcf_block_get(&cl->block, &cl->filter_list, sch, extack);
|
||||||
if (err) {
|
if (err) {
|
||||||
kfree(cl);
|
kfree(cl);
|
||||||
return err;
|
return err;
|
||||||
@ -1586,6 +1609,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
|
|||||||
qdisc_root_sleeping_running(sch),
|
qdisc_root_sleeping_running(sch),
|
||||||
tca[TCA_RATE]);
|
tca[TCA_RATE]);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Couldn't create new estimator");
|
||||||
tcf_block_put(cl->block);
|
tcf_block_put(cl->block);
|
||||||
kfree(cl);
|
kfree(cl);
|
||||||
goto failure;
|
goto failure;
|
||||||
@ -1594,7 +1618,8 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
|
|||||||
|
|
||||||
cl->R_tab = rtab;
|
cl->R_tab = rtab;
|
||||||
rtab = NULL;
|
rtab = NULL;
|
||||||
cl->q = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops, classid);
|
cl->q = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops, classid,
|
||||||
|
NULL);
|
||||||
if (!cl->q)
|
if (!cl->q)
|
||||||
cl->q = &noop_qdisc;
|
cl->q = &noop_qdisc;
|
||||||
else
|
else
|
||||||
@ -1678,7 +1703,8 @@ static int cbq_delete(struct Qdisc *sch, unsigned long arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tcf_block *cbq_tcf_block(struct Qdisc *sch, unsigned long arg)
|
static struct tcf_block *cbq_tcf_block(struct Qdisc *sch, unsigned long arg,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct cbq_sched_data *q = qdisc_priv(sch);
|
struct cbq_sched_data *q = qdisc_priv(sch);
|
||||||
struct cbq_class *cl = (struct cbq_class *)arg;
|
struct cbq_class *cl = (struct cbq_class *)arg;
|
||||||
|
@ -219,14 +219,17 @@ static void cbs_disable_offload(struct net_device *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int cbs_enable_offload(struct net_device *dev, struct cbs_sched_data *q,
|
static int cbs_enable_offload(struct net_device *dev, struct cbs_sched_data *q,
|
||||||
const struct tc_cbs_qopt *opt)
|
const struct tc_cbs_qopt *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
const struct net_device_ops *ops = dev->netdev_ops;
|
const struct net_device_ops *ops = dev->netdev_ops;
|
||||||
struct tc_cbs_qopt_offload cbs = { };
|
struct tc_cbs_qopt_offload cbs = { };
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!ops->ndo_setup_tc)
|
if (!ops->ndo_setup_tc) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Specified device does not support cbs offload");
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
cbs.queue = q->queue;
|
cbs.queue = q->queue;
|
||||||
|
|
||||||
@ -237,8 +240,10 @@ static int cbs_enable_offload(struct net_device *dev, struct cbs_sched_data *q,
|
|||||||
cbs.sendslope = opt->sendslope;
|
cbs.sendslope = opt->sendslope;
|
||||||
|
|
||||||
err = ops->ndo_setup_tc(dev, TC_SETUP_QDISC_CBS, &cbs);
|
err = ops->ndo_setup_tc(dev, TC_SETUP_QDISC_CBS, &cbs);
|
||||||
if (err < 0)
|
if (err < 0) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Specified device failed to setup cbs hardware offload");
|
||||||
return err;
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
q->enqueue = cbs_enqueue_offload;
|
q->enqueue = cbs_enqueue_offload;
|
||||||
q->dequeue = cbs_dequeue_offload;
|
q->dequeue = cbs_dequeue_offload;
|
||||||
@ -246,7 +251,8 @@ static int cbs_enable_offload(struct net_device *dev, struct cbs_sched_data *q,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cbs_change(struct Qdisc *sch, struct nlattr *opt)
|
static int cbs_change(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct cbs_sched_data *q = qdisc_priv(sch);
|
struct cbs_sched_data *q = qdisc_priv(sch);
|
||||||
struct net_device *dev = qdisc_dev(sch);
|
struct net_device *dev = qdisc_dev(sch);
|
||||||
@ -254,12 +260,14 @@ static int cbs_change(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
struct tc_cbs_qopt *qopt;
|
struct tc_cbs_qopt *qopt;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = nla_parse_nested(tb, TCA_CBS_MAX, opt, cbs_policy, NULL);
|
err = nla_parse_nested(tb, TCA_CBS_MAX, opt, cbs_policy, extack);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (!tb[TCA_CBS_PARMS])
|
if (!tb[TCA_CBS_PARMS]) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Missing CBS parameter which are mandatory");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
qopt = nla_data(tb[TCA_CBS_PARMS]);
|
qopt = nla_data(tb[TCA_CBS_PARMS]);
|
||||||
|
|
||||||
@ -276,7 +284,7 @@ static int cbs_change(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
|
|
||||||
cbs_disable_offload(dev, q);
|
cbs_disable_offload(dev, q);
|
||||||
} else {
|
} else {
|
||||||
err = cbs_enable_offload(dev, q, qopt);
|
err = cbs_enable_offload(dev, q, qopt, extack);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -291,13 +299,16 @@ static int cbs_change(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cbs_init(struct Qdisc *sch, struct nlattr *opt)
|
static int cbs_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct cbs_sched_data *q = qdisc_priv(sch);
|
struct cbs_sched_data *q = qdisc_priv(sch);
|
||||||
struct net_device *dev = qdisc_dev(sch);
|
struct net_device *dev = qdisc_dev(sch);
|
||||||
|
|
||||||
if (!opt)
|
if (!opt) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Missing CBS qdisc options which are mandatory");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
q->queue = sch->dev_queue - netdev_get_tx_queue(dev, 0);
|
q->queue = sch->dev_queue - netdev_get_tx_queue(dev, 0);
|
||||||
|
|
||||||
@ -306,7 +317,7 @@ static int cbs_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
|
|
||||||
qdisc_watchdog_init(&q->watchdog, sch);
|
qdisc_watchdog_init(&q->watchdog, sch);
|
||||||
|
|
||||||
return cbs_change(sch, opt);
|
return cbs_change(sch, opt, extack);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cbs_destroy(struct Qdisc *sch)
|
static void cbs_destroy(struct Qdisc *sch)
|
||||||
|
@ -344,7 +344,8 @@ static void choke_free(void *addr)
|
|||||||
kvfree(addr);
|
kvfree(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int choke_change(struct Qdisc *sch, struct nlattr *opt)
|
static int choke_change(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct choke_sched_data *q = qdisc_priv(sch);
|
struct choke_sched_data *q = qdisc_priv(sch);
|
||||||
struct nlattr *tb[TCA_CHOKE_MAX + 1];
|
struct nlattr *tb[TCA_CHOKE_MAX + 1];
|
||||||
@ -431,9 +432,10 @@ static int choke_change(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int choke_init(struct Qdisc *sch, struct nlattr *opt)
|
static int choke_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
return choke_change(sch, opt);
|
return choke_change(sch, opt, extack);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int choke_dump(struct Qdisc *sch, struct sk_buff *skb)
|
static int choke_dump(struct Qdisc *sch, struct sk_buff *skb)
|
||||||
|
@ -130,7 +130,8 @@ static const struct nla_policy codel_policy[TCA_CODEL_MAX + 1] = {
|
|||||||
[TCA_CODEL_CE_THRESHOLD]= { .type = NLA_U32 },
|
[TCA_CODEL_CE_THRESHOLD]= { .type = NLA_U32 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int codel_change(struct Qdisc *sch, struct nlattr *opt)
|
static int codel_change(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct codel_sched_data *q = qdisc_priv(sch);
|
struct codel_sched_data *q = qdisc_priv(sch);
|
||||||
struct nlattr *tb[TCA_CODEL_MAX + 1];
|
struct nlattr *tb[TCA_CODEL_MAX + 1];
|
||||||
@ -184,7 +185,8 @@ static int codel_change(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codel_init(struct Qdisc *sch, struct nlattr *opt)
|
static int codel_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct codel_sched_data *q = qdisc_priv(sch);
|
struct codel_sched_data *q = qdisc_priv(sch);
|
||||||
|
|
||||||
@ -196,7 +198,7 @@ static int codel_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
q->params.mtu = psched_mtu(qdisc_dev(sch));
|
q->params.mtu = psched_mtu(qdisc_dev(sch));
|
||||||
|
|
||||||
if (opt) {
|
if (opt) {
|
||||||
int err = codel_change(sch, opt);
|
int err = codel_change(sch, opt, extack);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
@ -64,7 +64,8 @@ static const struct nla_policy drr_policy[TCA_DRR_MAX + 1] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int drr_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
static int drr_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
||||||
struct nlattr **tca, unsigned long *arg)
|
struct nlattr **tca, unsigned long *arg,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct drr_sched *q = qdisc_priv(sch);
|
struct drr_sched *q = qdisc_priv(sch);
|
||||||
struct drr_class *cl = (struct drr_class *)*arg;
|
struct drr_class *cl = (struct drr_class *)*arg;
|
||||||
@ -73,17 +74,21 @@ static int drr_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
|||||||
u32 quantum;
|
u32 quantum;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!opt)
|
if (!opt) {
|
||||||
|
NL_SET_ERR_MSG(extack, "DRR options are required for this operation");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
err = nla_parse_nested(tb, TCA_DRR_MAX, opt, drr_policy, NULL);
|
err = nla_parse_nested(tb, TCA_DRR_MAX, opt, drr_policy, extack);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (tb[TCA_DRR_QUANTUM]) {
|
if (tb[TCA_DRR_QUANTUM]) {
|
||||||
quantum = nla_get_u32(tb[TCA_DRR_QUANTUM]);
|
quantum = nla_get_u32(tb[TCA_DRR_QUANTUM]);
|
||||||
if (quantum == 0)
|
if (quantum == 0) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Specified DRR quantum cannot be zero");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
quantum = psched_mtu(qdisc_dev(sch));
|
quantum = psched_mtu(qdisc_dev(sch));
|
||||||
|
|
||||||
@ -94,8 +99,10 @@ static int drr_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
|||||||
NULL,
|
NULL,
|
||||||
qdisc_root_sleeping_running(sch),
|
qdisc_root_sleeping_running(sch),
|
||||||
tca[TCA_RATE]);
|
tca[TCA_RATE]);
|
||||||
if (err)
|
if (err) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Failed to replace estimator");
|
||||||
return err;
|
return err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sch_tree_lock(sch);
|
sch_tree_lock(sch);
|
||||||
@ -113,7 +120,8 @@ static int drr_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
|||||||
cl->common.classid = classid;
|
cl->common.classid = classid;
|
||||||
cl->quantum = quantum;
|
cl->quantum = quantum;
|
||||||
cl->qdisc = qdisc_create_dflt(sch->dev_queue,
|
cl->qdisc = qdisc_create_dflt(sch->dev_queue,
|
||||||
&pfifo_qdisc_ops, classid);
|
&pfifo_qdisc_ops, classid,
|
||||||
|
NULL);
|
||||||
if (cl->qdisc == NULL)
|
if (cl->qdisc == NULL)
|
||||||
cl->qdisc = &noop_qdisc;
|
cl->qdisc = &noop_qdisc;
|
||||||
else
|
else
|
||||||
@ -125,6 +133,7 @@ static int drr_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
|||||||
qdisc_root_sleeping_running(sch),
|
qdisc_root_sleeping_running(sch),
|
||||||
tca[TCA_RATE]);
|
tca[TCA_RATE]);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Failed to replace estimator");
|
||||||
qdisc_destroy(cl->qdisc);
|
qdisc_destroy(cl->qdisc);
|
||||||
kfree(cl);
|
kfree(cl);
|
||||||
return err;
|
return err;
|
||||||
@ -172,12 +181,15 @@ static unsigned long drr_search_class(struct Qdisc *sch, u32 classid)
|
|||||||
return (unsigned long)drr_find_class(sch, classid);
|
return (unsigned long)drr_find_class(sch, classid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tcf_block *drr_tcf_block(struct Qdisc *sch, unsigned long cl)
|
static struct tcf_block *drr_tcf_block(struct Qdisc *sch, unsigned long cl,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct drr_sched *q = qdisc_priv(sch);
|
struct drr_sched *q = qdisc_priv(sch);
|
||||||
|
|
||||||
if (cl)
|
if (cl) {
|
||||||
|
NL_SET_ERR_MSG(extack, "DRR classid must be zero");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return q->block;
|
return q->block;
|
||||||
}
|
}
|
||||||
@ -201,13 +213,14 @@ static void drr_unbind_tcf(struct Qdisc *sch, unsigned long arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int drr_graft_class(struct Qdisc *sch, unsigned long arg,
|
static int drr_graft_class(struct Qdisc *sch, unsigned long arg,
|
||||||
struct Qdisc *new, struct Qdisc **old)
|
struct Qdisc *new, struct Qdisc **old,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct drr_class *cl = (struct drr_class *)arg;
|
struct drr_class *cl = (struct drr_class *)arg;
|
||||||
|
|
||||||
if (new == NULL) {
|
if (new == NULL) {
|
||||||
new = qdisc_create_dflt(sch->dev_queue,
|
new = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
||||||
&pfifo_qdisc_ops, cl->common.classid);
|
cl->common.classid, NULL);
|
||||||
if (new == NULL)
|
if (new == NULL)
|
||||||
new = &noop_qdisc;
|
new = &noop_qdisc;
|
||||||
}
|
}
|
||||||
@ -408,12 +421,13 @@ out:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int drr_init_qdisc(struct Qdisc *sch, struct nlattr *opt)
|
static int drr_init_qdisc(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct drr_sched *q = qdisc_priv(sch);
|
struct drr_sched *q = qdisc_priv(sch);
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = tcf_block_get(&q->block, &q->filter_list, sch);
|
err = tcf_block_get(&q->block, &q->filter_list, sch, extack);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
err = qdisc_class_hash_init(&q->clhash);
|
err = qdisc_class_hash_init(&q->clhash);
|
||||||
|
@ -61,7 +61,8 @@ static inline int dsmark_valid_index(struct dsmark_qdisc_data *p, u16 index)
|
|||||||
/* ------------------------- Class/flow operations ------------------------- */
|
/* ------------------------- Class/flow operations ------------------------- */
|
||||||
|
|
||||||
static int dsmark_graft(struct Qdisc *sch, unsigned long arg,
|
static int dsmark_graft(struct Qdisc *sch, unsigned long arg,
|
||||||
struct Qdisc *new, struct Qdisc **old)
|
struct Qdisc *new, struct Qdisc **old,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct dsmark_qdisc_data *p = qdisc_priv(sch);
|
struct dsmark_qdisc_data *p = qdisc_priv(sch);
|
||||||
|
|
||||||
@ -70,7 +71,7 @@ static int dsmark_graft(struct Qdisc *sch, unsigned long arg,
|
|||||||
|
|
||||||
if (new == NULL) {
|
if (new == NULL) {
|
||||||
new = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
new = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
||||||
sch->handle);
|
sch->handle, NULL);
|
||||||
if (new == NULL)
|
if (new == NULL)
|
||||||
new = &noop_qdisc;
|
new = &noop_qdisc;
|
||||||
}
|
}
|
||||||
@ -112,7 +113,8 @@ static const struct nla_policy dsmark_policy[TCA_DSMARK_MAX + 1] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int dsmark_change(struct Qdisc *sch, u32 classid, u32 parent,
|
static int dsmark_change(struct Qdisc *sch, u32 classid, u32 parent,
|
||||||
struct nlattr **tca, unsigned long *arg)
|
struct nlattr **tca, unsigned long *arg,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct dsmark_qdisc_data *p = qdisc_priv(sch);
|
struct dsmark_qdisc_data *p = qdisc_priv(sch);
|
||||||
struct nlattr *opt = tca[TCA_OPTIONS];
|
struct nlattr *opt = tca[TCA_OPTIONS];
|
||||||
@ -184,7 +186,8 @@ ignore:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tcf_block *dsmark_tcf_block(struct Qdisc *sch, unsigned long cl)
|
static struct tcf_block *dsmark_tcf_block(struct Qdisc *sch, unsigned long cl,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct dsmark_qdisc_data *p = qdisc_priv(sch);
|
struct dsmark_qdisc_data *p = qdisc_priv(sch);
|
||||||
|
|
||||||
@ -330,7 +333,8 @@ static struct sk_buff *dsmark_peek(struct Qdisc *sch)
|
|||||||
return p->q->ops->peek(p->q);
|
return p->q->ops->peek(p->q);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dsmark_init(struct Qdisc *sch, struct nlattr *opt)
|
static int dsmark_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct dsmark_qdisc_data *p = qdisc_priv(sch);
|
struct dsmark_qdisc_data *p = qdisc_priv(sch);
|
||||||
struct nlattr *tb[TCA_DSMARK_MAX + 1];
|
struct nlattr *tb[TCA_DSMARK_MAX + 1];
|
||||||
@ -344,7 +348,7 @@ static int dsmark_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
if (!opt)
|
if (!opt)
|
||||||
goto errout;
|
goto errout;
|
||||||
|
|
||||||
err = tcf_block_get(&p->block, &p->filter_list, sch);
|
err = tcf_block_get(&p->block, &p->filter_list, sch, extack);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@ -377,7 +381,8 @@ static int dsmark_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
p->default_index = default_index;
|
p->default_index = default_index;
|
||||||
p->set_tc_index = nla_get_flag(tb[TCA_DSMARK_SET_TC_INDEX]);
|
p->set_tc_index = nla_get_flag(tb[TCA_DSMARK_SET_TC_INDEX]);
|
||||||
|
|
||||||
p->q = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops, sch->handle);
|
p->q = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops, sch->handle,
|
||||||
|
NULL);
|
||||||
if (p->q == NULL)
|
if (p->q == NULL)
|
||||||
p->q = &noop_qdisc;
|
p->q = &noop_qdisc;
|
||||||
else
|
else
|
||||||
|
@ -55,7 +55,8 @@ static int pfifo_tail_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
|||||||
return NET_XMIT_CN;
|
return NET_XMIT_CN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fifo_init(struct Qdisc *sch, struct nlattr *opt)
|
static int fifo_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
bool bypass;
|
bool bypass;
|
||||||
bool is_bfifo = sch->ops == &bfifo_qdisc_ops;
|
bool is_bfifo = sch->ops == &bfifo_qdisc_ops;
|
||||||
@ -157,7 +158,7 @@ int fifo_set_limit(struct Qdisc *q, unsigned int limit)
|
|||||||
nla->nla_len = nla_attr_size(sizeof(struct tc_fifo_qopt));
|
nla->nla_len = nla_attr_size(sizeof(struct tc_fifo_qopt));
|
||||||
((struct tc_fifo_qopt *)nla_data(nla))->limit = limit;
|
((struct tc_fifo_qopt *)nla_data(nla))->limit = limit;
|
||||||
|
|
||||||
ret = q->ops->change(q, nla);
|
ret = q->ops->change(q, nla, NULL);
|
||||||
kfree(nla);
|
kfree(nla);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -165,12 +166,14 @@ int fifo_set_limit(struct Qdisc *q, unsigned int limit)
|
|||||||
EXPORT_SYMBOL(fifo_set_limit);
|
EXPORT_SYMBOL(fifo_set_limit);
|
||||||
|
|
||||||
struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops,
|
struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops,
|
||||||
unsigned int limit)
|
unsigned int limit,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct Qdisc *q;
|
struct Qdisc *q;
|
||||||
int err = -ENOMEM;
|
int err = -ENOMEM;
|
||||||
|
|
||||||
q = qdisc_create_dflt(sch->dev_queue, ops, TC_H_MAKE(sch->handle, 1));
|
q = qdisc_create_dflt(sch->dev_queue, ops, TC_H_MAKE(sch->handle, 1),
|
||||||
|
extack);
|
||||||
if (q) {
|
if (q) {
|
||||||
err = fifo_set_limit(q, limit);
|
err = fifo_set_limit(q, limit);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
@ -685,7 +685,8 @@ static const struct nla_policy fq_policy[TCA_FQ_MAX + 1] = {
|
|||||||
[TCA_FQ_LOW_RATE_THRESHOLD] = { .type = NLA_U32 },
|
[TCA_FQ_LOW_RATE_THRESHOLD] = { .type = NLA_U32 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int fq_change(struct Qdisc *sch, struct nlattr *opt)
|
static int fq_change(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct fq_sched_data *q = qdisc_priv(sch);
|
struct fq_sched_data *q = qdisc_priv(sch);
|
||||||
struct nlattr *tb[TCA_FQ_MAX + 1];
|
struct nlattr *tb[TCA_FQ_MAX + 1];
|
||||||
@ -788,7 +789,8 @@ static void fq_destroy(struct Qdisc *sch)
|
|||||||
qdisc_watchdog_cancel(&q->watchdog);
|
qdisc_watchdog_cancel(&q->watchdog);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fq_init(struct Qdisc *sch, struct nlattr *opt)
|
static int fq_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct fq_sched_data *q = qdisc_priv(sch);
|
struct fq_sched_data *q = qdisc_priv(sch);
|
||||||
int err;
|
int err;
|
||||||
@ -811,7 +813,7 @@ static int fq_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
qdisc_watchdog_init(&q->watchdog, sch);
|
qdisc_watchdog_init(&q->watchdog, sch);
|
||||||
|
|
||||||
if (opt)
|
if (opt)
|
||||||
err = fq_change(sch, opt);
|
err = fq_change(sch, opt, extack);
|
||||||
else
|
else
|
||||||
err = fq_resize(sch, q->fq_trees_log);
|
err = fq_resize(sch, q->fq_trees_log);
|
||||||
|
|
||||||
|
@ -377,7 +377,8 @@ static const struct nla_policy fq_codel_policy[TCA_FQ_CODEL_MAX + 1] = {
|
|||||||
[TCA_FQ_CODEL_MEMORY_LIMIT] = { .type = NLA_U32 },
|
[TCA_FQ_CODEL_MEMORY_LIMIT] = { .type = NLA_U32 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt)
|
static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct fq_codel_sched_data *q = qdisc_priv(sch);
|
struct fq_codel_sched_data *q = qdisc_priv(sch);
|
||||||
struct nlattr *tb[TCA_FQ_CODEL_MAX + 1];
|
struct nlattr *tb[TCA_FQ_CODEL_MAX + 1];
|
||||||
@ -458,7 +459,8 @@ static void fq_codel_destroy(struct Qdisc *sch)
|
|||||||
kvfree(q->flows);
|
kvfree(q->flows);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt)
|
static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct fq_codel_sched_data *q = qdisc_priv(sch);
|
struct fq_codel_sched_data *q = qdisc_priv(sch);
|
||||||
int i;
|
int i;
|
||||||
@ -477,12 +479,12 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
q->cparams.mtu = psched_mtu(qdisc_dev(sch));
|
q->cparams.mtu = psched_mtu(qdisc_dev(sch));
|
||||||
|
|
||||||
if (opt) {
|
if (opt) {
|
||||||
int err = fq_codel_change(sch, opt);
|
int err = fq_codel_change(sch, opt, extack);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = tcf_block_get(&q->block, &q->filter_list, sch);
|
err = tcf_block_get(&q->block, &q->filter_list, sch, extack);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@ -595,7 +597,8 @@ static void fq_codel_unbind(struct Qdisc *q, unsigned long cl)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tcf_block *fq_codel_tcf_block(struct Qdisc *sch, unsigned long cl)
|
static struct tcf_block *fq_codel_tcf_block(struct Qdisc *sch, unsigned long cl,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct fq_codel_sched_data *q = qdisc_priv(sch);
|
struct fq_codel_sched_data *q = qdisc_priv(sch);
|
||||||
|
|
||||||
|
@ -551,7 +551,8 @@ struct Qdisc noop_qdisc = {
|
|||||||
};
|
};
|
||||||
EXPORT_SYMBOL(noop_qdisc);
|
EXPORT_SYMBOL(noop_qdisc);
|
||||||
|
|
||||||
static int noqueue_init(struct Qdisc *qdisc, struct nlattr *opt)
|
static int noqueue_init(struct Qdisc *qdisc, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
/* register_qdisc() assigns a default of noop_enqueue if unset,
|
/* register_qdisc() assigns a default of noop_enqueue if unset,
|
||||||
* but __dev_queue_xmit() treats noqueue only as such
|
* but __dev_queue_xmit() treats noqueue only as such
|
||||||
@ -690,7 +691,8 @@ nla_put_failure:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pfifo_fast_init(struct Qdisc *qdisc, struct nlattr *opt)
|
static int pfifo_fast_init(struct Qdisc *qdisc, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
unsigned int qlen = qdisc_dev(qdisc)->tx_queue_len;
|
unsigned int qlen = qdisc_dev(qdisc)->tx_queue_len;
|
||||||
struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
|
struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
|
||||||
@ -753,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;
|
||||||
@ -762,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;
|
||||||
}
|
}
|
||||||
@ -826,21 +830,24 @@ errout:
|
|||||||
|
|
||||||
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,
|
const struct Qdisc_ops *ops,
|
||||||
unsigned int parentid)
|
unsigned int parentid,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct Qdisc *sch;
|
struct Qdisc *sch;
|
||||||
|
|
||||||
if (!try_module_get(ops->owner))
|
if (!try_module_get(ops->owner)) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Failed to increase module reference counter");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
sch = qdisc_alloc(dev_queue, ops);
|
sch = qdisc_alloc(dev_queue, ops, extack);
|
||||||
if (IS_ERR(sch)) {
|
if (IS_ERR(sch)) {
|
||||||
module_put(ops->owner);
|
module_put(ops->owner);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
sch->parent = parentid;
|
sch->parent = parentid;
|
||||||
|
|
||||||
if (!ops->init || ops->init(sch, NULL) == 0)
|
if (!ops->init || ops->init(sch, NULL, extack) == 0)
|
||||||
return sch;
|
return sch;
|
||||||
|
|
||||||
qdisc_destroy(sch);
|
qdisc_destroy(sch);
|
||||||
@ -952,7 +959,7 @@ static void attach_one_default_qdisc(struct net_device *dev,
|
|||||||
if (dev->priv_flags & IFF_NO_QUEUE)
|
if (dev->priv_flags & IFF_NO_QUEUE)
|
||||||
ops = &noqueue_qdisc_ops;
|
ops = &noqueue_qdisc_ops;
|
||||||
|
|
||||||
qdisc = qdisc_create_dflt(dev_queue, ops, TC_H_ROOT);
|
qdisc = qdisc_create_dflt(dev_queue, ops, TC_H_ROOT, NULL);
|
||||||
if (!qdisc) {
|
if (!qdisc) {
|
||||||
netdev_info(dev, "activation failed\n");
|
netdev_info(dev, "activation failed\n");
|
||||||
return;
|
return;
|
||||||
@ -975,7 +982,7 @@ static void attach_default_qdiscs(struct net_device *dev)
|
|||||||
dev->qdisc = txq->qdisc_sleeping;
|
dev->qdisc = txq->qdisc_sleeping;
|
||||||
qdisc_refcount_inc(dev->qdisc);
|
qdisc_refcount_inc(dev->qdisc);
|
||||||
} else {
|
} else {
|
||||||
qdisc = qdisc_create_dflt(txq, &mq_qdisc_ops, TC_H_ROOT);
|
qdisc = qdisc_create_dflt(txq, &mq_qdisc_ops, TC_H_ROOT, NULL);
|
||||||
if (qdisc) {
|
if (qdisc) {
|
||||||
dev->qdisc = qdisc;
|
dev->qdisc = qdisc;
|
||||||
qdisc->ops->attach(qdisc);
|
qdisc->ops->attach(qdisc);
|
||||||
|
@ -306,12 +306,13 @@ static inline int gred_change_table_def(struct Qdisc *sch, struct nlattr *dps)
|
|||||||
struct tc_gred_sopt *sopt;
|
struct tc_gred_sopt *sopt;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (dps == NULL)
|
if (!dps)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
sopt = nla_data(dps);
|
sopt = nla_data(dps);
|
||||||
|
|
||||||
if (sopt->DPs > MAX_DPs || sopt->DPs == 0 || sopt->def_DP >= sopt->DPs)
|
if (sopt->DPs > MAX_DPs || sopt->DPs == 0 ||
|
||||||
|
sopt->def_DP >= sopt->DPs)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
sch_tree_lock(sch);
|
sch_tree_lock(sch);
|
||||||
@ -391,7 +392,8 @@ static const struct nla_policy gred_policy[TCA_GRED_MAX + 1] = {
|
|||||||
[TCA_GRED_LIMIT] = { .type = NLA_U32 },
|
[TCA_GRED_LIMIT] = { .type = NLA_U32 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int gred_change(struct Qdisc *sch, struct nlattr *opt)
|
static int gred_change(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct gred_sched *table = qdisc_priv(sch);
|
struct gred_sched *table = qdisc_priv(sch);
|
||||||
struct tc_gred_qopt *ctl;
|
struct tc_gred_qopt *ctl;
|
||||||
@ -465,12 +467,13 @@ errout:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gred_init(struct Qdisc *sch, struct nlattr *opt)
|
static int gred_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct nlattr *tb[TCA_GRED_MAX + 1];
|
struct nlattr *tb[TCA_GRED_MAX + 1];
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (opt == NULL)
|
if (!opt)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
err = nla_parse_nested(tb, TCA_GRED_MAX, opt, gred_policy, NULL);
|
err = nla_parse_nested(tb, TCA_GRED_MAX, opt, gred_policy, NULL);
|
||||||
|
@ -921,7 +921,8 @@ static const struct nla_policy hfsc_policy[TCA_HFSC_MAX + 1] = {
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
||||||
struct nlattr **tca, unsigned long *arg)
|
struct nlattr **tca, unsigned long *arg,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct hfsc_sched *q = qdisc_priv(sch);
|
struct hfsc_sched *q = qdisc_priv(sch);
|
||||||
struct hfsc_class *cl = (struct hfsc_class *)*arg;
|
struct hfsc_class *cl = (struct hfsc_class *)*arg;
|
||||||
@ -1033,7 +1034,7 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
|||||||
if (cl == NULL)
|
if (cl == NULL)
|
||||||
return -ENOBUFS;
|
return -ENOBUFS;
|
||||||
|
|
||||||
err = tcf_block_get(&cl->block, &cl->filter_list, sch);
|
err = tcf_block_get(&cl->block, &cl->filter_list, sch, extack);
|
||||||
if (err) {
|
if (err) {
|
||||||
kfree(cl);
|
kfree(cl);
|
||||||
return err;
|
return err;
|
||||||
@ -1061,8 +1062,8 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
|||||||
cl->cl_common.classid = classid;
|
cl->cl_common.classid = classid;
|
||||||
cl->sched = q;
|
cl->sched = q;
|
||||||
cl->cl_parent = parent;
|
cl->cl_parent = parent;
|
||||||
cl->qdisc = qdisc_create_dflt(sch->dev_queue,
|
cl->qdisc = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
||||||
&pfifo_qdisc_ops, classid);
|
classid, NULL);
|
||||||
if (cl->qdisc == NULL)
|
if (cl->qdisc == NULL)
|
||||||
cl->qdisc = &noop_qdisc;
|
cl->qdisc = &noop_qdisc;
|
||||||
else
|
else
|
||||||
@ -1176,7 +1177,7 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
hfsc_graft_class(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
hfsc_graft_class(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
||||||
struct Qdisc **old)
|
struct Qdisc **old, struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct hfsc_class *cl = (struct hfsc_class *)arg;
|
struct hfsc_class *cl = (struct hfsc_class *)arg;
|
||||||
|
|
||||||
@ -1184,7 +1185,7 @@ hfsc_graft_class(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (new == NULL) {
|
if (new == NULL) {
|
||||||
new = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
new = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
||||||
cl->cl_common.classid);
|
cl->cl_common.classid, NULL);
|
||||||
if (new == NULL)
|
if (new == NULL)
|
||||||
new = &noop_qdisc;
|
new = &noop_qdisc;
|
||||||
}
|
}
|
||||||
@ -1246,7 +1247,8 @@ hfsc_unbind_tcf(struct Qdisc *sch, unsigned long arg)
|
|||||||
cl->filter_cnt--;
|
cl->filter_cnt--;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tcf_block *hfsc_tcf_block(struct Qdisc *sch, unsigned long arg)
|
static struct tcf_block *hfsc_tcf_block(struct Qdisc *sch, unsigned long arg,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct hfsc_sched *q = qdisc_priv(sch);
|
struct hfsc_sched *q = qdisc_priv(sch);
|
||||||
struct hfsc_class *cl = (struct hfsc_class *)arg;
|
struct hfsc_class *cl = (struct hfsc_class *)arg;
|
||||||
@ -1388,7 +1390,8 @@ hfsc_schedule_watchdog(struct Qdisc *sch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
hfsc_init_qdisc(struct Qdisc *sch, struct nlattr *opt)
|
hfsc_init_qdisc(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct hfsc_sched *q = qdisc_priv(sch);
|
struct hfsc_sched *q = qdisc_priv(sch);
|
||||||
struct tc_hfsc_qopt *qopt;
|
struct tc_hfsc_qopt *qopt;
|
||||||
@ -1396,7 +1399,7 @@ hfsc_init_qdisc(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
|
|
||||||
qdisc_watchdog_init(&q->watchdog, sch);
|
qdisc_watchdog_init(&q->watchdog, sch);
|
||||||
|
|
||||||
if (opt == NULL || nla_len(opt) < sizeof(*qopt))
|
if (!opt || nla_len(opt) < sizeof(*qopt))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
qopt = nla_data(opt);
|
qopt = nla_data(opt);
|
||||||
|
|
||||||
@ -1406,14 +1409,14 @@ hfsc_init_qdisc(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
return err;
|
return err;
|
||||||
q->eligible = RB_ROOT;
|
q->eligible = RB_ROOT;
|
||||||
|
|
||||||
err = tcf_block_get(&q->root.block, &q->root.filter_list, sch);
|
err = tcf_block_get(&q->root.block, &q->root.filter_list, sch, extack);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
q->root.cl_common.classid = sch->handle;
|
q->root.cl_common.classid = sch->handle;
|
||||||
q->root.sched = q;
|
q->root.sched = q;
|
||||||
q->root.qdisc = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
q->root.qdisc = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
||||||
sch->handle);
|
sch->handle, NULL);
|
||||||
if (q->root.qdisc == NULL)
|
if (q->root.qdisc == NULL)
|
||||||
q->root.qdisc = &noop_qdisc;
|
q->root.qdisc = &noop_qdisc;
|
||||||
else
|
else
|
||||||
@ -1429,7 +1432,8 @@ hfsc_init_qdisc(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
hfsc_change_qdisc(struct Qdisc *sch, struct nlattr *opt)
|
hfsc_change_qdisc(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct hfsc_sched *q = qdisc_priv(sch);
|
struct hfsc_sched *q = qdisc_priv(sch);
|
||||||
struct tc_hfsc_qopt *qopt;
|
struct tc_hfsc_qopt *qopt;
|
||||||
|
@ -504,7 +504,8 @@ static const struct nla_policy hhf_policy[TCA_HHF_MAX + 1] = {
|
|||||||
[TCA_HHF_NON_HH_WEIGHT] = { .type = NLA_U32 },
|
[TCA_HHF_NON_HH_WEIGHT] = { .type = NLA_U32 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int hhf_change(struct Qdisc *sch, struct nlattr *opt)
|
static int hhf_change(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct hhf_sched_data *q = qdisc_priv(sch);
|
struct hhf_sched_data *q = qdisc_priv(sch);
|
||||||
struct nlattr *tb[TCA_HHF_MAX + 1];
|
struct nlattr *tb[TCA_HHF_MAX + 1];
|
||||||
@ -571,7 +572,8 @@ static int hhf_change(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hhf_init(struct Qdisc *sch, struct nlattr *opt)
|
static int hhf_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct hhf_sched_data *q = qdisc_priv(sch);
|
struct hhf_sched_data *q = qdisc_priv(sch);
|
||||||
int i;
|
int i;
|
||||||
@ -589,7 +591,7 @@ static int hhf_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
q->hhf_non_hh_weight = 2;
|
q->hhf_non_hh_weight = 2;
|
||||||
|
|
||||||
if (opt) {
|
if (opt) {
|
||||||
int err = hhf_change(sch, opt);
|
int err = hhf_change(sch, opt, extack);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
@ -1017,7 +1017,8 @@ static void htb_work_func(struct work_struct *work)
|
|||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int htb_init(struct Qdisc *sch, struct nlattr *opt)
|
static int htb_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct htb_sched *q = qdisc_priv(sch);
|
struct htb_sched *q = qdisc_priv(sch);
|
||||||
struct nlattr *tb[TCA_HTB_MAX + 1];
|
struct nlattr *tb[TCA_HTB_MAX + 1];
|
||||||
@ -1031,7 +1032,7 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
if (!opt)
|
if (!opt)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
err = tcf_block_get(&q->block, &q->filter_list, sch);
|
err = tcf_block_get(&q->block, &q->filter_list, sch, extack);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@ -1171,7 +1172,7 @@ htb_dump_class_stats(struct Qdisc *sch, unsigned long arg, struct gnet_dump *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int htb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
static int htb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
||||||
struct Qdisc **old)
|
struct Qdisc **old, struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct htb_class *cl = (struct htb_class *)arg;
|
struct htb_class *cl = (struct htb_class *)arg;
|
||||||
|
|
||||||
@ -1179,7 +1180,7 @@ static int htb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (new == NULL &&
|
if (new == NULL &&
|
||||||
(new = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
(new = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
||||||
cl->common.classid)) == NULL)
|
cl->common.classid, extack)) == NULL)
|
||||||
return -ENOBUFS;
|
return -ENOBUFS;
|
||||||
|
|
||||||
*old = qdisc_replace(sch, new, &cl->un.leaf.q);
|
*old = qdisc_replace(sch, new, &cl->un.leaf.q);
|
||||||
@ -1289,7 +1290,8 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg)
|
|||||||
|
|
||||||
if (!cl->level && htb_parent_last_child(cl)) {
|
if (!cl->level && htb_parent_last_child(cl)) {
|
||||||
new_q = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
new_q = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
||||||
cl->parent->common.classid);
|
cl->parent->common.classid,
|
||||||
|
NULL);
|
||||||
last_child = 1;
|
last_child = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1326,7 +1328,7 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg)
|
|||||||
|
|
||||||
static int htb_change_class(struct Qdisc *sch, u32 classid,
|
static int htb_change_class(struct Qdisc *sch, u32 classid,
|
||||||
u32 parentid, struct nlattr **tca,
|
u32 parentid, struct nlattr **tca,
|
||||||
unsigned long *arg)
|
unsigned long *arg, struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
int err = -EINVAL;
|
int err = -EINVAL;
|
||||||
struct htb_sched *q = qdisc_priv(sch);
|
struct htb_sched *q = qdisc_priv(sch);
|
||||||
@ -1356,10 +1358,12 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
|
|||||||
|
|
||||||
/* Keeping backward compatible with rate_table based iproute2 tc */
|
/* Keeping backward compatible with rate_table based iproute2 tc */
|
||||||
if (hopt->rate.linklayer == TC_LINKLAYER_UNAWARE)
|
if (hopt->rate.linklayer == TC_LINKLAYER_UNAWARE)
|
||||||
qdisc_put_rtab(qdisc_get_rtab(&hopt->rate, tb[TCA_HTB_RTAB]));
|
qdisc_put_rtab(qdisc_get_rtab(&hopt->rate, tb[TCA_HTB_RTAB],
|
||||||
|
NULL));
|
||||||
|
|
||||||
if (hopt->ceil.linklayer == TC_LINKLAYER_UNAWARE)
|
if (hopt->ceil.linklayer == TC_LINKLAYER_UNAWARE)
|
||||||
qdisc_put_rtab(qdisc_get_rtab(&hopt->ceil, tb[TCA_HTB_CTAB]));
|
qdisc_put_rtab(qdisc_get_rtab(&hopt->ceil, tb[TCA_HTB_CTAB],
|
||||||
|
NULL));
|
||||||
|
|
||||||
if (!cl) { /* new class */
|
if (!cl) { /* new class */
|
||||||
struct Qdisc *new_q;
|
struct Qdisc *new_q;
|
||||||
@ -1394,7 +1398,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
|
|||||||
if (!cl)
|
if (!cl)
|
||||||
goto failure;
|
goto failure;
|
||||||
|
|
||||||
err = tcf_block_get(&cl->block, &cl->filter_list, sch);
|
err = tcf_block_get(&cl->block, &cl->filter_list, sch, extack);
|
||||||
if (err) {
|
if (err) {
|
||||||
kfree(cl);
|
kfree(cl);
|
||||||
goto failure;
|
goto failure;
|
||||||
@ -1423,8 +1427,8 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
|
|||||||
* so that can't be used inside of sch_tree_lock
|
* so that can't be used inside of sch_tree_lock
|
||||||
* -- thanks to Karlis Peisenieks
|
* -- thanks to Karlis Peisenieks
|
||||||
*/
|
*/
|
||||||
new_q = qdisc_create_dflt(sch->dev_queue,
|
new_q = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
||||||
&pfifo_qdisc_ops, classid);
|
classid, NULL);
|
||||||
sch_tree_lock(sch);
|
sch_tree_lock(sch);
|
||||||
if (parent && !parent->level) {
|
if (parent && !parent->level) {
|
||||||
unsigned int qlen = parent->un.leaf.q->q.qlen;
|
unsigned int qlen = parent->un.leaf.q->q.qlen;
|
||||||
@ -1524,7 +1528,8 @@ failure:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tcf_block *htb_tcf_block(struct Qdisc *sch, unsigned long arg)
|
static struct tcf_block *htb_tcf_block(struct Qdisc *sch, unsigned long arg,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct htb_sched *q = qdisc_priv(sch);
|
struct htb_sched *q = qdisc_priv(sch);
|
||||||
struct htb_class *cl = (struct htb_class *)arg;
|
struct htb_class *cl = (struct htb_class *)arg;
|
||||||
|
@ -48,7 +48,8 @@ static void ingress_walk(struct Qdisc *sch, struct qdisc_walker *walker)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tcf_block *ingress_tcf_block(struct Qdisc *sch, unsigned long cl)
|
static struct tcf_block *ingress_tcf_block(struct Qdisc *sch, unsigned long cl,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct ingress_sched_data *q = qdisc_priv(sch);
|
struct ingress_sched_data *q = qdisc_priv(sch);
|
||||||
|
|
||||||
@ -62,7 +63,8 @@ static void clsact_chain_head_change(struct tcf_proto *tp_head, void *priv)
|
|||||||
mini_qdisc_pair_swap(miniqp, tp_head);
|
mini_qdisc_pair_swap(miniqp, tp_head);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ingress_init(struct Qdisc *sch, struct nlattr *opt)
|
static int ingress_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct ingress_sched_data *q = qdisc_priv(sch);
|
struct ingress_sched_data *q = qdisc_priv(sch);
|
||||||
struct net_device *dev = qdisc_dev(sch);
|
struct net_device *dev = qdisc_dev(sch);
|
||||||
@ -76,7 +78,7 @@ static int ingress_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
q->block_info.chain_head_change = clsact_chain_head_change;
|
q->block_info.chain_head_change = clsact_chain_head_change;
|
||||||
q->block_info.chain_head_change_priv = &q->miniqp;
|
q->block_info.chain_head_change_priv = &q->miniqp;
|
||||||
|
|
||||||
err = tcf_block_get_ext(&q->block, sch, &q->block_info);
|
err = tcf_block_get_ext(&q->block, sch, &q->block_info, extack);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@ -153,7 +155,8 @@ static unsigned long clsact_bind_filter(struct Qdisc *sch,
|
|||||||
return clsact_find(sch, classid);
|
return clsact_find(sch, classid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tcf_block *clsact_tcf_block(struct Qdisc *sch, unsigned long cl)
|
static struct tcf_block *clsact_tcf_block(struct Qdisc *sch, unsigned long cl,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct clsact_sched_data *q = qdisc_priv(sch);
|
struct clsact_sched_data *q = qdisc_priv(sch);
|
||||||
|
|
||||||
@ -167,7 +170,8 @@ static struct tcf_block *clsact_tcf_block(struct Qdisc *sch, unsigned long cl)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int clsact_init(struct Qdisc *sch, struct nlattr *opt)
|
static int clsact_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct clsact_sched_data *q = qdisc_priv(sch);
|
struct clsact_sched_data *q = qdisc_priv(sch);
|
||||||
struct net_device *dev = qdisc_dev(sch);
|
struct net_device *dev = qdisc_dev(sch);
|
||||||
@ -182,7 +186,8 @@ static int clsact_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
q->ingress_block_info.chain_head_change = clsact_chain_head_change;
|
q->ingress_block_info.chain_head_change = clsact_chain_head_change;
|
||||||
q->ingress_block_info.chain_head_change_priv = &q->miniqp_ingress;
|
q->ingress_block_info.chain_head_change_priv = &q->miniqp_ingress;
|
||||||
|
|
||||||
err = tcf_block_get_ext(&q->ingress_block, sch, &q->ingress_block_info);
|
err = tcf_block_get_ext(&q->ingress_block, sch, &q->ingress_block_info,
|
||||||
|
extack);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@ -192,7 +197,8 @@ static int clsact_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
q->egress_block_info.chain_head_change = clsact_chain_head_change;
|
q->egress_block_info.chain_head_change = clsact_chain_head_change;
|
||||||
q->egress_block_info.chain_head_change_priv = &q->miniqp_egress;
|
q->egress_block_info.chain_head_change_priv = &q->miniqp_egress;
|
||||||
|
|
||||||
err = tcf_block_get_ext(&q->egress_block, sch, &q->egress_block_info);
|
err = tcf_block_get_ext(&q->egress_block, sch, &q->egress_block_info,
|
||||||
|
extack);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
@ -36,7 +36,8 @@ static void mq_destroy(struct Qdisc *sch)
|
|||||||
kfree(priv->qdiscs);
|
kfree(priv->qdiscs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mq_init(struct Qdisc *sch, struct nlattr *opt)
|
static int mq_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct net_device *dev = qdisc_dev(sch);
|
struct net_device *dev = qdisc_dev(sch);
|
||||||
struct mq_sched *priv = qdisc_priv(sch);
|
struct mq_sched *priv = qdisc_priv(sch);
|
||||||
@ -60,7 +61,8 @@ static int mq_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
dev_queue = netdev_get_tx_queue(dev, ntx);
|
dev_queue = netdev_get_tx_queue(dev, ntx);
|
||||||
qdisc = qdisc_create_dflt(dev_queue, get_default_qdisc_ops(dev, ntx),
|
qdisc = qdisc_create_dflt(dev_queue, get_default_qdisc_ops(dev, ntx),
|
||||||
TC_H_MAKE(TC_H_MAJ(sch->handle),
|
TC_H_MAKE(TC_H_MAJ(sch->handle),
|
||||||
TC_H_MIN(ntx + 1)));
|
TC_H_MIN(ntx + 1)),
|
||||||
|
extack);
|
||||||
if (!qdisc)
|
if (!qdisc)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
priv->qdiscs[ntx] = qdisc;
|
priv->qdiscs[ntx] = qdisc;
|
||||||
@ -154,7 +156,7 @@ static struct netdev_queue *mq_select_queue(struct Qdisc *sch,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int mq_graft(struct Qdisc *sch, unsigned long cl, struct Qdisc *new,
|
static int mq_graft(struct Qdisc *sch, unsigned long cl, struct Qdisc *new,
|
||||||
struct Qdisc **old)
|
struct Qdisc **old, struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct netdev_queue *dev_queue = mq_queue_get(sch, cl);
|
struct netdev_queue *dev_queue = mq_queue_get(sch, cl);
|
||||||
struct net_device *dev = qdisc_dev(sch);
|
struct net_device *dev = qdisc_dev(sch);
|
||||||
|
@ -132,7 +132,8 @@ static int parse_attr(struct nlattr *tb[], int maxtype, struct nlattr *nla,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mqprio_init(struct Qdisc *sch, struct nlattr *opt)
|
static int mqprio_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct net_device *dev = qdisc_dev(sch);
|
struct net_device *dev = qdisc_dev(sch);
|
||||||
struct mqprio_sched *priv = qdisc_priv(sch);
|
struct mqprio_sched *priv = qdisc_priv(sch);
|
||||||
@ -229,7 +230,7 @@ static int mqprio_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
qdisc = qdisc_create_dflt(dev_queue,
|
qdisc = qdisc_create_dflt(dev_queue,
|
||||||
get_default_qdisc_ops(dev, i),
|
get_default_qdisc_ops(dev, i),
|
||||||
TC_H_MAKE(TC_H_MAJ(sch->handle),
|
TC_H_MAKE(TC_H_MAJ(sch->handle),
|
||||||
TC_H_MIN(i + 1)));
|
TC_H_MIN(i + 1)), extack);
|
||||||
if (!qdisc)
|
if (!qdisc)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@ -319,7 +320,7 @@ static struct netdev_queue *mqprio_queue_get(struct Qdisc *sch,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int mqprio_graft(struct Qdisc *sch, unsigned long cl, struct Qdisc *new,
|
static int mqprio_graft(struct Qdisc *sch, unsigned long cl, struct Qdisc *new,
|
||||||
struct Qdisc **old)
|
struct Qdisc **old, struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct net_device *dev = qdisc_dev(sch);
|
struct net_device *dev = qdisc_dev(sch);
|
||||||
struct netdev_queue *dev_queue = mqprio_queue_get(sch, cl);
|
struct netdev_queue *dev_queue = mqprio_queue_get(sch, cl);
|
||||||
|
@ -180,7 +180,8 @@ multiq_destroy(struct Qdisc *sch)
|
|||||||
kfree(q->queues);
|
kfree(q->queues);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int multiq_tune(struct Qdisc *sch, struct nlattr *opt)
|
static int multiq_tune(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct multiq_sched_data *q = qdisc_priv(sch);
|
struct multiq_sched_data *q = qdisc_priv(sch);
|
||||||
struct tc_multiq_qopt *qopt;
|
struct tc_multiq_qopt *qopt;
|
||||||
@ -215,7 +216,7 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
child = qdisc_create_dflt(sch->dev_queue,
|
child = qdisc_create_dflt(sch->dev_queue,
|
||||||
&pfifo_qdisc_ops,
|
&pfifo_qdisc_ops,
|
||||||
TC_H_MAKE(sch->handle,
|
TC_H_MAKE(sch->handle,
|
||||||
i + 1));
|
i + 1), extack);
|
||||||
if (child) {
|
if (child) {
|
||||||
sch_tree_lock(sch);
|
sch_tree_lock(sch);
|
||||||
old = q->queues[i];
|
old = q->queues[i];
|
||||||
@ -236,17 +237,18 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int multiq_init(struct Qdisc *sch, struct nlattr *opt)
|
static int multiq_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct multiq_sched_data *q = qdisc_priv(sch);
|
struct multiq_sched_data *q = qdisc_priv(sch);
|
||||||
int i, err;
|
int i, err;
|
||||||
|
|
||||||
q->queues = NULL;
|
q->queues = NULL;
|
||||||
|
|
||||||
if (opt == NULL)
|
if (!opt)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
err = tcf_block_get(&q->block, &q->filter_list, sch);
|
err = tcf_block_get(&q->block, &q->filter_list, sch, extack);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@ -258,7 +260,7 @@ static int multiq_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
for (i = 0; i < q->max_bands; i++)
|
for (i = 0; i < q->max_bands; i++)
|
||||||
q->queues[i] = &noop_qdisc;
|
q->queues[i] = &noop_qdisc;
|
||||||
|
|
||||||
return multiq_tune(sch, opt);
|
return multiq_tune(sch, opt, extack);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int multiq_dump(struct Qdisc *sch, struct sk_buff *skb)
|
static int multiq_dump(struct Qdisc *sch, struct sk_buff *skb)
|
||||||
@ -281,7 +283,7 @@ nla_put_failure:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int multiq_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
static int multiq_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
||||||
struct Qdisc **old)
|
struct Qdisc **old, struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct multiq_sched_data *q = qdisc_priv(sch);
|
struct multiq_sched_data *q = qdisc_priv(sch);
|
||||||
unsigned long band = arg - 1;
|
unsigned long band = arg - 1;
|
||||||
@ -369,7 +371,8 @@ static void multiq_walk(struct Qdisc *sch, struct qdisc_walker *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tcf_block *multiq_tcf_block(struct Qdisc *sch, unsigned long cl)
|
static struct tcf_block *multiq_tcf_block(struct Qdisc *sch, unsigned long cl,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct multiq_sched_data *q = qdisc_priv(sch);
|
struct multiq_sched_data *q = qdisc_priv(sch);
|
||||||
|
|
||||||
|
@ -893,7 +893,8 @@ static int parse_attr(struct nlattr *tb[], int maxtype, struct nlattr *nla,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Parse netlink message to set options */
|
/* Parse netlink message to set options */
|
||||||
static int netem_change(struct Qdisc *sch, struct nlattr *opt)
|
static int netem_change(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct netem_sched_data *q = qdisc_priv(sch);
|
struct netem_sched_data *q = qdisc_priv(sch);
|
||||||
struct nlattr *tb[TCA_NETEM_MAX + 1];
|
struct nlattr *tb[TCA_NETEM_MAX + 1];
|
||||||
@ -984,7 +985,8 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int netem_init(struct Qdisc *sch, struct nlattr *opt)
|
static int netem_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct netem_sched_data *q = qdisc_priv(sch);
|
struct netem_sched_data *q = qdisc_priv(sch);
|
||||||
int ret;
|
int ret;
|
||||||
@ -995,7 +997,7 @@ static int netem_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
q->loss_model = CLG_RANDOM;
|
q->loss_model = CLG_RANDOM;
|
||||||
ret = netem_change(sch, opt);
|
ret = netem_change(sch, opt, extack);
|
||||||
if (ret)
|
if (ret)
|
||||||
pr_info("netem: change failed\n");
|
pr_info("netem: change failed\n");
|
||||||
return ret;
|
return ret;
|
||||||
@ -1157,7 +1159,7 @@ static int netem_dump_class(struct Qdisc *sch, unsigned long cl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int netem_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
static int netem_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
||||||
struct Qdisc **old)
|
struct Qdisc **old, struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct netem_sched_data *q = qdisc_priv(sch);
|
struct netem_sched_data *q = qdisc_priv(sch);
|
||||||
|
|
||||||
|
@ -181,7 +181,8 @@ static const struct nla_policy pie_policy[TCA_PIE_MAX + 1] = {
|
|||||||
[TCA_PIE_BYTEMODE] = {.type = NLA_U32},
|
[TCA_PIE_BYTEMODE] = {.type = NLA_U32},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int pie_change(struct Qdisc *sch, struct nlattr *opt)
|
static int pie_change(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct pie_sched_data *q = qdisc_priv(sch);
|
struct pie_sched_data *q = qdisc_priv(sch);
|
||||||
struct nlattr *tb[TCA_PIE_MAX + 1];
|
struct nlattr *tb[TCA_PIE_MAX + 1];
|
||||||
@ -439,7 +440,8 @@ static void pie_timer(struct timer_list *t)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pie_init(struct Qdisc *sch, struct nlattr *opt)
|
static int pie_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct pie_sched_data *q = qdisc_priv(sch);
|
struct pie_sched_data *q = qdisc_priv(sch);
|
||||||
|
|
||||||
@ -451,7 +453,7 @@ static int pie_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
timer_setup(&q->adapt_timer, pie_timer, 0);
|
timer_setup(&q->adapt_timer, pie_timer, 0);
|
||||||
|
|
||||||
if (opt) {
|
if (opt) {
|
||||||
int err = pie_change(sch, opt);
|
int err = pie_change(sch, opt, extack);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
@ -123,7 +123,8 @@ static struct sk_buff *plug_dequeue(struct Qdisc *sch)
|
|||||||
return qdisc_dequeue_head(sch);
|
return qdisc_dequeue_head(sch);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int plug_init(struct Qdisc *sch, struct nlattr *opt)
|
static int plug_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct plug_sched_data *q = qdisc_priv(sch);
|
struct plug_sched_data *q = qdisc_priv(sch);
|
||||||
|
|
||||||
@ -158,7 +159,8 @@ static int plug_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
* command is received (just act as a pass-thru queue).
|
* command is received (just act as a pass-thru queue).
|
||||||
* TCQ_PLUG_LIMIT: Increase/decrease queue size
|
* TCQ_PLUG_LIMIT: Increase/decrease queue size
|
||||||
*/
|
*/
|
||||||
static int plug_change(struct Qdisc *sch, struct nlattr *opt)
|
static int plug_change(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct plug_sched_data *q = qdisc_priv(sch);
|
struct plug_sched_data *q = qdisc_priv(sch);
|
||||||
struct tc_plug_qopt *msg;
|
struct tc_plug_qopt *msg;
|
||||||
|
@ -153,7 +153,8 @@ prio_destroy(struct Qdisc *sch)
|
|||||||
qdisc_destroy(q->queues[prio]);
|
qdisc_destroy(q->queues[prio]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int prio_tune(struct Qdisc *sch, struct nlattr *opt)
|
static int prio_tune(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct prio_sched_data *q = qdisc_priv(sch);
|
struct prio_sched_data *q = qdisc_priv(sch);
|
||||||
struct Qdisc *queues[TCQ_PRIO_BANDS];
|
struct Qdisc *queues[TCQ_PRIO_BANDS];
|
||||||
@ -175,7 +176,8 @@ static int prio_tune(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
/* Before commit, make sure we can allocate all new qdiscs */
|
/* Before commit, make sure we can allocate all new qdiscs */
|
||||||
for (i = oldbands; i < qopt->bands; i++) {
|
for (i = oldbands; i < qopt->bands; i++) {
|
||||||
queues[i] = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
queues[i] = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
||||||
TC_H_MAKE(sch->handle, i + 1));
|
TC_H_MAKE(sch->handle, i + 1),
|
||||||
|
extack);
|
||||||
if (!queues[i]) {
|
if (!queues[i]) {
|
||||||
while (i > oldbands)
|
while (i > oldbands)
|
||||||
qdisc_destroy(queues[--i]);
|
qdisc_destroy(queues[--i]);
|
||||||
@ -205,7 +207,8 @@ static int prio_tune(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int prio_init(struct Qdisc *sch, struct nlattr *opt)
|
static int prio_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct prio_sched_data *q = qdisc_priv(sch);
|
struct prio_sched_data *q = qdisc_priv(sch);
|
||||||
int err;
|
int err;
|
||||||
@ -213,11 +216,11 @@ static int prio_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
if (!opt)
|
if (!opt)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
err = tcf_block_get(&q->block, &q->filter_list, sch);
|
err = tcf_block_get(&q->block, &q->filter_list, sch, extack);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
return prio_tune(sch, opt);
|
return prio_tune(sch, opt, extack);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int prio_dump(struct Qdisc *sch, struct sk_buff *skb)
|
static int prio_dump(struct Qdisc *sch, struct sk_buff *skb)
|
||||||
@ -240,7 +243,7 @@ nla_put_failure:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int prio_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
static int prio_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
||||||
struct Qdisc **old)
|
struct Qdisc **old, struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct prio_sched_data *q = qdisc_priv(sch);
|
struct prio_sched_data *q = qdisc_priv(sch);
|
||||||
unsigned long band = arg - 1;
|
unsigned long band = arg - 1;
|
||||||
@ -327,7 +330,8 @@ static void prio_walk(struct Qdisc *sch, struct qdisc_walker *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tcf_block *prio_tcf_block(struct Qdisc *sch, unsigned long cl)
|
static struct tcf_block *prio_tcf_block(struct Qdisc *sch, unsigned long cl,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct prio_sched_data *q = qdisc_priv(sch);
|
struct prio_sched_data *q = qdisc_priv(sch);
|
||||||
|
|
||||||
|
@ -402,7 +402,8 @@ static int qfq_change_agg(struct Qdisc *sch, struct qfq_class *cl, u32 weight,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
||||||
struct nlattr **tca, unsigned long *arg)
|
struct nlattr **tca, unsigned long *arg,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct qfq_sched *q = qdisc_priv(sch);
|
struct qfq_sched *q = qdisc_priv(sch);
|
||||||
struct qfq_class *cl = (struct qfq_class *)*arg;
|
struct qfq_class *cl = (struct qfq_class *)*arg;
|
||||||
@ -479,8 +480,8 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
|||||||
cl->common.classid = classid;
|
cl->common.classid = classid;
|
||||||
cl->deficit = lmax;
|
cl->deficit = lmax;
|
||||||
|
|
||||||
cl->qdisc = qdisc_create_dflt(sch->dev_queue,
|
cl->qdisc = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
||||||
&pfifo_qdisc_ops, classid);
|
classid, NULL);
|
||||||
if (cl->qdisc == NULL)
|
if (cl->qdisc == NULL)
|
||||||
cl->qdisc = &noop_qdisc;
|
cl->qdisc = &noop_qdisc;
|
||||||
|
|
||||||
@ -564,7 +565,8 @@ static unsigned long qfq_search_class(struct Qdisc *sch, u32 classid)
|
|||||||
return (unsigned long)qfq_find_class(sch, classid);
|
return (unsigned long)qfq_find_class(sch, classid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tcf_block *qfq_tcf_block(struct Qdisc *sch, unsigned long cl)
|
static struct tcf_block *qfq_tcf_block(struct Qdisc *sch, unsigned long cl,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct qfq_sched *q = qdisc_priv(sch);
|
struct qfq_sched *q = qdisc_priv(sch);
|
||||||
|
|
||||||
@ -593,13 +595,14 @@ static void qfq_unbind_tcf(struct Qdisc *sch, unsigned long arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int qfq_graft_class(struct Qdisc *sch, unsigned long arg,
|
static int qfq_graft_class(struct Qdisc *sch, unsigned long arg,
|
||||||
struct Qdisc *new, struct Qdisc **old)
|
struct Qdisc *new, struct Qdisc **old,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct qfq_class *cl = (struct qfq_class *)arg;
|
struct qfq_class *cl = (struct qfq_class *)arg;
|
||||||
|
|
||||||
if (new == NULL) {
|
if (new == NULL) {
|
||||||
new = qdisc_create_dflt(sch->dev_queue,
|
new = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
|
||||||
&pfifo_qdisc_ops, cl->common.classid);
|
cl->common.classid, NULL);
|
||||||
if (new == NULL)
|
if (new == NULL)
|
||||||
new = &noop_qdisc;
|
new = &noop_qdisc;
|
||||||
}
|
}
|
||||||
@ -1413,14 +1416,15 @@ static void qfq_qlen_notify(struct Qdisc *sch, unsigned long arg)
|
|||||||
qfq_deactivate_class(q, cl);
|
qfq_deactivate_class(q, cl);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qfq_init_qdisc(struct Qdisc *sch, struct nlattr *opt)
|
static int qfq_init_qdisc(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct qfq_sched *q = qdisc_priv(sch);
|
struct qfq_sched *q = qdisc_priv(sch);
|
||||||
struct qfq_group *grp;
|
struct qfq_group *grp;
|
||||||
int i, j, err;
|
int i, j, err;
|
||||||
u32 max_cl_shift, maxbudg_shift, max_classes;
|
u32 max_cl_shift, maxbudg_shift, max_classes;
|
||||||
|
|
||||||
err = tcf_block_get(&q->block, &q->filter_list, sch);
|
err = tcf_block_get(&q->block, &q->filter_list, sch, extack);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
@ -197,7 +197,8 @@ static const struct nla_policy red_policy[TCA_RED_MAX + 1] = {
|
|||||||
[TCA_RED_MAX_P] = { .type = NLA_U32 },
|
[TCA_RED_MAX_P] = { .type = NLA_U32 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int red_change(struct Qdisc *sch, struct nlattr *opt)
|
static int red_change(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct red_sched_data *q = qdisc_priv(sch);
|
struct red_sched_data *q = qdisc_priv(sch);
|
||||||
struct nlattr *tb[TCA_RED_MAX + 1];
|
struct nlattr *tb[TCA_RED_MAX + 1];
|
||||||
@ -224,7 +225,8 @@ static int red_change(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (ctl->limit > 0) {
|
if (ctl->limit > 0) {
|
||||||
child = fifo_create_dflt(sch, &bfifo_qdisc_ops, ctl->limit);
|
child = fifo_create_dflt(sch, &bfifo_qdisc_ops, ctl->limit,
|
||||||
|
extack);
|
||||||
if (IS_ERR(child))
|
if (IS_ERR(child))
|
||||||
return PTR_ERR(child);
|
return PTR_ERR(child);
|
||||||
}
|
}
|
||||||
@ -272,14 +274,15 @@ static inline void red_adaptative_timer(struct timer_list *t)
|
|||||||
spin_unlock(root_lock);
|
spin_unlock(root_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int red_init(struct Qdisc *sch, struct nlattr *opt)
|
static int red_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct red_sched_data *q = qdisc_priv(sch);
|
struct red_sched_data *q = qdisc_priv(sch);
|
||||||
|
|
||||||
q->qdisc = &noop_qdisc;
|
q->qdisc = &noop_qdisc;
|
||||||
q->sch = sch;
|
q->sch = sch;
|
||||||
timer_setup(&q->adapt_timer, red_adaptative_timer, 0);
|
timer_setup(&q->adapt_timer, red_adaptative_timer, 0);
|
||||||
return red_change(sch, opt);
|
return red_change(sch, opt, extack);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int red_dump_offload_stats(struct Qdisc *sch, struct tc_red_qopt *opt)
|
static int red_dump_offload_stats(struct Qdisc *sch, struct tc_red_qopt *opt)
|
||||||
@ -380,7 +383,7 @@ static int red_dump_class(struct Qdisc *sch, unsigned long cl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int red_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
static int red_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
||||||
struct Qdisc **old)
|
struct Qdisc **old, struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct red_sched_data *q = qdisc_priv(sch);
|
struct red_sched_data *q = qdisc_priv(sch);
|
||||||
|
|
||||||
|
@ -488,7 +488,8 @@ static const struct tc_sfb_qopt sfb_default_ops = {
|
|||||||
.penalty_burst = 20,
|
.penalty_burst = 20,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int sfb_change(struct Qdisc *sch, struct nlattr *opt)
|
static int sfb_change(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct sfb_sched_data *q = qdisc_priv(sch);
|
struct sfb_sched_data *q = qdisc_priv(sch);
|
||||||
struct Qdisc *child;
|
struct Qdisc *child;
|
||||||
@ -512,7 +513,7 @@ static int sfb_change(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
if (limit == 0)
|
if (limit == 0)
|
||||||
limit = qdisc_dev(sch)->tx_queue_len;
|
limit = qdisc_dev(sch)->tx_queue_len;
|
||||||
|
|
||||||
child = fifo_create_dflt(sch, &pfifo_qdisc_ops, limit);
|
child = fifo_create_dflt(sch, &pfifo_qdisc_ops, limit, extack);
|
||||||
if (IS_ERR(child))
|
if (IS_ERR(child))
|
||||||
return PTR_ERR(child);
|
return PTR_ERR(child);
|
||||||
|
|
||||||
@ -549,17 +550,18 @@ static int sfb_change(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sfb_init(struct Qdisc *sch, struct nlattr *opt)
|
static int sfb_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct sfb_sched_data *q = qdisc_priv(sch);
|
struct sfb_sched_data *q = qdisc_priv(sch);
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = tcf_block_get(&q->block, &q->filter_list, sch);
|
err = tcf_block_get(&q->block, &q->filter_list, sch, extack);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
q->qdisc = &noop_qdisc;
|
q->qdisc = &noop_qdisc;
|
||||||
return sfb_change(sch, opt);
|
return sfb_change(sch, opt, extack);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sfb_dump(struct Qdisc *sch, struct sk_buff *skb)
|
static int sfb_dump(struct Qdisc *sch, struct sk_buff *skb)
|
||||||
@ -615,7 +617,7 @@ static int sfb_dump_class(struct Qdisc *sch, unsigned long cl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int sfb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
static int sfb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
||||||
struct Qdisc **old)
|
struct Qdisc **old, struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct sfb_sched_data *q = qdisc_priv(sch);
|
struct sfb_sched_data *q = qdisc_priv(sch);
|
||||||
|
|
||||||
@ -643,7 +645,8 @@ static void sfb_unbind(struct Qdisc *sch, unsigned long arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int sfb_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
static int sfb_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
||||||
struct nlattr **tca, unsigned long *arg)
|
struct nlattr **tca, unsigned long *arg,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
@ -665,7 +668,8 @@ static void sfb_walk(struct Qdisc *sch, struct qdisc_walker *walker)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tcf_block *sfb_tcf_block(struct Qdisc *sch, unsigned long cl)
|
static struct tcf_block *sfb_tcf_block(struct Qdisc *sch, unsigned long cl,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct sfb_sched_data *q = qdisc_priv(sch);
|
struct sfb_sched_data *q = qdisc_priv(sch);
|
||||||
|
|
||||||
|
@ -721,7 +721,8 @@ static void sfq_destroy(struct Qdisc *sch)
|
|||||||
kfree(q->red_parms);
|
kfree(q->red_parms);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sfq_init(struct Qdisc *sch, struct nlattr *opt)
|
static int sfq_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct sfq_sched_data *q = qdisc_priv(sch);
|
struct sfq_sched_data *q = qdisc_priv(sch);
|
||||||
int i;
|
int i;
|
||||||
@ -730,7 +731,7 @@ static int sfq_init(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
q->sch = sch;
|
q->sch = sch;
|
||||||
timer_setup(&q->perturb_timer, sfq_perturbation, TIMER_DEFERRABLE);
|
timer_setup(&q->perturb_timer, sfq_perturbation, TIMER_DEFERRABLE);
|
||||||
|
|
||||||
err = tcf_block_get(&q->block, &q->filter_list, sch);
|
err = tcf_block_get(&q->block, &q->filter_list, sch, extack);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@ -836,7 +837,8 @@ static void sfq_unbind(struct Qdisc *q, unsigned long cl)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tcf_block *sfq_tcf_block(struct Qdisc *sch, unsigned long cl)
|
static struct tcf_block *sfq_tcf_block(struct Qdisc *sch, unsigned long cl,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct sfq_sched_data *q = qdisc_priv(sch);
|
struct sfq_sched_data *q = qdisc_priv(sch);
|
||||||
|
|
||||||
|
@ -302,7 +302,8 @@ static const struct nla_policy tbf_policy[TCA_TBF_MAX + 1] = {
|
|||||||
[TCA_TBF_PBURST] = { .type = NLA_U32 },
|
[TCA_TBF_PBURST] = { .type = NLA_U32 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int tbf_change(struct Qdisc *sch, struct nlattr *opt)
|
static int tbf_change(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct tbf_sched_data *q = qdisc_priv(sch);
|
struct tbf_sched_data *q = qdisc_priv(sch);
|
||||||
@ -326,11 +327,13 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
qopt = nla_data(tb[TCA_TBF_PARMS]);
|
qopt = nla_data(tb[TCA_TBF_PARMS]);
|
||||||
if (qopt->rate.linklayer == TC_LINKLAYER_UNAWARE)
|
if (qopt->rate.linklayer == TC_LINKLAYER_UNAWARE)
|
||||||
qdisc_put_rtab(qdisc_get_rtab(&qopt->rate,
|
qdisc_put_rtab(qdisc_get_rtab(&qopt->rate,
|
||||||
tb[TCA_TBF_RTAB]));
|
tb[TCA_TBF_RTAB],
|
||||||
|
NULL));
|
||||||
|
|
||||||
if (qopt->peakrate.linklayer == TC_LINKLAYER_UNAWARE)
|
if (qopt->peakrate.linklayer == TC_LINKLAYER_UNAWARE)
|
||||||
qdisc_put_rtab(qdisc_get_rtab(&qopt->peakrate,
|
qdisc_put_rtab(qdisc_get_rtab(&qopt->peakrate,
|
||||||
tb[TCA_TBF_PTAB]));
|
tb[TCA_TBF_PTAB],
|
||||||
|
NULL));
|
||||||
|
|
||||||
buffer = min_t(u64, PSCHED_TICKS2NS(qopt->buffer), ~0U);
|
buffer = min_t(u64, PSCHED_TICKS2NS(qopt->buffer), ~0U);
|
||||||
mtu = min_t(u64, PSCHED_TICKS2NS(qopt->mtu), ~0U);
|
mtu = min_t(u64, PSCHED_TICKS2NS(qopt->mtu), ~0U);
|
||||||
@ -383,7 +386,8 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt)
|
|||||||
if (err)
|
if (err)
|
||||||
goto done;
|
goto done;
|
||||||
} else if (qopt->limit > 0) {
|
} else if (qopt->limit > 0) {
|
||||||
child = fifo_create_dflt(sch, &bfifo_qdisc_ops, qopt->limit);
|
child = fifo_create_dflt(sch, &bfifo_qdisc_ops, qopt->limit,
|
||||||
|
extack);
|
||||||
if (IS_ERR(child)) {
|
if (IS_ERR(child)) {
|
||||||
err = PTR_ERR(child);
|
err = PTR_ERR(child);
|
||||||
goto done;
|
goto done;
|
||||||
@ -421,19 +425,20 @@ done:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tbf_init(struct Qdisc *sch, struct nlattr *opt)
|
static int tbf_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct tbf_sched_data *q = qdisc_priv(sch);
|
struct tbf_sched_data *q = qdisc_priv(sch);
|
||||||
|
|
||||||
qdisc_watchdog_init(&q->watchdog, sch);
|
qdisc_watchdog_init(&q->watchdog, sch);
|
||||||
q->qdisc = &noop_qdisc;
|
q->qdisc = &noop_qdisc;
|
||||||
|
|
||||||
if (opt == NULL)
|
if (!opt)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
q->t_c = ktime_get_ns();
|
q->t_c = ktime_get_ns();
|
||||||
|
|
||||||
return tbf_change(sch, opt);
|
return tbf_change(sch, opt, extack);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tbf_destroy(struct Qdisc *sch)
|
static void tbf_destroy(struct Qdisc *sch)
|
||||||
@ -494,7 +499,7 @@ static int tbf_dump_class(struct Qdisc *sch, unsigned long cl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int tbf_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
static int tbf_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
||||||
struct Qdisc **old)
|
struct Qdisc **old, struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct tbf_sched_data *q = qdisc_priv(sch);
|
struct tbf_sched_data *q = qdisc_priv(sch);
|
||||||
|
|
||||||
|
@ -167,7 +167,8 @@ teql_destroy(struct Qdisc *sch)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int teql_qdisc_init(struct Qdisc *sch, struct nlattr *opt)
|
static int teql_qdisc_init(struct Qdisc *sch, struct nlattr *opt,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct net_device *dev = qdisc_dev(sch);
|
struct net_device *dev = qdisc_dev(sch);
|
||||||
struct teql_master *m = (struct teql_master *)sch->ops;
|
struct teql_master *m = (struct teql_master *)sch->ops;
|
||||||
|
Loading…
Reference in New Issue
Block a user