~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/bpf/progs/tcp_ca_kfunc.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /* Copyright (c) 2024 Facebook */
  3 
  4 #include "vmlinux.h"
  5 #include <bpf/bpf_tracing.h>
  6 
  7 extern void bbr_init(struct sock *sk) __ksym;
  8 extern void bbr_main(struct sock *sk, u32 ack, int flag, const struct rate_sample *rs) __ksym;
  9 extern u32 bbr_sndbuf_expand(struct sock *sk) __ksym;
 10 extern u32 bbr_undo_cwnd(struct sock *sk) __ksym;
 11 extern void bbr_cwnd_event(struct sock *sk, enum tcp_ca_event event) __ksym;
 12 extern u32 bbr_ssthresh(struct sock *sk) __ksym;
 13 extern u32 bbr_min_tso_segs(struct sock *sk) __ksym;
 14 extern void bbr_set_state(struct sock *sk, u8 new_state) __ksym;
 15 
 16 extern void dctcp_init(struct sock *sk) __ksym;
 17 extern void dctcp_update_alpha(struct sock *sk, u32 flags) __ksym;
 18 extern void dctcp_cwnd_event(struct sock *sk, enum tcp_ca_event ev) __ksym;
 19 extern u32 dctcp_ssthresh(struct sock *sk) __ksym;
 20 extern u32 dctcp_cwnd_undo(struct sock *sk) __ksym;
 21 extern void dctcp_state(struct sock *sk, u8 new_state) __ksym;
 22 
 23 extern void cubictcp_init(struct sock *sk) __ksym;
 24 extern u32 cubictcp_recalc_ssthresh(struct sock *sk) __ksym;
 25 extern void cubictcp_cong_avoid(struct sock *sk, u32 ack, u32 acked) __ksym;
 26 extern void cubictcp_state(struct sock *sk, u8 new_state) __ksym;
 27 extern void cubictcp_cwnd_event(struct sock *sk, enum tcp_ca_event event) __ksym;
 28 extern void cubictcp_acked(struct sock *sk, const struct ack_sample *sample) __ksym;
 29 
 30 SEC("struct_ops")
 31 void BPF_PROG(init, struct sock *sk)
 32 {
 33         bbr_init(sk);
 34         dctcp_init(sk);
 35         cubictcp_init(sk);
 36 }
 37 
 38 SEC("struct_ops")
 39 void BPF_PROG(in_ack_event, struct sock *sk, u32 flags)
 40 {
 41         dctcp_update_alpha(sk, flags);
 42 }
 43 
 44 SEC("struct_ops")
 45 void BPF_PROG(cong_control, struct sock *sk, u32 ack, int flag, const struct rate_sample *rs)
 46 {
 47         bbr_main(sk, ack, flag, rs);
 48 }
 49 
 50 SEC("struct_ops")
 51 void BPF_PROG(cong_avoid, struct sock *sk, u32 ack, u32 acked)
 52 {
 53         cubictcp_cong_avoid(sk, ack, acked);
 54 }
 55 
 56 SEC("struct_ops")
 57 u32 BPF_PROG(sndbuf_expand, struct sock *sk)
 58 {
 59         return bbr_sndbuf_expand(sk);
 60 }
 61 
 62 SEC("struct_ops")
 63 u32 BPF_PROG(undo_cwnd, struct sock *sk)
 64 {
 65         bbr_undo_cwnd(sk);
 66         return dctcp_cwnd_undo(sk);
 67 }
 68 
 69 SEC("struct_ops")
 70 void BPF_PROG(cwnd_event, struct sock *sk, enum tcp_ca_event event)
 71 {
 72         bbr_cwnd_event(sk, event);
 73         dctcp_cwnd_event(sk, event);
 74         cubictcp_cwnd_event(sk, event);
 75 }
 76 
 77 SEC("struct_ops")
 78 u32 BPF_PROG(ssthresh, struct sock *sk)
 79 {
 80         bbr_ssthresh(sk);
 81         dctcp_ssthresh(sk);
 82         return cubictcp_recalc_ssthresh(sk);
 83 }
 84 
 85 SEC("struct_ops")
 86 u32 BPF_PROG(min_tso_segs, struct sock *sk)
 87 {
 88         return bbr_min_tso_segs(sk);
 89 }
 90 
 91 SEC("struct_ops")
 92 void BPF_PROG(set_state, struct sock *sk, u8 new_state)
 93 {
 94         bbr_set_state(sk, new_state);
 95         dctcp_state(sk, new_state);
 96         cubictcp_state(sk, new_state);
 97 }
 98 
 99 SEC("struct_ops")
100 void BPF_PROG(pkts_acked, struct sock *sk, const struct ack_sample *sample)
101 {
102         cubictcp_acked(sk, sample);
103 }
104 
105 SEC(".struct_ops")
106 struct tcp_congestion_ops tcp_ca_kfunc = {
107         .init           = (void *)init,
108         .in_ack_event   = (void *)in_ack_event,
109         .cong_control   = (void *)cong_control,
110         .cong_avoid     = (void *)cong_avoid,
111         .sndbuf_expand  = (void *)sndbuf_expand,
112         .undo_cwnd      = (void *)undo_cwnd,
113         .cwnd_event     = (void *)cwnd_event,
114         .ssthresh       = (void *)ssthresh,
115         .min_tso_segs   = (void *)min_tso_segs,
116         .set_state      = (void *)set_state,
117         .pkts_acked     = (void *)pkts_acked,
118         .name           = "tcp_ca_kfunc",
119 };
120 
121 char _license[] SEC("license") = "GPL";
122 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php