Lines Matching refs:hook
26 static int test_tc_bpf_basic(const struct bpf_tc_hook *hook, int fd) in test_tc_bpf_basic() argument
37 ret = bpf_tc_attach(hook, &opts); in test_tc_bpf_basic()
48 ret = bpf_tc_attach(hook, &opts); in test_tc_bpf_basic()
53 ret = bpf_tc_query(hook, &opts); in test_tc_bpf_basic()
64 ret = bpf_tc_detach(hook, &opts); in test_tc_bpf_basic()
69 static int test_tc_bpf_api(struct bpf_tc_hook *hook, int fd) in test_tc_bpf_api() argument
209 ret = bpf_tc_detach(hook, NULL); in test_tc_bpf_api()
213 ret = bpf_tc_detach(hook, &opts_hpr); in test_tc_bpf_api()
217 ret = bpf_tc_detach(hook, &opts_hpf); in test_tc_bpf_api()
221 ret = bpf_tc_detach(hook, &opts_hpi); in test_tc_bpf_api()
225 ret = bpf_tc_detach(hook, &opts_p); in test_tc_bpf_api()
229 ret = bpf_tc_detach(hook, &opts_h); in test_tc_bpf_api()
233 ret = bpf_tc_detach(hook, &opts_prio_max); in test_tc_bpf_api()
246 ret = bpf_tc_query(hook, NULL); in test_tc_bpf_api()
250 ret = bpf_tc_query(hook, &opts_hpr); in test_tc_bpf_api()
254 ret = bpf_tc_query(hook, &opts_hpf); in test_tc_bpf_api()
258 ret = bpf_tc_query(hook, &opts_hpi); in test_tc_bpf_api()
262 ret = bpf_tc_query(hook, &opts_p); in test_tc_bpf_api()
266 ret = bpf_tc_query(hook, &opts_h); in test_tc_bpf_api()
270 ret = bpf_tc_query(hook, &opts_prio_max); in test_tc_bpf_api()
275 ret = bpf_tc_query(hook, &opts_hp); in test_tc_bpf_api()
288 ret = bpf_tc_attach(hook, NULL); in test_tc_bpf_api()
293 ret = bpf_tc_attach(hook, &opts_hp); in test_tc_bpf_api()
297 ret = bpf_tc_attach(hook, NULL); in test_tc_bpf_api()
301 ret = bpf_tc_attach(hook, &opts_hpi); in test_tc_bpf_api()
305 ret = bpf_tc_attach(hook, &opts_pf); in test_tc_bpf_api()
309 ASSERT_OK(bpf_tc_detach(hook, &opts_pf), "bpf_tc_detach"); in test_tc_bpf_api()
311 ret = bpf_tc_attach(hook, &opts_hf); in test_tc_bpf_api()
315 ASSERT_OK(bpf_tc_detach(hook, &opts_hf), "bpf_tc_detach"); in test_tc_bpf_api()
317 ret = bpf_tc_attach(hook, &opts_prio_max); in test_tc_bpf_api()
321 ret = bpf_tc_attach(hook, &opts_f); in test_tc_bpf_api()
325 ASSERT_OK(bpf_tc_detach(hook, &opts_f), "bpf_tc_detach"); in test_tc_bpf_api()
333 DECLARE_LIBBPF_OPTS(bpf_tc_hook, hook, .ifindex = LO_IFINDEX, in tc_bpf_root()
345 ret = bpf_tc_hook_create(&hook); in tc_bpf_root()
353 hook.attach_point = BPF_TC_CUSTOM; in tc_bpf_root()
354 hook.parent = TC_H_MAKE(TC_H_CLSACT, TC_H_MIN_INGRESS); in tc_bpf_root()
355 ret = bpf_tc_hook_create(&hook); in tc_bpf_root()
359 ret = test_tc_bpf_basic(&hook, cls_fd); in tc_bpf_root()
363 ret = bpf_tc_hook_destroy(&hook); in tc_bpf_root()
367 hook.attach_point = BPF_TC_INGRESS; in tc_bpf_root()
368 hook.parent = 0; in tc_bpf_root()
369 bpf_tc_hook_destroy(&hook); in tc_bpf_root()
371 ret = test_tc_bpf_basic(&hook, cls_fd); in tc_bpf_root()
375 bpf_tc_hook_destroy(&hook); in tc_bpf_root()
377 hook.attach_point = BPF_TC_EGRESS; in tc_bpf_root()
378 ret = test_tc_bpf_basic(&hook, cls_fd); in tc_bpf_root()
382 bpf_tc_hook_destroy(&hook); in tc_bpf_root()
384 ret = test_tc_bpf_api(&hook, cls_fd); in tc_bpf_root()
388 bpf_tc_hook_destroy(&hook); in tc_bpf_root()
392 hook.attach_point = BPF_TC_INGRESS | BPF_TC_EGRESS; in tc_bpf_root()
393 bpf_tc_hook_destroy(&hook); in tc_bpf_root()