datapath: Correctly report flow used times for first 5 minutes after boot.
authorBen Pfaff <blp@nicira.com>
Fri, 28 Feb 2014 21:12:04 +0000 (13:12 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 28 Feb 2014 23:14:25 +0000 (15:14 -0800)
commit4029c0435aa80f7a301f3915fe5eeaf38cb9ad44
tree8d27d142566fc4ba522e90b7384f9948688ee126
parent77d9e0eba1cf556a88d8035482492df536cf2360
datapath: Correctly report flow used times for first 5 minutes after boot.

The kernel starts out its "jiffies" timer as 5 minutes below zero, as
shown in include/linux/jiffies.h:

  /*
   * Have the 32 bit jiffies value wrap 5 minutes after boot
   * so jiffies wrap bugs show up earlier.
   */
  #define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ))

The loop in ovs_flow_stats_get() starts out with 'used' set to 0, then
takes any "later" time.  This means that for the first five minutes after
boot, flows will always be reported as never used, since 0 is greater than
any time already seen.

Bug #1192516.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
datapath/flow.c