Commit aeb3fecd authored by Cong Wang's avatar Cong Wang Committed by David S. Miller

net_sched: fold tcf_block_cb_call() into tc_setup_cb_call()

After commit 69bd4840 ("net/sched: Remove egdev mechanism"),
tc_setup_cb_call() is nearly identical to tcf_block_cb_call(),
so we can just fold tcf_block_cb_call() into tc_setup_cb_call()
and remove its unused parameter 'exts'.

Fixes: 69bd4840 ("net/sched: Remove egdev mechanism")
Cc: Oz Shlomo <ozsh@mellanox.com>
Cc: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Acked-by: default avatarOz Shlomo <ozsh@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 390de194
...@@ -619,8 +619,8 @@ tcf_match_indev(struct sk_buff *skb, int ifindex) ...@@ -619,8 +619,8 @@ tcf_match_indev(struct sk_buff *skb, int ifindex)
} }
#endif /* CONFIG_NET_CLS_IND */ #endif /* CONFIG_NET_CLS_IND */
int tc_setup_cb_call(struct tcf_block *block, struct tcf_exts *exts, int tc_setup_cb_call(struct tcf_block *block, enum tc_setup_type type,
enum tc_setup_type type, void *type_data, bool err_stop); void *type_data, bool err_stop);
enum tc_block_command { enum tc_block_command {
TC_BLOCK_BIND, TC_BLOCK_BIND,
......
...@@ -1270,29 +1270,6 @@ void tcf_block_cb_unregister(struct tcf_block *block, ...@@ -1270,29 +1270,6 @@ void tcf_block_cb_unregister(struct tcf_block *block,
} }
EXPORT_SYMBOL(tcf_block_cb_unregister); EXPORT_SYMBOL(tcf_block_cb_unregister);
static int tcf_block_cb_call(struct tcf_block *block, enum tc_setup_type type,
void *type_data, bool err_stop)
{
struct tcf_block_cb *block_cb;
int ok_count = 0;
int err;
/* Make sure all netdevs sharing this block are offload-capable. */
if (block->nooffloaddevcnt && err_stop)
return -EOPNOTSUPP;
list_for_each_entry(block_cb, &block->cb_list, list) {
err = block_cb->cb(type, type_data, block_cb->cb_priv);
if (err) {
if (err_stop)
return err;
} else {
ok_count++;
}
}
return ok_count;
}
/* Main classifier routine: scans classifier chain attached /* Main classifier routine: scans classifier chain attached
* to this qdisc, (optionally) tests for protocol and asks * to this qdisc, (optionally) tests for protocol and asks
* specific classifiers. * specific classifiers.
...@@ -2515,10 +2492,27 @@ int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts) ...@@ -2515,10 +2492,27 @@ int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts)
} }
EXPORT_SYMBOL(tcf_exts_dump_stats); EXPORT_SYMBOL(tcf_exts_dump_stats);
int tc_setup_cb_call(struct tcf_block *block, struct tcf_exts *exts, int tc_setup_cb_call(struct tcf_block *block, enum tc_setup_type type,
enum tc_setup_type type, void *type_data, bool err_stop) void *type_data, bool err_stop)
{ {
return tcf_block_cb_call(block, type, type_data, err_stop); struct tcf_block_cb *block_cb;
int ok_count = 0;
int err;
/* Make sure all netdevs sharing this block are offload-capable. */
if (block->nooffloaddevcnt && err_stop)
return -EOPNOTSUPP;
list_for_each_entry(block_cb, &block->cb_list, list) {
err = block_cb->cb(type, type_data, block_cb->cb_priv);
if (err) {
if (err_stop)
return err;
} else {
ok_count++;
}
}
return ok_count;
} }
EXPORT_SYMBOL(tc_setup_cb_call); EXPORT_SYMBOL(tc_setup_cb_call);
......
...@@ -169,7 +169,7 @@ static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog, ...@@ -169,7 +169,7 @@ static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog,
if (oldprog) if (oldprog)
tcf_block_offload_dec(block, &oldprog->gen_flags); tcf_block_offload_dec(block, &oldprog->gen_flags);
err = tc_setup_cb_call(block, NULL, TC_SETUP_CLSBPF, &cls_bpf, skip_sw); err = tc_setup_cb_call(block, TC_SETUP_CLSBPF, &cls_bpf, skip_sw);
if (prog) { if (prog) {
if (err < 0) { if (err < 0) {
cls_bpf_offload_cmd(tp, oldprog, prog, extack); cls_bpf_offload_cmd(tp, oldprog, prog, extack);
...@@ -234,7 +234,7 @@ static void cls_bpf_offload_update_stats(struct tcf_proto *tp, ...@@ -234,7 +234,7 @@ static void cls_bpf_offload_update_stats(struct tcf_proto *tp,
cls_bpf.name = prog->bpf_name; cls_bpf.name = prog->bpf_name;
cls_bpf.exts_integrated = prog->exts_integrated; cls_bpf.exts_integrated = prog->exts_integrated;
tc_setup_cb_call(block, NULL, TC_SETUP_CLSBPF, &cls_bpf, false); tc_setup_cb_call(block, TC_SETUP_CLSBPF, &cls_bpf, false);
} }
static int cls_bpf_init(struct tcf_proto *tp) static int cls_bpf_init(struct tcf_proto *tp)
......
...@@ -368,8 +368,7 @@ static void fl_hw_destroy_filter(struct tcf_proto *tp, struct cls_fl_filter *f, ...@@ -368,8 +368,7 @@ static void fl_hw_destroy_filter(struct tcf_proto *tp, struct cls_fl_filter *f,
cls_flower.command = TC_CLSFLOWER_DESTROY; cls_flower.command = TC_CLSFLOWER_DESTROY;
cls_flower.cookie = (unsigned long) f; cls_flower.cookie = (unsigned long) f;
tc_setup_cb_call(block, &f->exts, TC_SETUP_CLSFLOWER, tc_setup_cb_call(block, TC_SETUP_CLSFLOWER, &cls_flower, false);
&cls_flower, false);
tcf_block_offload_dec(block, &f->flags); tcf_block_offload_dec(block, &f->flags);
} }
...@@ -391,8 +390,7 @@ static int fl_hw_replace_filter(struct tcf_proto *tp, ...@@ -391,8 +390,7 @@ static int fl_hw_replace_filter(struct tcf_proto *tp,
cls_flower.exts = &f->exts; cls_flower.exts = &f->exts;
cls_flower.classid = f->res.classid; cls_flower.classid = f->res.classid;
err = tc_setup_cb_call(block, &f->exts, TC_SETUP_CLSFLOWER, err = tc_setup_cb_call(block, TC_SETUP_CLSFLOWER, &cls_flower, skip_sw);
&cls_flower, skip_sw);
if (err < 0) { if (err < 0) {
fl_hw_destroy_filter(tp, f, NULL); fl_hw_destroy_filter(tp, f, NULL);
return err; return err;
...@@ -418,8 +416,7 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f) ...@@ -418,8 +416,7 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f)
cls_flower.exts = &f->exts; cls_flower.exts = &f->exts;
cls_flower.classid = f->res.classid; cls_flower.classid = f->res.classid;
tc_setup_cb_call(block, &f->exts, TC_SETUP_CLSFLOWER, tc_setup_cb_call(block, TC_SETUP_CLSFLOWER, &cls_flower, false);
&cls_flower, false);
} }
static bool __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f, static bool __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f,
...@@ -1502,8 +1499,7 @@ static void fl_hw_create_tmplt(struct tcf_chain *chain, ...@@ -1502,8 +1499,7 @@ static void fl_hw_create_tmplt(struct tcf_chain *chain,
/* We don't care if driver (any of them) fails to handle this /* We don't care if driver (any of them) fails to handle this
* call. It serves just as a hint for it. * call. It serves just as a hint for it.
*/ */
tc_setup_cb_call(block, NULL, TC_SETUP_CLSFLOWER, tc_setup_cb_call(block, TC_SETUP_CLSFLOWER, &cls_flower, false);
&cls_flower, false);
} }
static void fl_hw_destroy_tmplt(struct tcf_chain *chain, static void fl_hw_destroy_tmplt(struct tcf_chain *chain,
...@@ -1516,8 +1512,7 @@ static void fl_hw_destroy_tmplt(struct tcf_chain *chain, ...@@ -1516,8 +1512,7 @@ static void fl_hw_destroy_tmplt(struct tcf_chain *chain,
cls_flower.command = TC_CLSFLOWER_TMPLT_DESTROY; cls_flower.command = TC_CLSFLOWER_TMPLT_DESTROY;
cls_flower.cookie = (unsigned long) tmplt; cls_flower.cookie = (unsigned long) tmplt;
tc_setup_cb_call(block, NULL, TC_SETUP_CLSFLOWER, tc_setup_cb_call(block, TC_SETUP_CLSFLOWER, &cls_flower, false);
&cls_flower, false);
} }
static void *fl_tmplt_create(struct net *net, struct tcf_chain *chain, static void *fl_tmplt_create(struct net *net, struct tcf_chain *chain,
......
...@@ -71,7 +71,7 @@ static void mall_destroy_hw_filter(struct tcf_proto *tp, ...@@ -71,7 +71,7 @@ static void mall_destroy_hw_filter(struct tcf_proto *tp,
cls_mall.command = TC_CLSMATCHALL_DESTROY; cls_mall.command = TC_CLSMATCHALL_DESTROY;
cls_mall.cookie = cookie; cls_mall.cookie = cookie;
tc_setup_cb_call(block, NULL, TC_SETUP_CLSMATCHALL, &cls_mall, false); tc_setup_cb_call(block, TC_SETUP_CLSMATCHALL, &cls_mall, false);
tcf_block_offload_dec(block, &head->flags); tcf_block_offload_dec(block, &head->flags);
} }
...@@ -90,8 +90,7 @@ static int mall_replace_hw_filter(struct tcf_proto *tp, ...@@ -90,8 +90,7 @@ static int mall_replace_hw_filter(struct tcf_proto *tp,
cls_mall.exts = &head->exts; cls_mall.exts = &head->exts;
cls_mall.cookie = cookie; cls_mall.cookie = cookie;
err = tc_setup_cb_call(block, NULL, TC_SETUP_CLSMATCHALL, err = tc_setup_cb_call(block, TC_SETUP_CLSMATCHALL, &cls_mall, skip_sw);
&cls_mall, skip_sw);
if (err < 0) { if (err < 0) {
mall_destroy_hw_filter(tp, head, cookie, NULL); mall_destroy_hw_filter(tp, head, cookie, NULL);
return err; return err;
......
...@@ -491,7 +491,7 @@ static void u32_clear_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h, ...@@ -491,7 +491,7 @@ static void u32_clear_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h,
cls_u32.hnode.handle = h->handle; cls_u32.hnode.handle = h->handle;
cls_u32.hnode.prio = h->prio; cls_u32.hnode.prio = h->prio;
tc_setup_cb_call(block, NULL, TC_SETUP_CLSU32, &cls_u32, false); tc_setup_cb_call(block, TC_SETUP_CLSU32, &cls_u32, false);
} }
static int u32_replace_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h, static int u32_replace_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h,
...@@ -509,7 +509,7 @@ static int u32_replace_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h, ...@@ -509,7 +509,7 @@ static int u32_replace_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h,
cls_u32.hnode.handle = h->handle; cls_u32.hnode.handle = h->handle;
cls_u32.hnode.prio = h->prio; cls_u32.hnode.prio = h->prio;
err = tc_setup_cb_call(block, NULL, TC_SETUP_CLSU32, &cls_u32, skip_sw); err = tc_setup_cb_call(block, TC_SETUP_CLSU32, &cls_u32, skip_sw);
if (err < 0) { if (err < 0) {
u32_clear_hw_hnode(tp, h, NULL); u32_clear_hw_hnode(tp, h, NULL);
return err; return err;
...@@ -533,7 +533,7 @@ static void u32_remove_hw_knode(struct tcf_proto *tp, struct tc_u_knode *n, ...@@ -533,7 +533,7 @@ static void u32_remove_hw_knode(struct tcf_proto *tp, struct tc_u_knode *n,
cls_u32.command = TC_CLSU32_DELETE_KNODE; cls_u32.command = TC_CLSU32_DELETE_KNODE;
cls_u32.knode.handle = n->handle; cls_u32.knode.handle = n->handle;
tc_setup_cb_call(block, NULL, TC_SETUP_CLSU32, &cls_u32, false); tc_setup_cb_call(block, TC_SETUP_CLSU32, &cls_u32, false);
tcf_block_offload_dec(block, &n->flags); tcf_block_offload_dec(block, &n->flags);
} }
...@@ -563,7 +563,7 @@ static int u32_replace_hw_knode(struct tcf_proto *tp, struct tc_u_knode *n, ...@@ -563,7 +563,7 @@ static int u32_replace_hw_knode(struct tcf_proto *tp, struct tc_u_knode *n,
if (n->ht_down) if (n->ht_down)
cls_u32.knode.link_handle = ht->handle; cls_u32.knode.link_handle = ht->handle;
err = tc_setup_cb_call(block, NULL, TC_SETUP_CLSU32, &cls_u32, skip_sw); err = tc_setup_cb_call(block, TC_SETUP_CLSU32, &cls_u32, skip_sw);
if (err < 0) { if (err < 0) {
u32_remove_hw_knode(tp, n, NULL); u32_remove_hw_knode(tp, n, NULL);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment