summaryrefslogtreecommitdiff
path: root/lib
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:32:55 +0100
commita08a589ce494fffccefadc4a767197796d30da2f (patch)
tree05a4460e923881b0dc3f7cb64826d4dc9c069d20 /lib
parentd57299fc6cb3fc802faaa56e41514f28b87477de (diff)
downloadopenvswitch-a08a589ce494fffccefadc4a767197796d30da2f.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>
Diffstat (limited to 'lib')
-rw-r--r--lib/tc.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/tc.c b/lib/tc.c
index 1fb2b4a92..4c07e2216 100644
--- a/lib/tc.c
+++ b/lib/tc.c
@@ -1366,7 +1366,19 @@ get_user_hz(void)
static void
nl_parse_tcf(const struct tcf_t *tm, struct tc_flower *flower)
{
- uint64_t 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;