Lines Matching refs:hook

542 static int attach_point_to_config(struct bpf_tc_hook *hook,  in attach_point_to_config()  argument
545 switch (OPTS_GET(hook, attach_point, 0)) { in attach_point_to_config()
549 if (OPTS_GET(hook, parent, 0)) in attach_point_to_config()
582 static int tc_qdisc_modify(struct bpf_tc_hook *hook, int cmd, int flags) in tc_qdisc_modify() argument
588 ret = attach_point_to_config(hook, &config); in tc_qdisc_modify()
597 req.tc.tcm_ifindex = OPTS_GET(hook, ifindex, 0); in tc_qdisc_modify()
606 static int tc_qdisc_create_excl(struct bpf_tc_hook *hook) in tc_qdisc_create_excl() argument
608 return tc_qdisc_modify(hook, RTM_NEWQDISC, NLM_F_CREATE | NLM_F_EXCL); in tc_qdisc_create_excl()
611 static int tc_qdisc_delete(struct bpf_tc_hook *hook) in tc_qdisc_delete() argument
613 return tc_qdisc_modify(hook, RTM_DELQDISC, 0); in tc_qdisc_delete()
616 int bpf_tc_hook_create(struct bpf_tc_hook *hook) in bpf_tc_hook_create() argument
620 if (!hook || !OPTS_VALID(hook, bpf_tc_hook) || in bpf_tc_hook_create()
621 OPTS_GET(hook, ifindex, 0) <= 0) in bpf_tc_hook_create()
624 ret = tc_qdisc_create_excl(hook); in bpf_tc_hook_create()
628 static int __bpf_tc_detach(const struct bpf_tc_hook *hook,
632 int bpf_tc_hook_destroy(struct bpf_tc_hook *hook) in bpf_tc_hook_destroy() argument
634 if (!hook || !OPTS_VALID(hook, bpf_tc_hook) || in bpf_tc_hook_destroy()
635 OPTS_GET(hook, ifindex, 0) <= 0) in bpf_tc_hook_destroy()
638 switch (OPTS_GET(hook, attach_point, 0)) { in bpf_tc_hook_destroy()
641 return libbpf_err(__bpf_tc_detach(hook, NULL, true)); in bpf_tc_hook_destroy()
643 return libbpf_err(tc_qdisc_delete(hook)); in bpf_tc_hook_destroy()
718 int bpf_tc_attach(const struct bpf_tc_hook *hook, struct bpf_tc_opts *opts) in bpf_tc_attach() argument
726 if (!hook || !opts || in bpf_tc_attach()
727 !OPTS_VALID(hook, bpf_tc_hook) || in bpf_tc_attach()
731 ifindex = OPTS_GET(hook, ifindex, 0); in bpf_tc_attach()
732 parent = OPTS_GET(hook, parent, 0); in bpf_tc_attach()
733 attach_point = OPTS_GET(hook, attach_point, 0); in bpf_tc_attach()
792 static int __bpf_tc_detach(const struct bpf_tc_hook *hook, in __bpf_tc_detach() argument
800 if (!hook || in __bpf_tc_detach()
801 !OPTS_VALID(hook, bpf_tc_hook) || in __bpf_tc_detach()
805 ifindex = OPTS_GET(hook, ifindex, 0); in __bpf_tc_detach()
806 parent = OPTS_GET(hook, parent, 0); in __bpf_tc_detach()
807 attach_point = OPTS_GET(hook, attach_point, 0); in __bpf_tc_detach()
853 int bpf_tc_detach(const struct bpf_tc_hook *hook, in bpf_tc_detach() argument
861 ret = __bpf_tc_detach(hook, opts, false); in bpf_tc_detach()
865 int bpf_tc_query(const struct bpf_tc_hook *hook, struct bpf_tc_opts *opts) in bpf_tc_query() argument
872 if (!hook || !opts || in bpf_tc_query()
873 !OPTS_VALID(hook, bpf_tc_hook) || in bpf_tc_query()
877 ifindex = OPTS_GET(hook, ifindex, 0); in bpf_tc_query()
878 parent = OPTS_GET(hook, parent, 0); in bpf_tc_query()
879 attach_point = OPTS_GET(hook, attach_point, 0); in bpf_tc_query()