tcp_cubic: fix comparison of jiffies
authorstephen hemminger <shemminger@vyatta.com>
Mon, 14 Mar 2011 07:52:13 +0000 (07:52 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 14 Mar 2011 22:54:38 +0000 (15:54 -0700)
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>
net/ipv4/tcp_cubic.c

index 71d5f2f29fa62b92cb4ae4d4762b5322d017f5d3..43bb34c9b8bf0422183ec787aaeb15cd69f140ae 100644 (file)
@@ -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;
                }