aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/bpf.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/bpf.h')
-rw-r--r--include/linux/bpf.h35
1 files changed, 33 insertions, 2 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 38ebbc61ed99..321969da67b7 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -110,6 +110,11 @@ static inline struct bpf_offloaded_map *map_to_offmap(struct bpf_map *map)
110 return container_of(map, struct bpf_offloaded_map, map); 110 return container_of(map, struct bpf_offloaded_map, map);
111} 111}
112 112
113static inline bool bpf_map_offload_neutral(const struct bpf_map *map)
114{
115 return map->map_type == BPF_MAP_TYPE_PERF_EVENT_ARRAY;
116}
117
113static inline bool bpf_map_support_seq_show(const struct bpf_map *map) 118static inline bool bpf_map_support_seq_show(const struct bpf_map *map)
114{ 119{
115 return map->ops->map_seq_show_elem && map->ops->map_check_btf; 120 return map->ops->map_seq_show_elem && map->ops->map_check_btf;
@@ -235,6 +240,8 @@ struct bpf_verifier_ops {
235 struct bpf_insn_access_aux *info); 240 struct bpf_insn_access_aux *info);
236 int (*gen_prologue)(struct bpf_insn *insn, bool direct_write, 241 int (*gen_prologue)(struct bpf_insn *insn, bool direct_write,
237 const struct bpf_prog *prog); 242 const struct bpf_prog *prog);
243 int (*gen_ld_abs)(const struct bpf_insn *orig,
244 struct bpf_insn *insn_buf);
238 u32 (*convert_ctx_access)(enum bpf_access_type type, 245 u32 (*convert_ctx_access)(enum bpf_access_type type,
239 const struct bpf_insn *src, 246 const struct bpf_insn *src,
240 struct bpf_insn *dst, 247 struct bpf_insn *dst,
@@ -676,6 +683,31 @@ static inline int sock_map_prog(struct bpf_map *map,
676} 683}
677#endif 684#endif
678 685
686#if defined(CONFIG_XDP_SOCKETS)
687struct xdp_sock;
688struct xdp_sock *__xsk_map_lookup_elem(struct bpf_map *map, u32 key);
689int __xsk_map_redirect(struct bpf_map *map, struct xdp_buff *xdp,
690 struct xdp_sock *xs);
691void __xsk_map_flush(struct bpf_map *map);
692#else
693struct xdp_sock;
694static inline struct xdp_sock *__xsk_map_lookup_elem(struct bpf_map *map,
695 u32 key)
696{
697 return NULL;
698}
699
700static inline int __xsk_map_redirect(struct bpf_map *map, struct xdp_buff *xdp,
701 struct xdp_sock *xs)
702{
703 return -EOPNOTSUPP;
704}
705
706static inline void __xsk_map_flush(struct bpf_map *map)
707{
708}
709#endif
710
679/* verifier prototypes for helper functions called from eBPF programs */ 711/* verifier prototypes for helper functions called from eBPF programs */
680extern const struct bpf_func_proto bpf_map_lookup_elem_proto; 712extern const struct bpf_func_proto bpf_map_lookup_elem_proto;
681extern const struct bpf_func_proto bpf_map_update_elem_proto; 713extern const struct bpf_func_proto bpf_map_update_elem_proto;
@@ -689,9 +721,8 @@ extern const struct bpf_func_proto bpf_ktime_get_ns_proto;
689extern const struct bpf_func_proto bpf_get_current_pid_tgid_proto; 721extern const struct bpf_func_proto bpf_get_current_pid_tgid_proto;
690extern const struct bpf_func_proto bpf_get_current_uid_gid_proto; 722extern const struct bpf_func_proto bpf_get_current_uid_gid_proto;
691extern const struct bpf_func_proto bpf_get_current_comm_proto; 723extern const struct bpf_func_proto bpf_get_current_comm_proto;
692extern const struct bpf_func_proto bpf_skb_vlan_push_proto;
693extern const struct bpf_func_proto bpf_skb_vlan_pop_proto;
694extern const struct bpf_func_proto bpf_get_stackid_proto; 724extern const struct bpf_func_proto bpf_get_stackid_proto;
725extern const struct bpf_func_proto bpf_get_stack_proto;
695extern const struct bpf_func_proto bpf_sock_map_update_proto; 726extern const struct bpf_func_proto bpf_sock_map_update_proto;
696 727
697/* Shared helpers among cBPF and eBPF. */ 728/* Shared helpers among cBPF and eBPF. */