@@ -91,7 +91,7 @@ struct bictcp {
9191 __u32 curr_rtt ; /* the minimum rtt of current round */
9292};
9393
94- static inline void bictcp_reset (struct bictcp * ca )
94+ static void bictcp_reset (struct bictcp * ca )
9595{
9696 ca -> cnt = 0 ;
9797 ca -> last_max_cwnd = 0 ;
@@ -112,15 +112,15 @@ extern unsigned long CONFIG_HZ __kconfig;
112112#define USEC_PER_SEC 1000000UL
113113#define USEC_PER_JIFFY (USEC_PER_SEC / HZ)
114114
115- static __always_inline __u64 div64_u64 (__u64 dividend , __u64 divisor )
115+ static __u64 div64_u64 (__u64 dividend , __u64 divisor )
116116{
117117 return dividend / divisor ;
118118}
119119
120120#define div64_ul div64_u64
121121
122122#define BITS_PER_U64 (sizeof(__u64) * 8)
123- static __always_inline int fls64 (__u64 x )
123+ static int fls64 (__u64 x )
124124{
125125 int num = BITS_PER_U64 - 1 ;
126126
@@ -153,12 +153,12 @@ static __always_inline int fls64(__u64 x)
153153 return num + 1 ;
154154}
155155
156- static __always_inline __u32 bictcp_clock_us (const struct sock * sk )
156+ static __u32 bictcp_clock_us (const struct sock * sk )
157157{
158158 return tcp_sk (sk )-> tcp_mstamp ;
159159}
160160
161- static __always_inline void bictcp_hystart_reset (struct sock * sk )
161+ static void bictcp_hystart_reset (struct sock * sk )
162162{
163163 struct tcp_sock * tp = tcp_sk (sk );
164164 struct bictcp * ca = inet_csk_ca (sk );
@@ -169,8 +169,7 @@ static __always_inline void bictcp_hystart_reset(struct sock *sk)
169169 ca -> sample_cnt = 0 ;
170170}
171171
172- /* "struct_ops/" prefix is a requirement */
173- SEC ("struct_ops/bpf_cubic_init" )
172+ SEC ("struct_ops" )
174173void BPF_PROG (bpf_cubic_init , struct sock * sk )
175174{
176175 struct bictcp * ca = inet_csk_ca (sk );
@@ -184,8 +183,7 @@ void BPF_PROG(bpf_cubic_init, struct sock *sk)
184183 tcp_sk (sk )-> snd_ssthresh = initial_ssthresh ;
185184}
186185
187- /* "struct_ops" prefix is a requirement */
188- SEC ("struct_ops/bpf_cubic_cwnd_event" )
186+ SEC ("struct_ops" )
189187void BPF_PROG (bpf_cubic_cwnd_event , struct sock * sk , enum tcp_ca_event event )
190188{
191189 if (event == CA_EVENT_TX_START ) {
@@ -230,7 +228,7 @@ static const __u8 v[] = {
230228 * Newton-Raphson iteration.
231229 * Avg err ~= 0.195%
232230 */
233- static __always_inline __u32 cubic_root (__u64 a )
231+ static __u32 cubic_root (__u64 a )
234232{
235233 __u32 x , b , shift ;
236234
@@ -263,8 +261,7 @@ static __always_inline __u32 cubic_root(__u64 a)
263261/*
264262 * Compute congestion window to use.
265263 */
266- static __always_inline void bictcp_update (struct bictcp * ca , __u32 cwnd ,
267- __u32 acked )
264+ static void bictcp_update (struct bictcp * ca , __u32 cwnd , __u32 acked )
268265{
269266 __u32 delta , bic_target , max_cnt ;
270267 __u64 offs , t ;
@@ -377,8 +374,8 @@ static __always_inline void bictcp_update(struct bictcp *ca, __u32 cwnd,
377374 ca -> cnt = max (ca -> cnt , 2U );
378375}
379376
380- /* Or simply use the BPF_STRUCT_OPS to avoid the SEC boiler plate. */
381- void BPF_STRUCT_OPS (bpf_cubic_cong_avoid , struct sock * sk , __u32 ack , __u32 acked )
377+ SEC ( "struct_ops" )
378+ void BPF_PROG (bpf_cubic_cong_avoid , struct sock * sk , __u32 ack , __u32 acked )
382379{
383380 struct tcp_sock * tp = tcp_sk (sk );
384381 struct bictcp * ca = inet_csk_ca (sk );
@@ -397,7 +394,8 @@ void BPF_STRUCT_OPS(bpf_cubic_cong_avoid, struct sock *sk, __u32 ack, __u32 acke
397394 tcp_cong_avoid_ai (tp , ca -> cnt , acked );
398395}
399396
400- __u32 BPF_STRUCT_OPS (bpf_cubic_recalc_ssthresh , struct sock * sk )
397+ SEC ("struct_ops" )
398+ __u32 BPF_PROG (bpf_cubic_recalc_ssthresh , struct sock * sk )
401399{
402400 const struct tcp_sock * tp = tcp_sk (sk );
403401 struct bictcp * ca = inet_csk_ca (sk );
@@ -414,7 +412,8 @@ __u32 BPF_STRUCT_OPS(bpf_cubic_recalc_ssthresh, struct sock *sk)
414412 return max ((tp -> snd_cwnd * beta ) / BICTCP_BETA_SCALE , 2U );
415413}
416414
417- void BPF_STRUCT_OPS (bpf_cubic_state , struct sock * sk , __u8 new_state )
415+ SEC ("struct_ops" )
416+ void BPF_PROG (bpf_cubic_state , struct sock * sk , __u8 new_state )
418417{
419418 if (new_state == TCP_CA_Loss ) {
420419 bictcp_reset (inet_csk_ca (sk ));
@@ -433,7 +432,7 @@ void BPF_STRUCT_OPS(bpf_cubic_state, struct sock *sk, __u8 new_state)
433432 * We apply another 100% factor because @rate is doubled at this point.
434433 * We cap the cushion to 1ms.
435434 */
436- static __always_inline __u32 hystart_ack_delay (struct sock * sk )
435+ static __u32 hystart_ack_delay (struct sock * sk )
437436{
438437 unsigned long rate ;
439438
@@ -444,7 +443,7 @@ static __always_inline __u32 hystart_ack_delay(struct sock *sk)
444443 div64_ul ((__u64 )GSO_MAX_SIZE * 4 * USEC_PER_SEC , rate ));
445444}
446445
447- static __always_inline void hystart_update (struct sock * sk , __u32 delay )
446+ static void hystart_update (struct sock * sk , __u32 delay )
448447{
449448 struct tcp_sock * tp = tcp_sk (sk );
450449 struct bictcp * ca = inet_csk_ca (sk );
@@ -492,8 +491,8 @@ static __always_inline void hystart_update(struct sock *sk, __u32 delay)
492491
493492int bpf_cubic_acked_called = 0 ;
494493
495- void BPF_STRUCT_OPS ( bpf_cubic_acked , struct sock * sk ,
496- const struct ack_sample * sample )
494+ SEC ( "struct_ops" )
495+ void BPF_PROG ( bpf_cubic_acked , struct sock * sk , const struct ack_sample * sample )
497496{
498497 const struct tcp_sock * tp = tcp_sk (sk );
499498 struct bictcp * ca = inet_csk_ca (sk );
@@ -524,7 +523,8 @@ void BPF_STRUCT_OPS(bpf_cubic_acked, struct sock *sk,
524523
525524extern __u32 tcp_reno_undo_cwnd (struct sock * sk ) __ksym ;
526525
527- __u32 BPF_STRUCT_OPS (bpf_cubic_undo_cwnd , struct sock * sk )
526+ SEC ("struct_ops" )
527+ __u32 BPF_PROG (bpf_cubic_undo_cwnd , struct sock * sk )
528528{
529529 return tcp_reno_undo_cwnd (sk );
530530}
0 commit comments