Skip to content

Commit

Permalink
tcp_cubic: fix comparison of jiffies
Browse files Browse the repository at this point in the history
Jiffies wraps around therefore the correct way to compare is
to use cast to signed value.

Note: cubic is not using full jiffies value on 64 bit arch
because using full unsigned long makes struct bictcp grow too
large for the available ca_priv area.

Includes correction from Sangtae Ha to improve ack train detection.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
stephen hemminger authored and David S. Miller committed Mar 14, 2011
1 parent febf081 commit c54b4b7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/ipv4/tcp_cubic.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,11 @@ static void hystart_update(struct sock *sk, u32 delay)
u32 curr_jiffies = jiffies;

/* first detection parameter - ack-train detection */
if (curr_jiffies - ca->last_jiffies <= msecs_to_jiffies(2)) {
if ((s32)(curr_jiffies - ca->last_jiffies) <=
msecs_to_jiffies(2)) {
ca->last_jiffies = curr_jiffies;
if (curr_jiffies - ca->round_start >= ca->delay_min>>4)
if ((s32) (curr_jiffies - ca->round_start) >
ca->delay_min >> 4)
ca->found |= HYSTART_ACK_TRAIN;
}

Expand Down

0 comments on commit c54b4b7

Please sign in to comment.