Skip to contentSkip to conversation

fixes for "add mptcp_subflow bpf_iter" v10

PATCH In review Geliang Tang 2 participants 5 messages Oct 17, 2024

Subsystems (5)
lore
Share & tools
lore

Geliang Tang

author reviewer
#0 lore raw

v2 cover fixes for "add mptcp_subflow bpf_iter" v10

From: Geliang Tang <[email protected]>

v2:
- drop unused variable 'err'.

There are two building errors in v10:

progs/mptcp_bpf_iters.c:24:8: error: call to undeclared function 'bpf_mptcp_sk'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
24 | msk = bpf_mptcp_sk((struct sock *)sk);
| ^
progs/mptcp_bpf_iters.c:24:6: error: incompatible integer to pointer conversion assigning to 'struct mptcp_sock *' from 'int' [-Wint-conversion]
24 | msk = bpf_mptcp_sk((struct sock *)sk);

tools/testing/selftests/bpf/prog_tests/mptcp.c: In function 'test_iters_subflow':
tools/testing/selftests/bpf/prog_tests/mptcp.c:546:13: error: unused variable 'err' [-Werror=unused-variable]
546 | int err;
| ^~~
TEST-OBJ [test_progs] pe_preserve_elems.test.o

bpf_mptcp_sk() definition is missing. It will be used in patch 4. An unused variable 'err' needs to be dropped.

Depends on:
- "add mptcp_subflow bpf_iter" v10

Based-on: <[email protected]>

Geliang Tang (3):
Squash to "bpf: Register mptcp common kfunc set" Squash to "selftests/bpf: Add mptcp_subflow bpf_iter test prog" Squash to "selftests/bpf: Add mptcp_subflow bpf_iter subtest"

 net/mptcp/bpf.c                                | 6 ++++++
 tools/testing/selftests/bpf/prog_tests/mptcp.c | 1 -
 tools/testing/selftests/bpf/progs/mptcp_bpf.h  | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)
Signature · 1 line
2.43.0
author reviewer
#1 lore raw

PATCH v2 1/3 Squash to "bpf: Register mptcp common kfunc set"

From: Geliang Tang <[email protected]>

bpf_mptcp_sk() definition is missing. It will be used in patch 4.

Please update the commit log:

'''
MPTCP helper mptcp_sk() is used to convert struct sock to mptcp_sock. Helpers mptcp_subflow_ctx() and mptcp_subflow_tcp_sock() are used to convert between struct mptcp_subflow_context and sock. They all will be used in MPTCP BPF programs too. This patch defines corresponding wrappers of them, and put the wrappers into mptcp common kfunc set and register the set with the flag BPF_PROG_TYPE_UNSPEC to let them accessible to all types of BPF programs.
'''

---
 net/mptcp/bpf.c | 6 ++++++
 1 file changed, 6 insertions(+)
net/mptcp/bpf.c +6 -0
index a2fd62c2777a..1ad7f703abb2 100644
@@ -216,6 +216,11 @@ struct bpf_iter_mptcp_subflow_kern {
 
 __bpf_kfunc_start_defs();
 
+__bpf_kfunc static struct mptcp_sock *bpf_mptcp_sk(struct sock *sk)
+{
+	return mptcp_sk(sk);
+}
+
 __bpf_kfunc static struct mptcp_subflow_context *
 bpf_mptcp_subflow_ctx(const struct sock *sk)
 {
@@ -291,6 +296,7 @@ __bpf_kfunc static bool bpf_mptcp_subflow_queues_empty(struct sock *sk)
 __bpf_kfunc_end_defs();
 
 BTF_KFUNCS_START(bpf_mptcp_common_kfunc_ids)
+BTF_ID_FLAGS(func, bpf_mptcp_sk)
 BTF_ID_FLAGS(func, bpf_mptcp_subflow_ctx)
 BTF_ID_FLAGS(func, bpf_mptcp_subflow_tcp_sock)
 BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_new, KF_ITER_NEW | KF_TRUSTED_ARGS)
Signature · 1 line
2.43.0
author reviewer
#2 lore raw

PATCH v2 2/3 Squash to "selftests/bpf: Add mptcp_subflow bpf_iter test prog"

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

Export bpf_mptcp_sk(), it is used in this test program.

---
 tools/testing/selftests/bpf/progs/mptcp_bpf.h | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/progs/mptcp_bpf.h +1 -0
index b1f6e1fb467e..3b20cfd44505 100644
@@ -46,6 +46,7 @@ mptcp_subflow_tcp_sock(const struct mptcp_subflow_context *subflow)
 extern struct mptcp_sock *bpf_mptcp_sock_acquire(struct mptcp_sock *msk) __ksym;
 extern void bpf_mptcp_sock_release(struct mptcp_sock *msk) __ksym;
 
+extern struct mptcp_sock *bpf_mptcp_sk(struct sock *sk) __ksym;
 extern struct mptcp_subflow_context *
 bpf_mptcp_subflow_ctx(const struct sock *sk) __ksym;
 extern struct sock *
Signature · 1 line
2.43.0
author reviewer
#3 lore raw

PATCH v2 3/3 Squash to "selftests/bpf: Add mptcp_subflow bpf_iter subtest"

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

/home/tgl/mptcp_net-next/tools/testing/selftests/bpf/prog_tests/mptcp.c: In function 'test_iters_subflow':
/home/tgl/mptcp_net-next/tools/testing/selftests/bpf/prog_tests/mptcp.c:546:13: error: unused variable 'err' [-Werror=unused-variable]
546 | int err;
| ^~~
TEST-OBJ [test_progs] pe_preserve_elems.test.o

---
 tools/testing/selftests/bpf/prog_tests/mptcp.c | 1 -
 1 file changed, 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/mptcp.c +0 -1
index 6644fdaa10a5..7282e98a8f51 100644
@@ -543,7 +543,6 @@ static void test_iters_subflow(void)
 	struct mptcp_bpf_iters *skel;
 	struct nstoken *nstoken;
 	int cgroup_fd;
-	int err;
 
 	cgroup_fd = test__join_cgroup("/iters_subflow");
 	if (!ASSERT_OK_FD(cgroup_fd, "join_cgroup: iters_subflow"))
Signature · 1 line
2.43.0
#4 lore raw
In reply to Geliang Tang

Hi Geliang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal: Success! ✅
- KVM Validation: debug: Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/11383799550

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/5f1cca141423
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=900187

If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-normal

For more details:

https://github.com/multipath-tcp/mptcp-upstream-virtme-docker

Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)