xref: /linux/drivers/hid/bpf/hid_bpf_dispatch.h (revision d7696738d66b4f1379fe77eef61cd1047d7f0773)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef _BPF_HID_BPF_DISPATCH_H
4 #define _BPF_HID_BPF_DISPATCH_H
5 
6 #include <linux/hid.h>
7 
8 struct hid_bpf_ctx_kern {
9 	struct hid_bpf_ctx ctx;
10 	u8 *data;
11 };
12 
13 struct hid_device *hid_get_device(unsigned int hid_id);
14 void hid_put_device(struct hid_device *hid);
15 int hid_bpf_allocate_event_data(struct hid_device *hdev);
16 int hid_bpf_preload_skel(void);
17 void hid_bpf_free_links_and_skel(void);
18 int hid_bpf_get_prog_attach_type(struct bpf_prog *prog);
19 int __hid_bpf_attach_prog(struct hid_device *hdev, enum hid_bpf_prog_type prog_type, int prog_fd,
20 			  struct bpf_prog *prog, __u32 flags);
21 void __hid_bpf_destroy_device(struct hid_device *hdev);
22 void __hid_bpf_ops_destroy_device(struct hid_device *hdev);
23 int hid_bpf_prog_run(struct hid_device *hdev, enum hid_bpf_prog_type type,
24 		     struct hid_bpf_ctx_kern *ctx_kern);
25 int hid_bpf_reconnect(struct hid_device *hdev);
26 
27 struct bpf_prog;
28 
29 #endif
30