Lines Matching refs:hook

381 static int attach_point_to_config(struct bpf_tc_hook *hook,  in attach_point_to_config()  argument
384 switch (OPTS_GET(hook, attach_point, 0)) { in attach_point_to_config()
388 if (OPTS_GET(hook, parent, 0)) in attach_point_to_config()
421 static int tc_qdisc_modify(struct bpf_tc_hook *hook, int cmd, int flags) in tc_qdisc_modify() argument
427 ret = attach_point_to_config(hook, &config); in tc_qdisc_modify()
436 req.tc.tcm_ifindex = OPTS_GET(hook, ifindex, 0); in tc_qdisc_modify()
445 static int tc_qdisc_create_excl(struct bpf_tc_hook *hook) in tc_qdisc_create_excl() argument
447 return tc_qdisc_modify(hook, RTM_NEWQDISC, NLM_F_CREATE | NLM_F_EXCL); in tc_qdisc_create_excl()
450 static int tc_qdisc_delete(struct bpf_tc_hook *hook) in tc_qdisc_delete() argument
452 return tc_qdisc_modify(hook, RTM_DELQDISC, 0); in tc_qdisc_delete()
455 int bpf_tc_hook_create(struct bpf_tc_hook *hook) in bpf_tc_hook_create() argument
459 if (!hook || !OPTS_VALID(hook, bpf_tc_hook) || in bpf_tc_hook_create()
460 OPTS_GET(hook, ifindex, 0) <= 0) in bpf_tc_hook_create()
463 ret = tc_qdisc_create_excl(hook); in bpf_tc_hook_create()
467 static int __bpf_tc_detach(const struct bpf_tc_hook *hook,
471 int bpf_tc_hook_destroy(struct bpf_tc_hook *hook) in bpf_tc_hook_destroy() argument
473 if (!hook || !OPTS_VALID(hook, bpf_tc_hook) || in bpf_tc_hook_destroy()
474 OPTS_GET(hook, ifindex, 0) <= 0) in bpf_tc_hook_destroy()
477 switch (OPTS_GET(hook, attach_point, 0)) { in bpf_tc_hook_destroy()
480 return libbpf_err(__bpf_tc_detach(hook, NULL, true)); in bpf_tc_hook_destroy()
482 return libbpf_err(tc_qdisc_delete(hook)); in bpf_tc_hook_destroy()
556 int bpf_tc_attach(const struct bpf_tc_hook *hook, struct bpf_tc_opts *opts) in bpf_tc_attach() argument
564 if (!hook || !opts || in bpf_tc_attach()
565 !OPTS_VALID(hook, bpf_tc_hook) || in bpf_tc_attach()
569 ifindex = OPTS_GET(hook, ifindex, 0); in bpf_tc_attach()
570 parent = OPTS_GET(hook, parent, 0); in bpf_tc_attach()
571 attach_point = OPTS_GET(hook, attach_point, 0); in bpf_tc_attach()
629 static int __bpf_tc_detach(const struct bpf_tc_hook *hook, in __bpf_tc_detach() argument
637 if (!hook || in __bpf_tc_detach()
638 !OPTS_VALID(hook, bpf_tc_hook) || in __bpf_tc_detach()
642 ifindex = OPTS_GET(hook, ifindex, 0); in __bpf_tc_detach()
643 parent = OPTS_GET(hook, parent, 0); in __bpf_tc_detach()
644 attach_point = OPTS_GET(hook, attach_point, 0); in __bpf_tc_detach()
690 int bpf_tc_detach(const struct bpf_tc_hook *hook, in bpf_tc_detach() argument
698 ret = __bpf_tc_detach(hook, opts, false); in bpf_tc_detach()
702 int bpf_tc_query(const struct bpf_tc_hook *hook, struct bpf_tc_opts *opts) in bpf_tc_query() argument
709 if (!hook || !opts || in bpf_tc_query()
710 !OPTS_VALID(hook, bpf_tc_hook) || in bpf_tc_query()
714 ifindex = OPTS_GET(hook, ifindex, 0); in bpf_tc_query()
715 parent = OPTS_GET(hook, parent, 0); in bpf_tc_query()
716 attach_point = OPTS_GET(hook, attach_point, 0); in bpf_tc_query()