Skip to content

Commit

Permalink
Squash to "selftests/bpf: Add bpf_first scheduler & test"
Browse files Browse the repository at this point in the history
Use the newly added bpf_for_each() helper to walk the conn_list.

Signed-off-by: Geliang Tang <[email protected]>
  • Loading branch information
Geliang Tang authored and intel-lab-lkp committed Oct 22, 2024
1 parent 1f3ce6e commit cc5a502
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 0 additions & 3 deletions tools/testing/selftests/bpf/progs/mptcp_bpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,4 @@ bpf_mptcp_subflow_tcp_sock(const struct mptcp_subflow_context *subflow) __ksym;
extern void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow,
bool scheduled) __ksym;

extern struct mptcp_subflow_context *
bpf_mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned int pos) __ksym;

#endif
10 changes: 8 additions & 2 deletions tools/testing/selftests/bpf/progs/mptcp_bpf_first.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ SEC("struct_ops")
int BPF_PROG(bpf_first_get_subflow, struct mptcp_sock *msk,
struct mptcp_sched_data *data)
{
mptcp_subflow_set_scheduled(bpf_mptcp_subflow_ctx_by_pos(data, 0), true);
struct mptcp_subflow_context *subflow;

bpf_for_each(mptcp_subflow, subflow, msk) {
mptcp_subflow_set_scheduled(subflow, true);
break;
}

return 0;
}

SEC(".struct_ops")
SEC(".struct_ops.link")
struct mptcp_sched_ops first = {
.init = (void *)mptcp_sched_first_init,
.release = (void *)mptcp_sched_first_release,
Expand Down

0 comments on commit cc5a502

Please sign in to comment.