History

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

David S. Miller committed 6 years ago

Commit ed52f2c2 parents f87238d 8596a75107 files · +6086 −1728Browse files

Showing the changes to include/uapi/linux (2 of 107 files). Show all

Unified · Split

2 files
  1. include/uapi/linux/bpf.h +80 −2
  2. include/uapi/linux/if_link.h +3 −1
include/uapi/linux/bpf.h+80−2
@@ -111,6 +111,8 @@ enum bpf_cmd { · 110 unmodified lines
111 BPF_MAP_LOOKUP_AND_DELETE_BATCH,111 BPF_MAP_LOOKUP_AND_DELETE_BATCH,
112 BPF_MAP_UPDATE_BATCH,112 BPF_MAP_UPDATE_BATCH,
113 BPF_MAP_DELETE_BATCH,113 BPF_MAP_DELETE_BATCH,
114 BPF_LINK_CREATE,
115 BPF_LINK_UPDATE,
114};116};
115 117
116enum bpf_map_type {118enum bpf_map_type {
@@ -181,6 +183,7 @@ enum bpf_prog_type { · 64 unmodified lines
181 BPF_PROG_TYPE_TRACING,183 BPF_PROG_TYPE_TRACING,
182 BPF_PROG_TYPE_STRUCT_OPS,184 BPF_PROG_TYPE_STRUCT_OPS,
183 BPF_PROG_TYPE_EXT,185 BPF_PROG_TYPE_EXT,
186 BPF_PROG_TYPE_LSM,
184};187};
185 188
186enum bpf_attach_type {189enum bpf_attach_type {
@@ -211,6 +214,7 @@ enum bpf_attach_type { · 24 unmodified lines
211 BPF_TRACE_FENTRY,214 BPF_TRACE_FENTRY,
212 BPF_TRACE_FEXIT,215 BPF_TRACE_FEXIT,
213 BPF_MODIFY_RETURN,216 BPF_MODIFY_RETURN,
217 BPF_LSM_MAC,
214 __MAX_BPF_ATTACH_TYPE218 __MAX_BPF_ATTACH_TYPE
215};219};
216 220
@@ -539,7 +543,7 @@ union bpf_attr { · 322 unmodified lines
539 __u32 prog_cnt;543 __u32 prog_cnt;
540 } query;544 } query;
541 545
542 struct {546 struct { /* anonymous struct used by BPF_RAW_TRACEPOINT_OPEN command */
543 __u64 name;547 __u64 name;
544 __u32 prog_fd;548 __u32 prog_fd;
545 } raw_tracepoint;549 } raw_tracepoint;
@@ -567,6 +571,24 @@ union bpf_attr { · 21 unmodified lines
567 __u64 probe_offset; /* output: probe_offset */571 __u64 probe_offset; /* output: probe_offset */
568 __u64 probe_addr; /* output: probe_addr */572 __u64 probe_addr; /* output: probe_addr */
569 } task_fd_query;573 } task_fd_query;
574
575 struct { /* struct used by BPF_LINK_CREATE command */
576 __u32 prog_fd; /* eBPF program to attach */
577 __u32 target_fd; /* object to attach to */
578 __u32 attach_type; /* attach type */
579 __u32 flags; /* extra flags */
580 } link_create;
581
582 struct { /* struct used by BPF_LINK_UPDATE command */
583 __u32 link_fd; /* link fd */
584 /* new program fd to update link with */
585 __u32 new_prog_fd;
586 __u32 flags; /* extra flags */
587 /* expected link's program fd; is specified only if
588 * BPF_F_REPLACE flag is set in flags */
589 __u32 old_prog_fd;
590 } link_update;
591
570} __attribute__((aligned(8)));592} __attribute__((aligned(8)));
571 593
572/* The description below is an attempt at providing documentation to eBPF594/* The description below is an attempt at providing documentation to eBPF
@@ -2950,6 +2972,59 @@ union bpf_attr { · 2377 unmodified lines
2950 * restricted to raw_tracepoint bpf programs.2972 * restricted to raw_tracepoint bpf programs.
2951 * Return2973 * Return
2952 * 0 on success, or a negative error in case of failure.2974 * 0 on success, or a negative error in case of failure.
2975 *
2976 * u64 bpf_get_netns_cookie(void *ctx)
2977 * Description
2978 * Retrieve the cookie (generated by the kernel) of the network
2979 * namespace the input *ctx* is associated with. The network
2980 * namespace cookie remains stable for its lifetime and provides
2981 * a global identifier that can be assumed unique. If *ctx* is
2982 * NULL, then the helper returns the cookie for the initial
2983 * 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.
2986 * Return
2987 * A 8-byte long opaque number.
2988 *
2989 * u64 bpf_get_current_ancestor_cgroup_id(int ancestor_level)
2990 * Description
2991 * Return id of cgroup v2 that is ancestor of the cgroup associated
2992 * with the current task at the *ancestor_level*. The root cgroup
2993 * is at *ancestor_level* zero and each step down the hierarchy
2994 * increments the level. If *ancestor_level* == level of cgroup
2995 * associated with the current task, then return value will be the
2996 * same as that of **bpf_get_current_cgroup_id**\ ().
2997 *
2998 * The helper is useful to implement policies based on cgroups
2999 * that are upper in hierarchy than immediate cgroup associated
3000 * with the current task.
3001 *
3002 * The format of returned id and helper limitations are same as in
3003 * **bpf_get_current_cgroup_id**\ ().
3004 * Return
3005 * The id is returned or 0 in case the id could not be retrieved.
3006 *
3007 * int bpf_sk_assign(struct sk_buff *skb, struct bpf_sock *sk, u64 flags)
3008 * Description
3009 * Assign the *sk* to the *skb*. When combined with appropriate
3010 * routing configuration to receive the packet towards the socket,
3011 * will cause *skb* to be delivered to the specified socket.
3012 * Subsequent redirection of *skb* via **bpf_redirect**\ (),
3013 * **bpf_clone_redirect**\ () or other methods outside of BPF may
3014 * interfere with successful delivery to the socket.
3015 *
3016 * This operation is only valid from TC ingress path.
3017 *
3018 * The *flags* argument must be zero.
3019 * 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).
2953 */3028 */
2954#define __BPF_FUNC_MAPPER(FN) \3029#define __BPF_FUNC_MAPPER(FN) \
2955 FN(unspec), \3030 FN(unspec), \
@@ -3073,7 +3148,10 @@ union bpf_attr { · 117 unmodified lines
3073 FN(jiffies64), \3148 FN(jiffies64), \
3074 FN(read_branch_records), \3149 FN(read_branch_records), \
3075 FN(get_ns_current_pid_tgid), \3150 FN(get_ns_current_pid_tgid), \
3076 FN(xdp_output),3151 FN(xdp_output), \
3152 FN(get_netns_cookie), \
3153 FN(get_current_ancestor_cgroup_id), \
3154 FN(sk_assign),
3077 3155
3078/* integer value in 'imm' field of BPF_CALL instruction selects which helper3156/* integer value in 'imm' field of BPF_CALL instruction selects which helper
3079 * function eBPF program intends to call3157 * function eBPF program intends to call
include/uapi/linux/if_link.h+3−1
@@ -974,11 +974,12 @@ enum { · 973 unmodified lines
974#define XDP_FLAGS_SKB_MODE (1U << 1)974#define XDP_FLAGS_SKB_MODE (1U << 1)
975#define XDP_FLAGS_DRV_MODE (1U << 2)975#define XDP_FLAGS_DRV_MODE (1U << 2)
976#define XDP_FLAGS_HW_MODE (1U << 3)976#define XDP_FLAGS_HW_MODE (1U << 3)
977#define XDP_FLAGS_REPLACE (1U << 4)
977#define XDP_FLAGS_MODES (XDP_FLAGS_SKB_MODE | \978#define XDP_FLAGS_MODES (XDP_FLAGS_SKB_MODE | \
978 XDP_FLAGS_DRV_MODE | \979 XDP_FLAGS_DRV_MODE | \
979 XDP_FLAGS_HW_MODE)980 XDP_FLAGS_HW_MODE)
980#define XDP_FLAGS_MASK (XDP_FLAGS_UPDATE_IF_NOEXIST | \981#define XDP_FLAGS_MASK (XDP_FLAGS_UPDATE_IF_NOEXIST | \
981 XDP_FLAGS_MODES)982 XDP_FLAGS_MODES | XDP_FLAGS_REPLACE)
982 983
983/* These are stored into IFLA_XDP_ATTACHED on dump. */984/* These are stored into IFLA_XDP_ATTACHED on dump. */
984enum {985enum {
@@ -998,6 +999,7 @@ enum { · 13 unmodified lines
998 IFLA_XDP_DRV_PROG_ID,999 IFLA_XDP_DRV_PROG_ID,
999 IFLA_XDP_SKB_PROG_ID,1000 IFLA_XDP_SKB_PROG_ID,
1000 IFLA_XDP_HW_PROG_ID,1001 IFLA_XDP_HW_PROG_ID,
1002 IFLA_XDP_EXPECTED_FD,
1001 __IFLA_XDP_MAX,1003 __IFLA_XDP_MAX,
1002};1004};
1003 1005