Skip to contentSkip to conversation

remove bpf_mptcp_subflow_queues_empty

PATCH In review Geliang Tang 3 participants 5 messages Jun 23

Subsystems (5)
lore
Share & tools
lore

Geliang Tang

author reviewer
#0 lore raw

cover remove bpf_mptcp_subflow_queues_empty

From: Geliang Tang <[email protected]>

This set removes bpf_mptcp_subflow_queues_empty() kfunc and updates burst scheduler to implement tcp_rtx_queue_empty() inline.

Geliang Tang (2):
Squash to "bpf: Export mptcp packet scheduler helpers" Squash to "selftests/bpf: Add bpf_burst scheduler & test"

 net/mptcp/bpf.c                                     | 6 ------
 tools/testing/selftests/bpf/progs/mptcp_bpf.h       | 1 +
 tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c | 9 +++++++--
 3 files changed, 8 insertions(+), 8 deletions(-)
Signature · 1 line
2.53.0
author reviewer
#1 lore raw

PATCH 1/2 Squash to "bpf: Export mptcp packet scheduler helpers"

From: Geliang Tang <[email protected]>

Remove bpf_mptcp_subflow_queues_empty() kfunc and its BTF ID. This kfunc is no longer used by any BPF scheduler after the burst scheduler was updated to implement tcp_rtx_queue_empty() inline.

---
 net/mptcp/bpf.c | 6 ------
 1 file changed, 6 deletions(-)
net/mptcp/bpf.c +0 -6
index 577b815775a2..0845061ddc65 100644
@@ -289,11 +289,6 @@ bpf_iter_mptcp_subflow_destroy(struct bpf_iter_mptcp_subflow *it)
 {
 }
 
-__bpf_kfunc static bool bpf_mptcp_subflow_queues_empty(struct sock *sk)
-{
-	return tcp_rtx_queue_empty(sk);
-}
-
 __bpf_kfunc static bool
 bpf_sk_stream_memory_free(const struct mptcp_subflow_context *subflow)
 {
@@ -327,7 +322,6 @@ BTF_ID_FLAGS(func, mptcp_subflow_active)
 BTF_ID_FLAGS(func, mptcp_set_timeout)
 BTF_ID_FLAGS(func, mptcp_wnd_end)
 BTF_ID_FLAGS(func, bpf_sk_stream_memory_free)
-BTF_ID_FLAGS(func, bpf_mptcp_subflow_queues_empty)
 BTF_ID_FLAGS(func, mptcp_pm_subflow_chk_stale, KF_SLEEPABLE)
 BTF_KFUNCS_END(bpf_mptcp_common_kfunc_ids)
 
Signature · 1 line
2.53.0
author reviewer
#2 lore raw

PATCH 2/2 Squash to "selftests/bpf: Add bpf_burst scheduler & test"

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

Implement tcp_rtx_queue_empty() inline in the burst scheduler using RB_EMPTY_ROOT(), and remove the dependency on the external kfunc bpf_mptcp_subflow_queues_empty(). Also include bpf_atomic.h for READ_ONCE() support.

---
 tools/testing/selftests/bpf/progs/mptcp_bpf.h       | 1 +
 tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/progs/mptcp_bpf.h +1 -0
index 4e901941d5dd..de450b2eaf0f 100644
@@ -3,6 +3,7 @@
 #define __MPTCP_BPF_H__
 
 #include "bpf_experimental.h"
+#include "bpf_atomic.h"
 
 /* list helpers from include/linux/list.h */
 static inline int list_is_head(const struct list_head *list,
tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c +7 -2
index 48c22f5bce32..8ff529d38a59 100644
@@ -19,12 +19,12 @@ struct bpf_subflow_send_info {
 #define SSK_MODE_MAX	2
 
 #define min(a, b) ((a) < (b) ? (a) : (b))
+#define RB_EMPTY_ROOT(root)  (READ_ONCE((root)->rb_node) == NULL)
 
 extern bool mptcp_subflow_active(struct mptcp_subflow_context *subflow) __ksym;
 extern void mptcp_set_timeout(struct sock *sk) __ksym;
 extern __u64 mptcp_wnd_end(const struct mptcp_sock *msk) __ksym;
 extern bool bpf_sk_stream_memory_free(const struct mptcp_subflow_context *subflow) __ksym;
-extern bool bpf_mptcp_subflow_queues_empty(struct sock *sk) __ksym;
 extern void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk) __ksym;
 
 static __always_inline __u64 div_u64(__u64 dividend, __u32 divisor)
@@ -39,9 +39,14 @@ static __always_inline bool tcp_write_queue_empty(struct sock *sk)
 	return tp ? tp->write_seq == tp->snd_nxt : true;
 }
 
+static __always_inline bool tcp_rtx_queue_empty(const struct sock *sk)
+{
+	return RB_EMPTY_ROOT(&sk->tcp_rtx_queue);
+}
+
 static __always_inline bool tcp_rtx_and_write_queues_empty(struct sock *sk)
 {
-	return bpf_mptcp_subflow_queues_empty(sk) && tcp_write_queue_empty(sk);
+	return tcp_rtx_queue_empty(sk) && tcp_write_queue_empty(sk);
 }
 
 SEC("struct_ops")
Signature · 1 line
2.53.0
#3 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 (except selftest_mptcp_join): Success! ✅
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Success! ✅
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/27999507296

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

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)

maintainer
#4 lore raw
In reply to Geliang Tang

Hi Geliang,

Quoted 5 lines · Geliang Tang

From: Geliang Tang <[email protected]>

This set removes bpf_mptcp_subflow_queues_empty() kfunc and updates burst scheduler to implement tcp_rtx_queue_empty() inline.

Quoted 8 lines

Geliang Tang (2):
Squash to "bpf: Export mptcp packet scheduler helpers" Squash to "selftests/bpf: Add bpf_burst scheduler & test"

 net/mptcp/bpf.c                                     | 6 ------
 tools/testing/selftests/bpf/progs/mptcp_bpf.h       | 1 +
 tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c | 9 +++++++--
 3 files changed, 8 insertions(+), 8 deletions(-)

Thanks!

New patches for t/upstream:
- d3a97b387059: "squashed" patch 1/2 in "bpf: Export mptcp packet scheduler helpers"
- 493ba0146d5d: "squashed" patch 2/2 in "selftests/bpf: Add bpf_burst scheduler & test"
- Results: 3e97a465b882..9fa996efa8d3 (export)

Tests are now in progress:

- export: https://github.com/multipath-tcp/mptcp_net-next/commit/24b2dd50c2614d8ac7086cb7c59f52523c9103f7/checks

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.