Alexei Starovoitov says: ==================== pull-request: bpf-next 2019-02-16 The following pull-request contains BPF updates for your *net-next* tree. The main changes are: 1) numerous libbpf API improvements, from Andrii, Andrey, Yonghong. 2) test all bpf progs in alu32 mode, from Jiong. 3) skb->sk access and bpf_sk_fullsock(), bpf_tcp_sock() helpers, from Martin. 4) support for IP encap in lwt bpf progs, from Peter. 5) remove XDP_QUERY_XSK_UMEM dead code, from Jan. ====================
Showing the changes to include/linux (2 of 92 files). Show all
Unified · Split
| @@ -194,6 +194,7 @@ enum bpf_arg_type { · 193 unmodified lines | ||
| 194 | 194 | ARG_ANYTHING, /* any (initialized) argument is ok */ |
| 195 | 195 | ARG_PTR_TO_SOCKET, /* pointer to bpf_sock */ |
| 196 | 196 | ARG_PTR_TO_SPIN_LOCK, /* pointer to bpf_spin_lock */ |
| 197 | + ARG_PTR_TO_SOCK_COMMON, /* pointer to sock_common */ | |
| 197 | 198 | }; |
| 198 | 199 | |
| 199 | 200 | /* type of values returned from helper functions */ |
| @@ -203,6 +204,7 @@ enum bpf_return_type { · 3 unmodified lines | ||
| 203 | 204 | RET_PTR_TO_MAP_VALUE, /* returns a pointer to map elem value */ |
| 204 | 205 | RET_PTR_TO_MAP_VALUE_OR_NULL, /* returns a pointer to map elem value or NULL */ |
| 205 | 206 | RET_PTR_TO_SOCKET_OR_NULL, /* returns a pointer to a socket or NULL */ |
| 207 | + RET_PTR_TO_TCP_SOCK_OR_NULL, /* returns a pointer to a tcp_sock or NULL */ | |
| 206 | 208 | }; |
| 207 | 209 | |
| 208 | 210 | /* eBPF function prototype used by verifier to allow BPF_CALLs from eBPF programs |
| @@ -256,6 +258,10 @@ enum bpf_reg_type { · 47 unmodified lines | ||
| 256 | 258 | PTR_TO_FLOW_KEYS, /* reg points to bpf_flow_keys */ |
| 257 | 259 | PTR_TO_SOCKET, /* reg points to struct bpf_sock */ |
| 258 | 260 | PTR_TO_SOCKET_OR_NULL, /* reg points to struct bpf_sock or NULL */ |
| 261 | + PTR_TO_SOCK_COMMON, /* reg points to sock_common */ | |
| 262 | + PTR_TO_SOCK_COMMON_OR_NULL, /* reg points to sock_common or NULL */ | |
| 263 | + PTR_TO_TCP_SOCK, /* reg points to struct tcp_sock */ | |
| 264 | + PTR_TO_TCP_SOCK_OR_NULL, /* reg points to struct tcp_sock or NULL */ | |
| 259 | 265 | }; |
| 260 | 266 | |
| 261 | 267 | /* The information passed from prog-specific *_is_valid_access |
| @@ -767,8 +773,9 @@ int bpf_map_offload_get_next_key(struct bpf_map *map, · 505 unmodified lines | ||
| 767 | 773 | bool bpf_offload_prog_map_match(struct bpf_prog *prog, struct bpf_map *map); |
| 768 | 774 | |
| 769 | 775 | struct bpf_offload_dev * |
| 770 | −bpf_offload_dev_create(const struct bpf_prog_offload_ops *ops); | |
| 776 | +bpf_offload_dev_create(const struct bpf_prog_offload_ops *ops, void *priv); | |
| 771 | 777 | void bpf_offload_dev_destroy(struct bpf_offload_dev *offdev); |
| 778 | +void *bpf_offload_dev_priv(struct bpf_offload_dev *offdev); | |
| 772 | 779 | int bpf_offload_dev_netdev_register(struct bpf_offload_dev *offdev, |
| 773 | 780 | struct net_device *netdev); |
| 774 | 781 | void bpf_offload_dev_netdev_unregister(struct bpf_offload_dev *offdev, |
| @@ -920,6 +927,9 @@ void bpf_user_rnd_init_once(void); · 145 unmodified lines | ||
| 920 | 927 | u64 bpf_user_rnd_u32(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5); |
| 921 | 928 | |
| 922 | 929 | #if defined(CONFIG_NET) |
| 930 | +bool bpf_sock_common_is_valid_access(int off, int size, | |
| 931 | + enum bpf_access_type type, | |
| 932 | + struct bpf_insn_access_aux *info); | |
| 923 | 933 | bool bpf_sock_is_valid_access(int off, int size, enum bpf_access_type type, |
| 924 | 934 | struct bpf_insn_access_aux *info); |
| 925 | 935 | u32 bpf_sock_convert_ctx_access(enum bpf_access_type type, |
| @@ -928,6 +938,12 @@ u32 bpf_sock_convert_ctx_access(enum bpf_access_type type, · 2 unmodified lines | ||
| 928 | 938 | struct bpf_prog *prog, |
| 929 | 939 | u32 *target_size); |
| 930 | 940 | #else |
| 941 | +static inline bool bpf_sock_common_is_valid_access(int off, int size, | |
| 942 | + enum bpf_access_type type, | |
| 943 | + struct bpf_insn_access_aux *info) | |
| 944 | +{ | |
| 945 | + return false; | |
| 946 | +} | |
| 931 | 947 | static inline bool bpf_sock_is_valid_access(int off, int size, |
| 932 | 948 | enum bpf_access_type type, |
| 933 | 949 | struct bpf_insn_access_aux *info) |
| @@ -944,4 +960,31 @@ static inline u32 bpf_sock_convert_ctx_access(enum bpf_access_type type, · 10 unmodified lines | ||
| 944 | 960 | } |
| 945 | 961 | #endif |
| 946 | 962 | |
| 963 | +#ifdef CONFIG_INET | |
| 964 | +bool bpf_tcp_sock_is_valid_access(int off, int size, enum bpf_access_type type, | |
| 965 | + struct bpf_insn_access_aux *info); | |
| 966 | + | |
| 967 | +u32 bpf_tcp_sock_convert_ctx_access(enum bpf_access_type type, | |
| 968 | + const struct bpf_insn *si, | |
| 969 | + struct bpf_insn *insn_buf, | |
| 970 | + struct bpf_prog *prog, | |
| 971 | + u32 *target_size); | |
| 972 | +#else | |
| 973 | +static inline bool bpf_tcp_sock_is_valid_access(int off, int size, | |
| 974 | + enum bpf_access_type type, | |
| 975 | + struct bpf_insn_access_aux *info) | |
| 976 | +{ | |
| 977 | + return false; | |
| 978 | +} | |
| 979 | + | |
| 980 | +static inline u32 bpf_tcp_sock_convert_ctx_access(enum bpf_access_type type, | |
| 981 | + const struct bpf_insn *si, | |
| 982 | + struct bpf_insn *insn_buf, | |
| 983 | + struct bpf_prog *prog, | |
| 984 | + u32 *target_size) | |
| 985 | +{ | |
| 986 | + return 0; | |
| 987 | +} | |
| 988 | +#endif /* CONFIG_INET */ | |
| 989 | + | |
| 947 | 990 | #endif /* _LINUX_BPF_H */ |
| @@ -868,7 +868,6 @@ enum bpf_netdev_command { · 867 unmodified lines | ||
| 868 | 868 | /* BPF program for offload callbacks, invoked at program load time. */ |
| 869 | 869 | BPF_OFFLOAD_MAP_ALLOC, |
| 870 | 870 | BPF_OFFLOAD_MAP_FREE, |
| 871 | − XDP_QUERY_XSK_UMEM, | |
| 872 | 871 | XDP_SETUP_XSK_UMEM, |
| 873 | 872 | }; |
| 874 | 873 | |
| @@ -895,10 +894,10 @@ struct netdev_bpf { · 20 unmodified lines | ||
| 895 | 894 | struct { |
| 896 | 895 | struct bpf_offloaded_map *offmap; |
| 897 | 896 | }; |
| 898 | − /* XDP_QUERY_XSK_UMEM, XDP_SETUP_XSK_UMEM */ | |
| 897 | + /* XDP_SETUP_XSK_UMEM */ | |
| 899 | 898 | struct { |
| 900 | − struct xdp_umem *umem; /* out for query*/ | |
| 901 | − u16 queue_id; /* in for query */ | |
| 899 | + struct xdp_umem *umem; | |
| 900 | + u16 queue_id; | |
| 902 | 901 | } xsk; |
| 903 | 902 | }; |
| 904 | 903 | }; |