diff options
author | Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> | 2008-09-21 00:21:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-09-21 00:21:54 -0400 |
commit | b5afe7bc71a1689376c9b547376d17568469f3b3 (patch) | |
tree | 30a790da358ea20c790e16f87a4dcddc83cdb316 /net/ipv4/tcp_output.c | |
parent | 184d68b2b0b836587f92887b14baea41033ffeef (diff) |
tcp: add tcp_can_forward_retransmit
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r-- | net/ipv4/tcp_output.c | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index cfae61b40c44..957c4e3d2176 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -1992,6 +1992,33 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) | |||
1992 | return err; | 1992 | return err; |
1993 | } | 1993 | } |
1994 | 1994 | ||
1995 | static int tcp_can_forward_retransmit(struct sock *sk) | ||
1996 | { | ||
1997 | const struct inet_connection_sock *icsk = inet_csk(sk); | ||
1998 | struct tcp_sock *tp = tcp_sk(sk); | ||
1999 | |||
2000 | /* Forward retransmissions are possible only during Recovery. */ | ||
2001 | if (icsk->icsk_ca_state != TCP_CA_Recovery) | ||
2002 | return 0; | ||
2003 | |||
2004 | /* No forward retransmissions in Reno are possible. */ | ||
2005 | if (tcp_is_reno(tp)) | ||
2006 | return 0; | ||
2007 | |||
2008 | /* Yeah, we have to make difficult choice between forward transmission | ||
2009 | * and retransmission... Both ways have their merits... | ||
2010 | * | ||
2011 | * For now we do not retransmit anything, while we have some new | ||
2012 | * segments to send. In the other cases, follow rule 3 for | ||
2013 | * NextSeg() specified in RFC3517. | ||
2014 | */ | ||
2015 | |||
2016 | if (tcp_may_send_now(sk)) | ||
2017 | return 0; | ||
2018 | |||
2019 | return 1; | ||
2020 | } | ||
2021 | |||
1995 | /* This gets called after a retransmit timeout, and the initially | 2022 | /* This gets called after a retransmit timeout, and the initially |
1996 | * retransmitted data is acknowledged. It tries to continue | 2023 | * retransmitted data is acknowledged. It tries to continue |
1997 | * resending the rest of the retransmit queue, until either | 2024 | * resending the rest of the retransmit queue, until either |
@@ -2057,24 +2084,7 @@ void tcp_xmit_retransmit_queue(struct sock *sk) | |||
2057 | } | 2084 | } |
2058 | 2085 | ||
2059 | /* OK, demanded retransmission is finished. */ | 2086 | /* OK, demanded retransmission is finished. */ |
2060 | 2087 | if (!tcp_can_forward_retransmit(sk)) | |
2061 | /* Forward retransmissions are possible only during Recovery. */ | ||
2062 | if (icsk->icsk_ca_state != TCP_CA_Recovery) | ||
2063 | return; | ||
2064 | |||
2065 | /* No forward retransmissions in Reno are possible. */ | ||
2066 | if (tcp_is_reno(tp)) | ||
2067 | return; | ||
2068 | |||
2069 | /* Yeah, we have to make difficult choice between forward transmission | ||
2070 | * and retransmission... Both ways have their merits... | ||
2071 | * | ||
2072 | * For now we do not retransmit anything, while we have some new | ||
2073 | * segments to send. In the other cases, follow rule 3 for | ||
2074 | * NextSeg() specified in RFC3517. | ||
2075 | */ | ||
2076 | |||
2077 | if (tcp_may_send_now(sk)) | ||
2078 | return; | 2088 | return; |
2079 | 2089 | ||
2080 | /* If nothing is SACKed, highest_sack in the loop won't be valid */ | 2090 | /* If nothing is SACKed, highest_sack in the loop won't be valid */ |