[TCP]: congestion control API pass RTT in microseconds

This patch changes the API for the callback that is done after an ACK is
received. It solves a couple of issues:

  * Some congestion controls want higher resolution value of RTT
    (controlled by TCP_CONG_RTT_SAMPLE flag). These don't really want a ktime, but
    all compute a RTT in microseconds.

  * Other congestion control could use RTT at jiffies resolution.

To keep API consistent the units should be the same for both cases, just the
resolution should change.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Stephen Hemminger
2007-07-25 23:49:34 -07:00
committed by David S. Miller
parent 6a302358d8
commit 30cfd0baf0
12 changed files with 39 additions and 29 deletions

View File

@@ -2490,12 +2490,23 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p)
tcp_ack_update_rtt(sk, acked, seq_rtt);
tcp_ack_packets_out(sk);
/* Is the ACK triggering packet unambiguous? */
if (acked & FLAG_RETRANS_DATA_ACKED)
last_ackt = net_invalid_timestamp();
if (ca_ops->pkts_acked) {
s32 rtt_us = -1;
if (ca_ops->pkts_acked)
ca_ops->pkts_acked(sk, pkts_acked, last_ackt);
/* Is the ACK triggering packet unambiguous? */
if (!(acked & FLAG_RETRANS_DATA_ACKED)) {
/* High resolution needed and available? */
if (ca_ops->flags & TCP_CONG_RTT_STAMP &&
!ktime_equal(last_ackt,
net_invalid_timestamp()))
rtt_us = ktime_us_delta(ktime_get_real(),
last_ackt);
else if (seq_rtt > 0)
rtt_us = jiffies_to_usecs(seq_rtt);
}
ca_ops->pkts_acked(sk, pkts_acked, rtt_us);
}
}
#if FASTRETRANS_DEBUG > 0