aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/tcp.h11
-rw-r--r--net/ipv4/tcp_input.c2
2 files changed, 8 insertions, 5 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 299872d461c7..39d0df6afe47 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -719,6 +719,11 @@ static inline void tcp_ca_event(struct sock *sk, const enum tcp_ca_event event)
719 icsk->icsk_ca_ops->cwnd_event(sk, event); 719 icsk->icsk_ca_ops->cwnd_event(sk, event);
720} 720}
721 721
722static inline unsigned int tcp_left_out(const struct tcp_sock *tp)
723{
724 return tp->sacked_out + tp->lost_out;
725}
726
722/* This determines how many packets are "in the network" to the best 727/* This determines how many packets are "in the network" to the best
723 * of our knowledge. In many cases it is conservative, but where 728 * of our knowledge. In many cases it is conservative, but where
724 * detailed information is available from the receiver (via SACK 729 * detailed information is available from the receiver (via SACK
@@ -735,8 +740,7 @@ static inline void tcp_ca_event(struct sock *sk, const enum tcp_ca_event event)
735 */ 740 */
736static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp) 741static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)
737{ 742{
738 return tp->packets_out - (tp->sacked_out + tp->lost_out) + 743 return tp->packets_out - tcp_left_out(tp) + tp->retrans_out;
739 tp->retrans_out;
740} 744}
741 745
742/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. 746/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd.
@@ -756,8 +760,7 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk)
756 760
757static inline void tcp_sync_left_out(struct tcp_sock *tp) 761static inline void tcp_sync_left_out(struct tcp_sock *tp)
758{ 762{
759 BUG_ON(tp->rx_opt.sack_ok && 763 BUG_ON(tp->rx_opt.sack_ok && (tcp_left_out(tp) > tp->packets_out));
760 (tp->sacked_out + tp->lost_out > tp->packets_out));
761} 764}
762 765
763extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); 766extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 957e0fb8afb7..6bdd053e252f 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1969,7 +1969,7 @@ static void DBGUNDO(struct sock *sk, const char *msg)
1969 printk(KERN_DEBUG "Undo %s %u.%u.%u.%u/%u c%u l%u ss%u/%u p%u\n", 1969 printk(KERN_DEBUG "Undo %s %u.%u.%u.%u/%u c%u l%u ss%u/%u p%u\n",
1970 msg, 1970 msg,
1971 NIPQUAD(inet->daddr), ntohs(inet->dport), 1971 NIPQUAD(inet->daddr), ntohs(inet->dport),
1972 tp->snd_cwnd, tp->sacked_out + tp->lost_out, 1972 tp->snd_cwnd, tcp_left_out(tp),
1973 tp->snd_ssthresh, tp->prior_ssthresh, 1973 tp->snd_ssthresh, tp->prior_ssthresh,
1974 tp->packets_out); 1974 tp->packets_out);
1975} 1975}