summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/tc.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/tc.c b/lib/tc.c
index 485e4834f..7298ce690 100644
--- a/lib/tc.c
+++ b/lib/tc.c
@@ -1334,7 +1334,23 @@ get_user_hz(void)
static void
nl_parse_tcf(const struct tcf_t *tm, struct tc_flower *flower)
{
- flower->lastused = time_msec() - (tm->lastuse * 1000 / get_user_hz());
+ uint64_t lastused;
+
+ /* On creation both tm->install and tm->lastuse are set to jiffies
+ * by the kernel. So if both values are the same, the flow has not been
+ * used yet.
+ *
+ * Note that tm->firstuse can not be used due to some kernel bug, i.e.,
+ * hardware offloaded flows do not update tm->firstuse. */
+ if (tm->lastuse == tm->install) {
+ lastused = 0;
+ } else {
+ lastused = time_msec() - (tm->lastuse * 1000 / get_user_hz());
+ }
+
+ if (flower->lastused < lastused) {
+ flower->lastused = lastused;
+ }
}
static int