Lines Matching refs:hook

435 static int attach_point_to_config(struct bpf_tc_hook *hook,  in attach_point_to_config()  argument
438 switch (OPTS_GET(hook, attach_point, 0)) { in attach_point_to_config()
442 if (OPTS_GET(hook, parent, 0)) in attach_point_to_config()
475 static int tc_qdisc_modify(struct bpf_tc_hook *hook, int cmd, int flags) in tc_qdisc_modify() argument
481 ret = attach_point_to_config(hook, &config); in tc_qdisc_modify()
490 req.tc.tcm_ifindex = OPTS_GET(hook, ifindex, 0); in tc_qdisc_modify()
499 static int tc_qdisc_create_excl(struct bpf_tc_hook *hook) in tc_qdisc_create_excl() argument
501 return tc_qdisc_modify(hook, RTM_NEWQDISC, NLM_F_CREATE | NLM_F_EXCL); in tc_qdisc_create_excl()
504 static int tc_qdisc_delete(struct bpf_tc_hook *hook) in tc_qdisc_delete() argument
506 return tc_qdisc_modify(hook, RTM_DELQDISC, 0); in tc_qdisc_delete()
509 int bpf_tc_hook_create(struct bpf_tc_hook *hook) in bpf_tc_hook_create() argument
513 if (!hook || !OPTS_VALID(hook, bpf_tc_hook) || in bpf_tc_hook_create()
514 OPTS_GET(hook, ifindex, 0) <= 0) in bpf_tc_hook_create()
517 ret = tc_qdisc_create_excl(hook); in bpf_tc_hook_create()
521 static int __bpf_tc_detach(const struct bpf_tc_hook *hook,
525 int bpf_tc_hook_destroy(struct bpf_tc_hook *hook) in bpf_tc_hook_destroy() argument
527 if (!hook || !OPTS_VALID(hook, bpf_tc_hook) || in bpf_tc_hook_destroy()
528 OPTS_GET(hook, ifindex, 0) <= 0) in bpf_tc_hook_destroy()
531 switch (OPTS_GET(hook, attach_point, 0)) { in bpf_tc_hook_destroy()
534 return libbpf_err(__bpf_tc_detach(hook, NULL, true)); in bpf_tc_hook_destroy()
536 return libbpf_err(tc_qdisc_delete(hook)); in bpf_tc_hook_destroy()
611 int bpf_tc_attach(const struct bpf_tc_hook *hook, struct bpf_tc_opts *opts) in bpf_tc_attach() argument
619 if (!hook || !opts || in bpf_tc_attach()
620 !OPTS_VALID(hook, bpf_tc_hook) || in bpf_tc_attach()
624 ifindex = OPTS_GET(hook, ifindex, 0); in bpf_tc_attach()
625 parent = OPTS_GET(hook, parent, 0); in bpf_tc_attach()
626 attach_point = OPTS_GET(hook, attach_point, 0); in bpf_tc_attach()
684 static int __bpf_tc_detach(const struct bpf_tc_hook *hook, in __bpf_tc_detach() argument
692 if (!hook || in __bpf_tc_detach()
693 !OPTS_VALID(hook, bpf_tc_hook) || in __bpf_tc_detach()
697 ifindex = OPTS_GET(hook, ifindex, 0); in __bpf_tc_detach()
698 parent = OPTS_GET(hook, parent, 0); in __bpf_tc_detach()
699 attach_point = OPTS_GET(hook, attach_point, 0); in __bpf_tc_detach()
745 int bpf_tc_detach(const struct bpf_tc_hook *hook, in bpf_tc_detach() argument
753 ret = __bpf_tc_detach(hook, opts, false); in bpf_tc_detach()
757 int bpf_tc_query(const struct bpf_tc_hook *hook, struct bpf_tc_opts *opts) in bpf_tc_query() argument
764 if (!hook || !opts || in bpf_tc_query()
765 !OPTS_VALID(hook, bpf_tc_hook) || in bpf_tc_query()
769 ifindex = OPTS_GET(hook, ifindex, 0); in bpf_tc_query()
770 parent = OPTS_GET(hook, parent, 0); in bpf_tc_query()
771 attach_point = OPTS_GET(hook, attach_point, 0); in bpf_tc_query()