aboutsummaryrefslogtreecommitdiffstats
path: root/tools/include/uapi/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-08-15 18:04:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-15 18:04:25 -0400
commit9a76aba02a37718242d7cdc294f0a3901928aa57 (patch)
tree2040d038f85d2120f21af83b0793efd5af1864e3 /tools/include/uapi/linux
parent0a957467c5fd46142bc9c52758ffc552d4c5e2f7 (diff)
parent26a1ccc6c117be8e33e0410fce8c5298b0015b99 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: "Highlights: - Gustavo A. R. Silva keeps working on the implicit switch fallthru changes. - Support 802.11ax High-Efficiency wireless in cfg80211 et al, From Luca Coelho. - Re-enable ASPM in r8169, from Kai-Heng Feng. - Add virtual XFRM interfaces, which avoids all of the limitations of existing IPSEC tunnels. From Steffen Klassert. - Convert GRO over to use a hash table, so that when we have many flows active we don't traverse a long list during accumluation. - Many new self tests for routing, TC, tunnels, etc. Too many contributors to mention them all, but I'm really happy to keep seeing this stuff. - Hardware timestamping support for dpaa_eth/fsl-fman from Yangbo Lu. - Lots of cleanups and fixes in L2TP code from Guillaume Nault. - Add IPSEC offload support to netdevsim, from Shannon Nelson. - Add support for slotting with non-uniform distribution to netem packet scheduler, from Yousuk Seung. - Add UDP GSO support to mlx5e, from Boris Pismenny. - Support offloading of Team LAG in NFP, from John Hurley. - Allow to configure TX queue selection based upon RX queue, from Amritha Nambiar. - Support ethtool ring size configuration in aquantia, from Anton Mikaev. - Support DSCP and flowlabel per-transport in SCTP, from Xin Long. - Support list based batching and stack traversal of SKBs, this is very exciting work. From Edward Cree. - Busyloop optimizations in vhost_net, from Toshiaki Makita. - Introduce the ETF qdisc, which allows time based transmissions. IGB can offload this in hardware. From Vinicius Costa Gomes. - Add parameter support to devlink, from Moshe Shemesh. - Several multiplication and division optimizations for BPF JIT in nfp driver, from Jiong Wang. - Lots of prepatory work to make more of the packet scheduler layer lockless, when possible, from Vlad Buslov. - Add ACK filter and NAT awareness to sch_cake packet scheduler, from Toke Høiland-Jørgensen. - Support regions and region snapshots in devlink, from Alex Vesker. - Allow to attach XDP programs to both HW and SW at the same time on a given device, with initial support in nfp. From Jakub Kicinski. - Add TLS RX offload and support in mlx5, from Ilya Lesokhin. - Use PHYLIB in r8169 driver, from Heiner Kallweit. - All sorts of changes to support Spectrum 2 in mlxsw driver, from Ido Schimmel. - PTP support in mv88e6xxx DSA driver, from Andrew Lunn. - Make TCP_USER_TIMEOUT socket option more accurate, from Jon Maxwell. - Support for templates in packet scheduler classifier, from Jiri Pirko. - IPV6 support in RDS, from Ka-Cheong Poon. - Native tproxy support in nf_tables, from Máté Eckl. - Maintain IP fragment queue in an rbtree, but optimize properly for in-order frags. From Peter Oskolkov. - Improvde handling of ACKs on hole repairs, from Yuchung Cheng" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1996 commits) bpf: test: fix spelling mistake "REUSEEPORT" -> "REUSEPORT" hv/netvsc: Fix NULL dereference at single queue mode fallback net: filter: mark expected switch fall-through xen-netfront: fix warn message as irq device name has '/' cxgb4: Add new T5 PCI device ids 0x50af and 0x50b0 net: dsa: mv88e6xxx: missing unlock on error path rds: fix building with IPV6=m inet/connection_sock: prefer _THIS_IP_ to current_text_addr net: dsa: mv88e6xxx: bitwise vs logical bug net: sock_diag: Fix spectre v1 gadget in __sock_diag_cmd() ieee802154: hwsim: using right kind of iteration net: hns3: Add vlan filter setting by ethtool command -K net: hns3: Set tx ring' tc info when netdev is up net: hns3: Remove tx ring BD len register in hns3_enet net: hns3: Fix desc num set to default when setting channel net: hns3: Fix for phy link issue when using marvell phy driver net: hns3: Fix for information of phydev lost problem when down/up net: hns3: Fix for command format parsing error in hclge_is_all_function_id_zero net: hns3: Add support for serdes loopback selftest bnxt_en: take coredump_record structure off stack ...
Diffstat (limited to 'tools/include/uapi/linux')
-rw-r--r--tools/include/uapi/linux/bpf.h104
1 files changed, 99 insertions, 5 deletions
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index b7db3261c62d..66917a4eba27 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -75,6 +75,11 @@ struct bpf_lpm_trie_key {
75 __u8 data[0]; /* Arbitrary size */ 75 __u8 data[0]; /* Arbitrary size */
76}; 76};
77 77
78struct bpf_cgroup_storage_key {
79 __u64 cgroup_inode_id; /* cgroup inode id */
80 __u32 attach_type; /* program attach type */
81};
82
78/* BPF syscall commands, see bpf(2) man-page for details. */ 83/* BPF syscall commands, see bpf(2) man-page for details. */
79enum bpf_cmd { 84enum bpf_cmd {
80 BPF_MAP_CREATE, 85 BPF_MAP_CREATE,
@@ -120,6 +125,8 @@ enum bpf_map_type {
120 BPF_MAP_TYPE_CPUMAP, 125 BPF_MAP_TYPE_CPUMAP,
121 BPF_MAP_TYPE_XSKMAP, 126 BPF_MAP_TYPE_XSKMAP,
122 BPF_MAP_TYPE_SOCKHASH, 127 BPF_MAP_TYPE_SOCKHASH,
128 BPF_MAP_TYPE_CGROUP_STORAGE,
129 BPF_MAP_TYPE_REUSEPORT_SOCKARRAY,
123}; 130};
124 131
125enum bpf_prog_type { 132enum bpf_prog_type {
@@ -144,6 +151,7 @@ enum bpf_prog_type {
144 BPF_PROG_TYPE_CGROUP_SOCK_ADDR, 151 BPF_PROG_TYPE_CGROUP_SOCK_ADDR,
145 BPF_PROG_TYPE_LWT_SEG6LOCAL, 152 BPF_PROG_TYPE_LWT_SEG6LOCAL,
146 BPF_PROG_TYPE_LIRC_MODE2, 153 BPF_PROG_TYPE_LIRC_MODE2,
154 BPF_PROG_TYPE_SK_REUSEPORT,
147}; 155};
148 156
149enum bpf_attach_type { 157enum bpf_attach_type {
@@ -1371,6 +1379,20 @@ union bpf_attr {
1371 * A 8-byte long non-decreasing number on success, or 0 if the 1379 * A 8-byte long non-decreasing number on success, or 0 if the
1372 * socket field is missing inside *skb*. 1380 * socket field is missing inside *skb*.
1373 * 1381 *
1382 * u64 bpf_get_socket_cookie(struct bpf_sock_addr *ctx)
1383 * Description
1384 * Equivalent to bpf_get_socket_cookie() helper that accepts
1385 * *skb*, but gets socket from **struct bpf_sock_addr** contex.
1386 * Return
1387 * A 8-byte long non-decreasing number.
1388 *
1389 * u64 bpf_get_socket_cookie(struct bpf_sock_ops *ctx)
1390 * Description
1391 * Equivalent to bpf_get_socket_cookie() helper that accepts
1392 * *skb*, but gets socket from **struct bpf_sock_ops** contex.
1393 * Return
1394 * A 8-byte long non-decreasing number.
1395 *
1374 * u32 bpf_get_socket_uid(struct sk_buff *skb) 1396 * u32 bpf_get_socket_uid(struct sk_buff *skb)
1375 * Return 1397 * Return
1376 * The owner UID of the socket associated to *skb*. If the socket 1398 * The owner UID of the socket associated to *skb*. If the socket
@@ -1826,7 +1848,7 @@ union bpf_attr {
1826 * A non-negative value equal to or less than *size* on success, 1848 * A non-negative value equal to or less than *size* on success,
1827 * or a negative error in case of failure. 1849 * or a negative error in case of failure.
1828 * 1850 *
1829 * int skb_load_bytes_relative(const struct sk_buff *skb, u32 offset, void *to, u32 len, u32 start_header) 1851 * int bpf_skb_load_bytes_relative(const struct sk_buff *skb, u32 offset, void *to, u32 len, u32 start_header)
1830 * Description 1852 * Description
1831 * This helper is similar to **bpf_skb_load_bytes**\ () in that 1853 * This helper is similar to **bpf_skb_load_bytes**\ () in that
1832 * it provides an easy way to load *len* bytes from *offset* 1854 * it provides an easy way to load *len* bytes from *offset*
@@ -1877,7 +1899,7 @@ union bpf_attr {
1877 * * < 0 if any input argument is invalid 1899 * * < 0 if any input argument is invalid
1878 * * 0 on success (packet is forwarded, nexthop neighbor exists) 1900 * * 0 on success (packet is forwarded, nexthop neighbor exists)
1879 * * > 0 one of **BPF_FIB_LKUP_RET_** codes explaining why the 1901 * * > 0 one of **BPF_FIB_LKUP_RET_** codes explaining why the
1880 * * packet is not forwarded or needs assist from full stack 1902 * packet is not forwarded or needs assist from full stack
1881 * 1903 *
1882 * int bpf_sock_hash_update(struct bpf_sock_ops_kern *skops, struct bpf_map *map, void *key, u64 flags) 1904 * int bpf_sock_hash_update(struct bpf_sock_ops_kern *skops, struct bpf_map *map, void *key, u64 flags)
1883 * Description 1905 * Description
@@ -2033,7 +2055,6 @@ union bpf_attr {
2033 * This helper is only available is the kernel was compiled with 2055 * This helper is only available is the kernel was compiled with
2034 * the **CONFIG_BPF_LIRC_MODE2** configuration option set to 2056 * the **CONFIG_BPF_LIRC_MODE2** configuration option set to
2035 * "**y**". 2057 * "**y**".
2036 *
2037 * Return 2058 * Return
2038 * 0 2059 * 0
2039 * 2060 *
@@ -2053,7 +2074,6 @@ union bpf_attr {
2053 * This helper is only available is the kernel was compiled with 2074 * This helper is only available is the kernel was compiled with
2054 * the **CONFIG_BPF_LIRC_MODE2** configuration option set to 2075 * the **CONFIG_BPF_LIRC_MODE2** configuration option set to
2055 * "**y**". 2076 * "**y**".
2056 *
2057 * Return 2077 * Return
2058 * 0 2078 * 0
2059 * 2079 *
@@ -2073,10 +2093,54 @@ union bpf_attr {
2073 * Return 2093 * Return
2074 * The id is returned or 0 in case the id could not be retrieved. 2094 * The id is returned or 0 in case the id could not be retrieved.
2075 * 2095 *
2096 * u64 bpf_skb_ancestor_cgroup_id(struct sk_buff *skb, int ancestor_level)
2097 * Description
2098 * Return id of cgroup v2 that is ancestor of cgroup associated
2099 * with the *skb* at the *ancestor_level*. The root cgroup is at
2100 * *ancestor_level* zero and each step down the hierarchy
2101 * increments the level. If *ancestor_level* == level of cgroup
2102 * associated with *skb*, then return value will be same as that
2103 * of **bpf_skb_cgroup_id**\ ().
2104 *
2105 * The helper is useful to implement policies based on cgroups
2106 * that are upper in hierarchy than immediate cgroup associated
2107 * with *skb*.
2108 *
2109 * The format of returned id and helper limitations are same as in
2110 * **bpf_skb_cgroup_id**\ ().
2111 * Return
2112 * The id is returned or 0 in case the id could not be retrieved.
2113 *
2076 * u64 bpf_get_current_cgroup_id(void) 2114 * u64 bpf_get_current_cgroup_id(void)
2077 * Return 2115 * Return
2078 * A 64-bit integer containing the current cgroup id based 2116 * A 64-bit integer containing the current cgroup id based
2079 * on the cgroup within which the current task is running. 2117 * on the cgroup within which the current task is running.
2118 *
2119 * void* get_local_storage(void *map, u64 flags)
2120 * Description
2121 * Get the pointer to the local storage area.
2122 * The type and the size of the local storage is defined
2123 * by the *map* argument.
2124 * The *flags* meaning is specific for each map type,
2125 * and has to be 0 for cgroup local storage.
2126 *
2127 * Depending on the bpf program type, a local storage area
2128 * can be shared between multiple instances of the bpf program,
2129 * running simultaneously.
2130 *
2131 * A user should care about the synchronization by himself.
2132 * For example, by using the BPF_STX_XADD instruction to alter
2133 * the shared data.
2134 * Return
2135 * Pointer to the local storage area.
2136 *
2137 * int bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags)
2138 * Description
2139 * Select a SO_REUSEPORT sk from a BPF_MAP_TYPE_REUSEPORT_ARRAY map
2140 * It checks the selected sk is matching the incoming
2141 * request in the skb.
2142 * Return
2143 * 0 on success, or a negative error in case of failure.
2080 */ 2144 */
2081#define __BPF_FUNC_MAPPER(FN) \ 2145#define __BPF_FUNC_MAPPER(FN) \
2082 FN(unspec), \ 2146 FN(unspec), \
@@ -2159,7 +2223,10 @@ union bpf_attr {
2159 FN(rc_repeat), \ 2223 FN(rc_repeat), \
2160 FN(rc_keydown), \ 2224 FN(rc_keydown), \
2161 FN(skb_cgroup_id), \ 2225 FN(skb_cgroup_id), \
2162 FN(get_current_cgroup_id), 2226 FN(get_current_cgroup_id), \
2227 FN(get_local_storage), \
2228 FN(sk_select_reuseport), \
2229 FN(skb_ancestor_cgroup_id),
2163 2230
2164/* integer value in 'imm' field of BPF_CALL instruction selects which helper 2231/* integer value in 'imm' field of BPF_CALL instruction selects which helper
2165 * function eBPF program intends to call 2232 * function eBPF program intends to call
@@ -2376,6 +2443,30 @@ struct sk_msg_md {
2376 __u32 local_port; /* stored in host byte order */ 2443 __u32 local_port; /* stored in host byte order */
2377}; 2444};
2378 2445
2446struct sk_reuseport_md {
2447 /*
2448 * Start of directly accessible data. It begins from
2449 * the tcp/udp header.
2450 */
2451 void *data;
2452 void *data_end; /* End of directly accessible data */
2453 /*
2454 * Total length of packet (starting from the tcp/udp header).
2455 * Note that the directly accessible bytes (data_end - data)
2456 * could be less than this "len". Those bytes could be
2457 * indirectly read by a helper "bpf_skb_load_bytes()".
2458 */
2459 __u32 len;
2460 /*
2461 * Eth protocol in the mac header (network byte order). e.g.
2462 * ETH_P_IP(0x0800) and ETH_P_IPV6(0x86DD)
2463 */
2464 __u32 eth_protocol;
2465 __u32 ip_protocol; /* IP protocol. e.g. IPPROTO_TCP, IPPROTO_UDP */
2466 __u32 bind_inany; /* Is sock bound to an INANY address? */
2467 __u32 hash; /* A hash of the packet 4 tuples */
2468};
2469
2379#define BPF_TAG_SIZE 8 2470#define BPF_TAG_SIZE 8
2380 2471
2381struct bpf_prog_info { 2472struct bpf_prog_info {
@@ -2557,6 +2648,9 @@ enum {
2557 * Arg1: old_state 2648 * Arg1: old_state
2558 * Arg2: new_state 2649 * Arg2: new_state
2559 */ 2650 */
2651 BPF_SOCK_OPS_TCP_LISTEN_CB, /* Called on listen(2), right after
2652 * socket transition to LISTEN state.
2653 */
2560}; 2654};
2561 2655
2562/* List of TCP states. There is a build check in net/ipv4/tcp.c to detect 2656/* List of TCP states. There is a build check in net/ipv4/tcp.c to detect