diff options
author | David S. Miller <davem@davemloft.net> | 2009-10-27 04:03:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-27 04:03:26 -0400 |
commit | cfadf853f6cd9689f79a63ca960c6f9d6665314f (patch) | |
tree | 35418e342d9783f0974ea33ef03875aa21d2362a /net/ipv4/inet_connection_sock.c | |
parent | 05423b241311c9380b7280179295bac7794281b6 (diff) | |
parent | f568a926a353d6816b3704d7367f34371df44ce7 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/sh_eth.c
Diffstat (limited to 'net/ipv4/inet_connection_sock.c')
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index f6a0af759932..26fb50e91311 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -447,6 +447,28 @@ extern int sysctl_tcp_synack_retries; | |||
447 | 447 | ||
448 | EXPORT_SYMBOL_GPL(inet_csk_reqsk_queue_hash_add); | 448 | EXPORT_SYMBOL_GPL(inet_csk_reqsk_queue_hash_add); |
449 | 449 | ||
450 | /* Decide when to expire the request and when to resend SYN-ACK */ | ||
451 | static inline void syn_ack_recalc(struct request_sock *req, const int thresh, | ||
452 | const int max_retries, | ||
453 | const u8 rskq_defer_accept, | ||
454 | int *expire, int *resend) | ||
455 | { | ||
456 | if (!rskq_defer_accept) { | ||
457 | *expire = req->retrans >= thresh; | ||
458 | *resend = 1; | ||
459 | return; | ||
460 | } | ||
461 | *expire = req->retrans >= thresh && | ||
462 | (!inet_rsk(req)->acked || req->retrans >= max_retries); | ||
463 | /* | ||
464 | * Do not resend while waiting for data after ACK, | ||
465 | * start to resend on end of deferring period to give | ||
466 | * last chance for data or ACK to create established socket. | ||
467 | */ | ||
468 | *resend = !inet_rsk(req)->acked || | ||
469 | req->retrans >= rskq_defer_accept - 1; | ||
470 | } | ||
471 | |||
450 | void inet_csk_reqsk_queue_prune(struct sock *parent, | 472 | void inet_csk_reqsk_queue_prune(struct sock *parent, |
451 | const unsigned long interval, | 473 | const unsigned long interval, |
452 | const unsigned long timeout, | 474 | const unsigned long timeout, |
@@ -502,9 +524,15 @@ void inet_csk_reqsk_queue_prune(struct sock *parent, | |||
502 | reqp=&lopt->syn_table[i]; | 524 | reqp=&lopt->syn_table[i]; |
503 | while ((req = *reqp) != NULL) { | 525 | while ((req = *reqp) != NULL) { |
504 | if (time_after_eq(now, req->expires)) { | 526 | if (time_after_eq(now, req->expires)) { |
505 | if ((req->retrans < thresh || | 527 | int expire = 0, resend = 0; |
506 | (inet_rsk(req)->acked && req->retrans < max_retries)) | 528 | |
507 | && !req->rsk_ops->rtx_syn_ack(parent, req)) { | 529 | syn_ack_recalc(req, thresh, max_retries, |
530 | queue->rskq_defer_accept, | ||
531 | &expire, &resend); | ||
532 | if (!expire && | ||
533 | (!resend || | ||
534 | !req->rsk_ops->rtx_syn_ack(parent, req) || | ||
535 | inet_rsk(req)->acked)) { | ||
508 | unsigned long timeo; | 536 | unsigned long timeo; |
509 | 537 | ||
510 | if (req->retrans++ == 0) | 538 | if (req->retrans++ == 0) |