From: Geliang Tang <geliang.tang@suse.com>
To: mptcp@lists.linux.dev
Cc: Geliang Tang <geliang.tang@suse.com>
Subject: [PATCH mptcp-next v10 4/5] selftests/bpf: Add bpf_red scheduler
Date: Thu, 30 Jun 2022 16:50:53 +0800 [thread overview]
Message-ID: <2a4bfa0a78bcc5ef6986a271de12457d04c61b06.1656578856.git.geliang.tang@suse.com> (raw)
In-Reply-To: <cover.1656578856.git.geliang.tang@suse.com>
This patch implements the redundant BPF MPTCP scheduler, named bpf_red,
which sends all packets redundantly on all available subflows.
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
.../selftests/bpf/progs/mptcp_bpf_red.c | 36 +++++++++++++++++++
1 file changed, 36 insertions(+)
create mode 100644 tools/testing/selftests/bpf/progs/mptcp_bpf_red.c
diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_red.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_red.c
new file mode 100644
index 000000000000..58f90473e495
--- /dev/null
+++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_red.c
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2022, SUSE. */
+
+#include <linux/bpf.h>
+#include "bpf_tcp_helpers.h"
+
+char _license[] SEC("license") = "GPL";
+
+SEC("struct_ops/mptcp_sched_red_init")
+void BPF_PROG(mptcp_sched_red_init, const struct mptcp_sock *msk)
+{
+}
+
+SEC("struct_ops/mptcp_sched_red_release")
+void BPF_PROG(mptcp_sched_red_release, const struct mptcp_sock *msk)
+{
+}
+
+void BPF_STRUCT_OPS(bpf_red_get_subflow, const struct mptcp_sock *msk,
+ struct mptcp_sched_data *data)
+{
+ for (int i = 0; i < MPTCP_SUBFLOWS_MAX; i++) {
+ if (!data->contexts[i])
+ break;
+
+ mptcp_subflow_set_scheduled(data->contexts[i], true);
+ }
+}
+
+SEC(".struct_ops")
+struct mptcp_sched_ops red = {
+ .init = (void *)mptcp_sched_red_init,
+ .release = (void *)mptcp_sched_red_release,
+ .get_subflow = (void *)bpf_red_get_subflow,
+ .name = "bpf_red",
+};
--
2.35.3
next prev parent reply other threads:[~2022-06-30 8:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-30 8:50 [PATCH mptcp-next v10 0/5] BPF redundant scheduler Geliang Tang
2022-06-30 8:50 ` [PATCH mptcp-next v10 1/5] Squash to "mptcp: add get_subflow wrappers" Geliang Tang
2022-06-30 8:50 ` [PATCH mptcp-next v10 2/5] mptcp: redundant subflows push pending Geliang Tang
2022-07-01 21:01 ` Mat Martineau
2022-06-30 8:50 ` [PATCH mptcp-next v10 3/5] mptcp: redundant subflows retrans support Geliang Tang
2022-06-30 8:50 ` Geliang Tang [this message]
2022-06-30 8:50 ` [PATCH mptcp-next v10 5/5] selftests/bpf: Add bpf_red test Geliang Tang
2022-06-30 10:32 ` selftests/bpf: Add bpf_red test: Tests Results MPTCP CI
2022-06-30 12:34 ` Geliang Tang
2022-07-01 19:16 ` Mat Martineau
2022-07-01 21:05 ` Mat Martineau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2a4bfa0a78bcc5ef6986a271de12457d04c61b06.1656578856.git.geliang.tang@suse.com \
--to=geliang.tang@suse.com \
--cc=mptcp@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).