diff options
author | Sean Young <sean@mess.org> | 2018-05-27 07:24:09 -0400 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-05-30 06:38:40 -0400 |
commit | f4364dcfc86df7c1ca47b256eaf6b6d0cdd0d936 (patch) | |
tree | aa0d09b48734429acec8d26b703db839fcc655de /kernel/bpf/syscall.c | |
parent | 170a7e3ea0709eae12c8f944b9f33c54fe80c6c1 (diff) |
media: rc: introduce BPF_PROG_LIRC_MODE2
Add support for BPF_PROG_LIRC_MODE2. This type of BPF program can call
rc_keydown() to reported decoded IR scancodes, or rc_repeat() to report
that the last key should be repeated.
The bpf program can be attached to using the bpf(BPF_PROG_ATTACH) syscall;
the target_fd must be the /dev/lircN device.
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'kernel/bpf/syscall.c')
-rw-r--r-- | kernel/bpf/syscall.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index e254526d6744..7365d79ae00d 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c | |||
@@ -11,6 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | #include <linux/bpf.h> | 12 | #include <linux/bpf.h> |
13 | #include <linux/bpf_trace.h> | 13 | #include <linux/bpf_trace.h> |
14 | #include <linux/bpf_lirc.h> | ||
14 | #include <linux/btf.h> | 15 | #include <linux/btf.h> |
15 | #include <linux/syscalls.h> | 16 | #include <linux/syscalls.h> |
16 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
@@ -1582,6 +1583,8 @@ static int bpf_prog_attach(const union bpf_attr *attr) | |||
1582 | case BPF_SK_SKB_STREAM_PARSER: | 1583 | case BPF_SK_SKB_STREAM_PARSER: |
1583 | case BPF_SK_SKB_STREAM_VERDICT: | 1584 | case BPF_SK_SKB_STREAM_VERDICT: |
1584 | return sockmap_get_from_fd(attr, BPF_PROG_TYPE_SK_SKB, true); | 1585 | return sockmap_get_from_fd(attr, BPF_PROG_TYPE_SK_SKB, true); |
1586 | case BPF_LIRC_MODE2: | ||
1587 | return lirc_prog_attach(attr); | ||
1585 | default: | 1588 | default: |
1586 | return -EINVAL; | 1589 | return -EINVAL; |
1587 | } | 1590 | } |
@@ -1654,6 +1657,8 @@ static int bpf_prog_detach(const union bpf_attr *attr) | |||
1654 | case BPF_SK_SKB_STREAM_PARSER: | 1657 | case BPF_SK_SKB_STREAM_PARSER: |
1655 | case BPF_SK_SKB_STREAM_VERDICT: | 1658 | case BPF_SK_SKB_STREAM_VERDICT: |
1656 | return sockmap_get_from_fd(attr, BPF_PROG_TYPE_SK_SKB, false); | 1659 | return sockmap_get_from_fd(attr, BPF_PROG_TYPE_SK_SKB, false); |
1660 | case BPF_LIRC_MODE2: | ||
1661 | return lirc_prog_detach(attr); | ||
1657 | default: | 1662 | default: |
1658 | return -EINVAL; | 1663 | return -EINVAL; |
1659 | } | 1664 | } |
@@ -1703,6 +1708,8 @@ static int bpf_prog_query(const union bpf_attr *attr, | |||
1703 | case BPF_CGROUP_SOCK_OPS: | 1708 | case BPF_CGROUP_SOCK_OPS: |
1704 | case BPF_CGROUP_DEVICE: | 1709 | case BPF_CGROUP_DEVICE: |
1705 | break; | 1710 | break; |
1711 | case BPF_LIRC_MODE2: | ||
1712 | return lirc_prog_query(attr, uattr); | ||
1706 | default: | 1713 | default: |
1707 | return -EINVAL; | 1714 | return -EINVAL; |
1708 | } | 1715 | } |