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
commit7909229f4cd808b2bf57a72f4d4ff328339b01e5 (patch)
tree24a397ecd6c83ec1375c4bff90f703fc2f257c9e
parenta596911fa2c83b74d0049e1845d72f0fba2bfb08 (diff)
downloadopenvswitch-7909229f4cd808b2bf57a72f4d4ff328339b01e5.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 deeb7afa9..e7918e9fe 100644
--- a/lib/tc.c
+++ b/lib/tc.c
@@ -1362,7 +1362,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;