Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 66719
b: refs/heads/master
c: 4c70f38
h: refs/heads/master
i:
  66717: cf87fa8
  66715: 42059b6
  66711: 36e4788
  66703: 9b2e348
  66687: 50b1ed2
v: v3
  • Loading branch information
Gerrit Renker authored and David S. Miller committed Oct 10, 2007
1 parent b378926 commit 79de123
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aa97efd97acefb7d3dcd864adb878c7ce34061b3
refs/heads/master: 4c70f383e0c0273c4092c4efdb414be0966978b7
2 changes: 2 additions & 0 deletions trunk/net/dccp/dccp.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ extern int dccp_insert_options(struct sock *sk, struct sk_buff *skb);
extern int dccp_insert_option_elapsed_time(struct sock *sk,
struct sk_buff *skb,
u32 elapsed_time);
extern u32 dccp_timestamp(void);
extern void dccp_timestamping_init(void);
extern int dccp_insert_option_timestamp(struct sock *sk,
struct sk_buff *skb);
extern int dccp_insert_option(struct sock *sk, struct sk_buff *skb,
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/dccp/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ EXPORT_SYMBOL_GPL(dccp_insert_option_elapsed_time);

int dccp_insert_option_timestamp(struct sock *sk, struct sk_buff *skb)
{
__be32 now = htonl(((suseconds_t)ktime_to_us(ktime_get_real())) / 10);
__be32 now = htonl(dccp_timestamp());
/* yes this will overflow but that is the point as we want a
* 10 usec 32 bit timer which mean it wraps every 11.9 hours */

Expand Down
2 changes: 2 additions & 0 deletions trunk/net/dccp/proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,8 @@ static int __init dccp_init(void)
rc = dccp_sysctl_init();
if (rc)
goto out_ackvec_exit;

dccp_timestamping_init();
out:
return rc;
out_ackvec_exit:
Expand Down
21 changes: 21 additions & 0 deletions trunk/net/dccp/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,24 @@ void dccp_init_xmit_timers(struct sock *sk)
inet_csk_init_xmit_timers(sk, &dccp_write_timer, &dccp_delack_timer,
&dccp_keepalive_timer);
}

static ktime_t dccp_timestamp_seed;
/**
* dccp_timestamp - 10s of microseconds time source
* Returns the number of 10s of microseconds since loading DCCP. This is native
* DCCP time difference format (RFC 4340, sec. 13).
* Please note: This will wrap around about circa every 11.9 hours.
*/
u32 dccp_timestamp(void)
{
s64 delta = ktime_us_delta(ktime_get_real(), dccp_timestamp_seed);

do_div(delta, 10);
return delta;
}
EXPORT_SYMBOL_GPL(dccp_timestamp);

void __init dccp_timestamping_init(void)
{
dccp_timestamp_seed = ktime_get_real();
}

0 comments on commit 79de123

Please sign in to comment.