diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-07-26 02:49:34 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-31 05:27:57 -0400 |
commit | 30cfd0baf0a0c4329fff1ef4b622919297969ec8 (patch) | |
tree | 945a72f636ced1b443d894495704237e4cb7816d /net/ipv4/tcp_input.c | |
parent | 6a302358d87fedaf7bda12b8e909265ebf1ce674 (diff) |
[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>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r-- | net/ipv4/tcp_input.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index fec8a7a4dbaf..4b255fe999d9 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -2490,12 +2490,23 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) | |||
2490 | tcp_ack_update_rtt(sk, acked, seq_rtt); | 2490 | tcp_ack_update_rtt(sk, acked, seq_rtt); |
2491 | tcp_ack_packets_out(sk); | 2491 | tcp_ack_packets_out(sk); |
2492 | 2492 | ||
2493 | /* Is the ACK triggering packet unambiguous? */ | 2493 | if (ca_ops->pkts_acked) { |
2494 | if (acked & FLAG_RETRANS_DATA_ACKED) | 2494 | s32 rtt_us = -1; |
2495 | last_ackt = net_invalid_timestamp(); | 2495 | |
2496 | /* Is the ACK triggering packet unambiguous? */ | ||
2497 | if (!(acked & FLAG_RETRANS_DATA_ACKED)) { | ||
2498 | /* High resolution needed and available? */ | ||
2499 | if (ca_ops->flags & TCP_CONG_RTT_STAMP && | ||
2500 | !ktime_equal(last_ackt, | ||
2501 | net_invalid_timestamp())) | ||
2502 | rtt_us = ktime_us_delta(ktime_get_real(), | ||
2503 | last_ackt); | ||
2504 | else if (seq_rtt > 0) | ||
2505 | rtt_us = jiffies_to_usecs(seq_rtt); | ||
2506 | } | ||
2496 | 2507 | ||
2497 | if (ca_ops->pkts_acked) | 2508 | ca_ops->pkts_acked(sk, pkts_acked, rtt_us); |
2498 | ca_ops->pkts_acked(sk, pkts_acked, last_ackt); | 2509 | } |
2499 | } | 2510 | } |
2500 | 2511 | ||
2501 | #if FASTRETRANS_DEBUG > 0 | 2512 | #if FASTRETRANS_DEBUG > 0 |