Commit 4b6bbf17 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

ipv4: shrink netns_ipv4 with sysctl conversions

These sysctls that can fit in one byte instead of one int
are converted to save space and thus reduce cache line misses.

 - icmp_echo_ignore_all, icmp_echo_ignore_broadcasts,
 - icmp_ignore_bogus_error_responses, icmp_errors_use_inbound_ifaddr
 - tcp_ecn, tcp_ecn_fallback
 - ip_default_ttl, ip_no_pmtu_disc, ip_fwd_use_pmtu
 - ip_nonlocal_bind, ip_autobind_reuse
 - ip_dynaddr, ip_early_demux, raw_l3mdev_accept
 - nexthop_compat_mode, fwmark_reflect
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cb944413
...@@ -83,36 +83,36 @@ struct netns_ipv4 { ...@@ -83,36 +83,36 @@ struct netns_ipv4 {
struct xt_table *nat_table; struct xt_table *nat_table;
#endif #endif
int sysctl_icmp_echo_ignore_all; u8 sysctl_icmp_echo_ignore_all;
int sysctl_icmp_echo_ignore_broadcasts; u8 sysctl_icmp_echo_ignore_broadcasts;
int sysctl_icmp_ignore_bogus_error_responses; u8 sysctl_icmp_ignore_bogus_error_responses;
u8 sysctl_icmp_errors_use_inbound_ifaddr;
int sysctl_icmp_ratelimit; int sysctl_icmp_ratelimit;
int sysctl_icmp_ratemask; int sysctl_icmp_ratemask;
int sysctl_icmp_errors_use_inbound_ifaddr;
struct local_ports ip_local_ports; struct local_ports ip_local_ports;
int sysctl_tcp_ecn; u8 sysctl_tcp_ecn;
int sysctl_tcp_ecn_fallback; u8 sysctl_tcp_ecn_fallback;
int sysctl_ip_default_ttl; u8 sysctl_ip_default_ttl;
int sysctl_ip_no_pmtu_disc; u8 sysctl_ip_no_pmtu_disc;
int sysctl_ip_fwd_use_pmtu; u8 sysctl_ip_fwd_use_pmtu;
int sysctl_ip_fwd_update_priority; int sysctl_ip_fwd_update_priority;
int sysctl_ip_nonlocal_bind; u8 sysctl_ip_nonlocal_bind;
int sysctl_ip_autobind_reuse; u8 sysctl_ip_autobind_reuse;
/* Shall we try to damage output packets if routing dev changes? */ /* Shall we try to damage output packets if routing dev changes? */
int sysctl_ip_dynaddr; u8 sysctl_ip_dynaddr;
int sysctl_ip_early_demux; u8 sysctl_ip_early_demux;
#ifdef CONFIG_NET_L3_MASTER_DEV #ifdef CONFIG_NET_L3_MASTER_DEV
int sysctl_raw_l3mdev_accept; u8 sysctl_raw_l3mdev_accept;
#endif #endif
int sysctl_tcp_early_demux; int sysctl_tcp_early_demux;
int sysctl_udp_early_demux; int sysctl_udp_early_demux;
int sysctl_nexthop_compat_mode; u8 sysctl_nexthop_compat_mode;
int sysctl_fwmark_reflect; u8 sysctl_fwmark_reflect;
int sysctl_tcp_fwmark_accept; int sysctl_tcp_fwmark_accept;
#ifdef CONFIG_NET_L3_MASTER_DEV #ifdef CONFIG_NET_L3_MASTER_DEV
int sysctl_tcp_l3mdev_accept; int sysctl_tcp_l3mdev_accept;
......
...@@ -595,30 +595,30 @@ static struct ctl_table ipv4_net_table[] = { ...@@ -595,30 +595,30 @@ static struct ctl_table ipv4_net_table[] = {
{ {
.procname = "icmp_echo_ignore_all", .procname = "icmp_echo_ignore_all",
.data = &init_net.ipv4.sysctl_icmp_echo_ignore_all, .data = &init_net.ipv4.sysctl_icmp_echo_ignore_all,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "icmp_echo_ignore_broadcasts", .procname = "icmp_echo_ignore_broadcasts",
.data = &init_net.ipv4.sysctl_icmp_echo_ignore_broadcasts, .data = &init_net.ipv4.sysctl_icmp_echo_ignore_broadcasts,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "icmp_ignore_bogus_error_responses", .procname = "icmp_ignore_bogus_error_responses",
.data = &init_net.ipv4.sysctl_icmp_ignore_bogus_error_responses, .data = &init_net.ipv4.sysctl_icmp_ignore_bogus_error_responses,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "icmp_errors_use_inbound_ifaddr", .procname = "icmp_errors_use_inbound_ifaddr",
.data = &init_net.ipv4.sysctl_icmp_errors_use_inbound_ifaddr, .data = &init_net.ipv4.sysctl_icmp_errors_use_inbound_ifaddr,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "icmp_ratelimit", .procname = "icmp_ratelimit",
...@@ -645,9 +645,9 @@ static struct ctl_table ipv4_net_table[] = { ...@@ -645,9 +645,9 @@ static struct ctl_table ipv4_net_table[] = {
{ {
.procname = "raw_l3mdev_accept", .procname = "raw_l3mdev_accept",
.data = &init_net.ipv4.sysctl_raw_l3mdev_accept, .data = &init_net.ipv4.sysctl_raw_l3mdev_accept,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec_minmax, .proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO, .extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE, .extra2 = SYSCTL_ONE,
}, },
...@@ -655,30 +655,30 @@ static struct ctl_table ipv4_net_table[] = { ...@@ -655,30 +655,30 @@ static struct ctl_table ipv4_net_table[] = {
{ {
.procname = "tcp_ecn", .procname = "tcp_ecn",
.data = &init_net.ipv4.sysctl_tcp_ecn, .data = &init_net.ipv4.sysctl_tcp_ecn,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "tcp_ecn_fallback", .procname = "tcp_ecn_fallback",
.data = &init_net.ipv4.sysctl_tcp_ecn_fallback, .data = &init_net.ipv4.sysctl_tcp_ecn_fallback,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "ip_dynaddr", .procname = "ip_dynaddr",
.data = &init_net.ipv4.sysctl_ip_dynaddr, .data = &init_net.ipv4.sysctl_ip_dynaddr,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "ip_early_demux", .procname = "ip_early_demux",
.data = &init_net.ipv4.sysctl_ip_early_demux, .data = &init_net.ipv4.sysctl_ip_early_demux,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "udp_early_demux", .procname = "udp_early_demux",
...@@ -697,18 +697,18 @@ static struct ctl_table ipv4_net_table[] = { ...@@ -697,18 +697,18 @@ static struct ctl_table ipv4_net_table[] = {
{ {
.procname = "nexthop_compat_mode", .procname = "nexthop_compat_mode",
.data = &init_net.ipv4.sysctl_nexthop_compat_mode, .data = &init_net.ipv4.sysctl_nexthop_compat_mode,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec_minmax, .proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO, .extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE, .extra2 = SYSCTL_ONE,
}, },
{ {
.procname = "ip_default_ttl", .procname = "ip_default_ttl",
.data = &init_net.ipv4.sysctl_ip_default_ttl, .data = &init_net.ipv4.sysctl_ip_default_ttl,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec_minmax, .proc_handler = proc_dou8vec_minmax,
.extra1 = &ip_ttl_min, .extra1 = &ip_ttl_min,
.extra2 = &ip_ttl_max, .extra2 = &ip_ttl_max,
}, },
...@@ -729,16 +729,16 @@ static struct ctl_table ipv4_net_table[] = { ...@@ -729,16 +729,16 @@ static struct ctl_table ipv4_net_table[] = {
{ {
.procname = "ip_no_pmtu_disc", .procname = "ip_no_pmtu_disc",
.data = &init_net.ipv4.sysctl_ip_no_pmtu_disc, .data = &init_net.ipv4.sysctl_ip_no_pmtu_disc,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "ip_forward_use_pmtu", .procname = "ip_forward_use_pmtu",
.data = &init_net.ipv4.sysctl_ip_fwd_use_pmtu, .data = &init_net.ipv4.sysctl_ip_fwd_use_pmtu,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec, .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "ip_forward_update_priority", .procname = "ip_forward_update_priority",
...@@ -752,25 +752,25 @@ static struct ctl_table ipv4_net_table[] = { ...@@ -752,25 +752,25 @@ static struct ctl_table ipv4_net_table[] = {
{ {
.procname = "ip_nonlocal_bind", .procname = "ip_nonlocal_bind",
.data = &init_net.ipv4.sysctl_ip_nonlocal_bind, .data = &init_net.ipv4.sysctl_ip_nonlocal_bind,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "ip_autobind_reuse", .procname = "ip_autobind_reuse",
.data = &init_net.ipv4.sysctl_ip_autobind_reuse, .data = &init_net.ipv4.sysctl_ip_autobind_reuse,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec_minmax, .proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO, .extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE, .extra2 = SYSCTL_ONE,
}, },
{ {
.procname = "fwmark_reflect", .procname = "fwmark_reflect",
.data = &init_net.ipv4.sysctl_fwmark_reflect, .data = &init_net.ipv4.sysctl_fwmark_reflect,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec, .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "tcp_fwmark_accept", .procname = "tcp_fwmark_accept",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment