From 4ad7e2ae624d9ba5c1b58830403b772b543e9a83 Mon Sep 17 00:00:00 2001 From: Geliang Tang Date: Sat, 21 Dec 2024 19:15:12 +0800 Subject: [PATCH] TODO Signed-off-by: Geliang Tang --- net/mptcp/sched.c | 2 ++ .../selftests/bpf/progs/mptcp_bpf_bkup.c | 17 +++-------------- .../selftests/bpf/progs/mptcp_bpf_first.c | 17 +++-------------- .../testing/selftests/bpf/progs/mptcp_bpf_red.c | 17 +++-------------- .../testing/selftests/bpf/progs/mptcp_bpf_rr.c | 17 +++-------------- .../selftests/bpf/progs/mptcp_bpf_stale.c | 17 +++-------------- 6 files changed, 17 insertions(+), 70 deletions(-) diff --git a/net/mptcp/sched.c b/net/mptcp/sched.c index 87aa291fed74..e8130e5ccb07 100644 --- a/net/mptcp/sched.c +++ b/net/mptcp/sched.c @@ -209,5 +209,7 @@ int mptcp_sched_get_retrans(struct mptcp_sock *msk) if (msk->sched == &mptcp_sched_default || !msk->sched) return mptcp_sched_default_get_retrans(msk); + if (!msk->sched->get_retrans) + return msk->sched->get_send(msk); return msk->sched->get_retrans(msk); } diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_bkup.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_bkup.c index 043ba32129b7..c3ea87ff89fa 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_bkup.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_bkup.c @@ -16,7 +16,8 @@ void BPF_PROG(mptcp_sched_bkup_release, struct mptcp_sock *msk) { } -static int bpf_bkup_get_subflow(struct mptcp_sock *msk) +SEC("struct_ops") +int BPF_PROG(bpf_bkup_get_send, struct mptcp_sock *msk) { struct mptcp_subflow_context *subflow; @@ -31,23 +32,11 @@ static int bpf_bkup_get_subflow(struct mptcp_sock *msk) return 0; } -SEC("struct_ops") -int BPF_PROG(bpf_bkup_get_send, struct mptcp_sock *msk) -{ - return bpf_bkup_get_subflow(msk); -} - -SEC("struct_ops") -int BPF_PROG(bpf_bkup_get_retrans, struct mptcp_sock *msk) -{ - return bpf_bkup_get_subflow(msk); -} - SEC(".struct_ops.link") struct mptcp_sched_ops bkup = { .init = (void *)mptcp_sched_bkup_init, .release = (void *)mptcp_sched_bkup_release, .get_send = (void *)bpf_bkup_get_send, - .get_retrans = (void *)bpf_bkup_get_retrans, + //.get_retrans = (void *)bpf_bkup_get_send, .name = "bpf_bkup", }; diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_first.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_first.c index ad68d0803163..025a78cb2d88 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_first.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_first.c @@ -16,7 +16,8 @@ void BPF_PROG(mptcp_sched_first_release, struct mptcp_sock *msk) { } -static int bpf_first_get_subflow(struct mptcp_sock *msk) +SEC("struct_ops") +int BPF_PROG(bpf_first_get_send, struct mptcp_sock *msk) { struct mptcp_subflow_context *subflow; @@ -28,23 +29,11 @@ static int bpf_first_get_subflow(struct mptcp_sock *msk) return 0; } -SEC("struct_ops") -int BPF_PROG(bpf_first_get_send, struct mptcp_sock *msk) -{ - return bpf_first_get_subflow(msk); -} - -SEC("struct_ops") -int BPF_PROG(bpf_first_get_retrans, struct mptcp_sock *msk) -{ - return bpf_first_get_subflow(msk); -} - SEC(".struct_ops.link") struct mptcp_sched_ops first = { .init = (void *)mptcp_sched_first_init, .release = (void *)mptcp_sched_first_release, .get_send = (void *)bpf_first_get_send, - .get_retrans = (void *)bpf_first_get_retrans, + //.get_retrans = (void *)bpf_first_get_send, .name = "bpf_first", }; diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_red.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_red.c index 9b44931bb743..b3ac3dab1ef6 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_red.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_red.c @@ -16,7 +16,8 @@ void BPF_PROG(mptcp_sched_red_release, struct mptcp_sock *msk) { } -static int bpf_red_get_subflow(struct mptcp_sock *msk) +SEC("struct_ops") +int BPF_PROG(bpf_red_get_send, struct mptcp_sock *msk) { struct mptcp_subflow_context *subflow; @@ -26,23 +27,11 @@ static int bpf_red_get_subflow(struct mptcp_sock *msk) return 0; } -SEC("struct_ops") -int BPF_PROG(bpf_red_get_send, struct mptcp_sock *msk) -{ - return bpf_red_get_subflow(msk); -} - -SEC("struct_ops") -int BPF_PROG(bpf_red_get_retrans, struct mptcp_sock *msk) -{ - return bpf_red_get_subflow(msk); -} - SEC(".struct_ops.link") struct mptcp_sched_ops red = { .init = (void *)mptcp_sched_red_init, .release = (void *)mptcp_sched_red_release, .get_send = (void *)bpf_red_get_send, - .get_retrans = (void *)bpf_red_get_retrans, + //.get_retrans = (void *)bpf_red_get_send, .name = "bpf_red", }; diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c index c3823ed20ac8..313f4c485efa 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c @@ -30,7 +30,8 @@ void BPF_PROG(mptcp_sched_rr_release, struct mptcp_sock *msk) bpf_sk_storage_delete(&mptcp_rr_map, msk); } -static int bpf_rr_get_subflow(struct mptcp_sock *msk) +SEC("struct_ops") +int BPF_PROG(bpf_rr_get_send, struct mptcp_sock *msk) { struct mptcp_subflow_context *subflow, *next; struct mptcp_rr_storage *ptr; @@ -65,23 +66,11 @@ static int bpf_rr_get_subflow(struct mptcp_sock *msk) return 0; } -SEC("struct_ops") -int BPF_PROG(bpf_rr_get_send, struct mptcp_sock *msk) -{ - return bpf_rr_get_subflow(msk); -} - -SEC("struct_ops") -int BPF_PROG(bpf_rr_get_retrans, struct mptcp_sock *msk) -{ - return bpf_rr_get_subflow(msk); -} - SEC(".struct_ops.link") struct mptcp_sched_ops rr = { .init = (void *)mptcp_sched_rr_init, .release = (void *)mptcp_sched_rr_release, .get_send = (void *)bpf_rr_get_send, - .get_retrans = (void *)bpf_rr_get_retrans, + //.get_retrans = (void *)bpf_rr_get_send, .name = "bpf_rr", }; diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_stale.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_stale.c index 8ce61c1c4e1c..af93aad84649 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_stale.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_stale.c @@ -102,7 +102,8 @@ void BPF_PROG(mptcp_sched_stale_release, struct mptcp_sock *msk) bpf_sk_storage_delete(&mptcp_stale_map, msk); } -static int bpf_stale_get_subflow(struct mptcp_sock *msk) +SEC("struct_ops") +int BPF_PROG(bpf_stale_get_send, struct mptcp_sock *msk) { struct mptcp_subflow_context *subflow; struct mptcp_stale_storage *storage; @@ -139,23 +140,11 @@ static int bpf_stale_get_subflow(struct mptcp_sock *msk) return 0; } -SEC("struct_ops") -int BPF_PROG(bpf_stale_get_send, struct mptcp_sock *msk) -{ - return bpf_stale_get_subflow(msk); -} - -SEC("struct_ops") -int BPF_PROG(bpf_stale_get_retrans, struct mptcp_sock *msk) -{ - return bpf_stale_get_subflow(msk); -} - SEC(".struct_ops.link") struct mptcp_sched_ops stale = { .init = (void *)mptcp_sched_stale_init, .release = (void *)mptcp_sched_stale_release, .get_send = (void *)bpf_stale_get_send, - .get_retrans = (void *)bpf_stale_get_retrans, + //.get_retrans = (void *)bpf_stale_get_send, .name = "bpf_stale", };