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:44:31 +0100
commit188da42e3dbb558c33a1c3f2aae0940d23331528 (patch)
treedd3b18c1204d8e5c046bca8475104194ae245be7
parenta77b8a32c18805592a2c4626c5d16941d8927ea9 (diff)
downloadopenvswitch-188da42e3dbb558c33a1c3f2aae0940d23331528.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.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;