X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=datapath%2Fflow.c;h=eb67cf4503ec08f84647792bfb0e8b60f17c5af6;hb=6767a2cce9a6412b3a41a927c4d56b9f0e1ec36f;hp=e90b36a93b5a37f2171d540216a1f277b6f7cd52;hpb=37a1300c3ca05a97160d44dc34298c447b50ed9d;p=openvswitch diff --git a/datapath/flow.c b/datapath/flow.c index e90b36a9..eb67cf45 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -82,6 +82,20 @@ static inline bool icmphdr_ok(struct sk_buff *skb) return skb->len >= skb_transport_offset(skb) + sizeof(struct icmphdr); } +u64 flow_used_time(unsigned long flow_jiffies) +{ + struct timespec cur_ts; + u64 cur_ms, idle_ms; + + ktime_get_ts(&cur_ts); + idle_ms = jiffies_to_msecs(jiffies - flow_jiffies); + cur_ms = (u64)cur_ts.tv_sec * MSEC_PER_SEC + + cur_ts.tv_nsec / NSEC_PER_MSEC; + + return cur_ms - idle_ms; +} + + #define TCP_FLAGS_OFFSET 13 #define TCP_FLAG_MASK 0x3f