mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2025-12-10 08:44:39 +01:00
ucode-mod-bpf: add support for passing classid for tc attached programs
Some checks are pending
Build all core packages / Build all core packages for selected target (push) Waiting to run
Some checks are pending
Build all core packages / Build all core packages for selected target (push) Waiting to run
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
9ec4060962
commit
8873e26c68
1 changed files with 5 additions and 3 deletions
|
|
@ -620,7 +620,7 @@ uc_bpf_map_pin(uc_vm_t *vm, size_t nargs)
|
||||||
|
|
||||||
static uc_value_t *
|
static uc_value_t *
|
||||||
uc_bpf_set_tc_hook(uc_value_t *ifname, uc_value_t *type, uc_value_t *prio,
|
uc_bpf_set_tc_hook(uc_value_t *ifname, uc_value_t *type, uc_value_t *prio,
|
||||||
int fd)
|
uc_value_t *classid, int fd)
|
||||||
{
|
{
|
||||||
DECLARE_LIBBPF_OPTS(bpf_tc_hook, hook);
|
DECLARE_LIBBPF_OPTS(bpf_tc_hook, hook);
|
||||||
DECLARE_LIBBPF_OPTS(bpf_tc_opts, attach_tc,
|
DECLARE_LIBBPF_OPTS(bpf_tc_opts, attach_tc,
|
||||||
|
|
@ -657,6 +657,7 @@ uc_bpf_set_tc_hook(uc_value_t *ifname, uc_value_t *type, uc_value_t *prio,
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
attach_tc.prog_fd = fd;
|
attach_tc.prog_fd = fd;
|
||||||
|
attach_tc.classid = ucv_int64_get(classid);
|
||||||
if (bpf_tc_attach(&hook, &attach_tc) < 0)
|
if (bpf_tc_attach(&hook, &attach_tc) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|
@ -676,11 +677,12 @@ uc_bpf_program_tc_attach(uc_vm_t *vm, size_t nargs)
|
||||||
uc_value_t *ifname = uc_fn_arg(0);
|
uc_value_t *ifname = uc_fn_arg(0);
|
||||||
uc_value_t *type = uc_fn_arg(1);
|
uc_value_t *type = uc_fn_arg(1);
|
||||||
uc_value_t *prio = uc_fn_arg(2);
|
uc_value_t *prio = uc_fn_arg(2);
|
||||||
|
uc_value_t *classid = uc_fn_arg(3);
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
err_return(EINVAL, NULL);
|
err_return(EINVAL, NULL);
|
||||||
|
|
||||||
return uc_bpf_set_tc_hook(ifname, type, prio, f->fd);
|
return uc_bpf_set_tc_hook(ifname, type, prio, classid, f->fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uc_value_t *
|
static uc_value_t *
|
||||||
|
|
@ -690,7 +692,7 @@ uc_bpf_tc_detach(uc_vm_t *vm, size_t nargs)
|
||||||
uc_value_t *type = uc_fn_arg(1);
|
uc_value_t *type = uc_fn_arg(1);
|
||||||
uc_value_t *prio = uc_fn_arg(2);
|
uc_value_t *prio = uc_fn_arg(2);
|
||||||
|
|
||||||
return uc_bpf_set_tc_hook(ifname, type, prio, -1);
|
return uc_bpf_set_tc_hook(ifname, type, prio, NULL, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue