aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/bpf.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-06-30 05:03:36 -0400
committerDavid S. Miller <davem@davemloft.net>2016-06-30 05:03:36 -0400
commitee58b57100ca953da7320c285315a95db2f7053d (patch)
tree77b815a31240adc4d6326346908137fc6c2c3a96 /include/linux/bpf.h
parent6f30e8b022c8e3a722928ddb1a2ae0be852fcc0e (diff)
parente7bdea7750eb2a64aea4a08fa5c0a31719c8155d (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Several cases of overlapping changes, except the packet scheduler conflicts which deal with the addition of the free list parameter to qdisc_enqueue(). Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/bpf.h')
-rw-r--r--include/linux/bpf.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 9adfef694a25..8411032ac90d 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -115,6 +115,31 @@ enum bpf_access_type {
115 BPF_WRITE = 2 115 BPF_WRITE = 2
116}; 116};
117 117
118/* types of values stored in eBPF registers */
119enum bpf_reg_type {
120 NOT_INIT = 0, /* nothing was written into register */
121 UNKNOWN_VALUE, /* reg doesn't contain a valid pointer */
122 PTR_TO_CTX, /* reg points to bpf_context */
123 CONST_PTR_TO_MAP, /* reg points to struct bpf_map */
124 PTR_TO_MAP_VALUE, /* reg points to map element value */
125 PTR_TO_MAP_VALUE_OR_NULL,/* points to map elem value or NULL */
126 FRAME_PTR, /* reg == frame_pointer */
127 PTR_TO_STACK, /* reg == frame_pointer + imm */
128 CONST_IMM, /* constant integer value */
129
130 /* PTR_TO_PACKET represents:
131 * skb->data
132 * skb->data + imm
133 * skb->data + (u16) var
134 * skb->data + (u16) var + imm
135 * if (range > 0) then [ptr, ptr + range - off) is safe to access
136 * if (id > 0) means that some 'var' was added
137 * if (off > 0) menas that 'imm' was added
138 */
139 PTR_TO_PACKET,
140 PTR_TO_PACKET_END, /* skb->data + headlen */
141};
142
118struct bpf_prog; 143struct bpf_prog;
119 144
120struct bpf_verifier_ops { 145struct bpf_verifier_ops {
@@ -124,7 +149,8 @@ struct bpf_verifier_ops {
124 /* return true if 'size' wide access at offset 'off' within bpf_context 149 /* return true if 'size' wide access at offset 'off' within bpf_context
125 * with 'type' (read or write) is allowed 150 * with 'type' (read or write) is allowed
126 */ 151 */
127 bool (*is_valid_access)(int off, int size, enum bpf_access_type type); 152 bool (*is_valid_access)(int off, int size, enum bpf_access_type type,
153 enum bpf_reg_type *reg_type);
128 154
129 u32 (*convert_ctx_access)(enum bpf_access_type type, int dst_reg, 155 u32 (*convert_ctx_access)(enum bpf_access_type type, int dst_reg,
130 int src_reg, int ctx_off, 156 int src_reg, int ctx_off,
@@ -255,6 +281,10 @@ static inline struct bpf_prog *bpf_prog_get(u32 ufd)
255static inline void bpf_prog_put(struct bpf_prog *prog) 281static inline void bpf_prog_put(struct bpf_prog *prog)
256{ 282{
257} 283}
284
285static inline void bpf_prog_put_rcu(struct bpf_prog *prog)
286{
287}
258#endif /* CONFIG_BPF_SYSCALL */ 288#endif /* CONFIG_BPF_SYSCALL */
259 289
260/* verifier prototypes for helper functions called from eBPF programs */ 290/* verifier prototypes for helper functions called from eBPF programs */