Skip to content

Commit

Permalink
selftests/bpf: mptcp RR: send 1 MSS on each subflow
Browse files Browse the repository at this point in the history
This uses the helper and APIs to schedule one MSS on alternance
on each subflow.

This now really acts at a round-robin scheduler: packets are equally
balanced on each path

Signed-off-by: Gregory Detal <[email protected]>
  • Loading branch information
gdetal authored and intel-lab-lkp committed May 27, 2024
1 parent 8bb7680 commit 342df98
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions tools/testing/selftests/bpf/progs/mptcp_bpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <bpf/bpf_core_read.h>

#define MPTCP_SUBFLOWS_MAX 8
#define MPTCP_SCHED_FLAG_RESCHEDULE (1 << 0)

extern void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow,
bool scheduled) __ksym;
Expand Down
18 changes: 18 additions & 0 deletions tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,28 @@ int BPF_PROG(bpf_rr_get_subflow, struct mptcp_sock *msk,
return 0;
}

SEC("struct_ops")
void BPF_PROG(bpf_rr_push, struct mptcp_sock *msk,
struct mptcp_subflow_context *subflow,
struct mptcp_sched_chunk *chunk)
{
struct tcp_sock *tp = bpf_skc_to_tcp_sock(mptcp_subflow_tcp_sock(subflow));

if (!tp) {
/* Should not happen, in that case let default behavior. */
return;
}

/* Make sure to reschedule for each MSS. */
chunk->limit = tp->mss_cache;
chunk->flags |= MPTCP_SCHED_FLAG_RESCHEDULE;
}

SEC(".struct_ops")
struct mptcp_sched_ops rr = {
.init = (void *)mptcp_sched_rr_init,
.release = (void *)mptcp_sched_rr_release,
.get_subflow = (void *)bpf_rr_get_subflow,
.push = (void *)bpf_rr_push,
.name = "bpf_rr",
};

0 comments on commit 342df98

Please sign in to comment.