summaryrefslogtreecommitdiff
path: root/net/dccp/dccp.h
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2008-09-04 05:30:19 (GMT)
committerGerrit Renker <gerrit@erg.abdn.ac.uk>2008-09-04 05:45:41 (GMT)
commit49ffc29a0223adbe0ea7005eea3ab2a03abbeb06 (patch)
treed7bf19858c85b5dbb6bded3f543fbf8a6a355a2e /net/dccp/dccp.h
parent2b81143aa3505e2460b24b357996c2f21840ea58 (diff)
downloadlinux-49ffc29a0223adbe0ea7005eea3ab2a03abbeb06.tar.xz
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/dccp.h')
-rw-r--r--net/dccp/dccp.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index b63a82c..5281190 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -334,7 +334,14 @@ extern struct sk_buff *dccp_ctl_make_reset(struct sock *sk,
extern int dccp_send_reset(struct sock *sk, enum dccp_reset_codes code);
extern void dccp_send_close(struct sock *sk, const int active);
extern int dccp_invalid_packet(struct sk_buff *skb);
-extern u32 dccp_sample_rtt(struct sock *sk, long delta);
+
+static inline u32 dccp_sane_rtt(long usec_sample)
+{
+ if (unlikely(usec_sample <= 0 || usec_sample > DCCP_SANE_RTT_MAX))
+ DCCP_WARN("RTT sample %ld out of bounds!\n", usec_sample);
+ return clamp_val(usec_sample, DCCP_SANE_RTT_MIN, DCCP_SANE_RTT_MAX);
+}
+extern u32 dccp_sample_rtt(struct sock *sk, long delta);
static inline int dccp_bad_service_code(const struct sock *sk,
const __be32 service)