0001
0002
0003 #include "vmlinux.h"
0004
0005 #include <bpf/bpf_helpers.h>
0006 #include <bpf/bpf_tracing.h>
0007
0008 char _license[] SEC("license") = "GPL";
0009
0010 static inline struct tcp_sock *tcp_sk(const struct sock *sk)
0011 {
0012 return (struct tcp_sock *)sk;
0013 }
0014
0015 SEC("struct_ops/incompl_cong_ops_ssthresh")
0016 __u32 BPF_PROG(incompl_cong_ops_ssthresh, struct sock *sk)
0017 {
0018 return tcp_sk(sk)->snd_ssthresh;
0019 }
0020
0021 SEC("struct_ops/incompl_cong_ops_undo_cwnd")
0022 __u32 BPF_PROG(incompl_cong_ops_undo_cwnd, struct sock *sk)
0023 {
0024 return tcp_sk(sk)->snd_cwnd;
0025 }
0026
0027 SEC(".struct_ops")
0028 struct tcp_congestion_ops incompl_cong_ops = {
0029
0030
0031
0032 .ssthresh = (void *)incompl_cong_ops_ssthresh,
0033 .undo_cwnd = (void *)incompl_cong_ops_undo_cwnd,
0034 .name = "bpf_incompl_ops",
0035 };