]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/linux: update kernel headers to 5.19-rc1 23708/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 10 Jun 2022 21:42:24 +0000 (06:42 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 10 Jun 2022 21:50:12 +0000 (06:50 +0900)
src/shared/linux/bpf.h
src/shared/linux/dm-ioctl.h
src/shared/linux/ethtool.h

index ba5af15e25f5c108388429a8e86b2bae12f1f237..f4009dbdf62daf493beb22e4cbf5befc85a85137 100644 (file)
@@ -330,6 +330,8 @@ union bpf_iter_link_info {
  *                     *ctx_out*, *data_in* and *data_out* must be NULL.
  *                     *repeat* must be zero.
  *
+ *             BPF_PROG_RUN is an alias for BPF_PROG_TEST_RUN.
+ *
  *     Return
  *             Returns zero on success. On error, -1 is returned and *errno*
  *             is set appropriately.
@@ -995,6 +997,7 @@ enum bpf_attach_type {
        BPF_SK_REUSEPORT_SELECT,
        BPF_SK_REUSEPORT_SELECT_OR_MIGRATE,
        BPF_PERF_EVENT,
+       BPF_TRACE_KPROBE_MULTI,
        __MAX_BPF_ATTACH_TYPE
 };
 
@@ -1009,6 +1012,8 @@ enum bpf_link_type {
        BPF_LINK_TYPE_NETNS = 5,
        BPF_LINK_TYPE_XDP = 6,
        BPF_LINK_TYPE_PERF_EVENT = 7,
+       BPF_LINK_TYPE_KPROBE_MULTI = 8,
+       BPF_LINK_TYPE_STRUCT_OPS = 9,
 
        MAX_BPF_LINK_TYPE,
 };
@@ -1111,6 +1116,16 @@ enum bpf_link_type {
  */
 #define BPF_F_SLEEPABLE                (1U << 4)
 
+/* If BPF_F_XDP_HAS_FRAGS is used in BPF_PROG_LOAD command, the loaded program
+ * fully support xdp frags.
+ */
+#define BPF_F_XDP_HAS_FRAGS    (1U << 5)
+
+/* link_create.kprobe_multi.flags used in LINK_CREATE command for
+ * BPF_TRACE_KPROBE_MULTI attach type to create return probe.
+ */
+#define BPF_F_KPROBE_MULTI_RETURN      (1U << 0)
+
 /* When BPF ldimm64's insn[0].src_reg != 0 then this can have
  * the following extensions:
  *
@@ -1225,6 +1240,8 @@ enum {
 
 /* If set, run the test on the cpu specified by bpf_attr.test.cpu */
 #define BPF_F_TEST_RUN_ON_CPU  (1U << 0)
+/* If set, XDP frames will be transmitted after processing */
+#define BPF_F_TEST_XDP_LIVE_FRAMES     (1U << 1)
 
 /* type for BPF_ENABLE_STATS */
 enum bpf_stats_type {
@@ -1342,8 +1359,10 @@ union bpf_attr {
                        /* or valid module BTF object fd or 0 to attach to vmlinux */
                        __u32           attach_btf_obj_fd;
                };
-               __u32           :32;            /* pad */
+               __u32           core_relo_cnt;  /* number of bpf_core_relo */
                __aligned_u64   fd_array;       /* array of FDs */
+               __aligned_u64   core_relos;
+               __u32           core_relo_rec_size; /* sizeof(struct bpf_core_relo) */
        };
 
        struct { /* anonymous struct used by BPF_OBJ_* commands */
@@ -1384,6 +1403,7 @@ union bpf_attr {
                __aligned_u64   ctx_out;
                __u32           flags;
                __u32           cpu;
+               __u32           batch_size;
        } test;
 
        struct { /* anonymous struct used by BPF_*_GET_*_ID */
@@ -1463,6 +1483,22 @@ union bpf_attr {
                                 */
                                __u64           bpf_cookie;
                        } perf_event;
+                       struct {
+                               __u32           flags;
+                               __u32           cnt;
+                               __aligned_u64   syms;
+                               __aligned_u64   addrs;
+                               __aligned_u64   cookies;
+                       } kprobe_multi;
+                       struct {
+                               /* this is overlaid with the target_btf_id above. */
+                               __u32           target_btf_id;
+                               /* black box user-provided value passed through
+                                * to BPF program at the execution time and
+                                * accessible through bpf_get_attach_cookie() BPF helper
+                                */
+                               __u64           cookie;
+                       } tracing;
                };
        } link_create;
 
@@ -1744,7 +1780,7 @@ union bpf_attr {
  *             if the maximum number of tail calls has been reached for this
  *             chain of programs. This limit is defined in the kernel by the
  *             macro **MAX_TAIL_CALL_CNT** (not accessible to user space),
- *             which is currently set to 32.
+ *             which is currently set to 33.
  *     Return
  *             0 on success, or a negative error in case of failure.
  *
@@ -1773,6 +1809,8 @@ union bpf_attr {
  *             0 on success, or a negative error in case of failure.
  *
  * u64 bpf_get_current_pid_tgid(void)
+ *     Description
+ *             Get the current pid and tgid.
  *     Return
  *             A 64-bit integer containing the current tgid and pid, and
  *             created as such:
@@ -1780,6 +1818,8 @@ union bpf_attr {
  *             *current_task*\ **->pid**.
  *
  * u64 bpf_get_current_uid_gid(void)
+ *     Description
+ *             Get the current uid and gid.
  *     Return
  *             A 64-bit integer containing the current GID and UID, and
  *             created as such: *current_gid* **<< 32 \|** *current_uid*.
@@ -2254,6 +2294,8 @@ union bpf_attr {
  *             The 32-bit hash.
  *
  * u64 bpf_get_current_task(void)
+ *     Description
+ *             Get the current task.
  *     Return
  *             A pointer to the current task struct.
  *
@@ -2284,8 +2326,8 @@ union bpf_attr {
  *     Return
  *             The return value depends on the result of the test, and can be:
  *
- *             * 0, if current task belongs to the cgroup2.
- *             * 1, if current task does not belong to the cgroup2.
+ *             * 1, if current task belongs to the cgroup2.
+ *             * 0, if current task does not belong to the cgroup2.
  *             * A negative error code, if an error occurred.
  *
  * long bpf_skb_change_tail(struct sk_buff *skb, u32 len, u64 flags)
@@ -2367,6 +2409,8 @@ union bpf_attr {
  *             indicate that the hash is outdated and to trigger a
  *             recalculation the next time the kernel tries to access this
  *             hash or when the **bpf_get_hash_recalc**\ () helper is called.
+ *     Return
+ *             void.
  *
  * long bpf_get_numa_node_id(void)
  *     Description
@@ -2464,6 +2508,8 @@ union bpf_attr {
  *             A 8-byte long unique number or 0 if *sk* is NULL.
  *
  * u32 bpf_get_socket_uid(struct sk_buff *skb)
+ *     Description
+ *             Get the owner UID of the socked associated to *skb*.
  *     Return
  *             The owner UID of the socket associated to *skb*. If the socket
  *             is **NULL**, or if it is not a full socket (i.e. if it is a
@@ -2973,8 +3019,8 @@ union bpf_attr {
  *
  *                     # sysctl kernel.perf_event_max_stack=<new value>
  *     Return
- *             A non-negative value equal to or less than *size* on success,
- *             or a negative error in case of failure.
+ *             The non-negative copied *buf* length equal to or less than
+ *             *size* on success, or a negative error in case of failure.
  *
  * long bpf_skb_load_bytes_relative(const void *skb, u32 offset, void *to, u32 len, u32 start_header)
  *     Description
@@ -3238,6 +3284,9 @@ union bpf_attr {
  *             The id is returned or 0 in case the id could not be retrieved.
  *
  * u64 bpf_get_current_cgroup_id(void)
+ *     Description
+ *             Get the current cgroup id based on the cgroup within which
+ *             the current task is running.
  *     Return
  *             A 64-bit integer containing the current cgroup id based
  *             on the cgroup within which the current task is running.
@@ -4277,8 +4326,8 @@ union bpf_attr {
  *
  *                     # sysctl kernel.perf_event_max_stack=<new value>
  *     Return
- *             A non-negative value equal to or less than *size* on success,
- *             or a negative error in case of failure.
+ *             The non-negative copied *buf* length equal to or less than
+ *             *size* on success, or a negative error in case of failure.
  *
  * long bpf_load_hdr_opt(struct bpf_sock_ops *skops, void *searchby_res, u32 len, u64 flags)
  *     Description
@@ -4938,6 +4987,268 @@ union bpf_attr {
  *             **-ENOENT** if symbol is not found.
  *
  *             **-EPERM** if caller does not have permission to obtain kernel address.
+ *
+ * long bpf_find_vma(struct task_struct *task, u64 addr, void *callback_fn, void *callback_ctx, u64 flags)
+ *     Description
+ *             Find vma of *task* that contains *addr*, call *callback_fn*
+ *             function with *task*, *vma*, and *callback_ctx*.
+ *             The *callback_fn* should be a static function and
+ *             the *callback_ctx* should be a pointer to the stack.
+ *             The *flags* is used to control certain aspects of the helper.
+ *             Currently, the *flags* must be 0.
+ *
+ *             The expected callback signature is
+ *
+ *             long (\*callback_fn)(struct task_struct \*task, struct vm_area_struct \*vma, void \*callback_ctx);
+ *
+ *     Return
+ *             0 on success.
+ *             **-ENOENT** if *task->mm* is NULL, or no vma contains *addr*.
+ *             **-EBUSY** if failed to try lock mmap_lock.
+ *             **-EINVAL** for invalid **flags**.
+ *
+ * long bpf_loop(u32 nr_loops, void *callback_fn, void *callback_ctx, u64 flags)
+ *     Description
+ *             For **nr_loops**, call **callback_fn** function
+ *             with **callback_ctx** as the context parameter.
+ *             The **callback_fn** should be a static function and
+ *             the **callback_ctx** should be a pointer to the stack.
+ *             The **flags** is used to control certain aspects of the helper.
+ *             Currently, the **flags** must be 0. Currently, nr_loops is
+ *             limited to 1 << 23 (~8 million) loops.
+ *
+ *             long (\*callback_fn)(u32 index, void \*ctx);
+ *
+ *             where **index** is the current index in the loop. The index
+ *             is zero-indexed.
+ *
+ *             If **callback_fn** returns 0, the helper will continue to the next
+ *             loop. If return value is 1, the helper will skip the rest of
+ *             the loops and return. Other return values are not used now,
+ *             and will be rejected by the verifier.
+ *
+ *     Return
+ *             The number of loops performed, **-EINVAL** for invalid **flags**,
+ *             **-E2BIG** if **nr_loops** exceeds the maximum number of loops.
+ *
+ * long bpf_strncmp(const char *s1, u32 s1_sz, const char *s2)
+ *     Description
+ *             Do strncmp() between **s1** and **s2**. **s1** doesn't need
+ *             to be null-terminated and **s1_sz** is the maximum storage
+ *             size of **s1**. **s2** must be a read-only string.
+ *     Return
+ *             An integer less than, equal to, or greater than zero
+ *             if the first **s1_sz** bytes of **s1** is found to be
+ *             less than, to match, or be greater than **s2**.
+ *
+ * long bpf_get_func_arg(void *ctx, u32 n, u64 *value)
+ *     Description
+ *             Get **n**-th argument (zero based) of the traced function (for tracing programs)
+ *             returned in **value**.
+ *
+ *     Return
+ *             0 on success.
+ *             **-EINVAL** if n >= arguments count of traced function.
+ *
+ * long bpf_get_func_ret(void *ctx, u64 *value)
+ *     Description
+ *             Get return value of the traced function (for tracing programs)
+ *             in **value**.
+ *
+ *     Return
+ *             0 on success.
+ *             **-EOPNOTSUPP** for tracing programs other than BPF_TRACE_FEXIT or BPF_MODIFY_RETURN.
+ *
+ * long bpf_get_func_arg_cnt(void *ctx)
+ *     Description
+ *             Get number of arguments of the traced function (for tracing programs).
+ *
+ *     Return
+ *             The number of arguments of the traced function.
+ *
+ * int bpf_get_retval(void)
+ *     Description
+ *             Get the syscall's return value that will be returned to userspace.
+ *
+ *             This helper is currently supported by cgroup programs only.
+ *     Return
+ *             The syscall's return value.
+ *
+ * int bpf_set_retval(int retval)
+ *     Description
+ *             Set the syscall's return value that will be returned to userspace.
+ *
+ *             This helper is currently supported by cgroup programs only.
+ *     Return
+ *             0 on success, or a negative error in case of failure.
+ *
+ * u64 bpf_xdp_get_buff_len(struct xdp_buff *xdp_md)
+ *     Description
+ *             Get the total size of a given xdp buff (linear and paged area)
+ *     Return
+ *             The total size of a given xdp buffer.
+ *
+ * long bpf_xdp_load_bytes(struct xdp_buff *xdp_md, u32 offset, void *buf, u32 len)
+ *     Description
+ *             This helper is provided as an easy way to load data from a
+ *             xdp buffer. It can be used to load *len* bytes from *offset* from
+ *             the frame associated to *xdp_md*, into the buffer pointed by
+ *             *buf*.
+ *     Return
+ *             0 on success, or a negative error in case of failure.
+ *
+ * long bpf_xdp_store_bytes(struct xdp_buff *xdp_md, u32 offset, void *buf, u32 len)
+ *     Description
+ *             Store *len* bytes from buffer *buf* into the frame
+ *             associated to *xdp_md*, at *offset*.
+ *     Return
+ *             0 on success, or a negative error in case of failure.
+ *
+ * long bpf_copy_from_user_task(void *dst, u32 size, const void *user_ptr, struct task_struct *tsk, u64 flags)
+ *     Description
+ *             Read *size* bytes from user space address *user_ptr* in *tsk*'s
+ *             address space, and stores the data in *dst*. *flags* is not
+ *             used yet and is provided for future extensibility. This helper
+ *             can only be used by sleepable programs.
+ *     Return
+ *             0 on success, or a negative error in case of failure. On error
+ *             *dst* buffer is zeroed out.
+ *
+ * long bpf_skb_set_tstamp(struct sk_buff *skb, u64 tstamp, u32 tstamp_type)
+ *     Description
+ *             Change the __sk_buff->tstamp_type to *tstamp_type*
+ *             and set *tstamp* to the __sk_buff->tstamp together.
+ *
+ *             If there is no need to change the __sk_buff->tstamp_type,
+ *             the tstamp value can be directly written to __sk_buff->tstamp
+ *             instead.
+ *
+ *             BPF_SKB_TSTAMP_DELIVERY_MONO is the only tstamp that
+ *             will be kept during bpf_redirect_*().  A non zero
+ *             *tstamp* must be used with the BPF_SKB_TSTAMP_DELIVERY_MONO
+ *             *tstamp_type*.
+ *
+ *             A BPF_SKB_TSTAMP_UNSPEC *tstamp_type* can only be used
+ *             with a zero *tstamp*.
+ *
+ *             Only IPv4 and IPv6 skb->protocol are supported.
+ *
+ *             This function is most useful when it needs to set a
+ *             mono delivery time to __sk_buff->tstamp and then
+ *             bpf_redirect_*() to the egress of an iface.  For example,
+ *             changing the (rcv) timestamp in __sk_buff->tstamp at
+ *             ingress to a mono delivery time and then bpf_redirect_*()
+ *             to sch_fq@phy-dev.
+ *     Return
+ *             0 on success.
+ *             **-EINVAL** for invalid input
+ *             **-EOPNOTSUPP** for unsupported protocol
+ *
+ * long bpf_ima_file_hash(struct file *file, void *dst, u32 size)
+ *     Description
+ *             Returns a calculated IMA hash of the *file*.
+ *             If the hash is larger than *size*, then only *size*
+ *             bytes will be copied to *dst*
+ *     Return
+ *             The **hash_algo** is returned on success,
+ *             **-EOPNOTSUP** if the hash calculation failed or **-EINVAL** if
+ *             invalid arguments are passed.
+ *
+ * void *bpf_kptr_xchg(void *map_value, void *ptr)
+ *     Description
+ *             Exchange kptr at pointer *map_value* with *ptr*, and return the
+ *             old value. *ptr* can be NULL, otherwise it must be a referenced
+ *             pointer which will be released when this helper is called.
+ *     Return
+ *             The old value of kptr (which can be NULL). The returned pointer
+ *             if not NULL, is a reference which must be released using its
+ *             corresponding release function, or moved into a BPF map before
+ *             program exit.
+ *
+ * void *bpf_map_lookup_percpu_elem(struct bpf_map *map, const void *key, u32 cpu)
+ *     Description
+ *             Perform a lookup in *percpu map* for an entry associated to
+ *             *key* on *cpu*.
+ *     Return
+ *             Map value associated to *key* on *cpu*, or **NULL** if no entry
+ *             was found or *cpu* is invalid.
+ *
+ * struct mptcp_sock *bpf_skc_to_mptcp_sock(void *sk)
+ *     Description
+ *             Dynamically cast a *sk* pointer to a *mptcp_sock* pointer.
+ *     Return
+ *             *sk* if casting is valid, or **NULL** otherwise.
+ *
+ * long bpf_dynptr_from_mem(void *data, u32 size, u64 flags, struct bpf_dynptr *ptr)
+ *     Description
+ *             Get a dynptr to local memory *data*.
+ *
+ *             *data* must be a ptr to a map value.
+ *             The maximum *size* supported is DYNPTR_MAX_SIZE.
+ *             *flags* is currently unused.
+ *     Return
+ *             0 on success, -E2BIG if the size exceeds DYNPTR_MAX_SIZE,
+ *             -EINVAL if flags is not 0.
+ *
+ * long bpf_ringbuf_reserve_dynptr(void *ringbuf, u32 size, u64 flags, struct bpf_dynptr *ptr)
+ *     Description
+ *             Reserve *size* bytes of payload in a ring buffer *ringbuf*
+ *             through the dynptr interface. *flags* must be 0.
+ *
+ *             Please note that a corresponding bpf_ringbuf_submit_dynptr or
+ *             bpf_ringbuf_discard_dynptr must be called on *ptr*, even if the
+ *             reservation fails. This is enforced by the verifier.
+ *     Return
+ *             0 on success, or a negative error in case of failure.
+ *
+ * void bpf_ringbuf_submit_dynptr(struct bpf_dynptr *ptr, u64 flags)
+ *     Description
+ *             Submit reserved ring buffer sample, pointed to by *data*,
+ *             through the dynptr interface. This is a no-op if the dynptr is
+ *             invalid/null.
+ *
+ *             For more information on *flags*, please see
+ *             'bpf_ringbuf_submit'.
+ *     Return
+ *             Nothing. Always succeeds.
+ *
+ * void bpf_ringbuf_discard_dynptr(struct bpf_dynptr *ptr, u64 flags)
+ *     Description
+ *             Discard reserved ring buffer sample through the dynptr
+ *             interface. This is a no-op if the dynptr is invalid/null.
+ *
+ *             For more information on *flags*, please see
+ *             'bpf_ringbuf_discard'.
+ *     Return
+ *             Nothing. Always succeeds.
+ *
+ * long bpf_dynptr_read(void *dst, u32 len, struct bpf_dynptr *src, u32 offset)
+ *     Description
+ *             Read *len* bytes from *src* into *dst*, starting from *offset*
+ *             into *src*.
+ *     Return
+ *             0 on success, -E2BIG if *offset* + *len* exceeds the length
+ *             of *src*'s data, -EINVAL if *src* is an invalid dynptr.
+ *
+ * long bpf_dynptr_write(struct bpf_dynptr *dst, u32 offset, void *src, u32 len)
+ *     Description
+ *             Write *len* bytes from *src* into *dst*, starting from *offset*
+ *             into *dst*.
+ *     Return
+ *             0 on success, -E2BIG if *offset* + *len* exceeds the length
+ *             of *dst*'s data, -EINVAL if *dst* is an invalid dynptr or if *dst*
+ *             is a read-only dynptr.
+ *
+ * void *bpf_dynptr_data(struct bpf_dynptr *ptr, u32 offset, u32 len)
+ *     Description
+ *             Get a pointer to the underlying dynptr data.
+ *
+ *             *len* must be a statically known value. The returned data slice
+ *             is invalidated whenever the dynptr is invalidated.
+ *     Return
+ *             Pointer to the underlying dynptr data, NULL if the dynptr is
+ *             read-only, if the dynptr is invalid, or if the offset and length
+ *             is out of bounds.
  */
 #define __BPF_FUNC_MAPPER(FN)          \
        FN(unspec),                     \
@@ -5120,6 +5431,30 @@ union bpf_attr {
        FN(trace_vprintk),              \
        FN(skc_to_unix_sock),           \
        FN(kallsyms_lookup_name),       \
+       FN(find_vma),                   \
+       FN(loop),                       \
+       FN(strncmp),                    \
+       FN(get_func_arg),               \
+       FN(get_func_ret),               \
+       FN(get_func_arg_cnt),           \
+       FN(get_retval),                 \
+       FN(set_retval),                 \
+       FN(xdp_get_buff_len),           \
+       FN(xdp_load_bytes),             \
+       FN(xdp_store_bytes),            \
+       FN(copy_from_user_task),        \
+       FN(skb_set_tstamp),             \
+       FN(ima_file_hash),              \
+       FN(kptr_xchg),                  \
+       FN(map_lookup_percpu_elem),     \
+       FN(skc_to_mptcp_sock),          \
+       FN(dynptr_from_mem),            \
+       FN(ringbuf_reserve_dynptr),     \
+       FN(ringbuf_submit_dynptr),      \
+       FN(ringbuf_discard_dynptr),     \
+       FN(dynptr_read),                \
+       FN(dynptr_write),               \
+       FN(dynptr_data),                \
        /* */
 
 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
@@ -5309,6 +5644,15 @@ union {                                  \
        __u64 :64;                      \
 } __attribute__((aligned(8)))
 
+enum {
+       BPF_SKB_TSTAMP_UNSPEC,
+       BPF_SKB_TSTAMP_DELIVERY_MONO,   /* tstamp has mono delivery time */
+       /* For any BPF_SKB_TSTAMP_* that the bpf prog cannot handle,
+        * the bpf prog should handle it like BPF_SKB_TSTAMP_UNSPEC
+        * and try to deduce it by ingress, egress or skb->sk->sk_clockid.
+        */
+};
+
 /* user accessible mirror of in-kernel sk_buff.
  * new fields can only be added to the end of this structure
  */
@@ -5349,7 +5693,8 @@ struct __sk_buff {
        __u32 gso_segs;
        __bpf_md_ptr(struct bpf_sock *, sk);
        __u32 gso_size;
-       __u32 :32;              /* Padding, future use. */
+       __u8  tstamp_type;
+       __u32 :24;              /* Padding, future use. */
        __u64 hwtstamp;
 };
 
@@ -5363,6 +5708,10 @@ struct bpf_tunnel_key {
        __u8 tunnel_ttl;
        __u16 tunnel_ext;       /* Padding, future use. */
        __u32 tunnel_label;
+       union {
+               __u32 local_ipv4;
+               __u32 local_ipv6[4];
+       };
 };
 
 /* user accessible mirror of in-kernel xfrm_state.
@@ -5414,7 +5763,8 @@ struct bpf_sock {
        __u32 src_ip4;
        __u32 src_ip6[4];
        __u32 src_port;         /* host byte order */
-       __u32 dst_port;         /* network byte order */
+       __be16 dst_port;        /* network byte order */
+       __u16 :16;              /* zero padding */
        __u32 dst_ip4;
        __u32 dst_ip6[4];
        __u32 state;
@@ -6256,6 +6606,11 @@ struct bpf_timer {
        __u64 :64;
 } __attribute__((aligned(8)));
 
+struct bpf_dynptr {
+       __u64 :64;
+       __u64 :64;
+} __attribute__((aligned(8)));
+
 struct bpf_sysctl {
        __u32   write;          /* Sysctl is being read (= 0) or written (= 1).
                                 * Allows 1,2,4-byte read, but no write.
@@ -6292,10 +6647,12 @@ struct bpf_sk_lookup {
        __u32 protocol;         /* IP protocol (IPPROTO_TCP, IPPROTO_UDP) */
        __u32 remote_ip4;       /* Network byte order */
        __u32 remote_ip6[4];    /* Network byte order */
-       __u32 remote_port;      /* Network byte order */
+       __be16 remote_port;     /* Network byte order */
+       __u16 :16;              /* Zero padding */
        __u32 local_ip4;        /* Network byte order */
        __u32 local_ip6[4];     /* Network byte order */
        __u32 local_port;       /* Host byte order */
+       __u32 ingress_ifindex;          /* The arriving interface. Determined by inet_iif. */
 };
 
 /*
@@ -6328,4 +6685,78 @@ enum {
        BTF_F_ZERO      =       (1ULL << 3),
 };
 
+/* bpf_core_relo_kind encodes which aspect of captured field/type/enum value
+ * has to be adjusted by relocations. It is emitted by llvm and passed to
+ * libbpf and later to the kernel.
+ */
+enum bpf_core_relo_kind {
+       BPF_CORE_FIELD_BYTE_OFFSET = 0,      /* field byte offset */
+       BPF_CORE_FIELD_BYTE_SIZE = 1,        /* field size in bytes */
+       BPF_CORE_FIELD_EXISTS = 2,           /* field existence in target kernel */
+       BPF_CORE_FIELD_SIGNED = 3,           /* field signedness (0 - unsigned, 1 - signed) */
+       BPF_CORE_FIELD_LSHIFT_U64 = 4,       /* bitfield-specific left bitshift */
+       BPF_CORE_FIELD_RSHIFT_U64 = 5,       /* bitfield-specific right bitshift */
+       BPF_CORE_TYPE_ID_LOCAL = 6,          /* type ID in local BPF object */
+       BPF_CORE_TYPE_ID_TARGET = 7,         /* type ID in target kernel */
+       BPF_CORE_TYPE_EXISTS = 8,            /* type existence in target kernel */
+       BPF_CORE_TYPE_SIZE = 9,              /* type size in bytes */
+       BPF_CORE_ENUMVAL_EXISTS = 10,        /* enum value existence in target kernel */
+       BPF_CORE_ENUMVAL_VALUE = 11,         /* enum value integer value */
+};
+
+/*
+ * "struct bpf_core_relo" is used to pass relocation data form LLVM to libbpf
+ * and from libbpf to the kernel.
+ *
+ * CO-RE relocation captures the following data:
+ * - insn_off - instruction offset (in bytes) within a BPF program that needs
+ *   its insn->imm field to be relocated with actual field info;
+ * - type_id - BTF type ID of the "root" (containing) entity of a relocatable
+ *   type or field;
+ * - access_str_off - offset into corresponding .BTF string section. String
+ *   interpretation depends on specific relocation kind:
+ *     - for field-based relocations, string encodes an accessed field using
+ *       a sequence of field and array indices, separated by colon (:). It's
+ *       conceptually very close to LLVM's getelementptr ([0]) instruction's
+ *       arguments for identifying offset to a field.
+ *     - for type-based relocations, strings is expected to be just "0";
+ *     - for enum value-based relocations, string contains an index of enum
+ *       value within its enum type;
+ * - kind - one of enum bpf_core_relo_kind;
+ *
+ * Example:
+ *   struct sample {
+ *       int a;
+ *       struct {
+ *           int b[10];
+ *       };
+ *   };
+ *
+ *   struct sample *s = ...;
+ *   int *x = &s->a;     // encoded as "0:0" (a is field #0)
+ *   int *y = &s->b[5];  // encoded as "0:1:0:5" (anon struct is field #1,
+ *                       // b is field #0 inside anon struct, accessing elem #5)
+ *   int *z = &s[10]->b; // encoded as "10:1" (ptr is used as an array)
+ *
+ * type_id for all relocs in this example will capture BTF type id of
+ * `struct sample`.
+ *
+ * Such relocation is emitted when using __builtin_preserve_access_index()
+ * Clang built-in, passing expression that captures field address, e.g.:
+ *
+ * bpf_probe_read(&dst, sizeof(dst),
+ *               __builtin_preserve_access_index(&src->a.b.c));
+ *
+ * In this case Clang will emit field relocation recording necessary data to
+ * be able to find offset of embedded `a.b.c` field within `src` struct.
+ *
+ * [0] https://llvm.org/docs/LangRef.html#getelementptr-instruction
+ */
+struct bpf_core_relo {
+       __u32 insn_off;
+       __u32 type_id;
+       __u32 access_str_off;
+       enum bpf_core_relo_kind kind;
+};
+
 #endif /* _UAPI__LINUX_BPF_H__ */
index a6cc1cc40f7944a9d0f08ab7c143c321df25d194..5a4bca34094ddf38a1dcc1d840269a1f1041a6df 100644 (file)
@@ -288,7 +288,7 @@ enum {
 #define DM_VERSION_MAJOR       4
 #define DM_VERSION_MINOR       27
 #define DM_VERSION_PATCHLEVEL  0
-#define DM_VERSION_EXTRA       "-ioctl (2021-03-22)"
+#define DM_VERSION_EXTRA       "-ioctl (2022-02-22)"
 
 /* Status bits */
 #define DM_READONLY_FLAG       (1 << 0) /* In/Out */
index cf20b6dba5373ff6553dc63b311e1b77e089d439..bcdf4850a07dd3a006bb90a65a95792c760ea9c7 100644 (file)
@@ -235,6 +235,7 @@ enum tunable_id {
        ETHTOOL_RX_COPYBREAK,
        ETHTOOL_TX_COPYBREAK,
        ETHTOOL_PFC_PREVENTION_TOUT, /* timeout in msecs */
+       ETHTOOL_TX_COPYBREAK_BUF_SIZE,
        /*
         * Add your fresh new tunable attribute above and remember to update
         * tunable_strings[] in net/ethtool/common.c
@@ -1694,6 +1695,7 @@ enum ethtool_link_mode_bit_indices {
        ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT         = 89,
        ETHTOOL_LINK_MODE_100baseFX_Half_BIT             = 90,
        ETHTOOL_LINK_MODE_100baseFX_Full_BIT             = 91,
+       ETHTOOL_LINK_MODE_10baseT1L_Full_BIT             = 92,
        /* must be last entry */
        __ETHTOOL_LINK_MODE_MASK_NBITS
 };