• Benjamin Tissoires's avatar
    HID: bpf: implement HID-BPF through bpf_struct_ops · ebc0d809
    Benjamin Tissoires authored
    We do this implementation in several steps to not have the CI failing:
    - first (this patch), we add struct_ops while keeping the existing infra
      available
    - then we change the selftests, the examples and the existing in-tree
      HID-BPF programs
    - then we remove the existing trace points making old HID-BPF obsolete
    
    There are a few advantages of struct_ops over tracing:
    - compatibility with sleepable programs (for hid_hw_raw_request() in
      a later patch)
    - a lot simpler in the kernel: it's a simple rcu protected list
    - we can add more parameters to the function called without much trouble
    - the "attach" is now generic through BPF-core: the caller just needs to
      set hid_id and flags before calling __load().
    - all the BPF tough part is not handled in BPF-core through generic
      processing
    - hid_bpf_ctx is now only writable where it needs be
    Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Link: https://lore.kernel.org/r/20240608-hid_bpf_struct_ops-v3-3-6ac6ade58329@kernel.orgSigned-off-by: default avatarBenjamin Tissoires <bentiss@kernel.org>
    ebc0d809
hid_bpf_dispatch.h 936 Bytes