diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/net/inet_timewait_sock.h | 57 | ||||
-rw-r--r-- | include/net/tcp.h | 36 |
2 files changed, 61 insertions, 32 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 | ||
31 | struct 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 | |||
65 | struct 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 | ||
35 | struct inet_bind_bucket; | 91 | struct inet_bind_bucket; |
36 | struct 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 |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 077db859ae0d..4c4cd4fb1ed8 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/percpu.h> | 29 | #include <linux/percpu.h> |
30 | 30 | ||
31 | #include <net/inet_connection_sock.h> | 31 | #include <net/inet_connection_sock.h> |
32 | #include <net/inet_timewait_sock.h> | ||
32 | #include <net/inet_hashtables.h> | 33 | #include <net/inet_hashtables.h> |
33 | #include <net/checksum.h> | 34 | #include <net/checksum.h> |
34 | #include <net/request_sock.h> | 35 | #include <net/request_sock.h> |
@@ -42,9 +43,9 @@ | |||
42 | extern struct inet_hashinfo tcp_hashinfo; | 43 | extern struct inet_hashinfo tcp_hashinfo; |
43 | 44 | ||
44 | extern atomic_t tcp_orphan_count; | 45 | extern atomic_t tcp_orphan_count; |
45 | extern int tcp_tw_count; | ||
46 | extern void tcp_time_wait(struct sock *sk, int state, int timeo); | 46 | extern void tcp_time_wait(struct sock *sk, int state, int timeo); |
47 | extern void tcp_tw_deschedule(struct inet_timewait_sock *tw); | 47 | extern void inet_twsk_deschedule(struct inet_timewait_sock *tw, |
48 | struct inet_timewait_death_row *twdr); | ||
48 | 49 | ||
49 | #define MAX_TCP_HEADER (128 + MAX_HEADER) | 50 | #define MAX_TCP_HEADER (128 + MAX_HEADER) |
50 | 51 | ||
@@ -148,33 +149,6 @@ extern void tcp_tw_deschedule(struct inet_timewait_sock *tw); | |||
148 | * timestamps. It must be less than | 149 | * timestamps. It must be less than |
149 | * minimal timewait lifetime. | 150 | * minimal timewait lifetime. |
150 | */ | 151 | */ |
151 | |||
152 | #define TCP_TW_RECYCLE_SLOTS_LOG 5 | ||
153 | #define TCP_TW_RECYCLE_SLOTS (1<<TCP_TW_RECYCLE_SLOTS_LOG) | ||
154 | |||
155 | /* If time > 4sec, it is "slow" path, no recycling is required, | ||
156 | so that we select tick to get range about 4 seconds. | ||
157 | */ | ||
158 | |||
159 | #if HZ <= 16 || HZ > 4096 | ||
160 | # error Unsupported: HZ <= 16 or HZ > 4096 | ||
161 | #elif HZ <= 32 | ||
162 | # define TCP_TW_RECYCLE_TICK (5+2-TCP_TW_RECYCLE_SLOTS_LOG) | ||
163 | #elif HZ <= 64 | ||
164 | # define TCP_TW_RECYCLE_TICK (6+2-TCP_TW_RECYCLE_SLOTS_LOG) | ||
165 | #elif HZ <= 128 | ||
166 | # define TCP_TW_RECYCLE_TICK (7+2-TCP_TW_RECYCLE_SLOTS_LOG) | ||
167 | #elif HZ <= 256 | ||
168 | # define TCP_TW_RECYCLE_TICK (8+2-TCP_TW_RECYCLE_SLOTS_LOG) | ||
169 | #elif HZ <= 512 | ||
170 | # define TCP_TW_RECYCLE_TICK (9+2-TCP_TW_RECYCLE_SLOTS_LOG) | ||
171 | #elif HZ <= 1024 | ||
172 | # define TCP_TW_RECYCLE_TICK (10+2-TCP_TW_RECYCLE_SLOTS_LOG) | ||
173 | #elif HZ <= 2048 | ||
174 | # define TCP_TW_RECYCLE_TICK (11+2-TCP_TW_RECYCLE_SLOTS_LOG) | ||
175 | #else | ||
176 | # define TCP_TW_RECYCLE_TICK (12+2-TCP_TW_RECYCLE_SLOTS_LOG) | ||
177 | #endif | ||
178 | /* | 152 | /* |
179 | * TCP option | 153 | * TCP option |
180 | */ | 154 | */ |
@@ -209,12 +183,13 @@ extern void tcp_tw_deschedule(struct inet_timewait_sock *tw); | |||
209 | #define TCP_NAGLE_CORK 2 /* Socket is corked */ | 183 | #define TCP_NAGLE_CORK 2 /* Socket is corked */ |
210 | #define TCP_NAGLE_PUSH 4 /* Cork is overriden for already queued data */ | 184 | #define TCP_NAGLE_PUSH 4 /* Cork is overriden for already queued data */ |
211 | 185 | ||
186 | extern struct inet_timewait_death_row tcp_death_row; | ||
187 | |||
212 | /* sysctl variables for tcp */ | 188 | /* sysctl variables for tcp */ |
213 | extern int sysctl_tcp_timestamps; | 189 | extern int sysctl_tcp_timestamps; |
214 | extern int sysctl_tcp_window_scaling; | 190 | extern int sysctl_tcp_window_scaling; |
215 | extern int sysctl_tcp_sack; | 191 | extern int sysctl_tcp_sack; |
216 | extern int sysctl_tcp_fin_timeout; | 192 | extern int sysctl_tcp_fin_timeout; |
217 | extern int sysctl_tcp_tw_recycle; | ||
218 | extern int sysctl_tcp_keepalive_time; | 193 | extern int sysctl_tcp_keepalive_time; |
219 | extern int sysctl_tcp_keepalive_probes; | 194 | extern int sysctl_tcp_keepalive_probes; |
220 | extern int sysctl_tcp_keepalive_intvl; | 195 | extern int sysctl_tcp_keepalive_intvl; |
@@ -229,7 +204,6 @@ extern int sysctl_tcp_stdurg; | |||
229 | extern int sysctl_tcp_rfc1337; | 204 | extern int sysctl_tcp_rfc1337; |
230 | extern int sysctl_tcp_abort_on_overflow; | 205 | extern int sysctl_tcp_abort_on_overflow; |
231 | extern int sysctl_tcp_max_orphans; | 206 | extern int sysctl_tcp_max_orphans; |
232 | extern int sysctl_tcp_max_tw_buckets; | ||
233 | extern int sysctl_tcp_fack; | 207 | extern int sysctl_tcp_fack; |
234 | extern int sysctl_tcp_reordering; | 208 | extern int sysctl_tcp_reordering; |
235 | extern int sysctl_tcp_ecn; | 209 | extern int sysctl_tcp_ecn; |