forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Squash to "selftests/bpf: Add bpf scheduler test" - drop has_bytes_sent
Drop ss_search() and has_bytes_sent(), add a new bpf program to check the bytes_sent. Signed-off-by: Geliang Tang <[email protected]>
- Loading branch information
1 parent
81759bc
commit 48db7fb
Showing
2 changed files
with
62 additions
and
22 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,36 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* Copyright (c) 2024, Kylin Software */ | ||
|
||
/* vmlinux.h, bpf_helpers.h and other 'define' */ | ||
#include "bpf_tracing_net.h" | ||
#include "mptcp_bpf.h" | ||
|
||
char _license[] SEC("license") = "GPL"; | ||
u64 bytes_sent_1 = 0; | ||
u64 bytes_sent_2 = 0; | ||
int pid; | ||
|
||
SEC("fexit/mptcp_sched_get_send") | ||
int BPF_PROG(trace_mptcp_sched_get_send, struct mptcp_sock *msk) | ||
{ | ||
struct mptcp_subflow_context *subflow; | ||
|
||
if (bpf_get_current_pid_tgid() >> 32 != pid) | ||
return 0; | ||
|
||
mptcp_for_each_subflow(msk, subflow) { | ||
struct tcp_sock *tp; | ||
struct sock *ssk; | ||
|
||
subflow = bpf_core_cast(subflow, struct mptcp_subflow_context); | ||
ssk = mptcp_subflow_tcp_sock(subflow); | ||
tp = bpf_core_cast(ssk, struct tcp_sock); | ||
|
||
if (subflow->subflow_id == 1) | ||
bytes_sent_1 = tp->bytes_sent; | ||
else if (subflow->subflow_id == 2) | ||
bytes_sent_2 = tp->bytes_sent; | ||
} | ||
|
||
return 0; | ||
} |