Skip to contentSkip to conversation

tcp: add cwnd_event_tx_start to tcp_congestion_ops

PATCH Superseded Eric Dumazet 2 participants 5 messages Mar 14

Subsystems (6)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tcp: add cwnd_event_tx_start to tcp_congestion_ops

(tcp_congestion_ops)->cwnd_event() is called very often, with @event oscillating between CA_EVENT_TX_START and other values.

This is not branch prediction friendly.

Provide a new cwnd_event_tx_start pointer dedicated for CA_EVENT_TX_START.

Both BBR and CUBIC benefit from this change, since they only care about CA_EVENT_TX_START.

No change in kernel size:

$ scripts/bloat-o-meter -t vmlinux.0 vmlinux
add/remove: 4/4 grow/shrink: 3/1 up/down: 564/-568 (-4)
Function                                     old     new   delta
bbr_cwnd_event_tx_start                        -     450    +450
cubictcp_cwnd_event_tx_start                   -      70     +70
__pfx_cubictcp_cwnd_event_tx_start             -      16     +16
__pfx_bbr_cwnd_event_tx_start                  -      16     +16
tcp_unregister_congestion_control             93      99      +6
tcp_update_congestion_control                518     521      +3
tcp_register_congestion_control              422     425      +3
__tcp_transmit_skb                          3308    3306      -2
__pfx_cubictcp_cwnd_event                     16       -     -16
__pfx_bbr_cwnd_event                          16       -     -16
cubictcp_cwnd_event                           80       -     -80
bbr_cwnd_event                               454       -    -454
Total: Before=25240512, After=25240508, chg -0.00%

---
v2: fix tools/testing/selftests/bpf/progs/bpf_cc_cubic.c (Jakub)
v1: https://lore.kernel.org/netdev/[email protected]/

 include/net/tcp.h                             |  8 +++++
 net/ipv4/tcp_bbr.c                            |  8 ++---
 net/ipv4/tcp_cubic.c                          | 35 +++++++++----------
 net/ipv4/tcp_dctcp.c                          | 11 ++++--
 net/ipv4/tcp_vegas.c                          |  9 +++--
 net/ipv4/tcp_vegas.h                          |  1 +
 net/ipv4/tcp_veno.c                           |  8 ++++-
 net/ipv4/tcp_yeah.c                           |  1 +
 .../selftests/bpf/progs/bpf_cc_cubic.c        |  8 ++---
 tools/testing/selftests/bpf/progs/bpf_cubic.c | 33 ++++++++---------
 .../selftests/bpf/progs/tcp_ca_kfunc.c        | 16 ++++++---
 11 files changed, 83 insertions(+), 55 deletions(-)
include/net/tcp.h +8 -0
index f87bdacb5a6995422851e88cfb65734702c84093..39ff4cf3c810f5619a479dcd92192043374a1739 100644
@@ -1341,6 +1341,9 @@ struct tcp_congestion_ops {
 	/* call when cwnd event occurs (optional) */
 	void (*cwnd_event)(struct sock *sk, enum tcp_ca_event ev);
 
+	/* call when CA_EVENT_TX_START cwnd event occurs (optional) */
+	void (*cwnd_event_tx_start)(struct sock *sk);
+
 	/* call when ack arrives (optional) */
 	void (*in_ack_event)(struct sock *sk, u32 flags);
 
@@ -1440,6 +1443,11 @@ static inline void tcp_ca_event(struct sock *sk, const enum tcp_ca_event event)
 {
 	const struct inet_connection_sock *icsk = inet_csk(sk);
 
+	if (event == CA_EVENT_TX_START) {
+	    if (icsk->icsk_ca_ops->cwnd_event_tx_start)
+			icsk->icsk_ca_ops->cwnd_event_tx_start(sk);
+		return;
+	}
 	if (icsk->icsk_ca_ops->cwnd_event)
 		icsk->icsk_ca_ops->cwnd_event(sk, event);
 }
net/ipv4/tcp_bbr.c +4 -4
index 05d52372ca8fb068530a9b3379f1ae0f9d0b362a..1ddc20a399b07054f8175b5f6459f8ae6dbf34bb 100644
@@ -330,12 +330,12 @@ static void bbr_save_cwnd(struct sock *sk)
 		bbr->prior_cwnd = max(bbr->prior_cwnd, tcp_snd_cwnd(tp));
 }
 
-__bpf_kfunc static void bbr_cwnd_event(struct sock *sk, enum tcp_ca_event event)
+__bpf_kfunc static void bbr_cwnd_event_tx_start(struct sock *sk)
 {
 	struct tcp_sock *tp = tcp_sk(sk);
 	struct bbr *bbr = inet_csk_ca(sk);
 
-	if (event == CA_EVENT_TX_START && tp->app_limited) {
+	if (tp->app_limited) {
 		bbr->idle_restart = 1;
 		bbr->ack_epoch_mstamp = tp->tcp_mstamp;
 		bbr->ack_epoch_acked = 0;
@@ -1149,7 +1149,7 @@ static struct tcp_congestion_ops tcp_bbr_cong_ops __read_mostly = {
 	.cong_control	= bbr_main,
 	.sndbuf_expand	= bbr_sndbuf_expand,
 	.undo_cwnd	= bbr_undo_cwnd,
-	.cwnd_event	= bbr_cwnd_event,
+	.cwnd_event_tx_start	= bbr_cwnd_event_tx_start,
 	.ssthresh	= bbr_ssthresh,
 	.min_tso_segs	= bbr_min_tso_segs,
 	.get_info	= bbr_get_info,
@@ -1161,7 +1161,7 @@ BTF_ID_FLAGS(func, bbr_init)
 BTF_ID_FLAGS(func, bbr_main)
 BTF_ID_FLAGS(func, bbr_sndbuf_expand)
 BTF_ID_FLAGS(func, bbr_undo_cwnd)
-BTF_ID_FLAGS(func, bbr_cwnd_event)
+BTF_ID_FLAGS(func, bbr_cwnd_event_tx_start)
 BTF_ID_FLAGS(func, bbr_ssthresh)
 BTF_ID_FLAGS(func, bbr_min_tso_segs)
 BTF_ID_FLAGS(func, bbr_set_state)
net/ipv4/tcp_cubic.c +16 -19
index 76c23675ae50ab50c977dc1de79a3df57db98ef6..ab78b5ae8d0e3d13a39bd1adf1e105b84f806b63 100644
@@ -139,24 +139,21 @@ __bpf_kfunc static void cubictcp_init(struct sock *sk)
 		tcp_sk(sk)->snd_ssthresh = initial_ssthresh;
 }
 
-__bpf_kfunc static void cubictcp_cwnd_event(struct sock *sk, enum tcp_ca_event event)
+__bpf_kfunc static void cubictcp_cwnd_event_tx_start(struct sock *sk)
 {
-	if (event == CA_EVENT_TX_START) {
-		struct bictcp *ca = inet_csk_ca(sk);
-		u32 now = tcp_jiffies32;
-		s32 delta;
-
-		delta = now - tcp_sk(sk)->lsndtime;
-
-		/* We were application limited (idle) for a while.
-		 * Shift epoch_start to keep cwnd growth to cubic curve.
-		 */
-		if (ca->epoch_start && delta > 0) {
-			ca->epoch_start += delta;
-			if (after(ca->epoch_start, now))
-				ca->epoch_start = now;
-		}
-		return;
+	struct bictcp *ca = inet_csk_ca(sk);
+	u32 now = tcp_jiffies32;
+	s32 delta;
+
+	delta = now - tcp_sk(sk)->lsndtime;
+
+	/* We were application limited (idle) for a while.
+	 * Shift epoch_start to keep cwnd growth to cubic curve.
+	 */
+	if (ca->epoch_start && delta > 0) {
+		ca->epoch_start += delta;
+		if (after(ca->epoch_start, now))
+			ca->epoch_start = now;
 	}
 }
 
@@ -481,7 +478,7 @@ static struct tcp_congestion_ops cubictcp __read_mostly = {
 	.cong_avoid	= cubictcp_cong_avoid,
 	.set_state	= cubictcp_state,
 	.undo_cwnd	= tcp_reno_undo_cwnd,
-	.cwnd_event	= cubictcp_cwnd_event,
+	.cwnd_event_tx_start = cubictcp_cwnd_event_tx_start,
 	.pkts_acked     = cubictcp_acked,
 	.owner		= THIS_MODULE,
 	.name		= "cubic",
@@ -492,7 +489,7 @@ BTF_ID_FLAGS(func, cubictcp_init)
 BTF_ID_FLAGS(func, cubictcp_recalc_ssthresh)
 BTF_ID_FLAGS(func, cubictcp_cong_avoid)
 BTF_ID_FLAGS(func, cubictcp_state)
-BTF_ID_FLAGS(func, cubictcp_cwnd_event)
+BTF_ID_FLAGS(func, cubictcp_cwnd_event_tx_start)
 BTF_ID_FLAGS(func, cubictcp_acked)
 BTF_KFUNCS_END(tcp_cubic_check_kfunc_ids)
 
net/ipv4/tcp_dctcp.c +8 -3
index 03abe0848420d7fb7b514e6ad24f4c702954ab14..8ce84890feeea3094b6f46001295e2761c35f1da 100644
@@ -203,15 +203,19 @@ __bpf_kfunc static void dctcp_cwnd_event(struct sock *sk, enum tcp_ca_event ev)
 		tcp_plb_update_state_upon_rto(sk, &ca->plb);
 		dctcp_react_to_loss(sk);
 		break;
-	case CA_EVENT_TX_START:
-		tcp_plb_check_rehash(sk, &ca->plb); /* Maybe rehash when inflight is 0 */
-		break;
 	default:
 		/* Don't care for the rest. */
 		break;
 	}
 }
 
+__bpf_kfunc static void dctcp_cwnd_event_tx_start(struct sock *sk)
+{
+	struct dctcp *ca = inet_csk_ca(sk);
+
+	tcp_plb_check_rehash(sk, &ca->plb); /* Maybe rehash when inflight is 0 */
+}
+
 static size_t dctcp_get_info(struct sock *sk, u32 ext, int *attr,
 			     union tcp_cc_info *info)
 {
@@ -252,6 +256,7 @@ static struct tcp_congestion_ops dctcp __read_mostly = {
 	.init		= dctcp_init,
 	.in_ack_event   = dctcp_update_alpha,
 	.cwnd_event	= dctcp_cwnd_event,
+	.cwnd_event_tx_start = dctcp_cwnd_event_tx_start,
 	.ssthresh	= dctcp_ssthresh,
 	.cong_avoid	= tcp_reno_cong_avoid,
 	.undo_cwnd	= dctcp_cwnd_undo,
net/ipv4/tcp_vegas.c +7 -2
index 786848ad37ea8d5f9bd817666181905f3f6ec9d4..cf12fb6be079d8ccd65f297a3a90a9a5e90036e8 100644
@@ -151,12 +151,17 @@ EXPORT_SYMBOL_GPL(tcp_vegas_state);
  */
 void tcp_vegas_cwnd_event(struct sock *sk, enum tcp_ca_event event)
 {
-	if (event == CA_EVENT_CWND_RESTART ||
-	    event == CA_EVENT_TX_START)
+	if (event == CA_EVENT_CWND_RESTART)
 		tcp_vegas_init(sk);
 }
 EXPORT_SYMBOL_GPL(tcp_vegas_cwnd_event);
 
+void tcp_vegas_cwnd_event_tx_start(struct sock *sk)
+{
+	tcp_vegas_init(sk);
+}
+EXPORT_SYMBOL_GPL(tcp_vegas_cwnd_event_tx_start);
+
 static inline u32 tcp_vegas_ssthresh(struct tcp_sock *tp)
 {
 	return  min(tp->snd_ssthresh, tcp_snd_cwnd(tp));
net/ipv4/tcp_vegas.h +1 -0
index 4f24d0e37d9c1e9d5336e8e99253e660143362c9..602af8e600c7f85603ff1a53008e1144617ea14b 100644
@@ -20,6 +20,7 @@ void tcp_vegas_init(struct sock *sk);
 void tcp_vegas_state(struct sock *sk, u8 ca_state);
 void tcp_vegas_pkts_acked(struct sock *sk, const struct ack_sample *sample);
 void tcp_vegas_cwnd_event(struct sock *sk, enum tcp_ca_event event);
+void tcp_vegas_cwnd_event_tx_start(struct sock *sk);
 size_t tcp_vegas_get_info(struct sock *sk, u32 ext, int *attr,
 			  union tcp_cc_info *info);
 
net/ipv4/tcp_veno.c +7 -1
index 366ff6f214b2ee746cecdf10353e4624252478e0..1b2e1b947901f3ca6004aced8e6d39c131f1fb68 100644
@@ -112,10 +112,15 @@ static void tcp_veno_state(struct sock *sk, u8 ca_state)
  */
 static void tcp_veno_cwnd_event(struct sock *sk, enum tcp_ca_event event)
 {
-	if (event == CA_EVENT_CWND_RESTART || event == CA_EVENT_TX_START)
+	if (event == CA_EVENT_CWND_RESTART)
 		tcp_veno_init(sk);
 }
 
+static void tcp_veno_cwnd_event_tx_start(struct sock *sk)
+{
+	tcp_veno_init(sk);
+}
+
 static void tcp_veno_cong_avoid(struct sock *sk, u32 ack, u32 acked)
 {
 	struct tcp_sock *tp = tcp_sk(sk);
@@ -213,6 +218,7 @@ static struct tcp_congestion_ops tcp_veno __read_mostly = {
 	.pkts_acked	= tcp_veno_pkts_acked,
 	.set_state	= tcp_veno_state,
 	.cwnd_event	= tcp_veno_cwnd_event,
+	.cwnd_event_tx_start = tcp_veno_cwnd_event_tx_start,
 
 	.owner		= THIS_MODULE,
 	.name		= "veno",
net/ipv4/tcp_yeah.c +1 -0
index 18b07ff5d20e6c5eefe9ab54c6b8e429f01d64b9..b22b3dccd05efddfe11203578950eddecee14887 100644
@@ -212,6 +212,7 @@ static struct tcp_congestion_ops tcp_yeah __read_mostly = {
 	.cong_avoid	= tcp_yeah_cong_avoid,
 	.set_state	= tcp_vegas_state,
 	.cwnd_event	= tcp_vegas_cwnd_event,
+	.cwnd_event_tx_start = tcp_vegas_cwnd_event_tx_start,
 	.get_info	= tcp_vegas_get_info,
 	.pkts_acked	= tcp_vegas_pkts_acked,
 
tools/testing/selftests/bpf/progs/bpf_cc_cubic.c +4 -4
index 9af19dfe4e80b00bc09fe40c7d6c9642cdfb4a23..bccf677b94b61226a3dd0517e0b2e64168de711f 100644
@@ -23,7 +23,7 @@
 #define TCP_REORDERING (12)
 
 extern void cubictcp_init(struct sock *sk) __ksym;
-extern void cubictcp_cwnd_event(struct sock *sk, enum tcp_ca_event event) __ksym;
+extern void cubictcp_cwnd_event_tx_start(struct sock *sk) __ksym;
 extern __u32 cubictcp_recalc_ssthresh(struct sock *sk) __ksym;
 extern void cubictcp_state(struct sock *sk, __u8 new_state) __ksym;
 extern __u32 tcp_reno_undo_cwnd(struct sock *sk) __ksym;
@@ -108,9 +108,9 @@ void BPF_PROG(bpf_cubic_init, struct sock *sk)
 }
 
 SEC("struct_ops")
-void BPF_PROG(bpf_cubic_cwnd_event, struct sock *sk, enum tcp_ca_event event)
+void BPF_PROG(bpf_cubic_cwnd_event_tx_start, struct sock *sk)
 {
-	cubictcp_cwnd_event(sk, event);
+	cubictcp_cwnd_event_tx_start(sk);
 }
 
 SEC("struct_ops")
@@ -172,7 +172,7 @@ struct tcp_congestion_ops cc_cubic = {
 	.cong_control	= (void *)bpf_cubic_cong_control,
 	.set_state	= (void *)bpf_cubic_state,
 	.undo_cwnd	= (void *)bpf_cubic_undo_cwnd,
-	.cwnd_event	= (void *)bpf_cubic_cwnd_event,
+	.cwnd_event_tx_start	= (void *)bpf_cubic_cwnd_event_tx_start,
 	.pkts_acked     = (void *)bpf_cubic_acked,
 	.name		= "bpf_cc_cubic",
 };
tools/testing/selftests/bpf/progs/bpf_cubic.c +15 -18
index 46fb2b37d3a70671485af37ed700a991c0975cd2..ce18a4db813fab877aec0c73d72cc9c958312ad3 100644
@@ -185,24 +185,21 @@ void BPF_PROG(bpf_cubic_init, struct sock *sk)
 }
 
 SEC("struct_ops")
-void BPF_PROG(bpf_cubic_cwnd_event, struct sock *sk, enum tcp_ca_event event)
+void BPF_PROG(bpf_cubic_cwnd_event_tx_start, struct sock *sk)
 {
-	if (event == CA_EVENT_TX_START) {
-		struct bpf_bictcp *ca = inet_csk_ca(sk);
-		__u32 now = tcp_jiffies32;
-		__s32 delta;
-
-		delta = now - tcp_sk(sk)->lsndtime;
-
-		/* We were application limited (idle) for a while.
-		 * Shift epoch_start to keep cwnd growth to cubic curve.
-		 */
-		if (ca->epoch_start && delta > 0) {
-			ca->epoch_start += delta;
-			if (after(ca->epoch_start, now))
-				ca->epoch_start = now;
-		}
-		return;
+	struct bpf_bictcp *ca = inet_csk_ca(sk);
+	__u32 now = tcp_jiffies32;
+	__s32 delta;
+
+	delta = now - tcp_sk(sk)->lsndtime;
+
+	/* We were application limited (idle) for a while.
+	 * Shift epoch_start to keep cwnd growth to cubic curve.
+	 */
+	if (ca->epoch_start && delta > 0) {
+		ca->epoch_start += delta;
+		if (after(ca->epoch_start, now))
+			ca->epoch_start = now;
 	}
 }
 
@@ -537,7 +534,7 @@ struct tcp_congestion_ops cubic = {
 	.cong_avoid	= (void *)bpf_cubic_cong_avoid,
 	.set_state	= (void *)bpf_cubic_state,
 	.undo_cwnd	= (void *)bpf_cubic_undo_cwnd,
-	.cwnd_event	= (void *)bpf_cubic_cwnd_event,
+	.cwnd_event_tx_start	= (void *)bpf_cubic_cwnd_event_tx_start,
 	.pkts_acked     = (void *)bpf_cubic_acked,
 	.name		= "bpf_cubic",
 };
tools/testing/selftests/bpf/progs/tcp_ca_kfunc.c +12 -4
index f95862f570b73f4c86fa6d7b6a912c4b055d02fb..a4334cf4c6bd59a0552a5a2cccabf75489d46f58 100644
@@ -8,7 +8,7 @@ extern void bbr_init(struct sock *sk) __ksym;
 extern void bbr_main(struct sock *sk, u32 ack, int flag, const struct rate_sample *rs) __ksym;
 extern u32 bbr_sndbuf_expand(struct sock *sk) __ksym;
 extern u32 bbr_undo_cwnd(struct sock *sk) __ksym;
-extern void bbr_cwnd_event(struct sock *sk, enum tcp_ca_event event) __ksym;
+extern void bbr_cwnd_event_tx_start(struct sock *sk) __ksym;
 extern u32 bbr_ssthresh(struct sock *sk) __ksym;
 extern u32 bbr_min_tso_segs(struct sock *sk) __ksym;
 extern void bbr_set_state(struct sock *sk, u8 new_state) __ksym;
@@ -16,6 +16,7 @@ extern void bbr_set_state(struct sock *sk, u8 new_state) __ksym;
 extern void dctcp_init(struct sock *sk) __ksym;
 extern void dctcp_update_alpha(struct sock *sk, u32 flags) __ksym;
 extern void dctcp_cwnd_event(struct sock *sk, enum tcp_ca_event ev) __ksym;
+extern void dctcp_cwnd_event_tx_start(struct sock *sk) __ksym;
 extern u32 dctcp_ssthresh(struct sock *sk) __ksym;
 extern u32 dctcp_cwnd_undo(struct sock *sk) __ksym;
 extern void dctcp_state(struct sock *sk, u8 new_state) __ksym;
@@ -24,7 +25,7 @@ extern void cubictcp_init(struct sock *sk) __ksym;
 extern u32 cubictcp_recalc_ssthresh(struct sock *sk) __ksym;
 extern void cubictcp_cong_avoid(struct sock *sk, u32 ack, u32 acked) __ksym;
 extern void cubictcp_state(struct sock *sk, u8 new_state) __ksym;
-extern void cubictcp_cwnd_event(struct sock *sk, enum tcp_ca_event event) __ksym;
+extern void cubictcp_cwnd_event_tx_start(struct sock *sk) __ksym;
 extern void cubictcp_acked(struct sock *sk, const struct ack_sample *sample) __ksym;
 
 SEC("struct_ops")
@@ -69,9 +70,15 @@ u32 BPF_PROG(undo_cwnd, struct sock *sk)
 SEC("struct_ops")
 void BPF_PROG(cwnd_event, struct sock *sk, enum tcp_ca_event event)
 {
-	bbr_cwnd_event(sk, event);
 	dctcp_cwnd_event(sk, event);
-	cubictcp_cwnd_event(sk, event);
+}
+
+SEC("struct_ops")
+void BPF_PROG(cwnd_event_tx_stat, struct sock *sk)
+{
+	bbr_cwnd_event_tx_start(sk);
+	dctcp_cwnd_event_tx_start(sk);
+	cubictcp_cwnd_event_tx_start(sk);
 }
 
 SEC("struct_ops")
@@ -111,6 +118,7 @@ struct tcp_congestion_ops tcp_ca_kfunc = {
 	.sndbuf_expand	= (void *)sndbuf_expand,
 	.undo_cwnd	= (void *)undo_cwnd,
 	.cwnd_event	= (void *)cwnd_event,
+	.cwnd_event_tx_start = (void *)cwnd_event_tx_start,
 	.ssthresh	= (void *)ssthresh,
 	.min_tso_segs	= (void *)min_tso_segs,
 	.set_state	= (void *)set_state,
Signature · 1 line
2.53.0.851.ga537e3e6e9-goog
maintainer
#1 lore raw
Quoted 9 lines · On Sat, 14 Mar 2026 18:08:02 +0000 Eric Dumazet wrote:

(tcp_congestion_ops)->cwnd_event() is called very often, with @event oscillating between CA_EVENT_TX_START and other values.

This is not branch prediction friendly.

Provide a new cwnd_event_tx_start pointer dedicated for CA_EVENT_TX_START.

Both BBR and CUBIC benefit from this change, since they only care about CA_EVENT_TX_START.

BPF still not building :(

progs/tcp_ca_kfunc.c:121:33: error: use of undeclared identifier 'cwnd_event_tx_start'
121 | .cwnd_event_tx_start = (void *)cwnd_event_tx_start,
| ^~~~~~~~~~~~~~~~~~~

https://github.com/kernel-patches/bpf/actions/runs/23096281431/job/67089276918

Signature · 1 line
pw-bot: cr
#2 lore raw
Quoted 12 lines · Jakub Kicinski
Quoted 9 lines · On Sat, 14 Mar 2026 18:08:02 +0000 Eric Dumazet wrote:

(tcp_congestion_ops)->cwnd_event() is called very often, with @event oscillating between CA_EVENT_TX_START and other values.

This is not branch prediction friendly.

Provide a new cwnd_event_tx_start pointer dedicated for CA_EVENT_TX_START.

Both BBR and CUBIC benefit from this change, since they only care about CA_EVENT_TX_START.

Quoted 8 lines

BPF still not building :(

progs/tcp_ca_kfunc.c:121:33: error: use of undeclared identifier 'cwnd_event_tx_start'
121 | .cwnd_event_tx_start = (void *)cwnd_event_tx_start,
| ^~~~~~~~~~~~~~~~~~~

https://github.com/kernel-patches/bpf/actions/runs/23096281431/job/67089276918

make clean
vng -bv CC=clang >RES
make headers ; make -j100 -C tools/testing/selftests/net ; make -j100 -C tools/testing/selftests/bpf
make -j100 -C tools/testing/selftests/bpf
make: Entering directory '/usr/local/google/home/edumazet/git/net-next/tools/testing/selftests/bpf'
GEN-SKEL [test_progs] access_map_in_map.skel.h
GEN-SKEL [test_progs] arena_atomics.skel.h
GEN-SKEL [test_progs] arena_htab_asm.skel.h
GEN-SKEL [test_progs] arena_htab.skel.h
GEN-SKEL [test_progs] arena_list.skel.h
GEN-SKEL [test_progs] arena_spin_lock.skel.h
GEN-SKEL [test_progs] arena_strsearch.skel.h
GEN-SKEL [test_progs] async_stack_depth.skel.h
GEN-SKEL [test_progs] atomic_bounds.skel.h
GEN-SKEL [test_progs] bad_struct_ops2.skel.h
GEN-SKEL [test_progs] bad_struct_ops.skel.h
GEN-SKEL [test_progs] bench_local_storage_create.skel.h GEN-SKEL [test_progs] bench_sockmap_prog.skel.h
GEN-SKEL [test_progs] bind4_prog.skel.h
GEN-SKEL [test_progs] bind6_prog.skel.h
GEN-SKEL [test_progs] bind_perm.skel.h
GEN-SKEL [test_progs] bloom_filter_bench.skel.h
GEN-SKEL [test_progs] bloom_filter_map.skel.h
GEN-SKEL [test_progs] bpf_cc_cubic.skel.h
GEN-SKEL [test_progs] bpf_cubic.skel.h
GEN-SKEL [test_progs] bpf_dctcp.skel.h
GEN-SKEL [test_progs] bpf_dctcp_release.skel.h
GEN-SKEL [test_progs] bpf_flow.skel.h
GEN-SKEL [test_progs] bpf_gotox.skel.h
GEN-SKEL [test_progs] bpf_hashmap_full_update_bench.skel.h GEN-SKEL [test_progs] bpf_hashmap_lookup.skel.h
GEN-SKEL [test_progs] bpf_iter_bpf_array_map.skel.h
GEN-SKEL [test_progs] bpf_iter_bpf_hash_map.skel.h
GEN-SKEL [test_progs] bpf_iter_bpf_link.skel.h
GEN-SKEL [test_progs] bpf_iter_bpf_map.skel.h
GEN-SKEL [test_progs] bpf_iter_bpf_percpu_array_map.skel.h GEN-SKEL [test_progs] bpf_iter_bpf_percpu_hash_map.skel.h GEN-SKEL [test_progs] bpf_iter_bpf_sk_storage_helpers.skel.h GEN-SKEL [test_progs] bpf_iter_bpf_sk_storage_map.skel.h GEN-SKEL [test_progs] bpf_iter_ipv6_route.skel.h
GEN-SKEL [test_progs] bpf_iter_ksym.skel.h
GEN-SKEL [test_progs] bpf_iter_map_elem.skel.h
GEN-SKEL [test_progs] bpf_iter_netlink.skel.h
GEN-SKEL [test_progs] bpf_iter_setsockopt.skel.h
GEN-SKEL [test_progs] bpf_iter_setsockopt_unix.skel.h GEN-SKEL [test_progs] bpf_iter_sockmap.skel.h
GEN-SKEL [test_progs] bpf_iter_task_btf.skel.h
GEN-SKEL [test_progs] bpf_iter_task_file.skel.h
GEN-SKEL [test_progs] bpf_iter_tasks.skel.h
GEN-SKEL [test_progs] bpf_iter_task_stack.skel.h
GEN-SKEL [test_progs] bpf_iter_task_vmas.skel.h
GEN-SKEL [test_progs] bpf_iter_tcp4.skel.h
GEN-SKEL [test_progs] bpf_iter_tcp6.skel.h
GEN-SKEL [test_progs] bpf_iter_test_kern1.skel.h
GEN-SKEL [test_progs] bpf_iter_test_kern2.skel.h
GEN-SKEL [test_progs] bpf_iter_test_kern3.skel.h
GEN-SKEL [test_progs] bpf_iter_test_kern4.skel.h
GEN-SKEL [test_progs] bpf_iter_test_kern5.skel.h
GEN-SKEL [test_progs] bpf_iter_test_kern6.skel.h
GEN-SKEL [test_progs] bpf_iter_udp4.skel.h
GEN-SKEL [test_progs] bpf_iter_udp6.skel.h
GEN-SKEL [test_progs] bpf_iter_unix.skel.h
GEN-SKEL [test_progs] bpf_iter_vma_offset.skel.h
GEN-SKEL [test_progs] bpf_loop_bench.skel.h
GEN-SKEL [test_progs] bpf_loop.skel.h
GEN-SKEL [test_progs] bpf_mod_race.skel.h
CLNG-BPF [test_progs] bpf_qdisc_fail__incompl_ops.bpf.o CLNG-BPF [test_progs] bpf_qdisc_fifo.bpf.o
CLNG-BPF [test_progs] bpf_qdisc_fq.bpf.o
CLNG-BPF [test_progs] bpf_smc.bpf.o
GEN-SKEL [test_progs] bpf_syscall_macro.skel.h
GEN-SKEL [test_progs] bpf_tcp_nogpl.skel.h
GEN-SKEL [test_progs] bprm_opts.skel.h
GEN-SKEL [test_progs] btf_data.skel.h
GEN-SKEL [test_progs] btf_dump_test_case_bitfields.skel.h GEN-SKEL [test_progs] btf_dump_test_case_multidim.skel.h GEN-SKEL [test_progs] btf_dump_test_case_namespacing.skel.h GEN-SKEL [test_progs] btf_dump_test_case_ordering.skel.h GEN-SKEL [test_progs] btf_dump_test_case_packing.skel.h GEN-SKEL [test_progs] btf_dump_test_case_padding.skel.h GEN-SKEL [test_progs] btf_dump_test_case_syntax.skel.h GEN-SKEL [test_progs] btf_type_tag.skel.h
GEN-SKEL [test_progs] btf_type_tag_percpu.skel.h
GEN-SKEL [test_progs] btf_type_tag_user.skel.h
GEN-SKEL [test_progs] cb_refs.skel.h
GEN-SKEL [test_progs] cgroup_ancestor.skel.h
GEN-SKEL [test_progs] cgroup_getset_retval_getsockopt.skel.h GEN-SKEL [test_progs] cgroup_getset_retval_hooks.skel.h GEN-SKEL [test_progs] cgroup_getset_retval_setsockopt.skel.h GEN-SKEL [test_progs] cgroup_hierarchical_stats.skel.h GEN-SKEL [test_progs] cgroup_iter.skel.h
GEN-SKEL [test_progs] cgroup_iter_memcg.skel.h
GEN-SKEL [test_progs] cgroup_mprog.skel.h
GEN-SKEL [test_progs] cgroup_preorder.skel.h
GEN-SKEL [test_progs] cgroup_read_xattr.skel.h
GEN-SKEL [test_progs] cgroup_skb_direct_packet_access.skel.h GEN-SKEL [test_progs] cgroup_skb_sk_lookup_kern.skel.h GEN-SKEL [test_progs] cgroup_storage.skel.h
GEN-SKEL [test_progs] cgroup_tcp_skb.skel.h
GEN-SKEL [test_progs] cgrp_kfunc_failure.skel.h
GEN-SKEL [test_progs] cgrp_kfunc_success.skel.h
GEN-SKEL [test_progs] cgrp_ls_attach_cgroup.skel.h
GEN-SKEL [test_progs] cgrp_ls_negative.skel.h
GEN-SKEL [test_progs] cgrp_ls_recursion.skel.h
GEN-SKEL [test_progs] cgrp_ls_sleepable.skel.h
GEN-SKEL [test_progs] cgrp_ls_tp_btf.skel.h
GEN-SKEL [test_progs] cg_storage_multi_egress_only.skel.h GEN-SKEL [test_progs] cg_storage_multi_isolated.skel.h GEN-SKEL [test_progs] cg_storage_multi_shared.skel.h GEN-SKEL [test_progs] compute_live_registers.skel.h
GEN-SKEL [test_progs] connect4_dropper.skel.h
GEN-SKEL [test_progs] connect4_prog.skel.h
GEN-SKEL [test_progs] connect6_prog.skel.h
GEN-SKEL [test_progs] connect_force_port4.skel.h
GEN-SKEL [test_progs] connect_force_port6.skel.h
GEN-SKEL [test_progs] connect_ping.skel.h
GEN-SKEL [test_progs] connect_unix_prog.skel.h
GEN-SKEL [test_progs] cpumask_failure.skel.h
GEN-SKEL [test_progs] cpumask_success.skel.h
GEN-SKEL [test_progs] crypto_basic.skel.h
GEN-SKEL [test_progs] crypto_bench.skel.h
GEN-SKEL [test_progs] crypto_sanity.skel.h
GEN-SKEL [test_progs] csum_diff_test.skel.h
GEN-SKEL [test_progs] decap_sanity.skel.h
GEN-SKEL [test_progs] dev_cgroup.skel.h
GEN-SKEL [test_progs] dmabuf_iter.skel.h
GEN-SKEL [test_progs] dummy_st_ops_fail.skel.h
GEN-SKEL [test_progs] dummy_st_ops_success.skel.h
GEN-SKEL [test_progs] dynptr_fail.skel.h
GEN-SKEL [test_progs] dynptr_success.skel.h
GEN-SKEL [test_progs] empty_skb.skel.h
GEN-SKEL [test_progs] epilogue_exit.skel.h
GEN-SKEL [test_progs] epilogue_tailcall.skel.h
GEN-SKEL [test_progs] exceptions_assert.skel.h
GEN-SKEL [test_progs] exceptions.skel.h
GEN-SKEL [test_progs] exceptions_ext.skel.h
GEN-SKEL [test_progs] exceptions_fail.skel.h
GEN-SKEL [test_progs] exhandler_kern.skel.h
GEN-SKEL [test_progs] fd_htab_lookup.skel.h
GEN-SKEL [test_progs] fentry_many_args.skel.h
progs/bpf_qdisc_fail__incompl_ops.c:13:2: error: call to undeclared function 'bpf_qdisc_skb_drop'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

   13 |         bpf_qdisc_skb_drop(skb, to_free);
      |         ^
progs/bpf_smc.c:91:39: error: no member named 'smc' in 'struct net'
   91 |         if (!task || !task->nsproxy->net_ns->smc.hs_ctrl)
      |                       ~~~~~~~~~~~~~~~~~~~~~  ^
  GEN-SKEL [test_progs] fentry_recursive.skel.h
progs/bpf_smc.c:113:21: error: variable has incomplete type 'struct smc_hs_ctrl'
  113 | struct smc_hs_ctrl  linkcheck = {
      |                     ^

progs/bpf_smc.c:113:8: note: forward declaration of 'struct smc_hs_ctrl'
113 | struct smc_hs_ctrl linkcheck = {
| ^
progs/bpf_qdisc_fifo.c:38:3: error: call to undeclared function 'bpf_qdisc_skb_drop'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

   38 |                 bpf_qdisc_skb_drop(skb, to_free);
      |                 ^

GEN-SKEL [test_progs] fentry_recursive_target.skel.h GEN-SKEL [test_progs] fexit_bpf2bpf.skel.h
GEN-SKEL [test_progs] fexit_bpf2bpf_simple.skel.h
progs/bpf_qdisc_fq.c:280:11: error: call to undeclared function 'bpf_skb_get_hash'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
280 | hash = bpf_skb_get_hash(skb) & q.orphan_mask;
| ^
progs/bpf_qdisc_fq.c:287:11: error: call to undeclared function 'bpf_skb_get_hash'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
287 | hash = bpf_skb_get_hash(skb) & q.orphan_mask;
| ^
GEN-SKEL [test_progs] fexit_many_args.skel.h
GEN-SKEL [test_progs] fib_lookup.skel.h
GEN-SKEL [test_progs] file_reader.skel.h
GEN-SKEL [test_progs] file_reader_fail.skel.h
GEN-SKEL [test_progs] find_vma.skel.h
2 errors generated.
progs/bpf_qdisc_fq.c:375:3: error: call to undeclared function 'bpf_qdisc_skb_drop'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

  375 |                 bpf_qdisc_skb_drop(skb, to_free);
      |                 ^

1 error generated.
make: *** [Makefile:772:
/usr/local/google/home/edumazet/git/net-next/tools/testing/selftests/bpf/bpf_smc.bpf.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [Makefile:772:
/usr/local/google/home/edumazet/git/net-next/tools/testing/selftests/bpf/bpf_qdisc_fail__incompl_ops.bpf.o] Error 1
progs/bpf_qdisc_fifo.c:71:2: error: call to undeclared function
'bpf_qdisc_bstats_update'; ISO C99 and later do not support implicit
function declarations [-Wimplicit-function-declaration]

   71 |         bpf_qdisc_bstats_update(sch, skb);
      |         ^
progs/bpf_qdisc_fifo.c:106:4: error: call to undeclared function
'bpf_kfree_skb'; ISO C99 and later do not support implicit function
declarations [-Wimplicit-function-declaration]
  106 |                         bpf_kfree_skb(skb);
      |                         ^

3 errors generated.
make: *** [Makefile:772:
/usr/local/google/home/edumazet/git/net-next/tools/testing/selftests/bpf/bpf_qdisc_fifo.bpf.o] Error 1
progs/bpf_qdisc_fq.c:614:3: error: call to undeclared function 'bpf_qdisc_bstats_update'; ISO C99 and later do not support implicit
function declarations [-Wimplicit-function-declaration]

  614 |                 bpf_qdisc_bstats_update(sch, skb);
      |                 ^

progs/bpf_qdisc_fq.c:619:3: error: call to undeclared function 'bpf_qdisc_watchdog_schedule'; ISO C99 and later do not support
implicit function declarations [-Wimplicit-function-declaration]
619 | bpf_qdisc_watchdog_schedule(sch,
cb_ctx.expire, q.timer_slack);
| ^
5 errors generated.
make: *** [Makefile:772:
/usr/local/google/home/edumazet/git/net-next/tools/testing/selftests/bpf/bpf_qdisc_fq.bpf.o] Error 1
make: Leaving directory '/usr/local/google/home/edumazet/git/net-next/tools/testing/selftests/bpf'

I dot know how to get past these qdisc errors.

#3 lore raw
Quoted 24 lines · Eric Dumazet
Quoted 12 lines · Jakub Kicinski
Quoted 9 lines · On Sat, 14 Mar 2026 18:08:02 +0000 Eric Dumazet wrote:

(tcp_congestion_ops)->cwnd_event() is called very often, with @event oscillating between CA_EVENT_TX_START and other values.

This is not branch prediction friendly.

Provide a new cwnd_event_tx_start pointer dedicated for CA_EVENT_TX_START.

Both BBR and CUBIC benefit from this change, since they only care about CA_EVENT_TX_START.

Quoted 8 lines

BPF still not building :(

progs/tcp_ca_kfunc.c:121:33: error: use of undeclared identifier 'cwnd_event_tx_start'
121 | .cwnd_event_tx_start = (void *)cwnd_event_tx_start,
| ^~~~~~~~~~~~~~~~~~~

https://github.com/kernel-patches/bpf/actions/runs/23096281431/job/67089276918

Quoted 6 lines

make clean
vng -bv CC=clang >RES
make headers ; make -j100 -C tools/testing/selftests/net ; make -j100 -C tools/testing/selftests/bpf
make -j100 -C tools/testing/selftests/bpf
make: Entering directory

It seems my config missed

CONFIG_NET_SCH_BPF=y

#4 lore raw
Quoted 33 lines · Eric Dumazet
Quoted 24 lines · Eric Dumazet
Quoted 12 lines · Jakub Kicinski
Quoted 9 lines · On Sat, 14 Mar 2026 18:08:02 +0000 Eric Dumazet wrote:

(tcp_congestion_ops)->cwnd_event() is called very often, with @event oscillating between CA_EVENT_TX_START and other values.

This is not branch prediction friendly.

Provide a new cwnd_event_tx_start pointer dedicated for CA_EVENT_TX_START.

Both BBR and CUBIC benefit from this change, since they only care about CA_EVENT_TX_START.

Quoted 8 lines

BPF still not building :(

progs/tcp_ca_kfunc.c:121:33: error: use of undeclared identifier 'cwnd_event_tx_start'
121 | .cwnd_event_tx_start = (void *)cwnd_event_tx_start,
| ^~~~~~~~~~~~~~~~~~~

https://github.com/kernel-patches/bpf/actions/runs/23096281431/job/67089276918

Quoted 6 lines

make clean
vng -bv CC=clang >RES
make headers ; make -j100 -C tools/testing/selftests/net ; make -j100 -C tools/testing/selftests/bpf
make -j100 -C tools/testing/selftests/bpf
make: Entering directory

Quoted 3 lines

It seems my config missed

CONFIG_NET_SCH_BPF=y

OK this was a typo.

(quoted diff) +0 -0

b/tools/testing/selftests/bpf/progs/tcp_ca_kfunc.c
index a4334cf4c6bd59a0552a5a2cccabf75489d46f58..0a3e9d35bf6f0c4c988c741c010fb7f3405fb43c 100644

tools/testing/selftests/bpf/progs/tcp_ca_kfunc.c +0 -0
@@ -74,7 +74,7 @@ void BPF_PROG(cwnd_event, struct sock *sk, enum

tcp_ca_event event)
}

SEC("struct_ops")
-void BPF_PROG(cwnd_event_tx_stat, struct sock *sk) +void BPF_PROG(cwnd_event_tx_start, struct sock *sk)

 {
        bbr_cwnd_event_tx_start(sk);
        dctcp_cwnd_event_tx_start(sk);