Commit 47a31a6f authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

[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: default avatarEric Dumazet <dada1@cosmosbay.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 286ab3d4
...@@ -760,6 +760,8 @@ static int raw_ioctl(struct sock *sk, int cmd, unsigned long arg) ...@@ -760,6 +760,8 @@ static int raw_ioctl(struct sock *sk, int cmd, unsigned long arg)
} }
} }
DEFINE_PROTO_INUSE(raw)
struct proto raw_prot = { struct proto raw_prot = {
.name = "RAW", .name = "RAW",
.owner = THIS_MODULE, .owner = THIS_MODULE,
...@@ -781,6 +783,7 @@ struct proto raw_prot = { ...@@ -781,6 +783,7 @@ struct proto raw_prot = {
.compat_setsockopt = compat_raw_setsockopt, .compat_setsockopt = compat_raw_setsockopt,
.compat_getsockopt = compat_raw_getsockopt, .compat_getsockopt = compat_raw_getsockopt,
#endif #endif
REF_PROTO_INUSE(raw)
}; };
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
......
...@@ -2417,6 +2417,8 @@ void tcp4_proc_exit(void) ...@@ -2417,6 +2417,8 @@ void tcp4_proc_exit(void)
} }
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
DEFINE_PROTO_INUSE(tcp)
struct proto tcp_prot = { struct proto tcp_prot = {
.name = "TCP", .name = "TCP",
.owner = THIS_MODULE, .owner = THIS_MODULE,
...@@ -2451,6 +2453,7 @@ struct proto tcp_prot = { ...@@ -2451,6 +2453,7 @@ struct proto tcp_prot = {
.compat_setsockopt = compat_tcp_setsockopt, .compat_setsockopt = compat_tcp_setsockopt,
.compat_getsockopt = compat_tcp_getsockopt, .compat_getsockopt = compat_tcp_getsockopt,
#endif #endif
REF_PROTO_INUSE(tcp)
}; };
void __init tcp_v4_init(struct net_proto_family *ops) void __init tcp_v4_init(struct net_proto_family *ops)
......
...@@ -1430,6 +1430,8 @@ unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait) ...@@ -1430,6 +1430,8 @@ unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait)
} }
DEFINE_PROTO_INUSE(udp)
struct proto udp_prot = { struct proto udp_prot = {
.name = "UDP", .name = "UDP",
.owner = THIS_MODULE, .owner = THIS_MODULE,
...@@ -1452,6 +1454,7 @@ struct proto udp_prot = { ...@@ -1452,6 +1454,7 @@ struct proto udp_prot = {
.compat_setsockopt = compat_udp_setsockopt, .compat_setsockopt = compat_udp_setsockopt,
.compat_getsockopt = compat_udp_getsockopt, .compat_getsockopt = compat_udp_getsockopt,
#endif #endif
REF_PROTO_INUSE(udp)
}; };
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
......
...@@ -44,6 +44,8 @@ static struct net_protocol udplite_protocol = { ...@@ -44,6 +44,8 @@ static struct net_protocol udplite_protocol = {
.no_policy = 1, .no_policy = 1,
}; };
DEFINE_PROTO_INUSE(udplite)
struct proto udplite_prot = { struct proto udplite_prot = {
.name = "UDP-Lite", .name = "UDP-Lite",
.owner = THIS_MODULE, .owner = THIS_MODULE,
...@@ -67,6 +69,7 @@ struct proto udplite_prot = { ...@@ -67,6 +69,7 @@ struct proto udplite_prot = {
.compat_setsockopt = compat_udp_setsockopt, .compat_setsockopt = compat_udp_setsockopt,
.compat_getsockopt = compat_udp_getsockopt, .compat_getsockopt = compat_udp_getsockopt,
#endif #endif
REF_PROTO_INUSE(udplite)
}; };
static struct inet_protosw udplite4_protosw = { static struct inet_protosw udplite4_protosw = {
......
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