Skip to content

Libbpf userspace function bpf_tc_hook_create

0.4.0

Create a TC qdisc to which a BPF_PROG_TYPE_SCHED_CLS program can be attached via bpf_tc_attach.

Definition

int bpf_tc_hook_create(struct bpf_tc_hook *hook);

Parameters

  • hook: A pointer to a struct bpf_tc_hook that will be filled with the hook information.

Return

0 on success. A negative error code on failure.

struct bpf_tc_hook

struct bpf_tc_hook {
    size_t sz;
    int ifindex;
    enum bpf_tc_attach_point attach_point;
    __u32 parent;
    size_t :0;
};

ifindex

The interface index of the device to attach the TC qdisc to.

attach_point

The TC attach point. This can be one of the following values:

enum bpf_tc_attach_point {
    BPF_TC_INGRESS = 1 << 0,
    BPF_TC_EGRESS  = 1 << 1,
    BPF_TC_CUSTOM  = 1 << 2,
};

parent

The ID of the parent qdisc.

Usage

Docs could be improved

This part of the docs is incomplete, contributions are very welcome

Example

Docs could be improved

This part of the docs is incomplete, contributions are very welcome