From: planck kernel size experiment Subject: tcp: replace TCP Fast Open with ordinary-handshake fallbacks The log listener and its host proof use an ordinary three-way TCP handshake. TCP Fast Open adds cookie keys, SYN-data child creation, black-hole detection and per-network cipher management without helping that path. Keep its internal call surface as explicit fallbacks: inbound SYNs continue through the normal request queue, outbound connects use tcp_connect(), and attempts to manage a Fast Open key report EOPNOTSUPP. TCP itself, including streaming and retransmit behavior, is unchanged. Measured effect on RV32: 1,133,864 -> 1,125,672 bytes in the raw Image (-8,192 bytes). Linked sections fell by 6,676 bytes: text -2,580, data/padding -4,096, and BSS unchanged. The 2,548-byte Fast Open object becomes about 40 bytes of live fallbacks, its private hash routines disappear, and the exact UDP + TCP + fsync + disk-readback proof passes. --- a/net/ipv4/Makefile +++ b/net/ipv4/Makefile @@ -8,7 +8,7 @@ ip_output.o ip_sockglue.o inet_hashtables.o \ inet_timewait_sock.o inet_connection_sock.o \ tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o \ - tcp_minisocks.o tcp_cong.o tcp_fastopen.o \ + tcp_minisocks.o tcp_cong.o planck_fastopen.o \ tcp_rate.o tcp_recovery.o \ tcp_plb.o datagram.o raw.o udp.o \ arp.o icmp.o devinet.o af_inet.o planck_unicast.o \ --- /dev/null +++ b/net/ipv4/planck_fastopen.c @@ -0,0 +1,71 @@ +// SPDX-License-Identifier: GPL-2.0 +/* TCP Fast Open is absent; every hook selects the ordinary TCP path. */ + +#include + +void tcp_fastopen_destroy_cipher(struct sock *sk) +{ +} + +void tcp_fastopen_ctx_destroy(struct net *net) +{ +} + +int tcp_fastopen_reset_cipher(struct net *net, struct sock *sk, + void *primary_key, void *backup_key) +{ + return -EOPNOTSUPP; +} + +int tcp_fastopen_get_cipher(struct net *net, struct inet_connection_sock *icsk, + u64 *key) +{ + return 0; +} + +void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb) +{ +} + +struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb, + struct request_sock *req, + struct tcp_fastopen_cookie *foc, + const struct dst_entry *dst) +{ + /* NULL makes tcp_conn_request() enqueue a conventional SYN request. */ + return NULL; +} + +void tcp_fastopen_init_key_once(struct net *net) +{ +} + +bool tcp_fastopen_cookie_check(struct sock *sk, u16 *mss, + struct tcp_fastopen_cookie *cookie) +{ + /* False makes the send path fall back to a regular SYN. */ + return false; +} + +bool tcp_fastopen_defer_connect(struct sock *sk, int *err) +{ + *err = 0; + return false; +} + +void tcp_fastopen_active_disable(struct sock *sk) +{ +} + +bool tcp_fastopen_active_should_disable(struct sock *sk) +{ + return false; +} + +void tcp_fastopen_active_disable_ofo_check(struct sock *sk) +{ +} + +void tcp_fastopen_active_detect_blackhole(struct sock *sk, bool expired) +{ +}