diff mbox series

[ovs-dev,v10,09/11] netdev-offload-tc: If the flow has not been used, report it as such.

Message ID 167533627464.904861.12567093182947013231.stgit@ebuild.local
State Superseded
Headers show
Series tests: Add system-traffic.at tests to check-offloads. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Eelco Chaudron Feb. 2, 2023, 11:11 a.m. UTC
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.

f98e418fbdb6 ("tc: Add tc flower functions")
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Roi Dayan <roid@nvidia.com>
---
 lib/tc.c                |   14 +++++++++++++-
 tests/system-traffic.at |    1 -
 2 files changed, 13 insertions(+), 2 deletions(-)
diff mbox series

Patch

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;
diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index a93bdb26f..9fea221f2 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -7144,7 +7144,6 @@  AT_CLEANUP
 AT_BANNER([IGMP])
 
 AT_SETUP([IGMP - flood under normal action])
-CHECK_NO_TC_OFFLOAD()
 
 OVS_TRAFFIC_VSWITCHD_START()
 ADD_NAMESPACES(at_ns0, at_ns1)