aboutsummaryrefslogtreecommitdiffstats
path: root/tools/include/uapi/linux
diff options
context:
space:
mode:
authorRoman Gushchin <guro@fb.com>2018-08-02 17:27:25 -0400
committerDaniel Borkmann <daniel@iogearbox.net>2018-08-02 18:47:32 -0400
commitc419cf52da77d0f0f01d4b75a75ae89406f0923f (patch)
treeea3a2f974da1738bd3247d7a469b2a6a4e7d0db4 /tools/include/uapi/linux
parentcd3394317653837e2eb5c5d0904a8996102af9fc (diff)
bpf: sync bpf.h to tools/
Sync cgroup storage related changes: 1) new BPF_MAP_TYPE_CGROUP_STORAGE map type 2) struct bpf_cgroup_sotrage_key definition 3) get_local_storage() helper Signed-off-by: Roman Gushchin <guro@fb.com> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/include/uapi/linux')
-rw-r--r--tools/include/uapi/linux/bpf.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 0ebaaf7f3568..dd5758dc35d3 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -75,6 +75,11 @@ struct bpf_lpm_trie_key {
75 __u8 data[0]; /* Arbitrary size */ 75 __u8 data[0]; /* Arbitrary size */
76}; 76};
77 77
78struct bpf_cgroup_storage_key {
79 __u64 cgroup_inode_id; /* cgroup inode id */
80 __u32 attach_type; /* program attach type */
81};
82
78/* BPF syscall commands, see bpf(2) man-page for details. */ 83/* BPF syscall commands, see bpf(2) man-page for details. */
79enum bpf_cmd { 84enum bpf_cmd {
80 BPF_MAP_CREATE, 85 BPF_MAP_CREATE,
@@ -120,6 +125,7 @@ enum bpf_map_type {
120 BPF_MAP_TYPE_CPUMAP, 125 BPF_MAP_TYPE_CPUMAP,
121 BPF_MAP_TYPE_XSKMAP, 126 BPF_MAP_TYPE_XSKMAP,
122 BPF_MAP_TYPE_SOCKHASH, 127 BPF_MAP_TYPE_SOCKHASH,
128 BPF_MAP_TYPE_CGROUP_STORAGE,
123}; 129};
124 130
125enum bpf_prog_type { 131enum bpf_prog_type {
@@ -2089,6 +2095,24 @@ union bpf_attr {
2089 * Return 2095 * Return
2090 * A 64-bit integer containing the current cgroup id based 2096 * A 64-bit integer containing the current cgroup id based
2091 * on the cgroup within which the current task is running. 2097 * on the cgroup within which the current task is running.
2098 *
2099 * void* get_local_storage(void *map, u64 flags)
2100 * Description
2101 * Get the pointer to the local storage area.
2102 * The type and the size of the local storage is defined
2103 * by the *map* argument.
2104 * The *flags* meaning is specific for each map type,
2105 * and has to be 0 for cgroup local storage.
2106 *
2107 * Depending on the bpf program type, a local storage area
2108 * can be shared between multiple instances of the bpf program,
2109 * running simultaneously.
2110 *
2111 * A user should care about the synchronization by himself.
2112 * For example, by using the BPF_STX_XADD instruction to alter
2113 * the shared data.
2114 * Return
2115 * Pointer to the local storage area.
2092 */ 2116 */
2093#define __BPF_FUNC_MAPPER(FN) \ 2117#define __BPF_FUNC_MAPPER(FN) \
2094 FN(unspec), \ 2118 FN(unspec), \
@@ -2171,7 +2195,8 @@ union bpf_attr {
2171 FN(rc_repeat), \ 2195 FN(rc_repeat), \
2172 FN(rc_keydown), \ 2196 FN(rc_keydown), \
2173 FN(skb_cgroup_id), \ 2197 FN(skb_cgroup_id), \
2174 FN(get_current_cgroup_id), 2198 FN(get_current_cgroup_id), \
2199 FN(get_local_storage),
2175 2200
2176/* integer value in 'imm' field of BPF_CALL instruction selects which helper 2201/* integer value in 'imm' field of BPF_CALL instruction selects which helper
2177 * function eBPF program intends to call 2202 * function eBPF program intends to call