X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=net%2Fdccp%2Fproto.c;h=9dfe2470962c7dd966f93243cdefb29b377f914e;hb=654e4787689faffdd2137fe91f59fd3ef3363ad2;hp=0bed4a6095b7afd4f84ec179daefcf1285371a8c;hpb=6208e77e7fa9e69f399fddc55b1cf9527fbde599;p=linux-2.6-omap-h63xx.git diff --git a/net/dccp/proto.c b/net/dccp/proto.c index 0bed4a6095b..9dfe2470962 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c @@ -27,7 +27,6 @@ #include #include -#include #include #include #include @@ -78,7 +77,7 @@ void dccp_set_state(struct sock *sk, const int state) sk->sk_prot->unhash(sk); if (inet_csk(sk)->icsk_bind_hash != NULL && !(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) - inet_put_port(&dccp_hashinfo, sk); + inet_put_port(sk); /* fall through */ default: if (oldstate == DCCP_OPEN) @@ -173,20 +172,6 @@ const char *dccp_state_name(const int state) EXPORT_SYMBOL_GPL(dccp_state_name); -void dccp_hash(struct sock *sk) -{ - inet_hash(&dccp_hashinfo, sk); -} - -EXPORT_SYMBOL_GPL(dccp_hash); - -void dccp_unhash(struct sock *sk) -{ - inet_unhash(&dccp_hashinfo, sk); -} - -EXPORT_SYMBOL_GPL(dccp_unhash); - int dccp_init_sock(struct sock *sk, const __u8 ctl_sock_initialized) { struct dccp_sock *dp = dccp_sk(sk); @@ -268,7 +253,7 @@ int dccp_destroy_sock(struct sock *sk) /* Clean up a referenced DCCP bind bucket. */ if (inet_csk(sk)->icsk_bind_hash != NULL) - inet_put_port(&dccp_hashinfo, sk); + inet_put_port(sk); kfree(dp->dccps_service_list); dp->dccps_service_list = NULL; @@ -1024,33 +1009,14 @@ void dccp_shutdown(struct sock *sk, int how) EXPORT_SYMBOL_GPL(dccp_shutdown); -static int __init dccp_mib_init(void) +static inline int dccp_mib_init(void) { - int rc = -ENOMEM; - - dccp_statistics[0] = alloc_percpu(struct dccp_mib); - if (dccp_statistics[0] == NULL) - goto out; - - dccp_statistics[1] = alloc_percpu(struct dccp_mib); - if (dccp_statistics[1] == NULL) - goto out_free_one; - - rc = 0; -out: - return rc; -out_free_one: - free_percpu(dccp_statistics[0]); - dccp_statistics[0] = NULL; - goto out; - + return snmp_mib_init((void**)dccp_statistics, sizeof(struct dccp_mib)); } -static void dccp_mib_exit(void) +static inline void dccp_mib_exit(void) { - free_percpu(dccp_statistics[0]); - free_percpu(dccp_statistics[1]); - dccp_statistics[0] = dccp_statistics[1] = NULL; + snmp_mib_free((void**)dccp_statistics); } static int thash_entries; @@ -1071,6 +1037,9 @@ static int __init dccp_init(void) int ehash_order, bhash_order, i; int rc = -ENOBUFS; + BUILD_BUG_ON(sizeof(struct dccp_skb_cb) > + FIELD_SIZEOF(struct sk_buff, cb)); + dccp_hashinfo.bind_bucket_cachep = kmem_cache_create("dccp_bind_bucket", sizeof(struct inet_bind_bucket), 0,