Lines Matching refs:tp
49 struct tcf_proto *tp; member
80 static int cls_bpf_classify(struct sk_buff *skb, const struct tcf_proto *tp, in cls_bpf_classify() argument
83 struct cls_bpf_head *head = rcu_dereference_bh(tp->root); in cls_bpf_classify()
141 static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog, in cls_bpf_offload_cmd() argument
145 struct tcf_block *block = tp->chain->block; in cls_bpf_offload_cmd()
154 tc_cls_common_offload_init(&cls_bpf.common, tp, obj->gen_flags, extack); in cls_bpf_offload_cmd()
163 err = tc_setup_cb_replace(block, tp, TC_SETUP_CLSBPF, &cls_bpf, in cls_bpf_offload_cmd()
169 err = tc_setup_cb_add(block, tp, TC_SETUP_CLSBPF, &cls_bpf, in cls_bpf_offload_cmd()
173 err = tc_setup_cb_destroy(block, tp, TC_SETUP_CLSBPF, &cls_bpf, in cls_bpf_offload_cmd()
178 cls_bpf_offload_cmd(tp, oldprog, prog, extack); in cls_bpf_offload_cmd()
193 static int cls_bpf_offload(struct tcf_proto *tp, struct cls_bpf_prog *prog, in cls_bpf_offload() argument
209 return cls_bpf_offload_cmd(tp, prog, oldprog, extack); in cls_bpf_offload()
212 static void cls_bpf_stop_offload(struct tcf_proto *tp, in cls_bpf_stop_offload() argument
218 err = cls_bpf_offload_cmd(tp, NULL, prog, extack); in cls_bpf_stop_offload()
223 static void cls_bpf_offload_update_stats(struct tcf_proto *tp, in cls_bpf_offload_update_stats() argument
226 struct tcf_block *block = tp->chain->block; in cls_bpf_offload_update_stats()
229 tc_cls_common_offload_init(&cls_bpf.common, tp, prog->gen_flags, NULL); in cls_bpf_offload_update_stats()
239 static int cls_bpf_init(struct tcf_proto *tp) in cls_bpf_init() argument
249 rcu_assign_pointer(tp->root, head); in cls_bpf_init()
284 static void __cls_bpf_delete(struct tcf_proto *tp, struct cls_bpf_prog *prog, in __cls_bpf_delete() argument
287 struct cls_bpf_head *head = rtnl_dereference(tp->root); in __cls_bpf_delete()
290 cls_bpf_stop_offload(tp, prog, extack); in __cls_bpf_delete()
292 tcf_unbind_filter(tp, &prog->res); in __cls_bpf_delete()
299 static int cls_bpf_delete(struct tcf_proto *tp, void *arg, bool *last, in cls_bpf_delete() argument
302 struct cls_bpf_head *head = rtnl_dereference(tp->root); in cls_bpf_delete()
304 __cls_bpf_delete(tp, arg, extack); in cls_bpf_delete()
309 static void cls_bpf_destroy(struct tcf_proto *tp, bool rtnl_held, in cls_bpf_destroy() argument
312 struct cls_bpf_head *head = rtnl_dereference(tp->root); in cls_bpf_destroy()
316 __cls_bpf_delete(tp, prog, extack); in cls_bpf_destroy()
322 static void *cls_bpf_get(struct tcf_proto *tp, u32 handle) in cls_bpf_get() argument
324 struct cls_bpf_head *head = rtnl_dereference(tp->root); in cls_bpf_get()
373 u32 gen_flags, const struct tcf_proto *tp) in cls_bpf_prog_from_efd() argument
400 tcf_block_netif_keep_dst(tp->chain->block); in cls_bpf_prog_from_efd()
406 struct tcf_proto *tp, unsigned long base, in cls_bpf_change() argument
411 struct cls_bpf_head *head = rtnl_dereference(tp->root); in cls_bpf_change()
463 ret = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &prog->exts, in cls_bpf_change()
491 cls_bpf_prog_from_efd(tb, prog, gen_flags, tp); in cls_bpf_change()
497 tcf_bind_filter(tp, &prog->res, base); in cls_bpf_change()
501 ret = cls_bpf_offload(tp, prog, oldprog, extack); in cls_bpf_change()
511 tcf_unbind_filter(tp, &oldprog->res); in cls_bpf_change()
523 tcf_unbind_filter(tp, &prog->res); in cls_bpf_change()
573 static int cls_bpf_dump(struct net *net, struct tcf_proto *tp, void *fh, in cls_bpf_dump() argument
586 cls_bpf_offload_update_stats(tp, prog); in cls_bpf_dump()
639 static void cls_bpf_walk(struct tcf_proto *tp, struct tcf_walker *arg, in cls_bpf_walk() argument
642 struct cls_bpf_head *head = rtnl_dereference(tp->root); in cls_bpf_walk()
648 if (arg->fn(tp, prog, arg) < 0) { in cls_bpf_walk()
657 static int cls_bpf_reoffload(struct tcf_proto *tp, bool add, flow_setup_cb_t *cb, in cls_bpf_reoffload() argument
660 struct cls_bpf_head *head = rtnl_dereference(tp->root); in cls_bpf_reoffload()
661 struct tcf_block *block = tp->chain->block; in cls_bpf_reoffload()
670 tc_cls_common_offload_init(&cls_bpf.common, tp, prog->gen_flags, in cls_bpf_reoffload()
679 err = tc_setup_cb_reoffload(block, tp, add, cb, TC_SETUP_CLSBPF, in cls_bpf_reoffload()