Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
[linux-2.6-block.git] / tools / include / uapi / linux / bpf.h
index ec8b40ff386e3ac8cecbaf9ce6ef611228485b13..94c002584068b5b664a9d3f6e4557c0df4faefd2 100644 (file)
@@ -232,6 +232,20 @@ enum bpf_attach_type {
  */
 #define BPF_F_STRICT_ALIGNMENT (1U << 0)
 
+/* If BPF_F_ANY_ALIGNMENT is used in BPF_PROF_LOAD command, the
+ * verifier will allow any alignment whatsoever.  On platforms
+ * with strict alignment requirements for loads ands stores (such
+ * as sparc and mips) the verifier validates that all loads and
+ * stores provably follow this requirement.  This flag turns that
+ * checking and enforcement off.
+ *
+ * It is mostly used for testing when we want to validate the
+ * context and memory access aspects of the verifier, but because
+ * of an unaligned access the alignment check would trigger before
+ * the one we are interested in.
+ */
+#define BPF_F_ANY_ALIGNMENT    (1U << 1)
+
 /* when bpf_ldimm64->src_reg == BPF_PSEUDO_MAP_FD, bpf_ldimm64->imm == fd */
 #define BPF_PSEUDO_MAP_FD      1
 
@@ -342,6 +356,9 @@ union bpf_attr {
                __u32           func_info_rec_size;     /* userspace bpf_func_info size */
                __aligned_u64   func_info;      /* func info */
                __u32           func_info_cnt;  /* number of bpf_func_info records */
+               __u32           line_info_rec_size;     /* userspace bpf_line_info size */
+               __aligned_u64   line_info;      /* line info */
+               __u32           line_info_cnt;  /* number of bpf_line_info records */
        };
 
        struct { /* anonymous struct used by BPF_OBJ_* commands */
@@ -360,8 +377,11 @@ union bpf_attr {
        struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */
                __u32           prog_fd;
                __u32           retval;
-               __u32           data_size_in;
-               __u32           data_size_out;
+               __u32           data_size_in;   /* input: len of data_in */
+               __u32           data_size_out;  /* input/output: len of data_out
+                                                *   returns ENOSPC if data_out
+                                                *   is too small.
+                                                */
                __aligned_u64   data_in;
                __aligned_u64   data_out;
                __u32           repeat;
@@ -2282,9 +2302,22 @@ union bpf_attr {
  *             if possible. Other errors can occur if input parameters are
  *             invalid either due to *start* byte not being valid part of msg
  *             payload and/or *pop* value being to large.
+ *     Return
+ *             0 on success, or a negative error in case of failure.
+ *
+ * int bpf_rc_pointer_rel(void *ctx, s32 rel_x, s32 rel_y)
+ *     Description
+ *             This helper is used in programs implementing IR decoding, to
+ *             report a successfully decoded pointer movement.
+ *
+ *             The *ctx* should point to the lirc sample as passed into
+ *             the program.
  *
+ *             This helper is only available is the kernel was compiled with
+ *             the **CONFIG_BPF_LIRC_MODE2** configuration option set to
+ *             "**y**".
  *     Return
- *             0 on success, or a negative erro in case of failure.
+ *             0
  */
 #define __BPF_FUNC_MAPPER(FN)          \
        FN(unspec),                     \
@@ -2378,7 +2411,8 @@ union bpf_attr {
        FN(map_pop_elem),               \
        FN(map_peek_elem),              \
        FN(msg_push_data),              \
-       FN(msg_pop_data),
+       FN(msg_pop_data),               \
+       FN(rc_pointer_rel),
 
 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
  * function eBPF program intends to call
@@ -2496,6 +2530,7 @@ struct __sk_buff {
        __u32 data_meta;
        __bpf_md_ptr(struct bpf_flow_keys *, flow_keys);
        __u64 tstamp;
+       __u32 wire_len;
 };
 
 struct bpf_tunnel_key {
@@ -2674,7 +2709,13 @@ struct bpf_prog_info {
        __u32 btf_id;
        __u32 func_info_rec_size;
        __aligned_u64 func_info;
-       __u32 func_info_cnt;
+       __u32 nr_func_info;
+       __u32 nr_line_info;
+       __aligned_u64 line_info;
+       __aligned_u64 jited_line_info;
+       __u32 nr_jited_line_info;
+       __u32 line_info_rec_size;
+       __u32 jited_line_info_rec_size;
 } __attribute__((aligned(8)));
 
 struct bpf_map_info {
@@ -2987,8 +3028,18 @@ struct bpf_flow_keys {
 };
 
 struct bpf_func_info {
-       __u32   insn_offset;
+       __u32   insn_off;
        __u32   type_id;
 };
 
+#define BPF_LINE_INFO_LINE_NUM(line_col)       ((line_col) >> 10)
+#define BPF_LINE_INFO_LINE_COL(line_col)       ((line_col) & 0x3ff)
+
+struct bpf_line_info {
+       __u32   insn_off;
+       __u32   file_name_off;
+       __u32   line_off;
+       __u32   line_col;
+};
+
 #endif /* _UAPI__LINUX_BPF_H__ */