History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next

Pull networking updates from David Miller: 1) Allow setting bluetooth L2CAP modes via socket option, from Luiz Augusto von Dentz. 2) Add GSO partial support to igc, from Sasha Neftin. 3) Several cleanups and improvements to r8169 from Heiner Kallweit. 4) Add IF_OPER_TESTING link state and use it when ethtool triggers a device self-test. From Andrew Lunn. 5) Start moving away from custom driver versions, use the globally defined kernel version instead, from Leon Romanovsky. 6) Support GRO vis gro_cells in DSA layer, from Alexander Lobakin. 7) Allow hard IRQ deferral during NAPI, from Eric Dumazet. 8) Add sriov and vf support to hinic, from Luo bin. 9) Support Media Redundancy Protocol (MRP) in the bridging code, from Horatiu Vultur. 10) Support netmap in the nft_nat code, from Pablo Neira Ayuso. 11) Allow UDPv6 encapsulation of ESP in the ipsec code, from Sabrina Dubroca. Also add ipv6 support for espintcp. 12) Lots of ReST conversions of the networking documentation, from Mauro Carvalho Chehab. 13) Support configuration of ethtool rxnfc flows in bcmgenet driver, from Doug Berger. 14) Allow to dump cgroup id and filter by it in inet_diag code, from Dmitry Yakunin. 15) Add infrastructure to export netlink attribute policies to userspace, from Johannes Berg. 16) Several optimizations to sch_fq scheduler, from Eric Dumazet. 17) Fallback to the default qdisc if qdisc init fails because otherwise a packet scheduler init failure will make a device inoperative. From Jesper Dangaard Brouer. 18) Several RISCV bpf jit optimizations, from Luke Nelson. 19) Correct the return type of the ->ndo_start_xmit() method in several drivers, it's netdev_tx_t but many drivers were using 'int'. From Yunjian Wang. 20) Add an ethtool interface for PHY master/slave config, from Oleksij Rempel. 21) Add BPF iterators, from Yonghang Song. 22) Add cable test infrastructure, including ethool interfaces, from Andrew Lunn. Marvell PHY driver is the first to support this facility. 23) Remove zero-length arrays all over, from Gustavo A. R. Silva. 24) Calculate and maintain an explicit frame size in XDP, from Jesper Dangaard Brouer. 25) Add CAP_BPF, from Alexei Starovoitov. 26) Support terse dumps in the packet scheduler, from Vlad Buslov. 27) Support XDP_TX bulking in dpaa2 driver, from Ioana Ciornei. 28) Add devm_register_netdev(), from Bartosz Golaszewski. 29) Minimize qdisc resets, from Cong Wang. 30) Get rid of kernel_getsockopt and kernel_setsockopt in order to eliminate set_fs/get_fs calls. From Christoph Hellwig. * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (2517 commits) selftests: net: ip_defrag: ignore EPERM net_failover: fixed rollback in net_failover_open() Revert "tipc: Fix potential tipc_aead refcnt leak in tipc_crypto_rcv" Revert "tipc: Fix potential tipc_node refcnt leak in tipc_rcv" vmxnet3: allow rx flow hash ops only when rss is enabled hinic: add set_channels ethtool_ops support selftests/bpf: Add a default $(CXX) value tools/bpf: Don't use $(COMPILE.c) bpf, selftests: Use bpf_probe_read_kernel s390/bpf: Use bcr 0,%0 as tail call nop filler s390/bpf: Maintain 8-byte stack alignment selftests/bpf: Fix verifier test selftests/bpf: Fix sample_cnt shared between two threads bpf, selftests: Adapt cls_redirect to call csum_level helper bpf: Add csum_level helper for fixing up csum levels bpf: Fix up bpf_skb_adjust_room helper's skb csum setting sfc: add missing annotation for efx_ef10_try_update_nic_stats_vf() crypto/chtls: IPv6 support for inline TLS Crypto/chcr: Fixes a coccinile check error Crypto/chcr: Fixes compilations warnings ...

Linus Torvalds committed 6 years ago

Commit cb8e59c2 parents 2e63f6c 065fcfd2097 files · +151766 −46213Browse files

Showing the changes to tools/include/uapi (2 of 2097 files). Show all

Unified · Split

2 files
  1. tools/include/uapi/linux/bpf.h +344 −46
  2. tools/include/uapi/linux/if_link.h +1 −0
tools/include/uapi/linux/bpf.h+344−46
@@ -73,7 +73,7 @@ struct bpf_insn { · 72 unmodified lines
7373 /* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */
7474 struct bpf_lpm_trie_key {
7575 __u32 prefixlen; /* up to 32 for AF_INET, 128 for AF_INET6 */
76− __u8 data[]; /* Arbitrary size */
76+ __u8 data[0]; /* Arbitrary size */
7777 };
7878
7979 struct bpf_cgroup_storage_key {
@@ -113,6 +113,10 @@ enum bpf_cmd { · 33 unmodified lines
113113 BPF_MAP_DELETE_BATCH,
114114 BPF_LINK_CREATE,
115115 BPF_LINK_UPDATE,
116+ BPF_LINK_GET_FD_BY_ID,
117+ BPF_LINK_GET_NEXT_ID,
118+ BPF_ENABLE_STATS,
119+ BPF_ITER_CREATE,
116120 };
117121
118122 enum bpf_map_type {
@@ -143,6 +147,7 @@ enum bpf_map_type { · 24 unmodified lines
143147 BPF_MAP_TYPE_SK_STORAGE,
144148 BPF_MAP_TYPE_DEVMAP_HASH,
145149 BPF_MAP_TYPE_STRUCT_OPS,
150+ BPF_MAP_TYPE_RINGBUF,
146151 };
147152
148153 /* Note that tracing related programs such as
@@ -215,11 +220,28 @@ enum bpf_attach_type { · 66 unmodified lines
215220 BPF_TRACE_FEXIT,
216221 BPF_MODIFY_RETURN,
217222 BPF_LSM_MAC,
223+ BPF_TRACE_ITER,
224+ BPF_CGROUP_INET4_GETPEERNAME,
225+ BPF_CGROUP_INET6_GETPEERNAME,
226+ BPF_CGROUP_INET4_GETSOCKNAME,
227+ BPF_CGROUP_INET6_GETSOCKNAME,
228+ BPF_XDP_DEVMAP,
218229 __MAX_BPF_ATTACH_TYPE
219230 };
220231
221232 #define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE
222233
234+enum bpf_link_type {
235+ BPF_LINK_TYPE_UNSPEC = 0,
236+ BPF_LINK_TYPE_RAW_TRACEPOINT = 1,
237+ BPF_LINK_TYPE_TRACING = 2,
238+ BPF_LINK_TYPE_CGROUP = 3,
239+ BPF_LINK_TYPE_ITER = 4,
240+ BPF_LINK_TYPE_NETNS = 5,
241+
242+ MAX_BPF_LINK_TYPE,
243+};
244+
223245 /* cgroup-bpf attach flags used in BPF_PROG_ATTACH command
224246 *
225247 * NONE(default): No further bpf programs allowed in the subtree.
@@ -379,6 +401,12 @@ enum { · 153 unmodified lines
379401 */
380402 #define BPF_F_QUERY_EFFECTIVE (1U << 0)
381403
404+/* type for BPF_ENABLE_STATS */
405+enum bpf_stats_type {
406+ /* enabled run_time_ns and run_cnt */
407+ BPF_STATS_RUN_TIME = 0,
408+};
409+
382410 enum bpf_stack_build_id_status {
383411 /* user space need an empty entry to identify end of a trace */
384412 BPF_STACK_BUILD_ID_EMPTY = 0,
@@ -523,6 +551,7 @@ union bpf_attr { · 138 unmodified lines
523551 __u32 prog_id;
524552 __u32 map_id;
525553 __u32 btf_id;
554+ __u32 link_id;
526555 };
527556 __u32 next_id;
528557 __u32 open_flags;
@@ -589,6 +618,15 @@ union bpf_attr { · 60 unmodified lines
589618 __u32 old_prog_fd;
590619 } link_update;
591620
621+ struct { /* struct used by BPF_ENABLE_STATS command */
622+ __u32 type;
623+ } enable_stats;
624+
625+ struct { /* struct used by BPF_ITER_CREATE command */
626+ __u32 link_fd;
627+ __u32 flags;
628+ } iter_create;
629+
592630 } __attribute__((aligned(8)));
593631
594632 /* The description below is an attempt at providing documentation to eBPF
@@ -644,14 +682,16 @@ union bpf_attr { · 49 unmodified lines
644682 * For tracing programs, safely attempt to read *size* bytes from
645683 * kernel space address *unsafe_ptr* and store the data in *dst*.
646684 *
647− * Generally, use bpf_probe_read_user() or bpf_probe_read_kernel()
648− * instead.
685+ * Generally, use **bpf_probe_read_user**\ () or
686+ * **bpf_probe_read_kernel**\ () instead.
649687 * Return
650688 * 0 on success, or a negative error in case of failure.
651689 *
652690 * u64 bpf_ktime_get_ns(void)
653691 * Description
654692 * Return the time elapsed since system boot, in nanoseconds.
693+ * Does not include time the system was suspended.
694+ * See: **clock_gettime**\ (**CLOCK_MONOTONIC**)
655695 * Return
656696 * Current *ktime*.
657697 *
@@ -1510,11 +1550,11 @@ union bpf_attr { · 852 unmodified lines
15101550 * int bpf_probe_read_str(void *dst, u32 size, const void *unsafe_ptr)
15111551 * Description
15121552 * Copy a NUL terminated string from an unsafe kernel address
1513− * *unsafe_ptr* to *dst*. See bpf_probe_read_kernel_str() for
1553+ * *unsafe_ptr* to *dst*. See **bpf_probe_read_kernel_str**\ () for
15141554 * more details.
15151555 *
1516− * Generally, use bpf_probe_read_user_str() or bpf_probe_read_kernel_str()
1517− * instead.
1556+ * Generally, use **bpf_probe_read_user_str**\ () or
1557+ * **bpf_probe_read_kernel_str**\ () instead.
15181558 * Return
15191559 * On success, the strictly positive length of the string,
15201560 * including the trailing NUL character. On error, a negative
@@ -1542,7 +1582,7 @@ union bpf_attr { · 21 unmodified lines
15421582 *
15431583 * u64 bpf_get_socket_cookie(struct bpf_sock_ops *ctx)
15441584 * Description
1545− * Equivalent to bpf_get_socket_cookie() helper that accepts
1585+ * Equivalent to **bpf_get_socket_cookie**\ () helper that accepts
15461586 * *skb*, but gets socket from **struct bpf_sock_ops** context.
15471587 * Return
15481588 * A 8-byte long non-decreasing number.
@@ -1562,7 +1602,7 @@ union bpf_attr { · 13 unmodified lines
15621602 * Return
15631603 * 0
15641604 *
1565− * int bpf_setsockopt(struct bpf_sock_ops *bpf_socket, int level, int optname, void *optval, int optlen)
1605+ * int bpf_setsockopt(void *bpf_socket, int level, int optname, void *optval, int optlen)
15661606 * Description
15671607 * Emulate a call to **setsockopt()** on the socket associated to
15681608 * *bpf_socket*, which must be a full socket. The *level* at
@@ -1570,6 +1610,12 @@ union bpf_attr { · 1 unmodified line
15701610 * must be specified, see **setsockopt(2)** for more information.
15711611 * The option value of length *optlen* is pointed by *optval*.
15721612 *
1613+ * *bpf_socket* should be one of the following:
1614+ *
1615+ * * **struct bpf_sock_ops** for **BPF_PROG_TYPE_SOCK_OPS**.
1616+ * * **struct bpf_sock_addr** for **BPF_CGROUP_INET4_CONNECT**
1617+ * and **BPF_CGROUP_INET6_CONNECT**.
1618+ *
15731619 * This helper actually implements a subset of **setsockopt()**.
15741620 * It supports the following *level*\ s:
15751621 *
@@ -1589,6 +1635,13 @@ union bpf_attr { · 13 unmodified lines
15891635 * Grow or shrink the room for data in the packet associated to
15901636 * *skb* by *len_diff*, and according to the selected *mode*.
15911637 *
1638+ * By default, the helper will reset any offloaded checksum
1639+ * indicator of the skb to CHECKSUM_NONE. This can be avoided
1640+ * by the following flag:
1641+ *
1642+ * * **BPF_F_ADJ_ROOM_NO_CSUM_RESET**: Do not reset offloaded
1643+ * checksum data of the skb to CHECKSUM_NONE.
1644+ *
15921645 * There are two supported modes at this time:
15931646 *
15941647 * * **BPF_ADJ_ROOM_MAC**: Adjust room at the mac layer
@@ -1634,12 +1687,12 @@ union bpf_attr { · 39 unmodified lines
16341687 *
16351688 * The lower two bits of *flags* are used as the return code if
16361689 * the map lookup fails. This is so that the return value can be
1637− * one of the XDP program return codes up to XDP_TX, as chosen by
1638− * the caller. Any higher bits in the *flags* argument must be
1690+ * one of the XDP program return codes up to **XDP_TX**, as chosen
1691+ * by the caller. Any higher bits in the *flags* argument must be
16391692 * unset.
16401693 *
1641− * See also bpf_redirect(), which only supports redirecting to an
1642− * ifindex, but doesn't require a map to do so.
1694+ * See also **bpf_redirect**\ (), which only supports redirecting
1695+ * to an ifindex, but doesn't require a map to do so.
16431696 * Return
16441697 * **XDP_REDIRECT** on success, or the value of the two lower bits
16451698 * of the *flags* argument on error.
@@ -1747,7 +1800,7 @@ union bpf_attr { · 101 unmodified lines
17471800 * the time running for event since last normalization. The
17481801 * enabled and running times are accumulated since the perf event
17491802 * open. To achieve scaling factor between two invocations of an
1750− * eBPF program, users can can use CPU id as the key (which is
1803+ * eBPF program, users can use CPU id as the key (which is
17511804 * typical for perf array usage model) to remember the previous
17521805 * value and do the calculation inside the eBPF program.
17531806 * Return
@@ -1764,7 +1817,7 @@ union bpf_attr { · 10 unmodified lines
17641817 * Return
17651818 * 0 on success, or a negative error in case of failure.
17661819 *
1767− * int bpf_getsockopt(struct bpf_sock_ops *bpf_socket, int level, int optname, void *optval, int optlen)
1820+ * int bpf_getsockopt(void *bpf_socket, int level, int optname, void *optval, int optlen)
17681821 * Description
17691822 * Emulate a call to **getsockopt()** on the socket associated to
17701823 * *bpf_socket*, which must be a full socket. The *level* at
@@ -1773,6 +1826,12 @@ union bpf_attr { · 2 unmodified lines
17731826 * The retrieved value is stored in the structure pointed by
17741827 * *opval* and of length *optlen*.
17751828 *
1829+ * *bpf_socket* should be one of the following:
1830+ *
1831+ * * **struct bpf_sock_ops** for **BPF_PROG_TYPE_SOCK_OPS**.
1832+ * * **struct bpf_sock_addr** for **BPF_CGROUP_INET4_CONNECT**
1833+ * and **BPF_CGROUP_INET6_CONNECT**.
1834+ *
17761835 * This helper actually implements a subset of **getsockopt()**.
17771836 * It supports the following *level*\ s:
17781837 *
@@ -1790,7 +1849,7 @@ union bpf_attr { · 11 unmodified lines
17901849 * The first argument is the context *regs* on which the kprobe
17911850 * works.
17921851 *
1793− * This helper works by setting setting the PC (program counter)
1852+ * This helper works by setting the PC (program counter)
17941853 * to an override function which is run in place of the original
17951854 * probed function. This means the probed function is not run at
17961855 * all. The replacement function just returns with the required
@@ -1959,18 +2018,19 @@ union bpf_attr { · 162 unmodified lines
19592018 *
19602019 * This helper works for IPv4 and IPv6, TCP and UDP sockets. The
19612020 * domain (*addr*\ **->sa_family**) must be **AF_INET** (or
1962− * **AF_INET6**). Looking for a free port to bind to can be
1963− * expensive, therefore binding to port is not permitted by the
1964− * helper: *addr*\ **->sin_port** (or **sin6_port**, respectively)
1965− * must be set to zero.
2021+ * **AF_INET6**). It's advised to pass zero port (**sin_port**
2022+ * or **sin6_port**) which triggers IP_BIND_ADDRESS_NO_PORT-like
2023+ * behavior and lets the kernel efficiently pick up an unused
2024+ * port as long as 4-tuple is unique. Passing non-zero port might
2025+ * lead to degraded performance.
19662026 * Return
19672027 * 0 on success, or a negative error in case of failure.
19682028 *
19692029 * int bpf_xdp_adjust_tail(struct xdp_buff *xdp_md, int delta)
19702030 * Description
19712031 * Adjust (move) *xdp_md*\ **->data_end** by *delta* bytes. It is
1972− * only possible to shrink the packet as of this writing,
1973− * therefore *delta* must be a negative integer.
2032+ * possible to both shrink and grow the packet tail.
2033+ * Shrink done via *delta* being a negative integer.
19742034 *
19752035 * A call to this helper is susceptible to change the underlying
19762036 * packet buffer. Therefore, at load time, all checks on pointers
@@ -2256,7 +2316,7 @@ union bpf_attr { · 279 unmodified lines
22562316 * **bpf_rc_keydown**\ () again with the same values, or calling
22572317 * **bpf_rc_repeat**\ ().
22582318 *
2259− * Some protocols include a toggle bit, in case the button was
2319+ * Some protocols include a toggle bit, in case the button was
22602320 * released and pressed again between consecutive scancodes.
22612321 *
22622322 * The *ctx* should point to the lirc sample as passed into
@@ -2602,7 +2662,6 @@ union bpf_attr { · 339 unmodified lines
26022662 *
26032663 * *th* points to the start of the TCP header, while *th_len*
26042664 * contains **sizeof**\ (**struct tcphdr**).
2605− *
26062665 * Return
26072666 * 0 if *iph* and *th* are a valid SYN cookie ACK, or a negative
26082667 * error otherwise.
@@ -2785,7 +2844,6 @@ union bpf_attr { · 176 unmodified lines
27852844 *
27862845 * *th* points to the start of the TCP header, while *th_len*
27872846 * contains the length of the TCP header.
2788− *
27892847 * Return
27902848 * On success, lower 32 bits hold the generated SYN cookie in
27912849 * followed by 16 bits which hold the MSS value for that cookie,
@@ -2868,7 +2926,7 @@ union bpf_attr { · 76 unmodified lines
28682926 * // size, after checking its boundaries.
28692927 * }
28702928 *
2871− * In comparison, using **bpf_probe_read_user()** helper here
2929+ * In comparison, using **bpf_probe_read_user**\ () helper here
28722930 * instead to read the string would require to estimate the length
28732931 * at compile time, and would often result in copying more memory
28742932 * than necessary.
@@ -2886,14 +2944,14 @@ union bpf_attr { · 11 unmodified lines
28862944 * int bpf_probe_read_kernel_str(void *dst, u32 size, const void *unsafe_ptr)
28872945 * Description
28882946 * Copy a NUL terminated string from an unsafe kernel address *unsafe_ptr*
2889− * to *dst*. Same semantics as with bpf_probe_read_user_str() apply.
2947+ * to *dst*. Same semantics as with **bpf_probe_read_user_str**\ () apply.
28902948 * Return
2891− * On success, the strictly positive length of the string, including
2949+ * On success, the strictly positive length of the string, including
28922950 * the trailing NUL character. On error, a negative value.
28932951 *
28942952 * int bpf_tcp_send_ack(void *tp, u32 rcv_nxt)
28952953 * Description
2896− * Send out a tcp-ack. *tp* is the in-kernel struct tcp_sock.
2954+ * Send out a tcp-ack. *tp* is the in-kernel struct **tcp_sock**.
28972955 * *rcv_nxt* is the ack_seq to be sent out.
28982956 * Return
28992957 * 0 on success, or a negative error in case of failure.
@@ -2921,19 +2979,19 @@ union bpf_attr { · 21 unmodified lines
29212979 * int bpf_read_branch_records(struct bpf_perf_event_data *ctx, void *buf, u32 size, u64 flags)
29222980 * Description
29232981 * For an eBPF program attached to a perf event, retrieve the
2924− * branch records (struct perf_branch_entry) associated to *ctx*
2925− * and store it in the buffer pointed by *buf* up to size
2982+ * branch records (**struct perf_branch_entry**) associated to *ctx*
2983+ * and store it in the buffer pointed by *buf* up to size
29262984 * *size* bytes.
29272985 * Return
29282986 * On success, number of bytes written to *buf*. On error, a
29292987 * negative value.
29302988 *
29312989 * The *flags* can be set to **BPF_F_GET_BRANCH_RECORDS_SIZE** to
2932− * instead return the number of bytes required to store all the
2990+ * instead return the number of bytes required to store all the
29332991 * branch entries. If this flag is set, *buf* may be NULL.
29342992 *
29352993 * **-EINVAL** if arguments invalid or **size** not a multiple
2936− * of sizeof(struct perf_branch_entry).
2994+ * of **sizeof**\ (**struct perf_branch_entry**\ ).
29372995 *
29382996 * **-ENOENT** if architecture does not support branch records.
29392997 *
@@ -2941,8 +2999,8 @@ union bpf_attr { · 1 unmodified line
29412999 * Description
29423000 * Returns 0 on success, values for *pid* and *tgid* as seen from the current
29433001 * *namespace* will be returned in *nsdata*.
2944− *
2945− * On failure, the returned value is one of the following:
3002+ * Return
3003+ * 0 on success, or one of the following in case of failure:
29463004 *
29473005 * **-EINVAL** if dev and inum supplied don't match dev_t and inode number
29483006 * with nsfs of current task, or if dev conversion to dev_t lost high bits.
@@ -2981,8 +3039,8 @@ union bpf_attr { · 32 unmodified lines
29813039 * a global identifier that can be assumed unique. If *ctx* is
29823040 * NULL, then the helper returns the cookie for the initial
29833041 * network namespace. The cookie itself is very similar to that
2984− * of bpf_get_socket_cookie() helper, but for network namespaces
2985− * instead of sockets.
3042+ * of **bpf_get_socket_cookie**\ () helper, but for network
3043+ * namespaces instead of sockets.
29863044 * Return
29873045 * A 8-byte long opaque number.
29883046 *
@@ -3017,14 +3075,183 @@ union bpf_attr { · 28 unmodified lines
30173075 *
30183076 * The *flags* argument must be zero.
30193077 * Return
3020− * 0 on success, or a negative errno in case of failure.
3021− *
3022− * * **-EINVAL** Unsupported flags specified.
3023− * * **-ENOENT** Socket is unavailable for assignment.
3024− * * **-ENETUNREACH** Socket is unreachable (wrong netns).
3025− * * **-EOPNOTSUPP** Unsupported operation, for example a
3026− * call from outside of TC ingress.
3027− * * **-ESOCKTNOSUPPORT** Socket type not supported (reuseport).
3078+ * 0 on success, or a negative error in case of failure:
3079+ *
3080+ * **-EINVAL** if specified *flags* are not supported.
3081+ *
3082+ * **-ENOENT** if the socket is unavailable for assignment.
3083+ *
3084+ * **-ENETUNREACH** if the socket is unreachable (wrong netns).
3085+ *
3086+ * **-EOPNOTSUPP** if the operation is not supported, for example
3087+ * a call from outside of TC ingress.
3088+ *
3089+ * **-ESOCKTNOSUPPORT** if the socket type is not supported
3090+ * (reuseport).
3091+ *
3092+ * u64 bpf_ktime_get_boot_ns(void)
3093+ * Description
3094+ * Return the time elapsed since system boot, in nanoseconds.
3095+ * Does include the time the system was suspended.
3096+ * See: **clock_gettime**\ (**CLOCK_BOOTTIME**)
3097+ * Return
3098+ * Current *ktime*.
3099+ *
3100+ * int bpf_seq_printf(struct seq_file *m, const char *fmt, u32 fmt_size, const void *data, u32 data_len)
3101+ * Description
3102+ * **bpf_seq_printf**\ () uses seq_file **seq_printf**\ () to print
3103+ * out the format string.
3104+ * The *m* represents the seq_file. The *fmt* and *fmt_size* are for
3105+ * the format string itself. The *data* and *data_len* are format string
3106+ * arguments. The *data* are a **u64** array and corresponding format string
3107+ * values are stored in the array. For strings and pointers where pointees
3108+ * are accessed, only the pointer values are stored in the *data* array.
3109+ * The *data_len* is the size of *data* in bytes.
3110+ *
3111+ * Formats **%s**, **%p{i,I}{4,6}** requires to read kernel memory.
3112+ * Reading kernel memory may fail due to either invalid address or
3113+ * valid address but requiring a major memory fault. If reading kernel memory
3114+ * fails, the string for **%s** will be an empty string, and the ip
3115+ * address for **%p{i,I}{4,6}** will be 0. Not returning error to
3116+ * bpf program is consistent with what **bpf_trace_printk**\ () does for now.
3117+ * Return
3118+ * 0 on success, or a negative error in case of failure:
3119+ *
3120+ * **-EBUSY** if per-CPU memory copy buffer is busy, can try again
3121+ * by returning 1 from bpf program.
3122+ *
3123+ * **-EINVAL** if arguments are invalid, or if *fmt* is invalid/unsupported.
3124+ *
3125+ * **-E2BIG** if *fmt* contains too many format specifiers.
3126+ *
3127+ * **-EOVERFLOW** if an overflow happened: The same object will be tried again.
3128+ *
3129+ * int bpf_seq_write(struct seq_file *m, const void *data, u32 len)
3130+ * Description
3131+ * **bpf_seq_write**\ () uses seq_file **seq_write**\ () to write the data.
3132+ * The *m* represents the seq_file. The *data* and *len* represent the
3133+ * data to write in bytes.
3134+ * Return
3135+ * 0 on success, or a negative error in case of failure:
3136+ *
3137+ * **-EOVERFLOW** if an overflow happened: The same object will be tried again.
3138+ *
3139+ * u64 bpf_sk_cgroup_id(struct bpf_sock *sk)
3140+ * Description
3141+ * Return the cgroup v2 id of the socket *sk*.
3142+ *
3143+ * *sk* must be a non-**NULL** pointer to a full socket, e.g. one
3144+ * returned from **bpf_sk_lookup_xxx**\ (),
3145+ * **bpf_sk_fullsock**\ (), etc. The format of returned id is
3146+ * same as in **bpf_skb_cgroup_id**\ ().
3147+ *
3148+ * This helper is available only if the kernel was compiled with
3149+ * the **CONFIG_SOCK_CGROUP_DATA** configuration option.
3150+ * Return
3151+ * The id is returned or 0 in case the id could not be retrieved.
3152+ *
3153+ * u64 bpf_sk_ancestor_cgroup_id(struct bpf_sock *sk, int ancestor_level)
3154+ * Description
3155+ * Return id of cgroup v2 that is ancestor of cgroup associated
3156+ * with the *sk* at the *ancestor_level*. The root cgroup is at
3157+ * *ancestor_level* zero and each step down the hierarchy
3158+ * increments the level. If *ancestor_level* == level of cgroup
3159+ * associated with *sk*, then return value will be same as that
3160+ * of **bpf_sk_cgroup_id**\ ().
3161+ *
3162+ * The helper is useful to implement policies based on cgroups
3163+ * that are upper in hierarchy than immediate cgroup associated
3164+ * with *sk*.
3165+ *
3166+ * The format of returned id and helper limitations are same as in
3167+ * **bpf_sk_cgroup_id**\ ().
3168+ * Return
3169+ * The id is returned or 0 in case the id could not be retrieved.
3170+ *
3171+ * void *bpf_ringbuf_output(void *ringbuf, void *data, u64 size, u64 flags)
3172+ * Description
3173+ * Copy *size* bytes from *data* into a ring buffer *ringbuf*.
3174+ * If BPF_RB_NO_WAKEUP is specified in *flags*, no notification of
3175+ * new data availability is sent.
3176+ * IF BPF_RB_FORCE_WAKEUP is specified in *flags*, notification of
3177+ * new data availability is sent unconditionally.
3178+ * Return
3179+ * 0, on success;
3180+ * < 0, on error.
3181+ *
3182+ * void *bpf_ringbuf_reserve(void *ringbuf, u64 size, u64 flags)
3183+ * Description
3184+ * Reserve *size* bytes of payload in a ring buffer *ringbuf*.
3185+ * Return
3186+ * Valid pointer with *size* bytes of memory available; NULL,
3187+ * otherwise.
3188+ *
3189+ * void bpf_ringbuf_submit(void *data, u64 flags)
3190+ * Description
3191+ * Submit reserved ring buffer sample, pointed to by *data*.
3192+ * If BPF_RB_NO_WAKEUP is specified in *flags*, no notification of
3193+ * new data availability is sent.
3194+ * IF BPF_RB_FORCE_WAKEUP is specified in *flags*, notification of
3195+ * new data availability is sent unconditionally.
3196+ * Return
3197+ * Nothing. Always succeeds.
3198+ *
3199+ * void bpf_ringbuf_discard(void *data, u64 flags)
3200+ * Description
3201+ * Discard reserved ring buffer sample, pointed to by *data*.
3202+ * If BPF_RB_NO_WAKEUP is specified in *flags*, no notification of
3203+ * new data availability is sent.
3204+ * IF BPF_RB_FORCE_WAKEUP is specified in *flags*, notification of
3205+ * new data availability is sent unconditionally.
3206+ * Return
3207+ * Nothing. Always succeeds.
3208+ *
3209+ * u64 bpf_ringbuf_query(void *ringbuf, u64 flags)
3210+ * Description
3211+ * Query various characteristics of provided ring buffer. What
3212+ * exactly is queries is determined by *flags*:
3213+ * - BPF_RB_AVAIL_DATA - amount of data not yet consumed;
3214+ * - BPF_RB_RING_SIZE - the size of ring buffer;
3215+ * - BPF_RB_CONS_POS - consumer position (can wrap around);
3216+ * - BPF_RB_PROD_POS - producer(s) position (can wrap around);
3217+ * Data returned is just a momentary snapshots of actual values
3218+ * and could be inaccurate, so this facility should be used to
3219+ * power heuristics and for reporting, not to make 100% correct
3220+ * calculation.
3221+ * Return
3222+ * Requested value, or 0, if flags are not recognized.
3223+ *
3224+ * int bpf_csum_level(struct sk_buff *skb, u64 level)
3225+ * Description
3226+ * Change the skbs checksum level by one layer up or down, or
3227+ * reset it entirely to none in order to have the stack perform
3228+ * checksum validation. The level is applicable to the following
3229+ * protocols: TCP, UDP, GRE, SCTP, FCOE. For example, a decap of
3230+ * | ETH | IP | UDP | GUE | IP | TCP | into | ETH | IP | TCP |
3231+ * through **bpf_skb_adjust_room**\ () helper with passing in
3232+ * **BPF_F_ADJ_ROOM_NO_CSUM_RESET** flag would require one call
3233+ * to **bpf_csum_level**\ () with **BPF_CSUM_LEVEL_DEC** since
3234+ * the UDP header is removed. Similarly, an encap of the latter
3235+ * into the former could be accompanied by a helper call to
3236+ * **bpf_csum_level**\ () with **BPF_CSUM_LEVEL_INC** if the
3237+ * skb is still intended to be processed in higher layers of the
3238+ * stack instead of just egressing at tc.
3239+ *
3240+ * There are three supported level settings at this time:
3241+ *
3242+ * * **BPF_CSUM_LEVEL_INC**: Increases skb->csum_level for skbs
3243+ * with CHECKSUM_UNNECESSARY.
3244+ * * **BPF_CSUM_LEVEL_DEC**: Decreases skb->csum_level for skbs
3245+ * with CHECKSUM_UNNECESSARY.
3246+ * * **BPF_CSUM_LEVEL_RESET**: Resets skb->csum_level to 0 and
3247+ * sets CHECKSUM_NONE to force checksum validation by the stack.
3248+ * * **BPF_CSUM_LEVEL_QUERY**: No-op, returns the current
3249+ * skb->csum_level.
3250+ * Return
3251+ * 0 on success, or a negative error in case of failure. In the
3252+ * case of **BPF_CSUM_LEVEL_QUERY**, the current skb->csum_level
3253+ * is returned or the error code -EACCES in case the skb is not
3254+ * subject to CHECKSUM_UNNECESSARY.
30283255 */
30293256 #define __BPF_FUNC_MAPPER(FN) \
30303257 FN(unspec), \
@@ -3151,7 +3378,18 @@ union bpf_attr { · 120 unmodified lines
31513378 FN(xdp_output), \
31523379 FN(get_netns_cookie), \
31533380 FN(get_current_ancestor_cgroup_id), \
3154− FN(sk_assign),
3381+ FN(sk_assign), \
3382+ FN(ktime_get_boot_ns), \
3383+ FN(seq_printf), \
3384+ FN(seq_write), \
3385+ FN(sk_cgroup_id), \
3386+ FN(sk_ancestor_cgroup_id), \
3387+ FN(ringbuf_output), \
3388+ FN(ringbuf_reserve), \
3389+ FN(ringbuf_submit), \
3390+ FN(ringbuf_discard), \
3391+ FN(ringbuf_query), \
3392+ FN(csum_level),
31553393
31563394 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
31573395 * function eBPF program intends to call
@@ -3228,6 +3466,14 @@ enum { · 70 unmodified lines
32283466 BPF_F_CURRENT_NETNS = (-1L),
32293467 };
32303468
3469+/* BPF_FUNC_csum_level level values. */
3470+enum {
3471+ BPF_CSUM_LEVEL_QUERY,
3472+ BPF_CSUM_LEVEL_INC,
3473+ BPF_CSUM_LEVEL_DEC,
3474+ BPF_CSUM_LEVEL_RESET,
3475+};
3476+
32313477 /* BPF_FUNC_skb_adjust_room flags. */
32323478 enum {
32333479 BPF_F_ADJ_ROOM_FIXED_GSO = (1ULL << 0),
@@ -3235,6 +3481,7 @@ enum { · 1 unmodified line
32353481 BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = (1ULL << 2),
32363482 BPF_F_ADJ_ROOM_ENCAP_L4_GRE = (1ULL << 3),
32373483 BPF_F_ADJ_ROOM_ENCAP_L4_UDP = (1ULL << 4),
3484+ BPF_F_ADJ_ROOM_NO_CSUM_RESET = (1ULL << 5),
32383485 };
32393486
32403487 enum {
@@ -3261,6 +3508,29 @@ enum { · 20 unmodified lines
32613508 BPF_F_GET_BRANCH_RECORDS_SIZE = (1ULL << 0),
32623509 };
32633510
3511+/* BPF_FUNC_bpf_ringbuf_commit, BPF_FUNC_bpf_ringbuf_discard, and
3512+ * BPF_FUNC_bpf_ringbuf_output flags.
3513+ */
3514+enum {
3515+ BPF_RB_NO_WAKEUP = (1ULL << 0),
3516+ BPF_RB_FORCE_WAKEUP = (1ULL << 1),
3517+};
3518+
3519+/* BPF_FUNC_bpf_ringbuf_query flags */
3520+enum {
3521+ BPF_RB_AVAIL_DATA = 0,
3522+ BPF_RB_RING_SIZE = 1,
3523+ BPF_RB_CONS_POS = 2,
3524+ BPF_RB_PROD_POS = 3,
3525+};
3526+
3527+/* BPF ring buffer constants */
3528+enum {
3529+ BPF_RINGBUF_BUSY_BIT = (1U << 31),
3530+ BPF_RINGBUF_DISCARD_BIT = (1U << 30),
3531+ BPF_RINGBUF_HDR_SZ = 8,
3532+};
3533+
32643534 /* Mode for BPF_FUNC_skb_adjust_room helper. */
32653535 enum bpf_adj_room_mode {
32663536 BPF_ADJ_ROOM_NET,
@@ -3393,6 +3663,7 @@ struct bpf_sock { · 126 unmodified lines
33933663 __u32 dst_ip4;
33943664 __u32 dst_ip6[4];
33953665 __u32 state;
3666+ __s32 rx_queue_mapping;
33963667 };
33973668
33983669 struct bpf_tcp_sock {
@@ -3486,6 +3757,8 @@ struct xdp_md { · 87 unmodified lines
34863757 /* Below access go through struct xdp_rxq_info */
34873758 __u32 ingress_ifindex; /* rxq->dev->ifindex */
34883759 __u32 rx_queue_index; /* rxq->queue_index */
3760+
3761+ __u32 egress_ifindex; /* txq->dev->ifindex */
34893762 };
34903763
34913764 enum sk_action {
@@ -3508,6 +3781,8 @@ struct sk_msg_md { · 16 unmodified lines
35083781 __u32 remote_port; /* Stored in network byte order */
35093782 __u32 local_port; /* stored in host byte order */
35103783 __u32 size; /* Total size of sk_msg */
3784+
3785+ __bpf_md_ptr(struct bpf_sock *, sk); /* current socket */
35113786 };
35123787
35133788 struct sk_reuseport_md {
@@ -3598,6 +3873,29 @@ struct bpf_btf_info { · 84 unmodified lines
35983873 __u32 id;
35993874 } __attribute__((aligned(8)));
36003875
3876+struct bpf_link_info {
3877+ __u32 type;
3878+ __u32 id;
3879+ __u32 prog_id;
3880+ union {
3881+ struct {
3882+ __aligned_u64 tp_name; /* in/out: tp_name buffer ptr */
3883+ __u32 tp_name_len; /* in/out: tp_name buffer len */
3884+ } raw_tracepoint;
3885+ struct {
3886+ __u32 attach_type;
3887+ } tracing;
3888+ struct {
3889+ __u64 cgroup_id;
3890+ __u32 attach_type;
3891+ } cgroup;
3892+ struct {
3893+ __u32 netns_ino;
3894+ __u32 attach_type;
3895+ } netns;
3896+ };
3897+} __attribute__((aligned(8)));
3898+
36013899 /* User bpf_sock_addr struct to access socket fields and sockaddr struct passed
36023900 * by user and intended to be used by socket (e.g. to bind to, depends on
36033901 * attach attach type).
@@ -3610,7 +3908,7 @@ struct bpf_sock_addr { · 6 unmodified lines
36103908 __u32 user_ip6[4]; /* Allows 1,2,4,8-byte read and 4,8-byte write.
36113909 * Stored in network byte order.
36123910 */
3613− __u32 user_port; /* Allows 4-byte read and write.
3911+ __u32 user_port; /* Allows 1,2,4-byte read and 4-byte write.
36143912 * Stored in network byte order
36153913 */
36163914 __u32 family; /* Allows 4-byte read, but no write */
tools/include/uapi/linux/if_link.h+1−0
@@ -343,6 +343,7 @@ enum { · 342 unmodified lines
343343 IFLA_BRPORT_NEIGH_SUPPRESS,
344344 IFLA_BRPORT_ISOLATED,
345345 IFLA_BRPORT_BACKUP_PORT,
346+ IFLA_BRPORT_MRP_RING_OPEN,
346347 __IFLA_BRPORT_MAX
347348 };
348349 #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)