diff mbox series

[mptcp-next,3/8] Squash to "selftests/bpf: Add bpf_bkup scheduler & test"

Message ID 2dca04396fe589024c2f373d4531f0d1a50c7d98.1732153672.git.tanggeliang@kylinos.cn (mailing list archive)
State New
Headers show
Series split get_subflow interface into two | expand

Checks

Context Check Description
matttbe/checkpatch success total: 0 errors, 0 warnings, 0 checks, 38 lines checked
matttbe/shellcheck success MPTCP selftests files have not been modified
matttbe/build success Build and static analysis OK
matttbe/KVM_Validation__normal success Success! ✅
matttbe/KVM_Validation__debug success Success! ✅
matttbe/KVM_Validation__btf-normal__only_bpftest_all_ success Success! ✅
matttbe/KVM_Validation__btf-debug__only_bpftest_all_ success Success! ✅

Commit Message

Geliang Tang Nov. 21, 2024, 2:45 a.m. UTC
From: Geliang Tang <tanggeliang@kylinos.cn>

Split get_subflow() interface into two: get_send() and get_retrans().

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 .../selftests/bpf/progs/mptcp_bpf_bkup.c      | 24 +++++++++++++++----
 1 file changed, 19 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_bkup.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_bkup.c
index 296f0318d843..41e6639253a4 100644
--- a/tools/testing/selftests/bpf/progs/mptcp_bpf_bkup.c
+++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_bkup.c
@@ -16,9 +16,8 @@  void BPF_PROG(mptcp_sched_bkup_release, struct mptcp_sock *msk)
 {
 }
 
-SEC("struct_ops")
-int BPF_PROG(bpf_bkup_get_subflow, struct mptcp_sock *msk,
-	     struct mptcp_sched_data *data)
+static int bpf_bkup_get_subflow(struct mptcp_sock *msk,
+				struct mptcp_sched_data *data)
 {
 	int nr = -1;
 
@@ -43,10 +42,25 @@  int BPF_PROG(bpf_bkup_get_subflow, struct mptcp_sock *msk,
 	return 0;
 }
 
-SEC(".struct_ops")
+SEC("struct_ops")
+int BPF_PROG(bpf_bkup_get_send, struct mptcp_sock *msk,
+	     struct mptcp_sched_data *data)
+{
+	return bpf_bkup_get_subflow(msk, data);
+}
+
+SEC("struct_ops")
+int BPF_PROG(bpf_bkup_get_retrans, struct mptcp_sock *msk,
+	     struct mptcp_sched_data *data)
+{
+	return bpf_bkup_get_subflow(msk, data);
+}
+
+SEC(".struct_ops.link")
 struct mptcp_sched_ops bkup = {
 	.init		= (void *)mptcp_sched_bkup_init,
 	.release	= (void *)mptcp_sched_bkup_release,
-	.get_subflow	= (void *)bpf_bkup_get_subflow,
+	.get_send	= (void *)bpf_bkup_get_send,
+	.get_retrans	= (void *)bpf_bkup_get_retrans,
 	.name		= "bpf_bkup",
 };