aboutsummaryrefslogtreecommitdiff
path: root/datapath/flow.h
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2011-01-29 14:11:23 -0800
committerJesse Gross <jesse@nicira.com>2011-01-31 14:56:44 -0800
commitec58547a81246c0f3f7a03ab28ba1a78f1988235 (patch)
treea13f11ae9daf99bb29ceb7e9dfec11f86a763ec1 /datapath/flow.h
parent3569d18f47f49c115d80033a3661ad31c13d06c9 (diff)
datapath: Fix flow time used computation.
The current reporting of flow last used time has two issues that cause it to incorrectly report the system monotonic time when the flow was last used. The first is that it simply converts the stored jiffies value to milliseconds by scaling with a constant. This does not work because jiffies is not zero based and can wrap around on 32-bit platforms. The second is there is no guarantee that jiffies advances at the same rate as the RTC based monotonic time that userspace uses. A variety of factors can cause differences, including system suspend and clock drift. These are not too important for relatively short time periods such as the duration of the flow (nor is the flow timing precision of extreme importance). However, when the time being measured is the duration since system boot (assuming that the above issues had been addressed) the difference can become significant. This addresses both issues by restoring behavior similar to the previous method of computing the flow used time, though in a slightly different form to reflect the needs of the Netlink code. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'datapath/flow.h')
-rw-r--r--datapath/flow.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/datapath/flow.h b/datapath/flow.h
index 78d5a701..be734532 100644
--- a/datapath/flow.h
+++ b/datapath/flow.h
@@ -91,6 +91,7 @@ void flow_put(struct sw_flow *);
int flow_extract(struct sk_buff *, u16 in_port, struct sw_flow_key *, bool *is_frag);
void flow_used(struct sw_flow *, struct sk_buff *);
+u64 flow_used_time(unsigned long flow_jiffies);
u32 flow_hash(const struct sw_flow_key *);
int flow_cmp(const struct tbl_node *, void *target);