summaryrefslogtreecommitdiff
path: root/include/linux/hid_bpf.h
diff options
context:
space:
mode:
authorBenjamin Tissoires <bentiss@kernel.org>2024-06-08 12:01:20 +0300
committerBenjamin Tissoires <bentiss@kernel.org>2024-06-14 12:20:20 +0300
commit4a86220e046da009bef0948e9f51d1d26d68f93c (patch)
tree41e0cf9fdf3c33a3ae99190bc4d3f30702b76c3d /include/linux/hid_bpf.h
parent50fe0fc6e206c9b85a0a6cc183ee5513d70179d1 (diff)
downloadlinux-4a86220e046da009bef0948e9f51d1d26d68f93c.tar.xz
HID: bpf: remove tracing HID-BPF capability
We can now rely on struct_ops as we cleared the users in-tree. Link: https://lore.kernel.org/r/20240608-hid_bpf_struct_ops-v3-8-6ac6ade58329@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Diffstat (limited to 'include/linux/hid_bpf.h')
-rw-r--r--include/linux/hid_bpf.h54
1 files changed, 1 insertions, 53 deletions
diff --git a/include/linux/hid_bpf.h b/include/linux/hid_bpf.h
index c4f4ce10b7dd..447b94aa99ab 100644
--- a/include/linux/hid_bpf.h
+++ b/include/linux/hid_bpf.h
@@ -4,7 +4,7 @@
#define __HID_BPF_H
#include <linux/bpf.h>
-#include <linux/spinlock.h>
+#include <linux/mutex.h>
#include <uapi/linux/hid.h>
struct hid_device;
@@ -24,11 +24,7 @@ struct hid_device;
*
* All of these fields are currently read-only.
*
- * @index: program index in the jump table. No special meaning (a smaller index
- * doesn't mean the program will be executed before another program with
- * a bigger index).
* @hid: the ``struct hid_device`` representing the device itself
- * @report_type: used for ``hid_bpf_device_event()``
* @allocated_size: Allocated size of data.
*
* This is how much memory is available and can be requested
@@ -47,54 +43,21 @@ struct hid_device;
* @retval: Return value of the previous program.
*/
struct hid_bpf_ctx {
- __u32 index;
const struct hid_device *hid;
__u32 allocated_size;
- enum hid_report_type report_type;
union {
__s32 retval;
__s32 size;
};
};
-/**
- * enum hid_bpf_attach_flags - flags used when attaching a HIF-BPF program
- *
- * @HID_BPF_FLAG_NONE: no specific flag is used, the kernel choses where to
- * insert the program
- * @HID_BPF_FLAG_INSERT_HEAD: insert the given program before any other program
- * currently attached to the device. This doesn't
- * guarantee that this program will always be first
- */
-enum hid_bpf_attach_flags {
- HID_BPF_FLAG_NONE = 0,
- HID_BPF_FLAG_INSERT_HEAD = _BITUL(0),
-
- /* private: internal use only */
- HID_BPF_FLAG_MAX,
-};
-
-/* Following functions are tracepoints that BPF programs can attach to */
-int hid_bpf_device_event(struct hid_bpf_ctx *ctx);
-int hid_bpf_rdesc_fixup(struct hid_bpf_ctx *ctx);
-
/*
* Below is HID internal
*/
-/* internal function to call eBPF programs, not to be used by anybody */
-int __hid_bpf_tail_call(struct hid_bpf_ctx *ctx);
-
#define HID_BPF_MAX_PROGS_PER_DEV 64
#define HID_BPF_FLAG_MASK (((HID_BPF_FLAG_MAX - 1) << 1) - 1)
-/* types of HID programs to attach to */
-enum hid_bpf_prog_type {
- HID_BPF_PROG_TYPE_UNDEF = -1,
- HID_BPF_PROG_TYPE_DEVICE_EVENT, /* an event is emitted from the device */
- HID_BPF_PROG_TYPE_RDESC_FIXUP,
- HID_BPF_PROG_TYPE_MAX,
-};
struct hid_report_enum;
@@ -167,11 +130,6 @@ struct hid_bpf_ops {
struct hid_device *hdev;
};
-struct hid_bpf_prog_list {
- u16 prog_idx[HID_BPF_MAX_PROGS_PER_DEV];
- u8 prog_cnt;
-};
-
/* stored in each device */
struct hid_bpf {
u8 *device_data; /* allocated when a bpf program of type
@@ -179,23 +137,13 @@ struct hid_bpf {
* to this HID device
*/
u32 allocated_data;
-
- struct hid_bpf_prog_list __rcu *progs[HID_BPF_PROG_TYPE_MAX]; /* attached BPF progs */
bool destroyed; /* prevents the assignment of any progs */
- spinlock_t progs_lock; /* protects RCU update of progs */
-
struct hid_bpf_ops *rdesc_ops;
struct list_head prog_list;
struct mutex prog_list_lock; /* protects prog_list update */
};
-/* specific HID-BPF link when a program is attached to a device */
-struct hid_bpf_link {
- struct bpf_link link;
- int hid_table_index;
-};
-
#ifdef CONFIG_HID_BPF
u8 *dispatch_hid_bpf_device_event(struct hid_device *hid, enum hid_report_type type, u8 *data,
u32 *size, int interrupt);