diff options
Diffstat (limited to 'net/ipv4/tcp_timer.c')
-rw-r--r-- | net/ipv4/tcp_timer.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index 72cec6981830..415ee47ac1c5 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c | |||
@@ -233,11 +233,12 @@ out_unlock: | |||
233 | 233 | ||
234 | static void tcp_probe_timer(struct sock *sk) | 234 | static void tcp_probe_timer(struct sock *sk) |
235 | { | 235 | { |
236 | struct inet_connection_sock *icsk = inet_csk(sk); | ||
236 | struct tcp_sock *tp = tcp_sk(sk); | 237 | struct tcp_sock *tp = tcp_sk(sk); |
237 | int max_probes; | 238 | int max_probes; |
238 | 239 | ||
239 | if (tp->packets_out || !sk->sk_send_head) { | 240 | if (tp->packets_out || !sk->sk_send_head) { |
240 | tp->probes_out = 0; | 241 | icsk->icsk_probes_out = 0; |
241 | return; | 242 | return; |
242 | } | 243 | } |
243 | 244 | ||
@@ -248,7 +249,7 @@ static void tcp_probe_timer(struct sock *sk) | |||
248 | * FIXME: We ought not to do it, Solaris 2.5 actually has fixing | 249 | * FIXME: We ought not to do it, Solaris 2.5 actually has fixing |
249 | * this behaviour in Solaris down as a bug fix. [AC] | 250 | * this behaviour in Solaris down as a bug fix. [AC] |
250 | * | 251 | * |
251 | * Let me to explain. probes_out is zeroed by incoming ACKs | 252 | * Let me to explain. icsk_probes_out is zeroed by incoming ACKs |
252 | * even if they advertise zero window. Hence, connection is killed only | 253 | * even if they advertise zero window. Hence, connection is killed only |
253 | * if we received no ACKs for normal connection timeout. It is not killed | 254 | * if we received no ACKs for normal connection timeout. It is not killed |
254 | * only because window stays zero for some time, window may be zero | 255 | * only because window stays zero for some time, window may be zero |
@@ -259,16 +260,15 @@ static void tcp_probe_timer(struct sock *sk) | |||
259 | max_probes = sysctl_tcp_retries2; | 260 | max_probes = sysctl_tcp_retries2; |
260 | 261 | ||
261 | if (sock_flag(sk, SOCK_DEAD)) { | 262 | if (sock_flag(sk, SOCK_DEAD)) { |
262 | const struct inet_connection_sock *icsk = inet_csk(sk); | ||
263 | const int alive = ((icsk->icsk_rto << icsk->icsk_backoff) < TCP_RTO_MAX); | 263 | const int alive = ((icsk->icsk_rto << icsk->icsk_backoff) < TCP_RTO_MAX); |
264 | 264 | ||
265 | max_probes = tcp_orphan_retries(sk, alive); | 265 | max_probes = tcp_orphan_retries(sk, alive); |
266 | 266 | ||
267 | if (tcp_out_of_resources(sk, alive || tp->probes_out <= max_probes)) | 267 | if (tcp_out_of_resources(sk, alive || icsk->icsk_probes_out <= max_probes)) |
268 | return; | 268 | return; |
269 | } | 269 | } |
270 | 270 | ||
271 | if (tp->probes_out > max_probes) { | 271 | if (icsk->icsk_probes_out > max_probes) { |
272 | tcp_write_err(sk); | 272 | tcp_write_err(sk); |
273 | } else { | 273 | } else { |
274 | /* Only send another probe if we didn't close things up. */ | 274 | /* Only send another probe if we didn't close things up. */ |
@@ -319,19 +319,20 @@ static void tcp_retransmit_timer(struct sock *sk) | |||
319 | goto out; | 319 | goto out; |
320 | 320 | ||
321 | if (icsk->icsk_retransmits == 0) { | 321 | if (icsk->icsk_retransmits == 0) { |
322 | if (tp->ca_state == TCP_CA_Disorder || tp->ca_state == TCP_CA_Recovery) { | 322 | if (icsk->icsk_ca_state == TCP_CA_Disorder || |
323 | icsk->icsk_ca_state == TCP_CA_Recovery) { | ||
323 | if (tp->rx_opt.sack_ok) { | 324 | if (tp->rx_opt.sack_ok) { |
324 | if (tp->ca_state == TCP_CA_Recovery) | 325 | if (icsk->icsk_ca_state == TCP_CA_Recovery) |
325 | NET_INC_STATS_BH(LINUX_MIB_TCPSACKRECOVERYFAIL); | 326 | NET_INC_STATS_BH(LINUX_MIB_TCPSACKRECOVERYFAIL); |
326 | else | 327 | else |
327 | NET_INC_STATS_BH(LINUX_MIB_TCPSACKFAILURES); | 328 | NET_INC_STATS_BH(LINUX_MIB_TCPSACKFAILURES); |
328 | } else { | 329 | } else { |
329 | if (tp->ca_state == TCP_CA_Recovery) | 330 | if (icsk->icsk_ca_state == TCP_CA_Recovery) |
330 | NET_INC_STATS_BH(LINUX_MIB_TCPRENORECOVERYFAIL); | 331 | NET_INC_STATS_BH(LINUX_MIB_TCPRENORECOVERYFAIL); |
331 | else | 332 | else |
332 | NET_INC_STATS_BH(LINUX_MIB_TCPRENOFAILURES); | 333 | NET_INC_STATS_BH(LINUX_MIB_TCPRENOFAILURES); |
333 | } | 334 | } |
334 | } else if (tp->ca_state == TCP_CA_Loss) { | 335 | } else if (icsk->icsk_ca_state == TCP_CA_Loss) { |
335 | NET_INC_STATS_BH(LINUX_MIB_TCPLOSSFAILURES); | 336 | NET_INC_STATS_BH(LINUX_MIB_TCPLOSSFAILURES); |
336 | } else { | 337 | } else { |
337 | NET_INC_STATS_BH(LINUX_MIB_TCPTIMEOUTS); | 338 | NET_INC_STATS_BH(LINUX_MIB_TCPTIMEOUTS); |
@@ -449,6 +450,7 @@ void tcp_set_keepalive(struct sock *sk, int val) | |||
449 | static void tcp_keepalive_timer (unsigned long data) | 450 | static void tcp_keepalive_timer (unsigned long data) |
450 | { | 451 | { |
451 | struct sock *sk = (struct sock *) data; | 452 | struct sock *sk = (struct sock *) data; |
453 | struct inet_connection_sock *icsk = inet_csk(sk); | ||
452 | struct tcp_sock *tp = tcp_sk(sk); | 454 | struct tcp_sock *tp = tcp_sk(sk); |
453 | __u32 elapsed; | 455 | __u32 elapsed; |
454 | 456 | ||
@@ -490,14 +492,14 @@ static void tcp_keepalive_timer (unsigned long data) | |||
490 | elapsed = tcp_time_stamp - tp->rcv_tstamp; | 492 | elapsed = tcp_time_stamp - tp->rcv_tstamp; |
491 | 493 | ||
492 | if (elapsed >= keepalive_time_when(tp)) { | 494 | if (elapsed >= keepalive_time_when(tp)) { |
493 | if ((!tp->keepalive_probes && tp->probes_out >= sysctl_tcp_keepalive_probes) || | 495 | if ((!tp->keepalive_probes && icsk->icsk_probes_out >= sysctl_tcp_keepalive_probes) || |
494 | (tp->keepalive_probes && tp->probes_out >= tp->keepalive_probes)) { | 496 | (tp->keepalive_probes && icsk->icsk_probes_out >= tp->keepalive_probes)) { |
495 | tcp_send_active_reset(sk, GFP_ATOMIC); | 497 | tcp_send_active_reset(sk, GFP_ATOMIC); |
496 | tcp_write_err(sk); | 498 | tcp_write_err(sk); |
497 | goto out; | 499 | goto out; |
498 | } | 500 | } |
499 | if (tcp_write_wakeup(sk) <= 0) { | 501 | if (tcp_write_wakeup(sk) <= 0) { |
500 | tp->probes_out++; | 502 | icsk->icsk_probes_out++; |
501 | elapsed = keepalive_intvl_when(tp); | 503 | elapsed = keepalive_intvl_when(tp); |
502 | } else { | 504 | } else { |
503 | /* If keepalive was lost due to local congestion, | 505 | /* If keepalive was lost due to local congestion, |