diff options
author | David Woodhouse <dwmw2@infradead.org> | 2007-08-23 05:43:14 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2007-08-23 05:43:14 -0400 |
commit | ac0c955d5048c2c580fa7166a89133f0fd76c125 (patch) | |
tree | 041ac4fb544c7244a1a0b35c8ceabc142d5645c1 /net/ipv4/tcp_input.c | |
parent | 68d09b1b6780415d82160f6b6d88e82bd724e691 (diff) | |
parent | b377fd3982ad957c796758a90e2988401a884241 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r-- | net/ipv4/tcp_input.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 378ca8a086a3..f030435e0eb4 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -102,11 +102,14 @@ int sysctl_tcp_abc __read_mostly; | |||
102 | #define FLAG_DATA_LOST 0x80 /* SACK detected data lossage. */ | 102 | #define FLAG_DATA_LOST 0x80 /* SACK detected data lossage. */ |
103 | #define FLAG_SLOWPATH 0x100 /* Do not skip RFC checks for window update.*/ | 103 | #define FLAG_SLOWPATH 0x100 /* Do not skip RFC checks for window update.*/ |
104 | #define FLAG_ONLY_ORIG_SACKED 0x200 /* SACKs only non-rexmit sent before RTO */ | 104 | #define FLAG_ONLY_ORIG_SACKED 0x200 /* SACKs only non-rexmit sent before RTO */ |
105 | #define FLAG_SND_UNA_ADVANCED 0x400 /* Snd_una was changed (!= FLAG_DATA_ACKED) */ | ||
106 | #define FLAG_DSACKING_ACK 0x800 /* SACK blocks contained DSACK info */ | ||
105 | 107 | ||
106 | #define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED) | 108 | #define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED) |
107 | #define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED) | 109 | #define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED) |
108 | #define FLAG_CA_ALERT (FLAG_DATA_SACKED|FLAG_ECE) | 110 | #define FLAG_CA_ALERT (FLAG_DATA_SACKED|FLAG_ECE) |
109 | #define FLAG_FORWARD_PROGRESS (FLAG_ACKED|FLAG_DATA_SACKED) | 111 | #define FLAG_FORWARD_PROGRESS (FLAG_ACKED|FLAG_DATA_SACKED) |
112 | #define FLAG_ANY_PROGRESS (FLAG_FORWARD_PROGRESS|FLAG_SND_UNA_ADVANCED) | ||
110 | 113 | ||
111 | #define IsReno(tp) ((tp)->rx_opt.sack_ok == 0) | 114 | #define IsReno(tp) ((tp)->rx_opt.sack_ok == 0) |
112 | #define IsFack(tp) ((tp)->rx_opt.sack_ok & 2) | 115 | #define IsFack(tp) ((tp)->rx_opt.sack_ok & 2) |
@@ -964,12 +967,14 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ | |||
964 | 967 | ||
965 | /* Check for D-SACK. */ | 968 | /* Check for D-SACK. */ |
966 | if (before(ntohl(sp[0].start_seq), TCP_SKB_CB(ack_skb)->ack_seq)) { | 969 | if (before(ntohl(sp[0].start_seq), TCP_SKB_CB(ack_skb)->ack_seq)) { |
970 | flag |= FLAG_DSACKING_ACK; | ||
967 | found_dup_sack = 1; | 971 | found_dup_sack = 1; |
968 | tp->rx_opt.sack_ok |= 4; | 972 | tp->rx_opt.sack_ok |= 4; |
969 | NET_INC_STATS_BH(LINUX_MIB_TCPDSACKRECV); | 973 | NET_INC_STATS_BH(LINUX_MIB_TCPDSACKRECV); |
970 | } else if (num_sacks > 1 && | 974 | } else if (num_sacks > 1 && |
971 | !after(ntohl(sp[0].end_seq), ntohl(sp[1].end_seq)) && | 975 | !after(ntohl(sp[0].end_seq), ntohl(sp[1].end_seq)) && |
972 | !before(ntohl(sp[0].start_seq), ntohl(sp[1].start_seq))) { | 976 | !before(ntohl(sp[0].start_seq), ntohl(sp[1].start_seq))) { |
977 | flag |= FLAG_DSACKING_ACK; | ||
973 | found_dup_sack = 1; | 978 | found_dup_sack = 1; |
974 | tp->rx_opt.sack_ok |= 4; | 979 | tp->rx_opt.sack_ok |= 4; |
975 | NET_INC_STATS_BH(LINUX_MIB_TCPDSACKOFORECV); | 980 | NET_INC_STATS_BH(LINUX_MIB_TCPDSACKOFORECV); |
@@ -1856,7 +1861,7 @@ static void tcp_cwnd_down(struct sock *sk, int flag) | |||
1856 | struct tcp_sock *tp = tcp_sk(sk); | 1861 | struct tcp_sock *tp = tcp_sk(sk); |
1857 | int decr = tp->snd_cwnd_cnt + 1; | 1862 | int decr = tp->snd_cwnd_cnt + 1; |
1858 | 1863 | ||
1859 | if ((flag&FLAG_FORWARD_PROGRESS) || | 1864 | if ((flag&(FLAG_ANY_PROGRESS|FLAG_DSACKING_ACK)) || |
1860 | (IsReno(tp) && !(flag&FLAG_NOT_DUP))) { | 1865 | (IsReno(tp) && !(flag&FLAG_NOT_DUP))) { |
1861 | tp->snd_cwnd_cnt = decr&1; | 1866 | tp->snd_cwnd_cnt = decr&1; |
1862 | decr >>= 1; | 1867 | decr >>= 1; |
@@ -2107,15 +2112,13 @@ static void tcp_mtup_probe_success(struct sock *sk, struct sk_buff *skb) | |||
2107 | * tcp_xmit_retransmit_queue(). | 2112 | * tcp_xmit_retransmit_queue(). |
2108 | */ | 2113 | */ |
2109 | static void | 2114 | static void |
2110 | tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una, | 2115 | tcp_fastretrans_alert(struct sock *sk, int prior_packets, int flag) |
2111 | int prior_packets, int flag) | ||
2112 | { | 2116 | { |
2113 | struct inet_connection_sock *icsk = inet_csk(sk); | 2117 | struct inet_connection_sock *icsk = inet_csk(sk); |
2114 | struct tcp_sock *tp = tcp_sk(sk); | 2118 | struct tcp_sock *tp = tcp_sk(sk); |
2115 | int is_dupack = (tp->snd_una == prior_snd_una && | 2119 | int is_dupack = !(flag&(FLAG_SND_UNA_ADVANCED|FLAG_NOT_DUP)); |
2116 | (!(flag&FLAG_NOT_DUP) || | 2120 | int do_lost = is_dupack || ((flag&FLAG_DATA_SACKED) && |
2117 | ((flag&FLAG_DATA_SACKED) && | 2121 | (tp->fackets_out > tp->reordering)); |
2118 | (tp->fackets_out > tp->reordering)))); | ||
2119 | 2122 | ||
2120 | /* Some technical things: | 2123 | /* Some technical things: |
2121 | * 1. Reno does not count dupacks (sacked_out) automatically. */ | 2124 | * 1. Reno does not count dupacks (sacked_out) automatically. */ |
@@ -2192,14 +2195,14 @@ tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una, | |||
2192 | /* F. Process state. */ | 2195 | /* F. Process state. */ |
2193 | switch (icsk->icsk_ca_state) { | 2196 | switch (icsk->icsk_ca_state) { |
2194 | case TCP_CA_Recovery: | 2197 | case TCP_CA_Recovery: |
2195 | if (prior_snd_una == tp->snd_una) { | 2198 | if (!(flag & FLAG_SND_UNA_ADVANCED)) { |
2196 | if (IsReno(tp) && is_dupack) | 2199 | if (IsReno(tp) && is_dupack) |
2197 | tcp_add_reno_sack(sk); | 2200 | tcp_add_reno_sack(sk); |
2198 | } else { | 2201 | } else { |
2199 | int acked = prior_packets - tp->packets_out; | 2202 | int acked = prior_packets - tp->packets_out; |
2200 | if (IsReno(tp)) | 2203 | if (IsReno(tp)) |
2201 | tcp_remove_reno_sacks(sk, acked); | 2204 | tcp_remove_reno_sacks(sk, acked); |
2202 | is_dupack = tcp_try_undo_partial(sk, acked); | 2205 | do_lost = tcp_try_undo_partial(sk, acked); |
2203 | } | 2206 | } |
2204 | break; | 2207 | break; |
2205 | case TCP_CA_Loss: | 2208 | case TCP_CA_Loss: |
@@ -2215,7 +2218,7 @@ tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una, | |||
2215 | /* Loss is undone; fall through to processing in Open state. */ | 2218 | /* Loss is undone; fall through to processing in Open state. */ |
2216 | default: | 2219 | default: |
2217 | if (IsReno(tp)) { | 2220 | if (IsReno(tp)) { |
2218 | if (tp->snd_una != prior_snd_una) | 2221 | if (flag & FLAG_SND_UNA_ADVANCED) |
2219 | tcp_reset_reno_sack(tp); | 2222 | tcp_reset_reno_sack(tp); |
2220 | if (is_dupack) | 2223 | if (is_dupack) |
2221 | tcp_add_reno_sack(sk); | 2224 | tcp_add_reno_sack(sk); |
@@ -2264,7 +2267,7 @@ tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una, | |||
2264 | tcp_set_ca_state(sk, TCP_CA_Recovery); | 2267 | tcp_set_ca_state(sk, TCP_CA_Recovery); |
2265 | } | 2268 | } |
2266 | 2269 | ||
2267 | if (is_dupack || tcp_head_timedout(sk)) | 2270 | if (do_lost || tcp_head_timedout(sk)) |
2268 | tcp_update_scoreboard(sk); | 2271 | tcp_update_scoreboard(sk); |
2269 | tcp_cwnd_down(sk, flag); | 2272 | tcp_cwnd_down(sk, flag); |
2270 | tcp_xmit_retransmit_queue(sk); | 2273 | tcp_xmit_retransmit_queue(sk); |
@@ -2684,7 +2687,7 @@ static void tcp_undo_spur_to_response(struct sock *sk, int flag) | |||
2684 | * to prove that the RTO is indeed spurious. It transfers the control | 2687 | * to prove that the RTO is indeed spurious. It transfers the control |
2685 | * from F-RTO to the conventional RTO recovery | 2688 | * from F-RTO to the conventional RTO recovery |
2686 | */ | 2689 | */ |
2687 | static int tcp_process_frto(struct sock *sk, u32 prior_snd_una, int flag) | 2690 | static int tcp_process_frto(struct sock *sk, int flag) |
2688 | { | 2691 | { |
2689 | struct tcp_sock *tp = tcp_sk(sk); | 2692 | struct tcp_sock *tp = tcp_sk(sk); |
2690 | 2693 | ||
@@ -2704,8 +2707,7 @@ static int tcp_process_frto(struct sock *sk, u32 prior_snd_una, int flag) | |||
2704 | * ACK isn't duplicate nor advances window, e.g., opposite dir | 2707 | * ACK isn't duplicate nor advances window, e.g., opposite dir |
2705 | * data, winupdate | 2708 | * data, winupdate |
2706 | */ | 2709 | */ |
2707 | if ((tp->snd_una == prior_snd_una) && (flag&FLAG_NOT_DUP) && | 2710 | if (!(flag&FLAG_ANY_PROGRESS) && (flag&FLAG_NOT_DUP)) |
2708 | !(flag&FLAG_FORWARD_PROGRESS)) | ||
2709 | return 1; | 2711 | return 1; |
2710 | 2712 | ||
2711 | if (!(flag&FLAG_DATA_ACKED)) { | 2713 | if (!(flag&FLAG_DATA_ACKED)) { |
@@ -2785,6 +2787,9 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag) | |||
2785 | if (before(ack, prior_snd_una)) | 2787 | if (before(ack, prior_snd_una)) |
2786 | goto old_ack; | 2788 | goto old_ack; |
2787 | 2789 | ||
2790 | if (after(ack, prior_snd_una)) | ||
2791 | flag |= FLAG_SND_UNA_ADVANCED; | ||
2792 | |||
2788 | if (sysctl_tcp_abc) { | 2793 | if (sysctl_tcp_abc) { |
2789 | if (icsk->icsk_ca_state < TCP_CA_CWR) | 2794 | if (icsk->icsk_ca_state < TCP_CA_CWR) |
2790 | tp->bytes_acked += ack - prior_snd_una; | 2795 | tp->bytes_acked += ack - prior_snd_una; |
@@ -2837,14 +2842,14 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag) | |||
2837 | flag |= tcp_clean_rtx_queue(sk, &seq_rtt); | 2842 | flag |= tcp_clean_rtx_queue(sk, &seq_rtt); |
2838 | 2843 | ||
2839 | if (tp->frto_counter) | 2844 | if (tp->frto_counter) |
2840 | frto_cwnd = tcp_process_frto(sk, prior_snd_una, flag); | 2845 | frto_cwnd = tcp_process_frto(sk, flag); |
2841 | 2846 | ||
2842 | if (tcp_ack_is_dubious(sk, flag)) { | 2847 | if (tcp_ack_is_dubious(sk, flag)) { |
2843 | /* Advance CWND, if state allows this. */ | 2848 | /* Advance CWND, if state allows this. */ |
2844 | if ((flag & FLAG_DATA_ACKED) && !frto_cwnd && | 2849 | if ((flag & FLAG_DATA_ACKED) && !frto_cwnd && |
2845 | tcp_may_raise_cwnd(sk, flag)) | 2850 | tcp_may_raise_cwnd(sk, flag)) |
2846 | tcp_cong_avoid(sk, ack, prior_in_flight, 0); | 2851 | tcp_cong_avoid(sk, ack, prior_in_flight, 0); |
2847 | tcp_fastretrans_alert(sk, prior_snd_una, prior_packets, flag); | 2852 | tcp_fastretrans_alert(sk, prior_packets, flag); |
2848 | } else { | 2853 | } else { |
2849 | if ((flag & FLAG_DATA_ACKED) && !frto_cwnd) | 2854 | if ((flag & FLAG_DATA_ACKED) && !frto_cwnd) |
2850 | tcp_cong_avoid(sk, ack, prior_in_flight, 1); | 2855 | tcp_cong_avoid(sk, ack, prior_in_flight, 1); |