Skip to content

Commit

Permalink
Added fix for non zero based initial value of jiffies
Browse files Browse the repository at this point in the history
  • Loading branch information
msiniavine committed Aug 31, 2011
1 parent 245a2dc commit 3ba20ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/kernel/set_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,7 @@ void restore_tcp_socket(struct saved_file* f)
tp->mdev_max = saved_socket->tcp->mdev_max;
tp->rttvar = saved_socket->tcp->rttvar;
tp->rtt_seq = saved_socket->tcp->snd_nxt;
tp->tstamp_offset = saved_socket->tcp->tcp_tstamp_offset;
tp->tstamp_offset = saved_socket->tcp->tcp_tstamp_offset - ((__u32)jiffies); // to handle jiffies overflow

tp->rx_opt.tstamp_ok = saved_socket->tcp->timestamp_ok;
tp->rx_opt.rcv_tsval = saved_socket->tcp->tsval;
Expand Down
8 changes: 8 additions & 0 deletions include/linux/set_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ struct saved_tcp_state
u32 mdev_max;
u32 rttvar;
u32 rtt_seq;

// How do we handle the time stamps?
// We calculate the offset that needs to be added to the current time to generate the right timestamp
// but the initial current time is set to -5 minutes in unsigned int
// so the offset is calculated as:
// offset = current1-current2
// where current1 was the current time during save state and current2 is the current time after restore
// tcp_tstamp_offset is the saved current time
u32 tcp_tstamp_offset;

u32 timestamp_ok; // Are we doing tcp timestamps
Expand Down

0 comments on commit 3ba20ce

Please sign in to comment.