On Mon, 2015-12-07 at 10:00 +0100, Per Hurtig wrote: \ > > +static u32 tcp_unsent_pkts(const struct sock *sk) > +{ > + struct sk_buff *skb = tcp_send_head(sk); > + u32 pkts = 0; > + > + if (skb) > + tcp_for_write_queue_from(skb, sk) > + pkts += tcp_skb_pcount(skb); > + > + return pkts; > +}
write queue can be very big (consider GSO/TSO being off for example) Parsing it just to implement later : (tp->packets_out + tcp_unsent_pkts(sk) < > + TCP_RTORESTART_THRESH) is probably not very efficient. I would rather implement a different helper, aborting the loop as soon as the condition can not be met anymore. > + > /* Restart timer after forward progress on connection. > * RFC2988 recommends to restart timer to now+rto. > */ > @@ -3027,6 +3040,17 @@ void tcp_rearm_rto(struct sock *sk) > */ > if (delta > 0) > rto = delta; > + } else if (icsk->icsk_pending == ICSK_TIME_RETRANS && > + (sysctl_tcp_timer_restart == 1 || > + sysctl_tcp_timer_restart == 3) && > + (tp->packets_out + tcp_unsent_pkts(sk) < > + TCP_RTORESTART_THRESH)) { > + struct sk_buff *skb = tcp_write_queue_head(sk); > + const u32 rto_time_stamp = tcp_skb_timestamp(skb); > + s32 delta = (s32)(tcp_time_stamp - rto_time_stamp); > + > + if (delta > 0 && rto > delta) > + rto -= delta; > } > inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, rto, > TCP_RTO_MAX); -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html