Group the TCP sysctl members into tcp_sysctl using struct_group(). This makes the memcpy and sizeof boundaries clear in follow-up patches, avoids relying on writes across neighboring members, and improves readability. --- .../net_cachelines/netns_ipv4_sysctl.rst | 25 ++++++++------- include/net/netns/ipv4.h | 32 +++++++++++-------- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/Documentation/networking/net_cachelines/netns_ipv4_sysctl.rst b/Documentation/networking/net_cachelines/netns_ipv4_sysctl.rst index beaf1880a19b..f6edf02618fa 100644 --- a/Documentation/networking/net_cachelines/netns_ipv4_sysctl.rst +++ b/Documentation/networking/net_cachelines/netns_ipv4_sysctl.rst @@ -43,23 +43,20 @@ u32 ip_rt_min_pmtu int ip_rt_mtu_expires int ip_rt_min_advmss struct_local_ports ip_local_ports -u8 sysctl_tcp_ecn -u8 sysctl_tcp_ecn_fallback u8 sysctl_ip_default_ttl ip4_dst_hoplimit/ip_select_ttl u8 sysctl_ip_no_pmtu_disc -u8 sysctl_ip_fwd_use_pmtu read_mostly ip_dst_mtu_maybe_forward/ip_skb_dst_mtu u8 sysctl_ip_fwd_update_priority ip_forward u8 sysctl_ip_nonlocal_bind u8 sysctl_ip_autobind_reuse u8 sysctl_ip_dynaddr -u8 sysctl_ip_early_demux read_mostly ip(6)_rcv_finish_core u8 sysctl_raw_l3mdev_accept -u8 sysctl_tcp_early_demux read_mostly ip(6)_rcv_finish_core u8 sysctl_udp_early_demux u8 sysctl_nexthop_compat_mode u8 sysctl_fwmark_reflect +.. struct_group(tcp_sysctl) bulk-copied via memcpy() in tcp_sk_init() +u8 sysctl_tcp_ecn +u8 sysctl_tcp_ecn_fallback u8 sysctl_tcp_fwmark_accept -u8 sysctl_tcp_l3mdev_accept read_mostly __inet6_lookup_established/inet_request_bound_dev_if u8 sysctl_tcp_mtu_probing int sysctl_tcp_mtu_probe_floor int sysctl_tcp_base_mss @@ -85,6 +82,7 @@ unsigned_int sysctl_tcp_notsent_lowat rea u8 sysctl_tcp_sack tcp_syn_options u8 sysctl_tcp_window_scaling tcp_syn_options,tcp_parse_options u8 sysctl_tcp_timestamps +u8 sysctl_netns_inherit_tcp_sysctls read_mostly tcp_schedule_loss_probe(tcp_write_xmit) u8 sysctl_tcp_early_retrans read_mostly tcp_schedule_loss_probe(tcp_write_xmit) u32 sysctl_tcp_rto_max_ms u8 sysctl_tcp_recovery tcp_fastretrans_alert @@ -123,18 +121,21 @@ unsigned_long sysctl_tcp_comp_sack_delay_ns unsigned_long sysctl_tcp_comp_sack_slack_ns __tcp_ack_snd_check int sysctl_max_syn_backlog int sysctl_tcp_fastopen -struct_tcp_congestion_ops tcp_congestion_control init_cc -struct_tcp_fastopen_context tcp_fastopen_ctx unsigned_int sysctl_tcp_fastopen_blackhole_timeout -atomic_t tfo_active_disable_times -unsigned_long tfo_active_disable_stamp -u32 tcp_challenge_timestamp -u32 tcp_challenge_count u8 sysctl_tcp_plb_enabled u8 sysctl_tcp_plb_idle_rehash_rounds u8 sysctl_tcp_plb_rehash_rounds u8 sysctl_tcp_plb_suspend_rto_sec int sysctl_tcp_plb_cong_thresh +u8 sysctl_tcp_shrink_window +u8 sysctl_tcp_syn_linear_timeouts +.. end_of(tcp_sysctl) +struct_tcp_congestion_ops tcp_congestion_control init_cc +struct_tcp_fastopen_context tcp_fastopen_ctx +atomic_t tfo_active_disable_times +unsigned_long tfo_active_disable_stamp +u32 tcp_challenge_timestamp +u32 tcp_challenge_count int sysctl_udp_wmem_min int sysctl_udp_rmem_min u8 sysctl_fib_notify_on_flag_change diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 2dbd46fc4734..53b180cc7a94 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h @@ -116,7 +116,6 @@ struct netns_ipv4 { #endif bool fib_has_custom_local_routes; bool fib_offload_disabled; - u8 sysctl_tcp_shrink_window; #ifdef CONFIG_IP_ROUTE_CLASSID atomic_t fib_num_tclassid_users; #endif @@ -149,11 +148,6 @@ struct netns_ipv4 { struct local_ports ip_local_ports; - u8 sysctl_tcp_ecn; - u8 sysctl_tcp_ecn_option; - u8 sysctl_tcp_ecn_option_beacon; - u8 sysctl_tcp_ecn_fallback; - u8 sysctl_ip_default_ttl; u8 sysctl_ip_no_pmtu_disc; u8 sysctl_ip_fwd_update_priority; @@ -169,6 +163,14 @@ struct netns_ipv4 { u8 sysctl_nexthop_compat_mode; u8 sysctl_fwmark_reflect; + + /* TCP sysctl fields enclosed in tcp_sysctl group are copied + * using a single memcpy() in tcp_sk_init() + */ + struct_group(tcp_sysctl, u8 sysctl_tcp_ecn; + u8 sysctl_tcp_ecn_option; + u8 sysctl_tcp_ecn_option_beacon; + u8 sysctl_tcp_ecn_fallback; u8 sysctl_tcp_fwmark_accept; u8 sysctl_tcp_mtu_probing; int sysctl_tcp_mtu_probe_floor; @@ -227,24 +229,28 @@ struct netns_ipv4 { unsigned long sysctl_tcp_comp_sack_slack_ns; int sysctl_max_syn_backlog; int sysctl_tcp_fastopen; - const struct tcp_congestion_ops __rcu *tcp_congestion_control; - struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; unsigned int sysctl_tcp_fastopen_blackhole_timeout; - atomic_t tfo_active_disable_times; - unsigned long tfo_active_disable_stamp; - u32 tcp_challenge_timestamp; - u32 tcp_challenge_count; u8 sysctl_tcp_plb_enabled; u8 sysctl_tcp_plb_idle_rehash_rounds; u8 sysctl_tcp_plb_rehash_rounds; u8 sysctl_tcp_plb_suspend_rto_sec; int sysctl_tcp_plb_cong_thresh; + u8 sysctl_tcp_shrink_window; + u8 sysctl_tcp_syn_linear_timeouts; + + ); /* end tcp_sysctl group */ + + const struct tcp_congestion_ops __rcu *tcp_congestion_control; + struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; + atomic_t tfo_active_disable_times; + unsigned long tfo_active_disable_stamp; + u32 tcp_challenge_timestamp; + u32 tcp_challenge_count; int sysctl_udp_wmem_min; int sysctl_udp_rmem_min; u8 sysctl_fib_notify_on_flag_change; - u8 sysctl_tcp_syn_linear_timeouts; #ifdef CONFIG_NET_L3_MASTER_DEV u8 sysctl_udp_l3mdev_accept; -- 2.47.3