Skip to content

Commit

Permalink
selftests/bpf: mptcp tracepoint tests
Browse files Browse the repository at this point in the history
Signed-off-by: Geliang Tang <[email protected]>
  • Loading branch information
Geliang Tang committed Oct 10, 2024
1 parent ccf9015 commit d20f409
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/trace/events/mptcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ TRACE_EVENT(mptcp_subflow_get_send,
TP_ARGS(subflow),

TP_STRUCT__entry(
__field(struct mptcp_sock *, msk)
__field(bool, active)
__field(bool, free)
__field(u32, snd_wnd)
Expand All @@ -42,6 +43,7 @@ TRACE_EVENT(mptcp_subflow_get_send,
__entry->free = 0;

ssk = mptcp_subflow_tcp_sock(subflow);
__entry->msk = mptcp_sk(mptcp_subflow_ctx(ssk)->conn);
if (ssk && sk_fullsock(ssk)) {
__entry->snd_wnd = tcp_sk(ssk)->snd_wnd;
__entry->pace = READ_ONCE(ssk->sk_pacing_rate);
Expand Down
16 changes: 16 additions & 0 deletions tools/testing/selftests/bpf/progs/mptcp_bpf_iters_subflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,19 @@ int BPF_PROG(trace_mptcp_sched_get_send, struct mptcp_sock *msk)

return 0;
}

/* tools/testing/selftests/bpf/tools/include/vmlinux.h */
SEC("tracepoint/mptcp/mptcp_subflow_get_send")
int trace_get_send(struct trace_event_raw_mptcp_subflow_get_send *ctx)
{
struct mptcp_sock *msk = bpf_core_cast(ctx->msk, struct mptcp_sock);
struct mptcp_subflow_context *subflow;
int i = 0;

mptcp_for_each_subflow(msk, subflow) {
bpf_printk("bpf_iter tracepoint i=%d subflows=%u", i++, msk->pm.subflows);
}

bpf_printk("trace_get_send snd_wnd=%u token=%u", ctx->snd_wnd, msk->token);
return 0;
}

0 comments on commit d20f409

Please sign in to comment.