icsk->icsk_ca_ops->cwnd_event(sk, event);
 }
 
+static inline unsigned int tcp_left_out(const struct tcp_sock *tp)
+{
+       return tp->sacked_out + tp->lost_out;
+}
+
 /* This determines how many packets are "in the network" to the best
  * of our knowledge.  In many cases it is conservative, but where
  * detailed information is available from the receiver (via SACK
  */
 static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)
 {
-       return tp->packets_out - (tp->sacked_out + tp->lost_out) +
-               tp->retrans_out;
+       return tp->packets_out - tcp_left_out(tp) + tp->retrans_out;
 }
 
 /* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd.
 
 static inline void tcp_sync_left_out(struct tcp_sock *tp)
 {
-       BUG_ON(tp->rx_opt.sack_ok &&
-              (tp->sacked_out + tp->lost_out > tp->packets_out));
+       BUG_ON(tp->rx_opt.sack_ok && (tcp_left_out(tp) > tp->packets_out));
 }
 
 extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);
 
        printk(KERN_DEBUG "Undo %s %u.%u.%u.%u/%u c%u l%u ss%u/%u p%u\n",
               msg,
               NIPQUAD(inet->daddr), ntohs(inet->dport),
-              tp->snd_cwnd, tp->sacked_out + tp->lost_out,
+              tp->snd_cwnd, tcp_left_out(tp),
               tp->snd_ssthresh, tp->prior_ssthresh,
               tp->packets_out);
 }