diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2008-09-04 01:30:19 -0400 |
---|---|---|
committer | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2008-09-04 01:45:41 -0400 |
commit | 49ffc29a0223adbe0ea7005eea3ab2a03abbeb06 (patch) | |
tree | d7bf19858c85b5dbb6bded3f543fbf8a6a355a2e /net/dccp/input.c | |
parent | 2b81143aa3505e2460b24b357996c2f21840ea58 (diff) |
dccp: Clamping RTT values
This extracts the clamping part of dccp_sample_rtt() and makes it available
to other parts of the code (as e.g. used in the next patch).
Note: The function dccp_sample_rtt() now reduces to subtracting the elapsed
time. This could be eliminated but would require shorter prefixes and thus
is not done by this patch - maybe an idea for later.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Diffstat (limited to 'net/dccp/input.c')
-rw-r--r-- | net/dccp/input.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/net/dccp/input.c b/net/dccp/input.c index b1e38bf94456..df0e6714aa11 100644 --- a/net/dccp/input.c +++ b/net/dccp/input.c | |||
@@ -707,16 +707,7 @@ u32 dccp_sample_rtt(struct sock *sk, long delta) | |||
707 | /* dccpor_elapsed_time is either zeroed out or set and > 0 */ | 707 | /* dccpor_elapsed_time is either zeroed out or set and > 0 */ |
708 | delta -= dccp_sk(sk)->dccps_options_received.dccpor_elapsed_time * 10; | 708 | delta -= dccp_sk(sk)->dccps_options_received.dccpor_elapsed_time * 10; |
709 | 709 | ||
710 | if (unlikely(delta <= 0)) { | 710 | return dccp_sane_rtt(delta); |
711 | DCCP_WARN("unusable RTT sample %ld, using min\n", delta); | ||
712 | return DCCP_SANE_RTT_MIN; | ||
713 | } | ||
714 | if (unlikely(delta > DCCP_SANE_RTT_MAX)) { | ||
715 | DCCP_WARN("RTT sample %ld too large, using max\n", delta); | ||
716 | return DCCP_SANE_RTT_MAX; | ||
717 | } | ||
718 | |||
719 | return delta; | ||
720 | } | 711 | } |
721 | 712 | ||
722 | EXPORT_SYMBOL_GPL(dccp_sample_rtt); | 713 | EXPORT_SYMBOL_GPL(dccp_sample_rtt); |