summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Chaudron <echaudro@redhat.com>2023-02-07 15:06:23 +0100
committerIlya Maximets <i.maximets@ovn.org>2023-02-09 00:49:28 +0100
commit9b341844e717cc9d0c2a5c39f0e08138e26ce3b5 (patch)
tree1e3d80c8c7fbfea50c9deee8494c25e2208a999f
parentadac28dcdf377a6ef8200aac121a1cd383f69a58 (diff)
downloadopenvswitch-9b341844e717cc9d0c2a5c39f0e08138e26ce3b5.tar.gz
netdev-offload-tc: If the flow has not been used, report it as such.
If a tc flow was installed but has not yet been used, report it as such. In addition, add a delay to the "IGMP - flood under normal action" test case to make it work with many repetitions. This delay is also present in other ICMP/IGMP tests. Fixes: f98e418fbdb6 ("tc: Add tc flower functions") Signed-off-by: Eelco Chaudron <echaudro@redhat.com> Acked-by: Roi Dayan <roid@nvidia.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Tested-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
-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