aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/inet_timewait_sock.h
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2005-08-09 23:44:40 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2005-08-29 18:55:48 -0400
commit295ff7edb8f72b77d524759266f7524deae379b3 (patch)
treee16e99e324444fb01ae3dfd221b5d47a88acfeb8 /include/net/inet_timewait_sock.h
parent0b4e03bf0bc43ad6250a1e2fa25fc3eb2b028977 (diff)
[TIMEWAIT]: Introduce inet_timewait_death_row
That groups all of the tables and variables associated to the TCP timewait schedulling/recycling/killing code, that now can be isolated from the TCP specific code and used by other transport protocols, such as DCCP. Next changeset will move this code to net/ipv4/inet_timewait_sock.c Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/inet_timewait_sock.h')
-rw-r--r--include/net/inet_timewait_sock.h57
1 files changed, 56 insertions, 1 deletions
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index e00861b16696..a7e8052e2fbf 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -19,13 +19,69 @@
19 19
20#include <linux/ip.h> 20#include <linux/ip.h>
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/timer.h>
22#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/workqueue.h>
23 25
24#include <net/sock.h> 26#include <net/sock.h>
25#include <net/tcp_states.h> 27#include <net/tcp_states.h>
26 28
27#include <asm/atomic.h> 29#include <asm/atomic.h>
28 30
31struct inet_hashinfo;
32
33#define INET_TWDR_RECYCLE_SLOTS_LOG 5
34#define INET_TWDR_RECYCLE_SLOTS (1 << INET_TWDR_RECYCLE_SLOTS_LOG)
35
36/*
37 * If time > 4sec, it is "slow" path, no recycling is required,
38 * so that we select tick to get range about 4 seconds.
39 */
40#if HZ <= 16 || HZ > 4096
41# error Unsupported: HZ <= 16 or HZ > 4096
42#elif HZ <= 32
43# define INET_TWDR_RECYCLE_TICK (5 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
44#elif HZ <= 64
45# define INET_TWDR_RECYCLE_TICK (6 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
46#elif HZ <= 128
47# define INET_TWDR_RECYCLE_TICK (7 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
48#elif HZ <= 256
49# define INET_TWDR_RECYCLE_TICK (8 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
50#elif HZ <= 512
51# define INET_TWDR_RECYCLE_TICK (9 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
52#elif HZ <= 1024
53# define INET_TWDR_RECYCLE_TICK (10 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
54#elif HZ <= 2048
55# define INET_TWDR_RECYCLE_TICK (11 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
56#else
57# define INET_TWDR_RECYCLE_TICK (12 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
58#endif
59
60/* TIME_WAIT reaping mechanism. */
61#define INET_TWDR_TWKILL_SLOTS 8 /* Please keep this a power of 2. */
62
63#define INET_TWDR_TWKILL_QUOTA 100
64
65struct inet_timewait_death_row {
66 /* Short-time timewait calendar */
67 int twcal_hand;
68 int twcal_jiffie;
69 struct timer_list twcal_timer;
70 struct hlist_head twcal_row[INET_TWDR_RECYCLE_SLOTS];
71
72 spinlock_t death_lock;
73 int tw_count;
74 int period;
75 u32 thread_slots;
76 struct work_struct twkill_work;
77 struct timer_list tw_timer;
78 int slot;
79 struct hlist_head cells[INET_TWDR_TWKILL_SLOTS];
80 struct inet_hashinfo *hashinfo;
81 int sysctl_tw_recycle;
82 int sysctl_max_tw_buckets;
83};
84
29#if (BITS_PER_LONG == 64) 85#if (BITS_PER_LONG == 64)
30#define INET_TIMEWAIT_ADDRCMP_ALIGN_BYTES 8 86#define INET_TIMEWAIT_ADDRCMP_ALIGN_BYTES 8
31#else 87#else
@@ -33,7 +89,6 @@
33#endif 89#endif
34 90
35struct inet_bind_bucket; 91struct inet_bind_bucket;
36struct inet_hashinfo;
37 92
38/* 93/*
39 * This is a TIME_WAIT sock. It works around the memory consumption 94 * This is a TIME_WAIT sock. It works around the memory consumption