Linux Audio

Check our new training course

Loading...
v6.13.7
 1// SPDX-License-Identifier: GPL-2.0
 2
 3#include "bpf_tracing_net.h"
 
 4#include <bpf/bpf_helpers.h>
 5#include <bpf/bpf_tracing.h>
 6
 7char _license[] SEC("license") = "GPL";
 8
 9SEC("struct_ops")
 
 
 
 
 
10__u32 BPF_PROG(incompl_cong_ops_ssthresh, struct sock *sk)
11{
12	return tcp_sk(sk)->snd_ssthresh;
13}
14
15SEC("struct_ops")
16__u32 BPF_PROG(incompl_cong_ops_undo_cwnd, struct sock *sk)
17{
18	return tcp_sk(sk)->snd_cwnd;
19}
20
21SEC(".struct_ops")
22struct tcp_congestion_ops incompl_cong_ops = {
23	/* Intentionally leaving out any of the required cong_avoid() and
24	 * cong_control() here.
25	 */
26	.ssthresh = (void *)incompl_cong_ops_ssthresh,
27	.undo_cwnd = (void *)incompl_cong_ops_undo_cwnd,
28	.name = "bpf_incompl_ops",
29};
v6.8
 1// SPDX-License-Identifier: GPL-2.0
 2
 3#include "vmlinux.h"
 4
 5#include <bpf/bpf_helpers.h>
 6#include <bpf/bpf_tracing.h>
 7
 8char _license[] SEC("license") = "GPL";
 9
10static inline struct tcp_sock *tcp_sk(const struct sock *sk)
11{
12	return (struct tcp_sock *)sk;
13}
14
15SEC("struct_ops/incompl_cong_ops_ssthresh")
16__u32 BPF_PROG(incompl_cong_ops_ssthresh, struct sock *sk)
17{
18	return tcp_sk(sk)->snd_ssthresh;
19}
20
21SEC("struct_ops/incompl_cong_ops_undo_cwnd")
22__u32 BPF_PROG(incompl_cong_ops_undo_cwnd, struct sock *sk)
23{
24	return tcp_sk(sk)->snd_cwnd;
25}
26
27SEC(".struct_ops")
28struct tcp_congestion_ops incompl_cong_ops = {
29	/* Intentionally leaving out any of the required cong_avoid() and
30	 * cong_control() here.
31	 */
32	.ssthresh = (void *)incompl_cong_ops_ssthresh,
33	.undo_cwnd = (void *)incompl_cong_ops_undo_cwnd,
34	.name = "bpf_incompl_ops",
35};