-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
selftests/bpf: Add bpf_red scheduler & test
This patch implements the redundant BPF MPTCP scheduler, named bpf_red, which sends all packets redundantly on all available subflows. Using MPTCP_SCHED_TEST macro to add a new test for this bpf_red scheduler, the arguments "1 1" means data has been sent on both net devices. Run this test by RUN_MPTCP_TEST macro. Signed-off-by: Geliang Tang <[email protected]> Reviewed-by: Mat Martineau <[email protected]> Reviewed-by: Matthieu Baerts (NGI0) <[email protected]>
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* Copyright (c) 2022, SUSE. */ | ||
|
||
#include "mptcp_bpf.h" | ||
#include <bpf/bpf_tracing.h> | ||
|
||
char _license[] SEC("license") = "GPL"; | ||
|
||
SEC("struct_ops") | ||
void BPF_PROG(mptcp_sched_red_init, struct mptcp_sock *msk) | ||
{ | ||
} | ||
|
||
SEC("struct_ops") | ||
void BPF_PROG(mptcp_sched_red_release, struct mptcp_sock *msk) | ||
{ | ||
} | ||
|
||
SEC("struct_ops") | ||
int BPF_PROG(bpf_red_get_send, struct mptcp_sock *msk, | ||
struct mptcp_sched_data *data) | ||
{ | ||
for (int i = 0; i < data->subflows && i < MPTCP_SUBFLOWS_MAX; i++) { | ||
if (!bpf_mptcp_subflow_ctx_by_pos(data, i)) | ||
break; | ||
|
||
mptcp_subflow_set_scheduled(bpf_mptcp_subflow_ctx_by_pos(data, i), true); | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
SEC(".struct_ops") | ||
struct mptcp_sched_ops red = { | ||
.init = (void *)mptcp_sched_red_init, | ||
.release = (void *)mptcp_sched_red_release, | ||
.get_send = (void *)bpf_red_get_send, | ||
.name = "bpf_red", | ||
}; |