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:17:16 +0000 (15:17 -0800)
commitfc27bdc6ce5b6b3f95dbbc1ef5adbf3aa0e58e4a
tree6d1dd5d21fb3e362ff7e5cbadcc42fc6c93efe18
parentdff392b2bb40aa4ccd884bee43ac92fa501fb100
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