提交 69d78ef2 编写于 作者: J Jiri Pirko 提交者: David S. Miller

net: sched: store Qdisc pointer in struct block

Prepare for removal of tp->q and store Qdisc pointer in the block
structure.
Signed-off-by: NJiri Pirko <jiri@mellanox.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 32302902
...@@ -22,7 +22,7 @@ struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index, ...@@ -22,7 +22,7 @@ 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 tcf_proto __rcu **p_filter_chain, struct Qdisc *q);
void tcf_block_put(struct tcf_block *block); void tcf_block_put(struct tcf_block *block);
int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp, int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
struct tcf_result *res, bool compat_mode); struct tcf_result *res, bool compat_mode);
...@@ -30,7 +30,7 @@ int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp, ...@@ -30,7 +30,7 @@ int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
#else #else
static inline static inline
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 tcf_proto __rcu **p_filter_chain, struct Qdisc *q)
{ {
return 0; return 0;
} }
......
...@@ -270,6 +270,7 @@ struct tcf_chain { ...@@ -270,6 +270,7 @@ struct tcf_chain {
struct tcf_block { struct tcf_block {
struct list_head chain_list; struct list_head chain_list;
struct Qdisc *q;
}; };
static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz) static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz)
......
...@@ -241,7 +241,7 @@ tcf_chain_filter_chain_ptr_set(struct tcf_chain *chain, ...@@ -241,7 +241,7 @@ tcf_chain_filter_chain_ptr_set(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 tcf_proto __rcu **p_filter_chain, struct Qdisc *q)
{ {
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;
...@@ -257,6 +257,7 @@ int tcf_block_get(struct tcf_block **p_block, ...@@ -257,6 +257,7 @@ int tcf_block_get(struct tcf_block **p_block,
goto err_chain_create; goto err_chain_create;
} }
tcf_chain_filter_chain_ptr_set(chain, p_filter_chain); tcf_chain_filter_chain_ptr_set(chain, p_filter_chain);
block->q = q;
*p_block = block; *p_block = block;
return 0; return 0;
......
...@@ -281,7 +281,7 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent, ...@@ -281,7 +281,7 @@ 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); error = tcf_block_get(&flow->block, &flow->filter_list, sch);
if (error) { if (error) {
kfree(flow); kfree(flow);
goto err_out; goto err_out;
...@@ -546,7 +546,7 @@ static int atm_tc_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -546,7 +546,7 @@ static int atm_tc_init(struct Qdisc *sch, struct nlattr *opt)
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); err = tcf_block_get(&p->link.block, &p->link.filter_list, sch);
if (err) if (err)
return err; return err;
......
...@@ -1566,7 +1566,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t ...@@ -1566,7 +1566,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); err = tcf_block_get(&cl->block, &cl->filter_list, sch);
if (err) { if (err) {
kfree(cl); kfree(cl);
return err; return err;
......
...@@ -412,7 +412,7 @@ static int drr_init_qdisc(struct Qdisc *sch, struct nlattr *opt) ...@@ -412,7 +412,7 @@ static int drr_init_qdisc(struct Qdisc *sch, struct nlattr *opt)
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); err = tcf_block_get(&q->block, &q->filter_list, sch);
if (err) if (err)
return err; return err;
err = qdisc_class_hash_init(&q->clhash); err = qdisc_class_hash_init(&q->clhash);
......
...@@ -344,7 +344,7 @@ static int dsmark_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -344,7 +344,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); err = tcf_block_get(&p->block, &p->filter_list, sch);
if (err) if (err)
return err; return err;
......
...@@ -481,7 +481,7 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -481,7 +481,7 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt)
return err; return err;
} }
err = tcf_block_get(&q->block, &q->filter_list); err = tcf_block_get(&q->block, &q->filter_list, sch);
if (err) if (err)
return err; return err;
......
...@@ -1033,7 +1033,7 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid, ...@@ -1033,7 +1033,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); err = tcf_block_get(&cl->block, &cl->filter_list, sch);
if (err) { if (err) {
kfree(cl); kfree(cl);
return err; return err;
...@@ -1405,7 +1405,7 @@ hfsc_init_qdisc(struct Qdisc *sch, struct nlattr *opt) ...@@ -1405,7 +1405,7 @@ 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); err = tcf_block_get(&q->root.block, &q->root.filter_list, sch);
if (err) if (err)
return err; return err;
......
...@@ -1030,7 +1030,7 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -1030,7 +1030,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); err = tcf_block_get(&q->block, &q->filter_list, sch);
if (err) if (err)
return err; return err;
...@@ -1393,7 +1393,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, ...@@ -1393,7 +1393,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); err = tcf_block_get(&cl->block, &cl->filter_list, sch);
if (err) { if (err) {
kfree(cl); kfree(cl);
goto failure; goto failure;
......
...@@ -59,7 +59,7 @@ static int ingress_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -59,7 +59,7 @@ static int ingress_init(struct Qdisc *sch, struct nlattr *opt)
struct net_device *dev = qdisc_dev(sch); struct net_device *dev = qdisc_dev(sch);
int err; int err;
err = tcf_block_get(&q->block, &dev->ingress_cl_list); err = tcf_block_get(&q->block, &dev->ingress_cl_list, sch);
if (err) if (err)
return err; return err;
...@@ -153,11 +153,11 @@ static int clsact_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -153,11 +153,11 @@ static int clsact_init(struct Qdisc *sch, struct nlattr *opt)
struct net_device *dev = qdisc_dev(sch); struct net_device *dev = qdisc_dev(sch);
int err; int err;
err = tcf_block_get(&q->ingress_block, &dev->ingress_cl_list); err = tcf_block_get(&q->ingress_block, &dev->ingress_cl_list, sch);
if (err) if (err)
return err; return err;
err = tcf_block_get(&q->egress_block, &dev->egress_cl_list); err = tcf_block_get(&q->egress_block, &dev->egress_cl_list, sch);
if (err) if (err)
return err; return err;
......
...@@ -245,7 +245,7 @@ static int multiq_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -245,7 +245,7 @@ static int multiq_init(struct Qdisc *sch, struct nlattr *opt)
if (opt == NULL) if (opt == NULL)
return -EINVAL; return -EINVAL;
err = tcf_block_get(&q->block, &q->filter_list); err = tcf_block_get(&q->block, &q->filter_list, sch);
if (err) if (err)
return err; return err;
......
...@@ -212,7 +212,7 @@ static int prio_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -212,7 +212,7 @@ 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); err = tcf_block_get(&q->block, &q->filter_list, sch);
if (err) if (err)
return err; return err;
......
...@@ -1419,7 +1419,7 @@ static int qfq_init_qdisc(struct Qdisc *sch, struct nlattr *opt) ...@@ -1419,7 +1419,7 @@ static int qfq_init_qdisc(struct Qdisc *sch, struct nlattr *opt)
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); err = tcf_block_get(&q->block, &q->filter_list, sch);
if (err) if (err)
return err; return err;
......
...@@ -553,7 +553,7 @@ static int sfb_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -553,7 +553,7 @@ static int sfb_init(struct Qdisc *sch, struct nlattr *opt)
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); err = tcf_block_get(&q->block, &q->filter_list, sch);
if (err) if (err)
return err; return err;
......
...@@ -725,7 +725,7 @@ static int sfq_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -725,7 +725,7 @@ static int sfq_init(struct Qdisc *sch, struct nlattr *opt)
setup_deferrable_timer(&q->perturb_timer, sfq_perturbation, setup_deferrable_timer(&q->perturb_timer, sfq_perturbation,
(unsigned long)sch); (unsigned long)sch);
err = tcf_block_get(&q->block, &q->filter_list); err = tcf_block_get(&q->block, &q->filter_list, sch);
if (err) if (err)
return err; return err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册