diff options
| author | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2023-02-22 10:44:31 +0100 |
|---|---|---|
| committer | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2023-02-22 10:44:31 +0100 |
| commit | 904e28c6de083fa4834cdbd0026470ddc30676fc (patch) | |
| tree | f1b8a3dcdedcd9e7a4584808c8dcd96d7a091821 /drivers/hid/bpf/entrypoints/entrypoints.bpf.c | |
| parent | a738688177dcdffe8064dc5ecac6ec4431b6b951 (diff) | |
| parent | 2f7f4efb9411770b4ad99eb314d6418e980248b4 (diff) | |
| download | linux-904e28c6de083fa4834cdbd0026470ddc30676fc.tar.gz linux-904e28c6de083fa4834cdbd0026470ddc30676fc.tar.bz2 linux-904e28c6de083fa4834cdbd0026470ddc30676fc.zip | |
Merge branch 'for-6.3/hid-bpf' into for-linus
Initial support of HID-BPF (Benjamin Tissoires)
The history is a little long for this series, as it was intended to be
sent for v6.2. However some last minute issues forced us to postpone it
to v6.3.
Conflicts:
* drivers/hid/i2c-hid/Kconfig:
commit bf7660dab30d ("HID: stop drivers from selecting CONFIG_HID")
conflicts with commit 2afac81dd165 ("HID: fix I2C_HID not selected
when I2C_HID_OF_ELAN is")
the resolution is simple enough: just drop the "default" and "select"
lines as the new commit from Arnd is doing
Diffstat (limited to 'drivers/hid/bpf/entrypoints/entrypoints.bpf.c')
| -rw-r--r-- | drivers/hid/bpf/entrypoints/entrypoints.bpf.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/hid/bpf/entrypoints/entrypoints.bpf.c b/drivers/hid/bpf/entrypoints/entrypoints.bpf.c new file mode 100644 index 000000000000..c22921125a1a --- /dev/null +++ b/drivers/hid/bpf/entrypoints/entrypoints.bpf.c @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (c) 2022 Benjamin Tissoires */ + +#include ".output/vmlinux.h" +#include <bpf/bpf_helpers.h> +#include <bpf/bpf_tracing.h> + +#define HID_BPF_MAX_PROGS 1024 + +struct { + __uint(type, BPF_MAP_TYPE_PROG_ARRAY); + __uint(max_entries, HID_BPF_MAX_PROGS); + __uint(key_size, sizeof(__u32)); + __uint(value_size, sizeof(__u32)); +} hid_jmp_table SEC(".maps"); + +SEC("fmod_ret/__hid_bpf_tail_call") +int BPF_PROG(hid_tail_call, struct hid_bpf_ctx *hctx) +{ + bpf_tail_call(ctx, &hid_jmp_table, hctx->index); + + return 0; +} + +char LICENSE[] SEC("license") = "GPL"; |
