]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - include/uapi/linux/bpf.h
Update kernel headers
[mirror_iproute2.git] / include / uapi / linux / bpf.h
index 657645801e81f519c074a21454e389b7fc50f111..73a52a21ae9099ab15a147289947ff6b4eaf9d8e 100644 (file)
@@ -73,7 +73,7 @@ struct bpf_insn {
 /* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */
 struct bpf_lpm_trie_key {
        __u32   prefixlen;      /* up to 32 for AF_INET, 128 for AF_INET6 */
-       __u8    data[0];        /* Arbitrary size */
+       __u8    data[]; /* Arbitrary size */
 };
 
 struct bpf_cgroup_storage_key {
@@ -2890,6 +2890,25 @@ union bpf_attr {
  *             Obtain the 64bit jiffies
  *     Return
  *             The 64 bit jiffies
+ *
+ * int bpf_read_branch_records(struct bpf_perf_event_data *ctx, void *buf, u32 size, u64 flags)
+ *     Description
+ *             For an eBPF program attached to a perf event, retrieve the
+ *             branch records (struct perf_branch_entry) associated to *ctx*
+ *             and store it in the buffer pointed by *buf* up to size
+ *             *size* bytes.
+ *     Return
+ *             On success, number of bytes written to *buf*. On error, a
+ *             negative value.
+ *
+ *             The *flags* can be set to **BPF_F_GET_BRANCH_RECORDS_SIZE** to
+ *             instead return the number of bytes required to store all the
+ *             branch entries. If this flag is set, *buf* may be NULL.
+ *
+ *             **-EINVAL** if arguments invalid or **size** not a multiple
+ *             of sizeof(struct perf_branch_entry).
+ *
+ *             **-ENOENT** if architecture does not support branch records.
  */
 #define __BPF_FUNC_MAPPER(FN)          \
        FN(unspec),                     \
@@ -3010,7 +3029,8 @@ union bpf_attr {
        FN(probe_read_kernel_str),      \
        FN(tcp_send_ack),               \
        FN(send_signal_thread),         \
-       FN(jiffies64),
+       FN(jiffies64),                  \
+       FN(read_branch_records),
 
 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
  * function eBPF program intends to call
@@ -3089,6 +3109,9 @@ enum bpf_func_id {
 /* BPF_FUNC_sk_storage_get flags */
 #define BPF_SK_STORAGE_GET_F_CREATE    (1ULL << 0)
 
+/* BPF_FUNC_read_branch_records flags. */
+#define BPF_F_GET_BRANCH_RECORDS_SIZE  (1ULL << 0)
+
 /* Mode for BPF_FUNC_skb_adjust_room helper. */
 enum bpf_adj_room_mode {
        BPF_ADJ_ROOM_NET,