]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - include/net/inet_timewait_sock.h
[TWSK]: Introduce struct timewait_sock_ops
[net-next-2.6.git] / include / net / inet_timewait_sock.h
index 3b070352e869822a86d137036c6937402096be76..e396a65473d7369787ee1d4a105a849c516ce667 100644 (file)
 
 #include <linux/ip.h>
 #include <linux/list.h>
+#include <linux/module.h>
 #include <linux/timer.h>
 #include <linux/types.h>
 #include <linux/workqueue.h>
 
 #include <net/sock.h>
 #include <net/tcp_states.h>
+#include <net/timewait_sock.h>
 
 #include <asm/atomic.h>
 
@@ -112,6 +114,7 @@ struct inet_timewait_sock {
 #define tw_node                        __tw_common.skc_node
 #define tw_bind_node           __tw_common.skc_bind_node
 #define tw_refcnt              __tw_common.skc_refcnt
+#define tw_hash                        __tw_common.skc_hash
 #define tw_prot                        __tw_common.skc_prot
        volatile unsigned char  tw_substate;
        /* 3 bits hole, try to pack */
@@ -125,8 +128,8 @@ struct inet_timewait_sock {
        __u16                   tw_num;
        /* And these are ours. */
        __u8                    tw_ipv6only:1;
-       /* 31 bits hole, try to pack */
-       int                     tw_hashent;
+       /* 15 bits hole, try to pack */
+       __u16                   tw_ipv6_offset;
        int                     tw_timeout;
        unsigned long           tw_ttd;
        struct inet_bind_bucket *tw_tb;
@@ -193,11 +196,13 @@ static inline u32 inet_rcv_saddr(const struct sock *sk)
 static inline void inet_twsk_put(struct inet_timewait_sock *tw)
 {
        if (atomic_dec_and_test(&tw->tw_refcnt)) {
+               struct module *owner = tw->tw_prot->owner;
 #ifdef SOCK_REFCNT_DEBUG
                printk(KERN_DEBUG "%s timewait_sock %p released\n",
                       tw->tw_prot->name, tw);
 #endif
-               kmem_cache_free(tw->tw_prot->twsk_slab, tw);
+               kmem_cache_free(tw->tw_prot->twsk_prot->twsk_slab, tw);
+               module_put(owner);
        }
 }