Skip to content

Commit 208c0f4

Browse files
jpirkodavem330
authored andcommitted
net: sched: use tc_setup_cb_call to call per-block callbacks
Extend the tc_setup_cb_call entrypoint function originally used only for action egress devices callbacks to call per-block callbacks as well. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent acb6744 commit 208c0f4

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

include/net/pkt_cls.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,8 @@ tcf_match_indev(struct sk_buff *skb, int ifindex)
543543
}
544544
#endif /* CONFIG_NET_CLS_IND */
545545

546-
int tc_setup_cb_call(struct tcf_exts *exts, enum tc_setup_type type,
547-
void *type_data, bool err_stop);
546+
int tc_setup_cb_call(struct tcf_block *block, struct tcf_exts *exts,
547+
enum tc_setup_type type, void *type_data, bool err_stop);
548548

549549
enum tc_block_command {
550550
TC_BLOCK_BIND,

net/sched/cls_api.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,10 +1206,25 @@ static int tc_exts_setup_cb_egdev_call(struct tcf_exts *exts,
12061206
return ok_count;
12071207
}
12081208

1209-
int tc_setup_cb_call(struct tcf_exts *exts, enum tc_setup_type type,
1210-
void *type_data, bool err_stop)
1209+
int tc_setup_cb_call(struct tcf_block *block, struct tcf_exts *exts,
1210+
enum tc_setup_type type, void *type_data, bool err_stop)
12111211
{
1212-
return tc_exts_setup_cb_egdev_call(exts, type, type_data, err_stop);
1212+
int ok_count;
1213+
int ret;
1214+
1215+
ret = tcf_block_cb_call(block, type, type_data, err_stop);
1216+
if (ret < 0)
1217+
return ret;
1218+
ok_count = ret;
1219+
1220+
if (!exts)
1221+
return ok_count;
1222+
ret = tc_exts_setup_cb_egdev_call(exts, type, type_data, err_stop);
1223+
if (ret < 0)
1224+
return ret;
1225+
ok_count += ret;
1226+
1227+
return ok_count;
12131228
}
12141229
EXPORT_SYMBOL(tc_setup_cb_call);
12151230

net/sched/cls_flower.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ static void fl_hw_destroy_filter(struct tcf_proto *tp, struct cls_fl_filter *f)
201201
{
202202
struct tc_cls_flower_offload cls_flower = {};
203203
struct net_device *dev = tp->q->dev_queue->dev;
204+
struct tcf_block *block = tp->chain->block;
204205

205206
tc_cls_common_offload_init(&cls_flower.common, tp);
206207
cls_flower.command = TC_CLSFLOWER_DESTROY;
@@ -209,7 +210,7 @@ static void fl_hw_destroy_filter(struct tcf_proto *tp, struct cls_fl_filter *f)
209210
if (tc_can_offload(dev))
210211
dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSFLOWER,
211212
&cls_flower);
212-
tc_setup_cb_call(&f->exts, TC_SETUP_CLSFLOWER,
213+
tc_setup_cb_call(block, &f->exts, TC_SETUP_CLSFLOWER,
213214
&cls_flower, false);
214215
}
215216

@@ -220,6 +221,7 @@ static int fl_hw_replace_filter(struct tcf_proto *tp,
220221
{
221222
struct net_device *dev = tp->q->dev_queue->dev;
222223
struct tc_cls_flower_offload cls_flower = {};
224+
struct tcf_block *block = tp->chain->block;
223225
bool skip_sw = tc_skip_sw(f->flags);
224226
int err;
225227

@@ -242,7 +244,7 @@ static int fl_hw_replace_filter(struct tcf_proto *tp,
242244
}
243245
}
244246

245-
err = tc_setup_cb_call(&f->exts, TC_SETUP_CLSFLOWER,
247+
err = tc_setup_cb_call(block, &f->exts, TC_SETUP_CLSFLOWER,
246248
&cls_flower, skip_sw);
247249
if (err < 0) {
248250
fl_hw_destroy_filter(tp, f);
@@ -261,6 +263,7 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f)
261263
{
262264
struct tc_cls_flower_offload cls_flower = {};
263265
struct net_device *dev = tp->q->dev_queue->dev;
266+
struct tcf_block *block = tp->chain->block;
264267

265268
tc_cls_common_offload_init(&cls_flower.common, tp);
266269
cls_flower.command = TC_CLSFLOWER_STATS;
@@ -270,7 +273,7 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f)
270273
if (tc_can_offload(dev))
271274
dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSFLOWER,
272275
&cls_flower);
273-
tc_setup_cb_call(&f->exts, TC_SETUP_CLSFLOWER,
276+
tc_setup_cb_call(block, &f->exts, TC_SETUP_CLSFLOWER,
274277
&cls_flower, false);
275278
}
276279

0 commit comments

Comments
 (0)