Skip to content

Commit aeb3fec

Browse files
congwangdavem330
authored andcommitted
net_sched: fold tcf_block_cb_call() into tc_setup_cb_call()
After commit 69bd484 ("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: 69bd484 ("net/sched: Remove egdev mechanism") Cc: Oz Shlomo <ozsh@mellanox.com> Cc: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Acked-by: Oz Shlomo <ozsh@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 390de19 commit aeb3fec

File tree

6 files changed

+35
-47
lines changed

6 files changed

+35
-47
lines changed

include/net/pkt_cls.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,8 @@ tcf_match_indev(struct sk_buff *skb, int ifindex)
619619
}
620620
#endif /* CONFIG_NET_CLS_IND */
621621

622-
int tc_setup_cb_call(struct tcf_block *block, struct tcf_exts *exts,
623-
enum tc_setup_type type, void *type_data, bool err_stop);
622+
int tc_setup_cb_call(struct tcf_block *block, enum tc_setup_type type,
623+
void *type_data, bool err_stop);
624624

625625
enum tc_block_command {
626626
TC_BLOCK_BIND,

net/sched/cls_api.c

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,29 +1270,6 @@ void tcf_block_cb_unregister(struct tcf_block *block,
12701270
}
12711271
EXPORT_SYMBOL(tcf_block_cb_unregister);
12721272

1273-
static int tcf_block_cb_call(struct tcf_block *block, enum tc_setup_type type,
1274-
void *type_data, bool err_stop)
1275-
{
1276-
struct tcf_block_cb *block_cb;
1277-
int ok_count = 0;
1278-
int err;
1279-
1280-
/* Make sure all netdevs sharing this block are offload-capable. */
1281-
if (block->nooffloaddevcnt && err_stop)
1282-
return -EOPNOTSUPP;
1283-
1284-
list_for_each_entry(block_cb, &block->cb_list, list) {
1285-
err = block_cb->cb(type, type_data, block_cb->cb_priv);
1286-
if (err) {
1287-
if (err_stop)
1288-
return err;
1289-
} else {
1290-
ok_count++;
1291-
}
1292-
}
1293-
return ok_count;
1294-
}
1295-
12961273
/* Main classifier routine: scans classifier chain attached
12971274
* to this qdisc, (optionally) tests for protocol and asks
12981275
* specific classifiers.
@@ -2515,10 +2492,27 @@ int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts)
25152492
}
25162493
EXPORT_SYMBOL(tcf_exts_dump_stats);
25172494

2518-
int tc_setup_cb_call(struct tcf_block *block, struct tcf_exts *exts,
2519-
enum tc_setup_type type, void *type_data, bool err_stop)
2495+
int tc_setup_cb_call(struct tcf_block *block, enum tc_setup_type type,
2496+
void *type_data, bool err_stop)
25202497
{
2521-
return tcf_block_cb_call(block, type, type_data, err_stop);
2498+
struct tcf_block_cb *block_cb;
2499+
int ok_count = 0;
2500+
int err;
2501+
2502+
/* Make sure all netdevs sharing this block are offload-capable. */
2503+
if (block->nooffloaddevcnt && err_stop)
2504+
return -EOPNOTSUPP;
2505+
2506+
list_for_each_entry(block_cb, &block->cb_list, list) {
2507+
err = block_cb->cb(type, type_data, block_cb->cb_priv);
2508+
if (err) {
2509+
if (err_stop)
2510+
return err;
2511+
} else {
2512+
ok_count++;
2513+
}
2514+
}
2515+
return ok_count;
25222516
}
25232517
EXPORT_SYMBOL(tc_setup_cb_call);
25242518

net/sched/cls_bpf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog,
169169
if (oldprog)
170170
tcf_block_offload_dec(block, &oldprog->gen_flags);
171171

172-
err = tc_setup_cb_call(block, NULL, TC_SETUP_CLSBPF, &cls_bpf, skip_sw);
172+
err = tc_setup_cb_call(block, TC_SETUP_CLSBPF, &cls_bpf, skip_sw);
173173
if (prog) {
174174
if (err < 0) {
175175
cls_bpf_offload_cmd(tp, oldprog, prog, extack);
@@ -234,7 +234,7 @@ static void cls_bpf_offload_update_stats(struct tcf_proto *tp,
234234
cls_bpf.name = prog->bpf_name;
235235
cls_bpf.exts_integrated = prog->exts_integrated;
236236

237-
tc_setup_cb_call(block, NULL, TC_SETUP_CLSBPF, &cls_bpf, false);
237+
tc_setup_cb_call(block, TC_SETUP_CLSBPF, &cls_bpf, false);
238238
}
239239

240240
static int cls_bpf_init(struct tcf_proto *tp)

net/sched/cls_flower.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,7 @@ static void fl_hw_destroy_filter(struct tcf_proto *tp, struct cls_fl_filter *f,
368368
cls_flower.command = TC_CLSFLOWER_DESTROY;
369369
cls_flower.cookie = (unsigned long) f;
370370

371-
tc_setup_cb_call(block, &f->exts, TC_SETUP_CLSFLOWER,
372-
&cls_flower, false);
371+
tc_setup_cb_call(block, TC_SETUP_CLSFLOWER, &cls_flower, false);
373372
tcf_block_offload_dec(block, &f->flags);
374373
}
375374

@@ -391,8 +390,7 @@ static int fl_hw_replace_filter(struct tcf_proto *tp,
391390
cls_flower.exts = &f->exts;
392391
cls_flower.classid = f->res.classid;
393392

394-
err = tc_setup_cb_call(block, &f->exts, TC_SETUP_CLSFLOWER,
395-
&cls_flower, skip_sw);
393+
err = tc_setup_cb_call(block, TC_SETUP_CLSFLOWER, &cls_flower, skip_sw);
396394
if (err < 0) {
397395
fl_hw_destroy_filter(tp, f, NULL);
398396
return err;
@@ -418,8 +416,7 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f)
418416
cls_flower.exts = &f->exts;
419417
cls_flower.classid = f->res.classid;
420418

421-
tc_setup_cb_call(block, &f->exts, TC_SETUP_CLSFLOWER,
422-
&cls_flower, false);
419+
tc_setup_cb_call(block, TC_SETUP_CLSFLOWER, &cls_flower, false);
423420
}
424421

425422
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,
15021499
/* We don't care if driver (any of them) fails to handle this
15031500
* call. It serves just as a hint for it.
15041501
*/
1505-
tc_setup_cb_call(block, NULL, TC_SETUP_CLSFLOWER,
1506-
&cls_flower, false);
1502+
tc_setup_cb_call(block, TC_SETUP_CLSFLOWER, &cls_flower, false);
15071503
}
15081504

15091505
static void fl_hw_destroy_tmplt(struct tcf_chain *chain,
@@ -1516,8 +1512,7 @@ static void fl_hw_destroy_tmplt(struct tcf_chain *chain,
15161512
cls_flower.command = TC_CLSFLOWER_TMPLT_DESTROY;
15171513
cls_flower.cookie = (unsigned long) tmplt;
15181514

1519-
tc_setup_cb_call(block, NULL, TC_SETUP_CLSFLOWER,
1520-
&cls_flower, false);
1515+
tc_setup_cb_call(block, TC_SETUP_CLSFLOWER, &cls_flower, false);
15211516
}
15221517

15231518
static void *fl_tmplt_create(struct net *net, struct tcf_chain *chain,

net/sched/cls_matchall.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void mall_destroy_hw_filter(struct tcf_proto *tp,
7171
cls_mall.command = TC_CLSMATCHALL_DESTROY;
7272
cls_mall.cookie = cookie;
7373

74-
tc_setup_cb_call(block, NULL, TC_SETUP_CLSMATCHALL, &cls_mall, false);
74+
tc_setup_cb_call(block, TC_SETUP_CLSMATCHALL, &cls_mall, false);
7575
tcf_block_offload_dec(block, &head->flags);
7676
}
7777

@@ -90,8 +90,7 @@ static int mall_replace_hw_filter(struct tcf_proto *tp,
9090
cls_mall.exts = &head->exts;
9191
cls_mall.cookie = cookie;
9292

93-
err = tc_setup_cb_call(block, NULL, TC_SETUP_CLSMATCHALL,
94-
&cls_mall, skip_sw);
93+
err = tc_setup_cb_call(block, TC_SETUP_CLSMATCHALL, &cls_mall, skip_sw);
9594
if (err < 0) {
9695
mall_destroy_hw_filter(tp, head, cookie, NULL);
9796
return err;

net/sched/cls_u32.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ static void u32_clear_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h,
491491
cls_u32.hnode.handle = h->handle;
492492
cls_u32.hnode.prio = h->prio;
493493

494-
tc_setup_cb_call(block, NULL, TC_SETUP_CLSU32, &cls_u32, false);
494+
tc_setup_cb_call(block, TC_SETUP_CLSU32, &cls_u32, false);
495495
}
496496

497497
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,
509509
cls_u32.hnode.handle = h->handle;
510510
cls_u32.hnode.prio = h->prio;
511511

512-
err = tc_setup_cb_call(block, NULL, TC_SETUP_CLSU32, &cls_u32, skip_sw);
512+
err = tc_setup_cb_call(block, TC_SETUP_CLSU32, &cls_u32, skip_sw);
513513
if (err < 0) {
514514
u32_clear_hw_hnode(tp, h, NULL);
515515
return err;
@@ -533,7 +533,7 @@ static void u32_remove_hw_knode(struct tcf_proto *tp, struct tc_u_knode *n,
533533
cls_u32.command = TC_CLSU32_DELETE_KNODE;
534534
cls_u32.knode.handle = n->handle;
535535

536-
tc_setup_cb_call(block, NULL, TC_SETUP_CLSU32, &cls_u32, false);
536+
tc_setup_cb_call(block, TC_SETUP_CLSU32, &cls_u32, false);
537537
tcf_block_offload_dec(block, &n->flags);
538538
}
539539

@@ -563,7 +563,7 @@ static int u32_replace_hw_knode(struct tcf_proto *tp, struct tc_u_knode *n,
563563
if (n->ht_down)
564564
cls_u32.knode.link_handle = ht->handle;
565565

566-
err = tc_setup_cb_call(block, NULL, TC_SETUP_CLSU32, &cls_u32, skip_sw);
566+
err = tc_setup_cb_call(block, TC_SETUP_CLSU32, &cls_u32, skip_sw);
567567
if (err < 0) {
568568
u32_remove_hw_knode(tp, n, NULL);
569569
return err;

0 commit comments

Comments
 (0)