diff options
-rw-r--r-- | include/net/tcp.h | 7 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 20 | ||||
-rw-r--r-- | net/ipv4/tcp_output.c | 4 |
3 files changed, 15 insertions, 16 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 39d0df6afe47..7042c32085f5 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -758,10 +758,9 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk) | |||
758 | (tp->snd_cwnd >> 2))); | 758 | (tp->snd_cwnd >> 2))); |
759 | } | 759 | } |
760 | 760 | ||
761 | static inline void tcp_sync_left_out(struct tcp_sock *tp) | 761 | /* Use define here intentionally to get BUG_ON location shown at the caller */ |
762 | { | 762 | #define tcp_verify_left_out(tp) \ |
763 | BUG_ON(tp->rx_opt.sack_ok && (tcp_left_out(tp) > tp->packets_out)); | 763 | BUG_ON(tp->rx_opt.sack_ok && (tcp_left_out(tp) > tp->packets_out)) |
764 | } | ||
765 | 764 | ||
766 | extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); | 765 | extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); |
767 | extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); | 766 | extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 6bdd053e252f..b11bd1624227 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -1383,7 +1383,7 @@ static void tcp_add_reno_sack(struct sock *sk) | |||
1383 | struct tcp_sock *tp = tcp_sk(sk); | 1383 | struct tcp_sock *tp = tcp_sk(sk); |
1384 | tp->sacked_out++; | 1384 | tp->sacked_out++; |
1385 | tcp_check_reno_reordering(sk, 0); | 1385 | tcp_check_reno_reordering(sk, 0); |
1386 | tcp_sync_left_out(tp); | 1386 | tcp_verify_left_out(tp); |
1387 | } | 1387 | } |
1388 | 1388 | ||
1389 | /* Account for ACK, ACKing some data in Reno Recovery phase. */ | 1389 | /* Account for ACK, ACKing some data in Reno Recovery phase. */ |
@@ -1400,7 +1400,7 @@ static void tcp_remove_reno_sacks(struct sock *sk, int acked) | |||
1400 | tp->sacked_out -= acked-1; | 1400 | tp->sacked_out -= acked-1; |
1401 | } | 1401 | } |
1402 | tcp_check_reno_reordering(sk, acked); | 1402 | tcp_check_reno_reordering(sk, acked); |
1403 | tcp_sync_left_out(tp); | 1403 | tcp_verify_left_out(tp); |
1404 | } | 1404 | } |
1405 | 1405 | ||
1406 | static inline void tcp_reset_reno_sack(struct tcp_sock *tp) | 1406 | static inline void tcp_reset_reno_sack(struct tcp_sock *tp) |
@@ -1496,7 +1496,7 @@ void tcp_enter_frto(struct sock *sk) | |||
1496 | TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_RETRANS; | 1496 | TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_RETRANS; |
1497 | tp->retrans_out -= tcp_skb_pcount(skb); | 1497 | tp->retrans_out -= tcp_skb_pcount(skb); |
1498 | } | 1498 | } |
1499 | tcp_sync_left_out(tp); | 1499 | tcp_verify_left_out(tp); |
1500 | 1500 | ||
1501 | /* Earlier loss recovery underway (see RFC4138; Appendix B). | 1501 | /* Earlier loss recovery underway (see RFC4138; Appendix B). |
1502 | * The last condition is necessary at least in tp->frto_counter case. | 1502 | * The last condition is necessary at least in tp->frto_counter case. |
@@ -1551,7 +1551,7 @@ static void tcp_enter_frto_loss(struct sock *sk, int allowed_segments, int flag) | |||
1551 | tp->lost_out += tcp_skb_pcount(skb); | 1551 | tp->lost_out += tcp_skb_pcount(skb); |
1552 | } | 1552 | } |
1553 | } | 1553 | } |
1554 | tcp_sync_left_out(tp); | 1554 | tcp_verify_left_out(tp); |
1555 | 1555 | ||
1556 | tp->snd_cwnd = tcp_packets_in_flight(tp) + allowed_segments; | 1556 | tp->snd_cwnd = tcp_packets_in_flight(tp) + allowed_segments; |
1557 | tp->snd_cwnd_cnt = 0; | 1557 | tp->snd_cwnd_cnt = 0; |
@@ -1626,7 +1626,7 @@ void tcp_enter_loss(struct sock *sk, int how) | |||
1626 | tp->fackets_out = cnt; | 1626 | tp->fackets_out = cnt; |
1627 | } | 1627 | } |
1628 | } | 1628 | } |
1629 | tcp_sync_left_out(tp); | 1629 | tcp_verify_left_out(tp); |
1630 | 1630 | ||
1631 | tp->reordering = min_t(unsigned int, tp->reordering, | 1631 | tp->reordering = min_t(unsigned int, tp->reordering, |
1632 | sysctl_tcp_reordering); | 1632 | sysctl_tcp_reordering); |
@@ -1861,7 +1861,7 @@ static void tcp_mark_head_lost(struct sock *sk, | |||
1861 | tcp_verify_retransmit_hint(tp, skb); | 1861 | tcp_verify_retransmit_hint(tp, skb); |
1862 | } | 1862 | } |
1863 | } | 1863 | } |
1864 | tcp_sync_left_out(tp); | 1864 | tcp_verify_left_out(tp); |
1865 | } | 1865 | } |
1866 | 1866 | ||
1867 | /* Account newly detected lost packet(s) */ | 1867 | /* Account newly detected lost packet(s) */ |
@@ -1905,7 +1905,7 @@ static void tcp_update_scoreboard(struct sock *sk) | |||
1905 | 1905 | ||
1906 | tp->scoreboard_skb_hint = skb; | 1906 | tp->scoreboard_skb_hint = skb; |
1907 | 1907 | ||
1908 | tcp_sync_left_out(tp); | 1908 | tcp_verify_left_out(tp); |
1909 | } | 1909 | } |
1910 | } | 1910 | } |
1911 | 1911 | ||
@@ -2217,8 +2217,8 @@ tcp_fastretrans_alert(struct sock *sk, int prior_packets, int flag) | |||
2217 | NET_INC_STATS_BH(LINUX_MIB_TCPLOSS); | 2217 | NET_INC_STATS_BH(LINUX_MIB_TCPLOSS); |
2218 | } | 2218 | } |
2219 | 2219 | ||
2220 | /* D. Synchronize left_out to current state. */ | 2220 | /* D. Check consistency of the current state. */ |
2221 | tcp_sync_left_out(tp); | 2221 | tcp_verify_left_out(tp); |
2222 | 2222 | ||
2223 | /* E. Check state exit conditions. State can be terminated | 2223 | /* E. Check state exit conditions. State can be terminated |
2224 | * when high_seq is ACKed. */ | 2224 | * when high_seq is ACKed. */ |
@@ -2765,7 +2765,7 @@ static int tcp_process_frto(struct sock *sk, int flag) | |||
2765 | { | 2765 | { |
2766 | struct tcp_sock *tp = tcp_sk(sk); | 2766 | struct tcp_sock *tp = tcp_sk(sk); |
2767 | 2767 | ||
2768 | tcp_sync_left_out(tp); | 2768 | tcp_verify_left_out(tp); |
2769 | 2769 | ||
2770 | /* Duplicate the behavior from Loss state (fastretrans_alert) */ | 2770 | /* Duplicate the behavior from Loss state (fastretrans_alert) */ |
2771 | if (flag&FLAG_DATA_ACKED) | 2771 | if (flag&FLAG_DATA_ACKED) |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 7434944caa8f..a92fad55cd32 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -739,7 +739,7 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss | |||
739 | /* Adjust Reno SACK estimate. */ | 739 | /* Adjust Reno SACK estimate. */ |
740 | if (!tp->rx_opt.sack_ok) { | 740 | if (!tp->rx_opt.sack_ok) { |
741 | tcp_dec_pcount_approx_int(&tp->sacked_out, diff); | 741 | tcp_dec_pcount_approx_int(&tp->sacked_out, diff); |
742 | tcp_sync_left_out(tp); | 742 | tcp_verify_left_out(tp); |
743 | } | 743 | } |
744 | 744 | ||
745 | tcp_dec_pcount_approx_int(&tp->fackets_out, diff); | 745 | tcp_dec_pcount_approx_int(&tp->fackets_out, diff); |
@@ -1774,7 +1774,7 @@ void tcp_simple_retransmit(struct sock *sk) | |||
1774 | if (!lost) | 1774 | if (!lost) |
1775 | return; | 1775 | return; |
1776 | 1776 | ||
1777 | tcp_sync_left_out(tp); | 1777 | tcp_verify_left_out(tp); |
1778 | 1778 | ||
1779 | /* Don't muck with the congestion window here. | 1779 | /* Don't muck with the congestion window here. |
1780 | * Reason is that we do not increase amount of _data_ | 1780 | * Reason is that we do not increase amount of _data_ |