Skip to content

Commit 17edea2

Browse files
Cong WangAlexei Starovoitov
authored andcommitted
sock_map: Relax config dependency to CONFIG_NET
Currently sock_map still has Kconfig dependency on CONFIG_INET, but there is no actual functional dependency on it after we introduce ->psock_update_sk_prot(). We have to extend it to CONFIG_NET now as we are going to support AF_UNIX. Signed-off-by: Cong Wang <cong.wang@bytedance.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20210704190252.11866-2-xiyou.wangcong@gmail.com
1 parent 1554a08 commit 17edea2

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

include/linux/bpf.h

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,6 +1887,12 @@ void bpf_map_offload_map_free(struct bpf_map *map);
18871887
int bpf_prog_test_run_syscall(struct bpf_prog *prog,
18881888
const union bpf_attr *kattr,
18891889
union bpf_attr __user *uattr);
1890+
1891+
int sock_map_get_from_fd(const union bpf_attr *attr, struct bpf_prog *prog);
1892+
int sock_map_prog_detach(const union bpf_attr *attr, enum bpf_prog_type ptype);
1893+
int sock_map_update_elem_sys(struct bpf_map *map, void *key, void *value, u64 flags);
1894+
void sock_map_unhash(struct sock *sk);
1895+
void sock_map_close(struct sock *sk, long timeout);
18901896
#else
18911897
static inline int bpf_prog_offload_init(struct bpf_prog *prog,
18921898
union bpf_attr *attr)
@@ -1919,24 +1925,6 @@ static inline int bpf_prog_test_run_syscall(struct bpf_prog *prog,
19191925
{
19201926
return -ENOTSUPP;
19211927
}
1922-
#endif /* CONFIG_NET && CONFIG_BPF_SYSCALL */
1923-
1924-
#if defined(CONFIG_INET) && defined(CONFIG_BPF_SYSCALL)
1925-
int sock_map_get_from_fd(const union bpf_attr *attr, struct bpf_prog *prog);
1926-
int sock_map_prog_detach(const union bpf_attr *attr, enum bpf_prog_type ptype);
1927-
int sock_map_update_elem_sys(struct bpf_map *map, void *key, void *value, u64 flags);
1928-
void sock_map_unhash(struct sock *sk);
1929-
void sock_map_close(struct sock *sk, long timeout);
1930-
1931-
void bpf_sk_reuseport_detach(struct sock *sk);
1932-
int bpf_fd_reuseport_array_lookup_elem(struct bpf_map *map, void *key,
1933-
void *value);
1934-
int bpf_fd_reuseport_array_update_elem(struct bpf_map *map, void *key,
1935-
void *value, u64 map_flags);
1936-
#else
1937-
static inline void bpf_sk_reuseport_detach(struct sock *sk)
1938-
{
1939-
}
19401928

19411929
#ifdef CONFIG_BPF_SYSCALL
19421930
static inline int sock_map_get_from_fd(const union bpf_attr *attr,
@@ -1956,7 +1944,21 @@ static inline int sock_map_update_elem_sys(struct bpf_map *map, void *key, void
19561944
{
19571945
return -EOPNOTSUPP;
19581946
}
1947+
#endif /* CONFIG_BPF_SYSCALL */
1948+
#endif /* CONFIG_NET && CONFIG_BPF_SYSCALL */
19591949

1950+
#if defined(CONFIG_INET) && defined(CONFIG_BPF_SYSCALL)
1951+
void bpf_sk_reuseport_detach(struct sock *sk);
1952+
int bpf_fd_reuseport_array_lookup_elem(struct bpf_map *map, void *key,
1953+
void *value);
1954+
int bpf_fd_reuseport_array_update_elem(struct bpf_map *map, void *key,
1955+
void *value, u64 map_flags);
1956+
#else
1957+
static inline void bpf_sk_reuseport_detach(struct sock *sk)
1958+
{
1959+
}
1960+
1961+
#ifdef CONFIG_BPF_SYSCALL
19601962
static inline int bpf_fd_reuseport_array_lookup_elem(struct bpf_map *map,
19611963
void *key, void *value)
19621964
{

kernel/bpf/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ config BPF_SYSCALL
2929
select IRQ_WORK
3030
select TASKS_TRACE_RCU
3131
select BINARY_PRINTF
32-
select NET_SOCK_MSG if INET
32+
select NET_SOCK_MSG if NET
3333
default n
3434
help
3535
Enable the bpf() system call that allows to manipulate BPF programs

net/core/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ obj-$(CONFIG_HWBM) += hwbm.o
3333
obj-$(CONFIG_NET_DEVLINK) += devlink.o
3434
obj-$(CONFIG_GRO_CELLS) += gro_cells.o
3535
obj-$(CONFIG_FAILOVER) += failover.o
36-
ifeq ($(CONFIG_INET),y)
3736
obj-$(CONFIG_NET_SOCK_MSG) += skmsg.o
3837
obj-$(CONFIG_BPF_SYSCALL) += sock_map.o
39-
endif
4038
obj-$(CONFIG_BPF_SYSCALL) += bpf_sk_storage.o

0 commit comments

Comments
 (0)