aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorEric Dumazet <dada1@cosmosbay.com>2007-11-06 02:39:16 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-11-07 07:08:58 -0500
commit47a31a6ffcca3b55149bccd5b99763e5eea60ac4 (patch)
treede45b7c03799f16e717b9bf63b249bfe5f0f19a4 /net/ipv4
parent286ab3d46058840d68e5d7d52e316c1f7e98c59f (diff)
[IPV4]: Use the {DEFINE|REF}_PROTO_INUSE infrastructure
Trivial patch to make "tcp,udp,udplite,raw" protocols uses the fast "inuse sockets" infrastructure Each protocol use then a static percpu var, instead of a dynamic one. This saves some ram and some cpu cycles Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/raw.c3
-rw-r--r--net/ipv4/tcp_ipv4.c3
-rw-r--r--net/ipv4/udp.c3
-rw-r--r--net/ipv4/udplite.c3
4 files changed, 12 insertions, 0 deletions
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 3916faca3afe..66b42f547bf9 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -760,6 +760,8 @@ static int raw_ioctl(struct sock *sk, int cmd, unsigned long arg)
760 } 760 }
761} 761}
762 762
763DEFINE_PROTO_INUSE(raw)
764
763struct proto raw_prot = { 765struct proto raw_prot = {
764 .name = "RAW", 766 .name = "RAW",
765 .owner = THIS_MODULE, 767 .owner = THIS_MODULE,
@@ -781,6 +783,7 @@ struct proto raw_prot = {
781 .compat_setsockopt = compat_raw_setsockopt, 783 .compat_setsockopt = compat_raw_setsockopt,
782 .compat_getsockopt = compat_raw_getsockopt, 784 .compat_getsockopt = compat_raw_getsockopt,
783#endif 785#endif
786 REF_PROTO_INUSE(raw)
784}; 787};
785 788
786#ifdef CONFIG_PROC_FS 789#ifdef CONFIG_PROC_FS
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index d438dfb0c8f3..e9127cdced20 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2417,6 +2417,8 @@ void tcp4_proc_exit(void)
2417} 2417}
2418#endif /* CONFIG_PROC_FS */ 2418#endif /* CONFIG_PROC_FS */
2419 2419
2420DEFINE_PROTO_INUSE(tcp)
2421
2420struct proto tcp_prot = { 2422struct proto tcp_prot = {
2421 .name = "TCP", 2423 .name = "TCP",
2422 .owner = THIS_MODULE, 2424 .owner = THIS_MODULE,
@@ -2451,6 +2453,7 @@ struct proto tcp_prot = {
2451 .compat_setsockopt = compat_tcp_setsockopt, 2453 .compat_setsockopt = compat_tcp_setsockopt,
2452 .compat_getsockopt = compat_tcp_getsockopt, 2454 .compat_getsockopt = compat_tcp_getsockopt,
2453#endif 2455#endif
2456 REF_PROTO_INUSE(tcp)
2454}; 2457};
2455 2458
2456void __init tcp_v4_init(struct net_proto_family *ops) 2459void __init tcp_v4_init(struct net_proto_family *ops)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 4bc25b46f33f..03c400ca14c5 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1430,6 +1430,8 @@ unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait)
1430 1430
1431} 1431}
1432 1432
1433DEFINE_PROTO_INUSE(udp)
1434
1433struct proto udp_prot = { 1435struct proto udp_prot = {
1434 .name = "UDP", 1436 .name = "UDP",
1435 .owner = THIS_MODULE, 1437 .owner = THIS_MODULE,
@@ -1452,6 +1454,7 @@ struct proto udp_prot = {
1452 .compat_setsockopt = compat_udp_setsockopt, 1454 .compat_setsockopt = compat_udp_setsockopt,
1453 .compat_getsockopt = compat_udp_getsockopt, 1455 .compat_getsockopt = compat_udp_getsockopt,
1454#endif 1456#endif
1457 REF_PROTO_INUSE(udp)
1455}; 1458};
1456 1459
1457/* ------------------------------------------------------------------------ */ 1460/* ------------------------------------------------------------------------ */
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c
index 94977205abb4..f5baeb3e8b85 100644
--- a/net/ipv4/udplite.c
+++ b/net/ipv4/udplite.c
@@ -44,6 +44,8 @@ static struct net_protocol udplite_protocol = {
44 .no_policy = 1, 44 .no_policy = 1,
45}; 45};
46 46
47DEFINE_PROTO_INUSE(udplite)
48
47struct proto udplite_prot = { 49struct proto udplite_prot = {
48 .name = "UDP-Lite", 50 .name = "UDP-Lite",
49 .owner = THIS_MODULE, 51 .owner = THIS_MODULE,
@@ -67,6 +69,7 @@ struct proto udplite_prot = {
67 .compat_setsockopt = compat_udp_setsockopt, 69 .compat_setsockopt = compat_udp_setsockopt,
68 .compat_getsockopt = compat_udp_getsockopt, 70 .compat_getsockopt = compat_udp_getsockopt,
69#endif 71#endif
72 REF_PROTO_INUSE(udplite)
70}; 73};
71 74
72static struct inet_protosw udplite4_protosw = { 75static struct inet_protosw udplite4_protosw = {