diff options
author | Baruch Even <baruch@ev-en.org> | 2006-03-21 01:22:20 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-21 01:22:20 -0500 |
commit | c33ad6e476e4cdc245215f3eb5b3df353df1b370 (patch) | |
tree | b19831b1630b5963a897ae655027c6d7acdd2895 /net/ipv4 | |
parent | b191ba0d599928372be5a89f75486eb58efab48a (diff) |
[TCP] H-TCP: Use msecs_to_jiffies
Use functions to calculate jiffies from milliseconds and not the old,
crude method of dividing HZ by a value. Ensures more accurate values
even in the face of strange HZ values.
Signed-off-By: Baruch Even <baruch@ev-en.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/tcp_htcp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/tcp_htcp.c b/net/ipv4/tcp_htcp.c index 128de4d7c0b7..fda2f873599e 100644 --- a/net/ipv4/tcp_htcp.c +++ b/net/ipv4/tcp_htcp.c | |||
@@ -80,7 +80,7 @@ static inline void measure_rtt(struct sock *sk) | |||
80 | if (icsk->icsk_ca_state == TCP_CA_Open && tp->snd_ssthresh < 0xFFFF && ca->ccount > 3) { | 80 | if (icsk->icsk_ca_state == TCP_CA_Open && tp->snd_ssthresh < 0xFFFF && ca->ccount > 3) { |
81 | if (ca->maxRTT < ca->minRTT) | 81 | if (ca->maxRTT < ca->minRTT) |
82 | ca->maxRTT = ca->minRTT; | 82 | ca->maxRTT = ca->minRTT; |
83 | if (ca->maxRTT < srtt && srtt <= ca->maxRTT+HZ/50) | 83 | if (ca->maxRTT < srtt && srtt <= ca->maxRTT+msecs_to_jiffies(20)) |
84 | ca->maxRTT = srtt; | 84 | ca->maxRTT = srtt; |
85 | } | 85 | } |
86 | } | 86 | } |
@@ -135,7 +135,7 @@ static inline void htcp_beta_update(struct htcp *ca, u32 minRTT, u32 maxRTT) | |||
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | if (ca->modeswitch && minRTT > max(HZ/100, 1) && maxRTT) { | 138 | if (ca->modeswitch && minRTT > msecs_to_jiffies(10) && maxRTT) { |
139 | ca->beta = (minRTT<<7)/maxRTT; | 139 | ca->beta = (minRTT<<7)/maxRTT; |
140 | if (ca->beta < BETA_MIN) | 140 | if (ca->beta < BETA_MIN) |
141 | ca->beta = BETA_MIN; | 141 | ca->beta = BETA_MIN; |