diff options
-rw-r--r-- | net/dccp/ccids/ccid3.c | 13 | ||||
-rw-r--r-- | net/dccp/dccp.h | 5 | ||||
-rw-r--r-- | net/dccp/timer.c | 3 |
3 files changed, 18 insertions, 3 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index 0d406f82e433..f566eb76aeb2 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -869,6 +869,19 @@ MODULE_PARM_DESC(ccid3_debug, "Enable debug messages"); | |||
869 | 869 | ||
870 | static __init int ccid3_module_init(void) | 870 | static __init int ccid3_module_init(void) |
871 | { | 871 | { |
872 | struct timespec tp; | ||
873 | |||
874 | /* | ||
875 | * Without a fine-grained clock resolution, RTTs/X_recv are not sampled | ||
876 | * correctly and feedback is sent either too early or too late. | ||
877 | */ | ||
878 | hrtimer_get_res(CLOCK_MONOTONIC, &tp); | ||
879 | if (tp.tv_sec || tp.tv_nsec > DCCP_TIME_RESOLUTION * NSEC_PER_USEC) { | ||
880 | printk(KERN_ERR "%s: Timer too coarse (%ld usec), need %u-usec" | ||
881 | " resolution - check your clocksource.\n", __func__, | ||
882 | tp.tv_nsec/NSEC_PER_USEC, DCCP_TIME_RESOLUTION); | ||
883 | return -ESOCKTNOSUPPORT; | ||
884 | } | ||
872 | return ccid_register(&ccid3); | 885 | return ccid_register(&ccid3); |
873 | } | 886 | } |
874 | module_init(ccid3_module_init); | 887 | module_init(ccid3_module_init); |
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index 1585fa26488c..b63a82ccb2b2 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
@@ -86,10 +86,13 @@ extern void dccp_time_wait(struct sock *sk, int state, int timeo); | |||
86 | */ | 86 | */ |
87 | #define DCCP_RTO_MAX ((unsigned)(64 * HZ)) | 87 | #define DCCP_RTO_MAX ((unsigned)(64 * HZ)) |
88 | 88 | ||
89 | /* DCCP base time resolution - 10 microseconds (RFC 4340, 13.1 ... 13.3) */ | ||
90 | #define DCCP_TIME_RESOLUTION 10 | ||
91 | |||
89 | /* | 92 | /* |
90 | * RTT sampling: sanity bounds and fallback RTT value from RFC 4340, section 3.4 | 93 | * RTT sampling: sanity bounds and fallback RTT value from RFC 4340, section 3.4 |
91 | */ | 94 | */ |
92 | #define DCCP_SANE_RTT_MIN 100 | 95 | #define DCCP_SANE_RTT_MIN (10 * DCCP_TIME_RESOLUTION) |
93 | #define DCCP_FALLBACK_RTT (USEC_PER_SEC / 5) | 96 | #define DCCP_FALLBACK_RTT (USEC_PER_SEC / 5) |
94 | #define DCCP_SANE_RTT_MAX (3 * USEC_PER_SEC) | 97 | #define DCCP_SANE_RTT_MAX (3 * USEC_PER_SEC) |
95 | 98 | ||
diff --git a/net/dccp/timer.c b/net/dccp/timer.c index e02d5a94f4c0..16359e29e7f5 100644 --- a/net/dccp/timer.c +++ b/net/dccp/timer.c | |||
@@ -281,8 +281,7 @@ u32 dccp_timestamp(void) | |||
281 | { | 281 | { |
282 | s64 delta = ktime_us_delta(ktime_get_real(), dccp_timestamp_seed); | 282 | s64 delta = ktime_us_delta(ktime_get_real(), dccp_timestamp_seed); |
283 | 283 | ||
284 | do_div(delta, 10); | 284 | return div_u64(delta, DCCP_TIME_RESOLUTION); |
285 | return delta; | ||
286 | } | 285 | } |
287 | EXPORT_SYMBOL_GPL(dccp_timestamp); | 286 | EXPORT_SYMBOL_GPL(dccp_timestamp); |
288 | 287 | ||