[PATCH mptcp-next v2 01/13] Squash to "bpf: Add bpf_mptcp_sched_ops"

Geliang Tang posted 13 patches 2 years, 6 months ago
Maintainers: Matthieu Baerts <matthieu.baerts@tessares.net>, Mat Martineau <martineau@kernel.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Andrii Nakryiko <andrii@kernel.org>, Mykola Lysenko <mykolal@fb.com>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Martin KaFai Lau <martin.lau@linux.dev>, Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>, John Fastabend <john.fastabend@gmail.com>, KP Singh <kpsingh@kernel.org>, Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>, Jiri Olsa <jolsa@kernel.org>, Shuah Khan <shuah@kernel.org>
[PATCH mptcp-next v2 01/13] Squash to "bpf: Add bpf_mptcp_sched_ops"
Posted by Geliang Tang 2 years, 6 months ago
Some code in net/ipv4/bpf_tcp_ca.c is removed by the commit
9f0265e921de ("bpf: Require only one of cong_avoid() and cong_control()
from a TCP CC"), sync this into net/mptcp/bpf.c.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 net/mptcp/bpf.c | 27 ---------------------------
 1 file changed, 27 deletions(-)

diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c
index c580add9c7f1..f388baf08d49 100644
--- a/net/mptcp/bpf.c
+++ b/net/mptcp/bpf.c
@@ -18,15 +18,9 @@
 
 #ifdef CONFIG_BPF_JIT
 extern struct bpf_struct_ops bpf_mptcp_sched_ops;
-extern struct btf *btf_vmlinux;
 static const struct btf_type *mptcp_sched_type __read_mostly;
 static u32 mptcp_sched_id;
 
-static u32 optional_sched_ops[] = {
-	offsetof(struct mptcp_sched_ops, init),
-	offsetof(struct mptcp_sched_ops, release),
-};
-
 static const struct bpf_func_proto *
 bpf_mptcp_sched_get_func_proto(enum bpf_func_id func_id,
 			       const struct bpf_prog *prog)
@@ -101,25 +95,12 @@ static int bpf_mptcp_sched_check_member(const struct btf_type *t,
 	return 0;
 }
 
-static bool is_optional_sched(u32 member_offset)
-{
-	unsigned int i;
-
-	for (i = 0; i < ARRAY_SIZE(optional_sched_ops); i++) {
-		if (member_offset == optional_sched_ops[i])
-			return true;
-	}
-
-	return false;
-}
-
 static int bpf_mptcp_sched_init_member(const struct btf_type *t,
 				       const struct btf_member *member,
 				       void *kdata, const void *udata)
 {
 	const struct mptcp_sched_ops *usched;
 	struct mptcp_sched_ops *sched;
-	int prog_fd;
 	u32 moff;
 
 	usched = (const struct mptcp_sched_ops *)udata;
@@ -136,14 +117,6 @@ static int bpf_mptcp_sched_init_member(const struct btf_type *t,
 		return 1;
 	}
 
-	if (!btf_type_resolve_func_ptr(btf_vmlinux, member->type, NULL))
-		return 0;
-
-	/* Ensure bpf_prog is provided for compulsory func ptr */
-	prog_fd = (int)(*(unsigned long *)(udata + moff));
-	if (!prog_fd && !is_optional_sched(moff))
-		return -EINVAL;
-
 	return 0;
 }
 
-- 
2.35.3