From: planck kernel size experiment Subject: tcp: remove cross-connection metrics and their generic-netlink API The logger accepts independent TCP connections and needs no destination history. tcp_metrics nevertheless allocates at least 8192 pointer buckets (32 KiB on RV32), stores RTT/congestion/Fast-Open state after close, and is the last linked generic-netlink family. Those are connection-reuse optimizations and a userspace inspection API, not requirements for TCP transport correctness. Use conservative cache-miss behavior permanently: start with an infinite ssthresh, retain the RFC fallback RTO when the handshake yielded no RTT, never treat a peer as previously proven, and do not cache Fast Open state. Then omit tcp_metrics and the now-unreferenced generic-netlink dispatcher. Base netlink's policy encoder remains for route-netlink acknowledgements. The logger proof covers listen, handshake, exact receive and close after this change. --- a/net/ipv4/Makefile +++ b/net/ipv4/Makefile @@ -8,7 +8,7 @@ obj-y := route.o inetpeer.o protocol.o \ 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_metrics.o tcp_fastopen.o \ + tcp_minisocks.o tcp_cong.o tcp_fastopen.o \ tcp_rate.o tcp_recovery.o tcp_ulp.o \ tcp_offload.o tcp_plb.o datagram.o raw.o udp.o \ udp_offload.o arp.o icmp.o devinet.o af_inet.o igmp.o \ --- a/net/netlink/Makefile +++ b/net/netlink/Makefile @@ -3,7 +3,7 @@ # Makefile for the netlink driver. # -obj-y := af_netlink.o genetlink.o policy.o +obj-y := af_netlink.o policy.o obj-$(CONFIG_NETLINK_DIAG) += netlink_diag.o netlink_diag-y := diag.o --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -603,8 +603,6 @@ static void netlink_remove(struct sock *sk) if (nlk_sk(sk)->subscriptions) { __sk_del_bind_node(sk); netlink_update_listeners(sk); } - if (sk->sk_protocol == NETLINK_GENERIC) - atomic_inc(&genl_sk_destructing_cnt); netlink_table_ungrab(); } @@ -742,11 +740,7 @@ static int netlink_release(struct socket *sock) for (i = 0; i < nlk->ngroups; i++) if (test_bit(i, nlk->groups)) nlk->netlink_unbind(sock_net(sk), i + 1); } - if (sk->sk_protocol == NETLINK_GENERIC && - atomic_dec_return(&genl_sk_destructing_cnt) == 0) - wake_up(&genl_sk_destructing_waitq); - sock->sk = NULL; wake_up_interruptible_all(&nlk->wait); --- a/net/core/planck_minimal.c +++ b/net/core/planck_minimal.c @@ -3,4 +3,6 @@ #include #include +#include +#include #include #include @@ -97,3 +99,40 @@ void bpf_prog_change_xdp(struct bpf_prog *prev_prog, struct bpf_prog *prog) { } + +void tcp_update_metrics(struct sock *sk) +{ +} + +void tcp_init_metrics(struct sock *sk) +{ + struct tcp_sock *tp = tcp_sk(sk); + + tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; + if (!tp->srtt_us) { + tp->rttvar_us = jiffies_to_usecs(TCP_TIMEOUT_FALLBACK); + tp->mdev_us = tp->rttvar_us; + tp->mdev_max_us = tp->rttvar_us; + inet_csk(sk)->icsk_rto = TCP_TIMEOUT_FALLBACK; + } +} + +bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst) +{ + return false; +} + +void tcp_fastopen_cache_get(struct sock *sk, u16 *mss, + struct tcp_fastopen_cookie *cookie) +{ +} + +void tcp_fastopen_cache_set(struct sock *sk, u16 mss, + struct tcp_fastopen_cookie *cookie, bool syn_lost, + u16 try_exp) +{ +} + +void __init tcp_metrics_init(void) +{ +}