diff options
Diffstat (limited to 'include/linux/bpf.h')
-rw-r--r-- | include/linux/bpf.h | 35 |
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 | ||
113 | static 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 | |||
113 | static inline bool bpf_map_support_seq_show(const struct bpf_map *map) | 118 | static 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) | ||
687 | struct xdp_sock; | ||
688 | struct xdp_sock *__xsk_map_lookup_elem(struct bpf_map *map, u32 key); | ||
689 | int __xsk_map_redirect(struct bpf_map *map, struct xdp_buff *xdp, | ||
690 | struct xdp_sock *xs); | ||
691 | void __xsk_map_flush(struct bpf_map *map); | ||
692 | #else | ||
693 | struct xdp_sock; | ||
694 | static inline struct xdp_sock *__xsk_map_lookup_elem(struct bpf_map *map, | ||
695 | u32 key) | ||
696 | { | ||
697 | return NULL; | ||
698 | } | ||
699 | |||
700 | static inline int __xsk_map_redirect(struct bpf_map *map, struct xdp_buff *xdp, | ||
701 | struct xdp_sock *xs) | ||
702 | { | ||
703 | return -EOPNOTSUPP; | ||
704 | } | ||
705 | |||
706 | static 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 */ |
680 | extern const struct bpf_func_proto bpf_map_lookup_elem_proto; | 712 | extern const struct bpf_func_proto bpf_map_lookup_elem_proto; |
681 | extern const struct bpf_func_proto bpf_map_update_elem_proto; | 713 | extern 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; | |||
689 | extern const struct bpf_func_proto bpf_get_current_pid_tgid_proto; | 721 | extern const struct bpf_func_proto bpf_get_current_pid_tgid_proto; |
690 | extern const struct bpf_func_proto bpf_get_current_uid_gid_proto; | 722 | extern const struct bpf_func_proto bpf_get_current_uid_gid_proto; |
691 | extern const struct bpf_func_proto bpf_get_current_comm_proto; | 723 | extern const struct bpf_func_proto bpf_get_current_comm_proto; |
692 | extern const struct bpf_func_proto bpf_skb_vlan_push_proto; | ||
693 | extern const struct bpf_func_proto bpf_skb_vlan_pop_proto; | ||
694 | extern const struct bpf_func_proto bpf_get_stackid_proto; | 724 | extern const struct bpf_func_proto bpf_get_stackid_proto; |
725 | extern const struct bpf_func_proto bpf_get_stack_proto; | ||
695 | extern const struct bpf_func_proto bpf_sock_map_update_proto; | 726 | extern 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. */ |