Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
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     /* Intentionally leaving out any of the required cong_avoid() and
0030      * cong_control() here.
0031      */
0032     .ssthresh = (void *)incompl_cong_ops_ssthresh,
0033     .undo_cwnd = (void *)incompl_cong_ops_undo_cwnd,
0034     .name = "bpf_incompl_ops",
0035 };