aboutsummaryrefslogtreecommitdiffstats
path: root/tools/include/uapi/linux
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-06-05 12:42:19 -0400
committerDavid S. Miller <davem@davemloft.net>2018-06-05 12:42:19 -0400
commitfd129f8941cf2309def29b5c8a23b62faff0c9d0 (patch)
tree6ad8afbb59eaf14cfa9f0c4bad498254e6ff1e66 /tools/include/uapi/linux
parenta6fa9087fc280bba8a045d11d9b5d86cbf9a3a83 (diff)
parent9fa06104a235f64d6a2bf3012cc9966e8e4be5eb (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
Daniel Borkmann says: ==================== pull-request: bpf-next 2018-06-05 The following pull-request contains BPF updates for your *net-next* tree. The main changes are: 1) Add a new BPF hook for sendmsg similar to existing hooks for bind and connect: "This allows to override source IP (including the case when it's set via cmsg(3)) and destination IP:port for unconnected UDP (slow path). TCP and connected UDP (fast path) are not affected. This makes UDP support complete, that is, connected UDP is handled by connect hooks, unconnected by sendmsg ones.", from Andrey. 2) Rework of the AF_XDP API to allow extending it in future for type writer model if necessary. In this mode a memory window is passed to hardware and multiple frames might be filled into that window instead of just one that is the case in the current fixed frame-size model. With the new changes made this can be supported without having to add a new descriptor format. Also, core bits for the zero-copy support for AF_XDP have been merged as agreed upon, where i40e bits will be routed via Jeff later on. Various improvements to documentation and sample programs included as well, all from Björn and Magnus. 3) Given BPF's flexibility, a new program type has been added to implement infrared decoders. Quote: "The kernel IR decoders support the most widely used IR protocols, but there are many protocols which are not supported. [...] There is a 'long tail' of unsupported IR protocols, for which lircd is need to decode the IR. IR encoding is done in such a way that some simple circuit can decode it; therefore, BPF is ideal. [...] user-space can define a decoder in BPF, attach it to the rc device through the lirc chardev.", from Sean. 4) Several improvements and fixes to BPF core, among others, dumping map and prog IDs into fdinfo which is a straight forward way to correlate BPF objects used by applications, removing an indirect call and therefore retpoline in all map lookup/update/delete calls by invoking the callback directly for 64 bit archs, adding a new bpf_skb_cgroup_id() BPF helper for tc BPF programs to have an efficient way of looking up cgroup v2 id for policy or other use cases. Fixes to make sure we zero tunnel/xfrm state that hasn't been filled, to allow context access wrt pt_regs in 32 bit archs for tracing, and last but not least various test cases for fixes that landed in bpf earlier, from Daniel. 5) Get rid of the ndo_xdp_flush API and extend the ndo_xdp_xmit with a XDP_XMIT_FLUSH flag instead which allows to avoid one indirect call as flushing is now merged directly into ndo_xdp_xmit(), from Jesper. 6) Add a new bpf_get_current_cgroup_id() helper that can be used in tracing to retrieve the cgroup id from the current process in order to allow for e.g. aggregation of container-level events, from Yonghong. 7) Two follow-up fixes for BTF to reject invalid input values and related to that also two test cases for BPF kselftests, from Martin. 8) Various API improvements to the bpf_fib_lookup() helper, that is, dropping MPLS bits which are not fully hashed out yet, rejecting invalid helper flags, returning error for unsupported address families as well as renaming flowlabel to flowinfo, from David. 9) Various fixes and improvements to sockmap BPF kselftests in particular in proper error detection and data verification, from Prashant. 10) Two arm32 BPF JIT improvements. One is to fix imm range check with regards to whether immediate fits into 24 bits, and a naming cleanup to get functions related to rsh handling consistent to those handling lsh, from Wang. 11) Two compile warning fixes in BPF, one for BTF and a false positive to silent gcc in stack_map_get_build_id_offset(), from Arnd. 12) Add missing seg6.h header into tools include infrastructure in order to fix compilation of BPF kselftests, from Mathieu. 13) Several formatting cleanups in the BPF UAPI helper description that also fix an error during rst2man compilation, from Quentin. 14) Hide an unused variable in sk_msg_convert_ctx_access() when IPv6 is not built into the kernel, from Yue. 15) Remove a useless double assignment in dev_map_enqueue(), from Colin. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/include/uapi/linux')
-rw-r--r--tools/include/uapi/linux/bpf.h134
-rw-r--r--tools/include/uapi/linux/lirc.h217
-rw-r--r--tools/include/uapi/linux/seg6.h55
-rw-r--r--tools/include/uapi/linux/seg6_local.h80
4 files changed, 460 insertions, 26 deletions
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 671486133988..e0b06784f227 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -143,6 +143,7 @@ enum bpf_prog_type {
143 BPF_PROG_TYPE_RAW_TRACEPOINT, 143 BPF_PROG_TYPE_RAW_TRACEPOINT,
144 BPF_PROG_TYPE_CGROUP_SOCK_ADDR, 144 BPF_PROG_TYPE_CGROUP_SOCK_ADDR,
145 BPF_PROG_TYPE_LWT_SEG6LOCAL, 145 BPF_PROG_TYPE_LWT_SEG6LOCAL,
146 BPF_PROG_TYPE_LIRC_MODE2,
146}; 147};
147 148
148enum bpf_attach_type { 149enum bpf_attach_type {
@@ -160,6 +161,9 @@ enum bpf_attach_type {
160 BPF_CGROUP_INET6_CONNECT, 161 BPF_CGROUP_INET6_CONNECT,
161 BPF_CGROUP_INET4_POST_BIND, 162 BPF_CGROUP_INET4_POST_BIND,
162 BPF_CGROUP_INET6_POST_BIND, 163 BPF_CGROUP_INET6_POST_BIND,
164 BPF_CGROUP_UDP4_SENDMSG,
165 BPF_CGROUP_UDP6_SENDMSG,
166 BPF_LIRC_MODE2,
163 __MAX_BPF_ATTACH_TYPE 167 __MAX_BPF_ATTACH_TYPE
164}; 168};
165 169
@@ -1008,7 +1012,6 @@ union bpf_attr {
1008 * :: 1012 * ::
1009 * 1013 *
1010 * # sysctl kernel.perf_event_max_stack=<new value> 1014 * # sysctl kernel.perf_event_max_stack=<new value>
1011 *
1012 * Return 1015 * Return
1013 * The positive or null stack id on success, or a negative error 1016 * The positive or null stack id on success, or a negative error
1014 * in case of failure. 1017 * in case of failure.
@@ -1819,10 +1822,9 @@ union bpf_attr {
1819 * :: 1822 * ::
1820 * 1823 *
1821 * # sysctl kernel.perf_event_max_stack=<new value> 1824 * # sysctl kernel.perf_event_max_stack=<new value>
1822 *
1823 * Return 1825 * Return
1824 * a non-negative value equal to or less than size on success, or 1826 * A non-negative value equal to or less than *size* on success,
1825 * a negative error in case of failure. 1827 * or a negative error in case of failure.
1826 * 1828 *
1827 * int skb_load_bytes_relative(const struct sk_buff *skb, u32 offset, void *to, u32 len, u32 start_header) 1829 * int skb_load_bytes_relative(const struct sk_buff *skb, u32 offset, void *to, u32 len, u32 start_header)
1828 * Description 1830 * Description
@@ -1843,7 +1845,6 @@ union bpf_attr {
1843 * in socket filters where *skb*\ **->data** does not always point 1845 * in socket filters where *skb*\ **->data** does not always point
1844 * to the start of the mac header and where "direct packet access" 1846 * to the start of the mac header and where "direct packet access"
1845 * is not available. 1847 * is not available.
1846 *
1847 * Return 1848 * Return
1848 * 0 on success, or a negative error in case of failure. 1849 * 0 on success, or a negative error in case of failure.
1849 * 1850 *
@@ -1853,22 +1854,24 @@ union bpf_attr {
1853 * If lookup is successful and result shows packet is to be 1854 * If lookup is successful and result shows packet is to be
1854 * forwarded, the neighbor tables are searched for the nexthop. 1855 * forwarded, the neighbor tables are searched for the nexthop.
1855 * If successful (ie., FIB lookup shows forwarding and nexthop 1856 * If successful (ie., FIB lookup shows forwarding and nexthop
1856 * is resolved), the nexthop address is returned in ipv4_dst, 1857 * is resolved), the nexthop address is returned in ipv4_dst
1857 * ipv6_dst or mpls_out based on family, smac is set to mac 1858 * or ipv6_dst based on family, smac is set to mac address of
1858 * address of egress device, dmac is set to nexthop mac address, 1859 * egress device, dmac is set to nexthop mac address, rt_metric
1859 * rt_metric is set to metric from route. 1860 * is set to metric from route (IPv4/IPv6 only).
1860 * 1861 *
1861 * *plen* argument is the size of the passed in struct. 1862 * *plen* argument is the size of the passed in struct.
1862 * *flags* argument can be one or more BPF_FIB_LOOKUP_ flags: 1863 * *flags* argument can be a combination of one or more of the
1864 * following values:
1863 * 1865 *
1864 * **BPF_FIB_LOOKUP_DIRECT** means do a direct table lookup vs 1866 * **BPF_FIB_LOOKUP_DIRECT**
1865 * full lookup using FIB rules 1867 * Do a direct table lookup vs full lookup using FIB
1866 * **BPF_FIB_LOOKUP_OUTPUT** means do lookup from an egress 1868 * rules.
1867 * perspective (default is ingress) 1869 * **BPF_FIB_LOOKUP_OUTPUT**
1870 * Perform lookup from an egress perspective (default is
1871 * ingress).
1868 * 1872 *
1869 * *ctx* is either **struct xdp_md** for XDP programs or 1873 * *ctx* is either **struct xdp_md** for XDP programs or
1870 * **struct sk_buff** tc cls_act programs. 1874 * **struct sk_buff** tc cls_act programs.
1871 *
1872 * Return 1875 * Return
1873 * Egress device index on success, 0 if packet needs to continue 1876 * Egress device index on success, 0 if packet needs to continue
1874 * up the stack for further processing or a negative error in case 1877 * up the stack for further processing or a negative error in case
@@ -2004,6 +2007,74 @@ union bpf_attr {
2004 * direct packet access. 2007 * direct packet access.
2005 * Return 2008 * Return
2006 * 0 on success, or a negative error in case of failure. 2009 * 0 on success, or a negative error in case of failure.
2010 *
2011 * int bpf_rc_keydown(void *ctx, u32 protocol, u64 scancode, u32 toggle)
2012 * Description
2013 * This helper is used in programs implementing IR decoding, to
2014 * report a successfully decoded key press with *scancode*,
2015 * *toggle* value in the given *protocol*. The scancode will be
2016 * translated to a keycode using the rc keymap, and reported as
2017 * an input key down event. After a period a key up event is
2018 * generated. This period can be extended by calling either
2019 * **bpf_rc_keydown** () again with the same values, or calling
2020 * **bpf_rc_repeat** ().
2021 *
2022 * Some protocols include a toggle bit, in case the button was
2023 * released and pressed again between consecutive scancodes.
2024 *
2025 * The *ctx* should point to the lirc sample as passed into
2026 * the program.
2027 *
2028 * The *protocol* is the decoded protocol number (see
2029 * **enum rc_proto** for some predefined values).
2030 *
2031 * This helper is only available is the kernel was compiled with
2032 * the **CONFIG_BPF_LIRC_MODE2** configuration option set to
2033 * "**y**".
2034 *
2035 * Return
2036 * 0
2037 *
2038 * int bpf_rc_repeat(void *ctx)
2039 * Description
2040 * This helper is used in programs implementing IR decoding, to
2041 * report a successfully decoded repeat key message. This delays
2042 * the generation of a key up event for previously generated
2043 * key down event.
2044 *
2045 * Some IR protocols like NEC have a special IR message for
2046 * repeating last button, for when a button is held down.
2047 *
2048 * The *ctx* should point to the lirc sample as passed into
2049 * the program.
2050 *
2051 * This helper is only available is the kernel was compiled with
2052 * the **CONFIG_BPF_LIRC_MODE2** configuration option set to
2053 * "**y**".
2054 *
2055 * Return
2056 * 0
2057 *
2058 * uint64_t bpf_skb_cgroup_id(struct sk_buff *skb)
2059 * Description
2060 * Return the cgroup v2 id of the socket associated with the *skb*.
2061 * This is roughly similar to the **bpf_get_cgroup_classid**\ ()
2062 * helper for cgroup v1 by providing a tag resp. identifier that
2063 * can be matched on or used for map lookups e.g. to implement
2064 * policy. The cgroup v2 id of a given path in the hierarchy is
2065 * exposed in user space through the f_handle API in order to get
2066 * to the same 64-bit id.
2067 *
2068 * This helper can be used on TC egress path, but not on ingress,
2069 * and is available only if the kernel was compiled with the
2070 * **CONFIG_SOCK_CGROUP_DATA** configuration option.
2071 * Return
2072 * The id is returned or 0 in case the id could not be retrieved.
2073 *
2074 * u64 bpf_get_current_cgroup_id(void)
2075 * Return
2076 * A 64-bit integer containing the current cgroup id based
2077 * on the cgroup within which the current task is running.
2007 */ 2078 */
2008#define __BPF_FUNC_MAPPER(FN) \ 2079#define __BPF_FUNC_MAPPER(FN) \
2009 FN(unspec), \ 2080 FN(unspec), \
@@ -2082,7 +2153,11 @@ union bpf_attr {
2082 FN(lwt_push_encap), \ 2153 FN(lwt_push_encap), \
2083 FN(lwt_seg6_store_bytes), \ 2154 FN(lwt_seg6_store_bytes), \
2084 FN(lwt_seg6_adjust_srh), \ 2155 FN(lwt_seg6_adjust_srh), \
2085 FN(lwt_seg6_action), 2156 FN(lwt_seg6_action), \
2157 FN(rc_repeat), \
2158 FN(rc_keydown), \
2159 FN(skb_cgroup_id), \
2160 FN(get_current_cgroup_id),
2086 2161
2087/* integer value in 'imm' field of BPF_CALL instruction selects which helper 2162/* integer value in 'imm' field of BPF_CALL instruction selects which helper
2088 * function eBPF program intends to call 2163 * function eBPF program intends to call
@@ -2199,7 +2274,7 @@ struct bpf_tunnel_key {
2199 }; 2274 };
2200 __u8 tunnel_tos; 2275 __u8 tunnel_tos;
2201 __u8 tunnel_ttl; 2276 __u8 tunnel_ttl;
2202 __u16 tunnel_ext; 2277 __u16 tunnel_ext; /* Padding, future use. */
2203 __u32 tunnel_label; 2278 __u32 tunnel_label;
2204}; 2279};
2205 2280
@@ -2210,6 +2285,7 @@ struct bpf_xfrm_state {
2210 __u32 reqid; 2285 __u32 reqid;
2211 __u32 spi; /* Stored in network byte order */ 2286 __u32 spi; /* Stored in network byte order */
2212 __u16 family; 2287 __u16 family;
2288 __u16 ext; /* Padding, future use. */
2213 union { 2289 union {
2214 __u32 remote_ipv4; /* Stored in network byte order */ 2290 __u32 remote_ipv4; /* Stored in network byte order */
2215 __u32 remote_ipv6[4]; /* Stored in network byte order */ 2291 __u32 remote_ipv6[4]; /* Stored in network byte order */
@@ -2364,6 +2440,12 @@ struct bpf_sock_addr {
2364 __u32 family; /* Allows 4-byte read, but no write */ 2440 __u32 family; /* Allows 4-byte read, but no write */
2365 __u32 type; /* Allows 4-byte read, but no write */ 2441 __u32 type; /* Allows 4-byte read, but no write */
2366 __u32 protocol; /* Allows 4-byte read, but no write */ 2442 __u32 protocol; /* Allows 4-byte read, but no write */
2443 __u32 msg_src_ip4; /* Allows 1,2,4-byte read an 4-byte write.
2444 * Stored in network byte order.
2445 */
2446 __u32 msg_src_ip6[4]; /* Allows 1,2,4-byte read an 4-byte write.
2447 * Stored in network byte order.
2448 */
2367}; 2449};
2368 2450
2369/* User bpf_sock_ops struct to access socket values and specify request ops 2451/* User bpf_sock_ops struct to access socket values and specify request ops
@@ -2531,8 +2613,10 @@ struct bpf_raw_tracepoint_args {
2531#define BPF_FIB_LOOKUP_OUTPUT BIT(1) 2613#define BPF_FIB_LOOKUP_OUTPUT BIT(1)
2532 2614
2533struct bpf_fib_lookup { 2615struct bpf_fib_lookup {
2534 /* input */ 2616 /* input: network family for lookup (AF_INET, AF_INET6)
2535 __u8 family; /* network family, AF_INET, AF_INET6, AF_MPLS */ 2617 * output: network family of egress nexthop
2618 */
2619 __u8 family;
2536 2620
2537 /* set if lookup is to consider L4 data - e.g., FIB rules */ 2621 /* set if lookup is to consider L4 data - e.g., FIB rules */
2538 __u8 l4_protocol; 2622 __u8 l4_protocol;
@@ -2548,22 +2632,20 @@ struct bpf_fib_lookup {
2548 __u8 tos; /* AF_INET */ 2632 __u8 tos; /* AF_INET */
2549 __be32 flowlabel; /* AF_INET6 */ 2633 __be32 flowlabel; /* AF_INET6 */
2550 2634
2551 /* output: metric of fib result */ 2635 /* output: metric of fib result (IPv4/IPv6 only) */
2552 __u32 rt_metric; 2636 __u32 rt_metric;
2553 }; 2637 };
2554 2638
2555 union { 2639 union {
2556 __be32 mpls_in;
2557 __be32 ipv4_src; 2640 __be32 ipv4_src;
2558 __u32 ipv6_src[4]; /* in6_addr; network order */ 2641 __u32 ipv6_src[4]; /* in6_addr; network order */
2559 }; 2642 };
2560 2643
2561 /* input to bpf_fib_lookup, *dst is destination address. 2644 /* input to bpf_fib_lookup, ipv{4,6}_dst is destination address in
2562 * output: bpf_fib_lookup sets to gateway address 2645 * network header. output: bpf_fib_lookup sets to gateway address
2646 * if FIB lookup returns gateway route
2563 */ 2647 */
2564 union { 2648 union {
2565 /* return for MPLS lookups */
2566 __be32 mpls_out[4]; /* support up to 4 labels */
2567 __be32 ipv4_dst; 2649 __be32 ipv4_dst;
2568 __u32 ipv6_dst[4]; /* in6_addr; network order */ 2650 __u32 ipv6_dst[4]; /* in6_addr; network order */
2569 }; 2651 };
diff --git a/tools/include/uapi/linux/lirc.h b/tools/include/uapi/linux/lirc.h
new file mode 100644
index 000000000000..f189931042a7
--- /dev/null
+++ b/tools/include/uapi/linux/lirc.h
@@ -0,0 +1,217 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * lirc.h - linux infrared remote control header file
4 * last modified 2010/07/13 by Jarod Wilson
5 */
6
7#ifndef _LINUX_LIRC_H
8#define _LINUX_LIRC_H
9
10#include <linux/types.h>
11#include <linux/ioctl.h>
12
13#define PULSE_BIT 0x01000000
14#define PULSE_MASK 0x00FFFFFF
15
16#define LIRC_MODE2_SPACE 0x00000000
17#define LIRC_MODE2_PULSE 0x01000000
18#define LIRC_MODE2_FREQUENCY 0x02000000
19#define LIRC_MODE2_TIMEOUT 0x03000000
20
21#define LIRC_VALUE_MASK 0x00FFFFFF
22#define LIRC_MODE2_MASK 0xFF000000
23
24#define LIRC_SPACE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_SPACE)
25#define LIRC_PULSE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_PULSE)
26#define LIRC_FREQUENCY(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_FREQUENCY)
27#define LIRC_TIMEOUT(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_TIMEOUT)
28
29#define LIRC_VALUE(val) ((val)&LIRC_VALUE_MASK)
30#define LIRC_MODE2(val) ((val)&LIRC_MODE2_MASK)
31
32#define LIRC_IS_SPACE(val) (LIRC_MODE2(val) == LIRC_MODE2_SPACE)
33#define LIRC_IS_PULSE(val) (LIRC_MODE2(val) == LIRC_MODE2_PULSE)
34#define LIRC_IS_FREQUENCY(val) (LIRC_MODE2(val) == LIRC_MODE2_FREQUENCY)
35#define LIRC_IS_TIMEOUT(val) (LIRC_MODE2(val) == LIRC_MODE2_TIMEOUT)
36
37/* used heavily by lirc userspace */
38#define lirc_t int
39
40/*** lirc compatible hardware features ***/
41
42#define LIRC_MODE2SEND(x) (x)
43#define LIRC_SEND2MODE(x) (x)
44#define LIRC_MODE2REC(x) ((x) << 16)
45#define LIRC_REC2MODE(x) ((x) >> 16)
46
47#define LIRC_MODE_RAW 0x00000001
48#define LIRC_MODE_PULSE 0x00000002
49#define LIRC_MODE_MODE2 0x00000004
50#define LIRC_MODE_SCANCODE 0x00000008
51#define LIRC_MODE_LIRCCODE 0x00000010
52
53
54#define LIRC_CAN_SEND_RAW LIRC_MODE2SEND(LIRC_MODE_RAW)
55#define LIRC_CAN_SEND_PULSE LIRC_MODE2SEND(LIRC_MODE_PULSE)
56#define LIRC_CAN_SEND_MODE2 LIRC_MODE2SEND(LIRC_MODE_MODE2)
57#define LIRC_CAN_SEND_LIRCCODE LIRC_MODE2SEND(LIRC_MODE_LIRCCODE)
58
59#define LIRC_CAN_SEND_MASK 0x0000003f
60
61#define LIRC_CAN_SET_SEND_CARRIER 0x00000100
62#define LIRC_CAN_SET_SEND_DUTY_CYCLE 0x00000200
63#define LIRC_CAN_SET_TRANSMITTER_MASK 0x00000400
64
65#define LIRC_CAN_REC_RAW LIRC_MODE2REC(LIRC_MODE_RAW)
66#define LIRC_CAN_REC_PULSE LIRC_MODE2REC(LIRC_MODE_PULSE)
67#define LIRC_CAN_REC_MODE2 LIRC_MODE2REC(LIRC_MODE_MODE2)
68#define LIRC_CAN_REC_SCANCODE LIRC_MODE2REC(LIRC_MODE_SCANCODE)
69#define LIRC_CAN_REC_LIRCCODE LIRC_MODE2REC(LIRC_MODE_LIRCCODE)
70
71#define LIRC_CAN_REC_MASK LIRC_MODE2REC(LIRC_CAN_SEND_MASK)
72
73#define LIRC_CAN_SET_REC_CARRIER (LIRC_CAN_SET_SEND_CARRIER << 16)
74#define LIRC_CAN_SET_REC_DUTY_CYCLE (LIRC_CAN_SET_SEND_DUTY_CYCLE << 16)
75
76#define LIRC_CAN_SET_REC_DUTY_CYCLE_RANGE 0x40000000
77#define LIRC_CAN_SET_REC_CARRIER_RANGE 0x80000000
78#define LIRC_CAN_GET_REC_RESOLUTION 0x20000000
79#define LIRC_CAN_SET_REC_TIMEOUT 0x10000000
80#define LIRC_CAN_SET_REC_FILTER 0x08000000
81
82#define LIRC_CAN_MEASURE_CARRIER 0x02000000
83#define LIRC_CAN_USE_WIDEBAND_RECEIVER 0x04000000
84
85#define LIRC_CAN_SEND(x) ((x)&LIRC_CAN_SEND_MASK)
86#define LIRC_CAN_REC(x) ((x)&LIRC_CAN_REC_MASK)
87
88#define LIRC_CAN_NOTIFY_DECODE 0x01000000
89
90/*** IOCTL commands for lirc driver ***/
91
92#define LIRC_GET_FEATURES _IOR('i', 0x00000000, __u32)
93
94#define LIRC_GET_SEND_MODE _IOR('i', 0x00000001, __u32)
95#define LIRC_GET_REC_MODE _IOR('i', 0x00000002, __u32)
96#define LIRC_GET_REC_RESOLUTION _IOR('i', 0x00000007, __u32)
97
98#define LIRC_GET_MIN_TIMEOUT _IOR('i', 0x00000008, __u32)
99#define LIRC_GET_MAX_TIMEOUT _IOR('i', 0x00000009, __u32)
100
101/* code length in bits, currently only for LIRC_MODE_LIRCCODE */
102#define LIRC_GET_LENGTH _IOR('i', 0x0000000f, __u32)
103
104#define LIRC_SET_SEND_MODE _IOW('i', 0x00000011, __u32)
105#define LIRC_SET_REC_MODE _IOW('i', 0x00000012, __u32)
106/* Note: these can reset the according pulse_width */
107#define LIRC_SET_SEND_CARRIER _IOW('i', 0x00000013, __u32)
108#define LIRC_SET_REC_CARRIER _IOW('i', 0x00000014, __u32)
109#define LIRC_SET_SEND_DUTY_CYCLE _IOW('i', 0x00000015, __u32)
110#define LIRC_SET_TRANSMITTER_MASK _IOW('i', 0x00000017, __u32)
111
112/*
113 * when a timeout != 0 is set the driver will send a
114 * LIRC_MODE2_TIMEOUT data packet, otherwise LIRC_MODE2_TIMEOUT is
115 * never sent, timeout is disabled by default
116 */
117#define LIRC_SET_REC_TIMEOUT _IOW('i', 0x00000018, __u32)
118
119/* 1 enables, 0 disables timeout reports in MODE2 */
120#define LIRC_SET_REC_TIMEOUT_REPORTS _IOW('i', 0x00000019, __u32)
121
122/*
123 * if enabled from the next key press on the driver will send
124 * LIRC_MODE2_FREQUENCY packets
125 */
126#define LIRC_SET_MEASURE_CARRIER_MODE _IOW('i', 0x0000001d, __u32)
127
128/*
129 * to set a range use LIRC_SET_REC_CARRIER_RANGE with the
130 * lower bound first and later LIRC_SET_REC_CARRIER with the upper bound
131 */
132#define LIRC_SET_REC_CARRIER_RANGE _IOW('i', 0x0000001f, __u32)
133
134#define LIRC_SET_WIDEBAND_RECEIVER _IOW('i', 0x00000023, __u32)
135
136/*
137 * struct lirc_scancode - decoded scancode with protocol for use with
138 * LIRC_MODE_SCANCODE
139 *
140 * @timestamp: Timestamp in nanoseconds using CLOCK_MONOTONIC when IR
141 * was decoded.
142 * @flags: should be 0 for transmit. When receiving scancodes,
143 * LIRC_SCANCODE_FLAG_TOGGLE or LIRC_SCANCODE_FLAG_REPEAT can be set
144 * depending on the protocol
145 * @rc_proto: see enum rc_proto
146 * @keycode: the translated keycode. Set to 0 for transmit.
147 * @scancode: the scancode received or to be sent
148 */
149struct lirc_scancode {
150 __u64 timestamp;
151 __u16 flags;
152 __u16 rc_proto;
153 __u32 keycode;
154 __u64 scancode;
155};
156
157/* Set if the toggle bit of rc-5 or rc-6 is enabled */
158#define LIRC_SCANCODE_FLAG_TOGGLE 1
159/* Set if this is a nec or sanyo repeat */
160#define LIRC_SCANCODE_FLAG_REPEAT 2
161
162/**
163 * enum rc_proto - the Remote Controller protocol
164 *
165 * @RC_PROTO_UNKNOWN: Protocol not known
166 * @RC_PROTO_OTHER: Protocol known but proprietary
167 * @RC_PROTO_RC5: Philips RC5 protocol
168 * @RC_PROTO_RC5X_20: Philips RC5x 20 bit protocol
169 * @RC_PROTO_RC5_SZ: StreamZap variant of RC5
170 * @RC_PROTO_JVC: JVC protocol
171 * @RC_PROTO_SONY12: Sony 12 bit protocol
172 * @RC_PROTO_SONY15: Sony 15 bit protocol
173 * @RC_PROTO_SONY20: Sony 20 bit protocol
174 * @RC_PROTO_NEC: NEC protocol
175 * @RC_PROTO_NECX: Extended NEC protocol
176 * @RC_PROTO_NEC32: NEC 32 bit protocol
177 * @RC_PROTO_SANYO: Sanyo protocol
178 * @RC_PROTO_MCIR2_KBD: RC6-ish MCE keyboard
179 * @RC_PROTO_MCIR2_MSE: RC6-ish MCE mouse
180 * @RC_PROTO_RC6_0: Philips RC6-0-16 protocol
181 * @RC_PROTO_RC6_6A_20: Philips RC6-6A-20 protocol
182 * @RC_PROTO_RC6_6A_24: Philips RC6-6A-24 protocol
183 * @RC_PROTO_RC6_6A_32: Philips RC6-6A-32 protocol
184 * @RC_PROTO_RC6_MCE: MCE (Philips RC6-6A-32 subtype) protocol
185 * @RC_PROTO_SHARP: Sharp protocol
186 * @RC_PROTO_XMP: XMP protocol
187 * @RC_PROTO_CEC: CEC protocol
188 * @RC_PROTO_IMON: iMon Pad protocol
189 */
190enum rc_proto {
191 RC_PROTO_UNKNOWN = 0,
192 RC_PROTO_OTHER = 1,
193 RC_PROTO_RC5 = 2,
194 RC_PROTO_RC5X_20 = 3,
195 RC_PROTO_RC5_SZ = 4,
196 RC_PROTO_JVC = 5,
197 RC_PROTO_SONY12 = 6,
198 RC_PROTO_SONY15 = 7,
199 RC_PROTO_SONY20 = 8,
200 RC_PROTO_NEC = 9,
201 RC_PROTO_NECX = 10,
202 RC_PROTO_NEC32 = 11,
203 RC_PROTO_SANYO = 12,
204 RC_PROTO_MCIR2_KBD = 13,
205 RC_PROTO_MCIR2_MSE = 14,
206 RC_PROTO_RC6_0 = 15,
207 RC_PROTO_RC6_6A_20 = 16,
208 RC_PROTO_RC6_6A_24 = 17,
209 RC_PROTO_RC6_6A_32 = 18,
210 RC_PROTO_RC6_MCE = 19,
211 RC_PROTO_SHARP = 20,
212 RC_PROTO_XMP = 21,
213 RC_PROTO_CEC = 22,
214 RC_PROTO_IMON = 23,
215};
216
217#endif
diff --git a/tools/include/uapi/linux/seg6.h b/tools/include/uapi/linux/seg6.h
new file mode 100644
index 000000000000..286e8d6a8e98
--- /dev/null
+++ b/tools/include/uapi/linux/seg6.h
@@ -0,0 +1,55 @@
1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2/*
3 * SR-IPv6 implementation
4 *
5 * Author:
6 * David Lebrun <david.lebrun@uclouvain.be>
7 *
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14
15#ifndef _UAPI_LINUX_SEG6_H
16#define _UAPI_LINUX_SEG6_H
17
18#include <linux/types.h>
19#include <linux/in6.h> /* For struct in6_addr. */
20
21/*
22 * SRH
23 */
24struct ipv6_sr_hdr {
25 __u8 nexthdr;
26 __u8 hdrlen;
27 __u8 type;
28 __u8 segments_left;
29 __u8 first_segment; /* Represents the last_entry field of SRH */
30 __u8 flags;
31 __u16 tag;
32
33 struct in6_addr segments[0];
34};
35
36#define SR6_FLAG1_PROTECTED (1 << 6)
37#define SR6_FLAG1_OAM (1 << 5)
38#define SR6_FLAG1_ALERT (1 << 4)
39#define SR6_FLAG1_HMAC (1 << 3)
40
41#define SR6_TLV_INGRESS 1
42#define SR6_TLV_EGRESS 2
43#define SR6_TLV_OPAQUE 3
44#define SR6_TLV_PADDING 4
45#define SR6_TLV_HMAC 5
46
47#define sr_has_hmac(srh) ((srh)->flags & SR6_FLAG1_HMAC)
48
49struct sr6_tlv {
50 __u8 type;
51 __u8 len;
52 __u8 data[0];
53};
54
55#endif
diff --git a/tools/include/uapi/linux/seg6_local.h b/tools/include/uapi/linux/seg6_local.h
new file mode 100644
index 000000000000..edc138bdc56d
--- /dev/null
+++ b/tools/include/uapi/linux/seg6_local.h
@@ -0,0 +1,80 @@
1/*
2 * SR-IPv6 implementation
3 *
4 * Author:
5 * David Lebrun <david.lebrun@uclouvain.be>
6 *
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13
14#ifndef _UAPI_LINUX_SEG6_LOCAL_H
15#define _UAPI_LINUX_SEG6_LOCAL_H
16
17#include <linux/seg6.h>
18
19enum {
20 SEG6_LOCAL_UNSPEC,
21 SEG6_LOCAL_ACTION,
22 SEG6_LOCAL_SRH,
23 SEG6_LOCAL_TABLE,
24 SEG6_LOCAL_NH4,
25 SEG6_LOCAL_NH6,
26 SEG6_LOCAL_IIF,
27 SEG6_LOCAL_OIF,
28 SEG6_LOCAL_BPF,
29 __SEG6_LOCAL_MAX,
30};
31#define SEG6_LOCAL_MAX (__SEG6_LOCAL_MAX - 1)
32
33enum {
34 SEG6_LOCAL_ACTION_UNSPEC = 0,
35 /* node segment */
36 SEG6_LOCAL_ACTION_END = 1,
37 /* adjacency segment (IPv6 cross-connect) */
38 SEG6_LOCAL_ACTION_END_X = 2,
39 /* lookup of next seg NH in table */
40 SEG6_LOCAL_ACTION_END_T = 3,
41 /* decap and L2 cross-connect */
42 SEG6_LOCAL_ACTION_END_DX2 = 4,
43 /* decap and IPv6 cross-connect */
44 SEG6_LOCAL_ACTION_END_DX6 = 5,
45 /* decap and IPv4 cross-connect */
46 SEG6_LOCAL_ACTION_END_DX4 = 6,
47 /* decap and lookup of DA in v6 table */
48 SEG6_LOCAL_ACTION_END_DT6 = 7,
49 /* decap and lookup of DA in v4 table */
50 SEG6_LOCAL_ACTION_END_DT4 = 8,
51 /* binding segment with insertion */
52 SEG6_LOCAL_ACTION_END_B6 = 9,
53 /* binding segment with encapsulation */
54 SEG6_LOCAL_ACTION_END_B6_ENCAP = 10,
55 /* binding segment with MPLS encap */
56 SEG6_LOCAL_ACTION_END_BM = 11,
57 /* lookup last seg in table */
58 SEG6_LOCAL_ACTION_END_S = 12,
59 /* forward to SR-unaware VNF with static proxy */
60 SEG6_LOCAL_ACTION_END_AS = 13,
61 /* forward to SR-unaware VNF with masquerading */
62 SEG6_LOCAL_ACTION_END_AM = 14,
63 /* custom BPF action */
64 SEG6_LOCAL_ACTION_END_BPF = 15,
65
66 __SEG6_LOCAL_ACTION_MAX,
67};
68
69#define SEG6_LOCAL_ACTION_MAX (__SEG6_LOCAL_ACTION_MAX - 1)
70
71enum {
72 SEG6_LOCAL_BPF_PROG_UNSPEC,
73 SEG6_LOCAL_BPF_PROG,
74 SEG6_LOCAL_BPF_PROG_NAME,
75 __SEG6_LOCAL_BPF_PROG_MAX,
76};
77
78#define SEG6_LOCAL_BPF_PROG_MAX (__SEG6_LOCAL_BPF_PROG_MAX - 1)
79
80#endif