DPDK patches and discussions
 help / color / mirror / Atom feed
From: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
To: <dev@dpdk.org>
Cc: <rasland@nvidia.com>, <matan@nvidia.com>,
	<ferruh.yigit@intel.com>, Michael Baum <michaelba@nvidia.com>,
	<stable@dpdk.org>
Subject: [dpdk-dev] [PATCH v2 4/5] net/mlx5: fix flow age event triggering
Date: Thu, 29 Apr 2021 12:55:41 +0300	[thread overview]
Message-ID: <20210429095542.7800-5-viacheslavo@nvidia.com> (raw)
In-Reply-To: <20210429095542.7800-1-viacheslavo@nvidia.com>

From: Michael Baum <michaelba@nvidia.com>

A FLOW_AGE event should be invoked when a new aged-out flow is detected
by the PMD after the last user get-aged query calling.
The PMD manages 2 flags for this information and check them in order to
decide if an event should be invoked:
MLX5_AGE_EVENT_NEW - a new aged-out flow was detected. after the last
check.
MLX5_AGE_TRIGGER - get-aged query was called after the last aged-out
flow.
The 2 flags were unset after the event invoking.

When the user calls get-aged query from the event callback, the TRIGGER
flag was set inside the user callback and unset directly after the
callback what may stop the event invoking forever.

Unset the TRIGGER flag before the event invoking in order to allow set
it by the user callback.

Fixes: f935ed4b645a ("net/mlx5: support flow hit action for aging")
Cc: stable@dpdk.org

Reported-by: David Bouyeure <david.bouyeure@fraudbuster.mobi>
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5.c | 8 +++++---
 drivers/net/mlx5/mlx5.h | 2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 19ffa16769..10d44c7bbe 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -662,11 +662,13 @@ mlx5_age_event_prepare(struct mlx5_dev_ctx_shared *sh)
 		age_info = &sh->port[i].age_info;
 		if (!MLX5_AGE_GET(age_info, MLX5_AGE_EVENT_NEW))
 			continue;
-		if (MLX5_AGE_GET(age_info, MLX5_AGE_TRIGGER))
+		MLX5_AGE_UNSET(age_info, MLX5_AGE_EVENT_NEW);
+		if (MLX5_AGE_GET(age_info, MLX5_AGE_TRIGGER)) {
+			MLX5_AGE_UNSET(age_info, MLX5_AGE_TRIGGER);
 			rte_eth_dev_callback_process
 				(&rte_eth_devices[sh->port[i].devx_ih_port_id],
 				RTE_ETH_EVENT_FLOW_AGED, NULL);
-		age_info->flags = 0;
+		}
 	}
 }
 
@@ -675,7 +677,7 @@ mlx5_age_event_prepare(struct mlx5_dev_ctx_shared *sh)
  *
  * @param[in] sh
  *   Pointer to mlx5_dev_ctx_shared object.
- * @param[in] sh
+ * @param[in] config
  *   Pointer to user dev config.
  */
 static void
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index efb80a4a49..79ae8fbef1 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -563,6 +563,8 @@ struct mlx5_geneve_tlv_option_resource {
 #define MLX5_AGE_TRIGGER		2
 #define MLX5_AGE_SET(age_info, BIT) \
 	((age_info)->flags |= (1 << (BIT)))
+#define MLX5_AGE_UNSET(age_info, BIT) \
+	((age_info)->flags &= ~(1 << (BIT)))
 #define MLX5_AGE_GET(age_info, BIT) \
 	((age_info)->flags & (1 << (BIT)))
 #define GET_PORT_AGE_INFO(priv) \
-- 
2.18.1


  parent reply	other threads:[~2021-04-29  9:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26 12:42 [dpdk-dev] [PATCH 0/5] net/mlx5: add indirect count action Michael Baum
2021-04-26 12:42 ` [dpdk-dev] [PATCH 1/5] net/mlx5: support flow count action handle Michael Baum
2021-04-26 12:42 ` [dpdk-dev] [PATCH 2/5] app/testpmd: remove indirect RSS action query Michael Baum
2021-04-29 13:46   ` Ori Kam
2021-04-26 12:42 ` [dpdk-dev] [PATCH 3/5] app/testpmd: support indirect counter " Michael Baum
2021-04-29 13:45   ` Ori Kam
2021-04-26 12:42 ` [dpdk-dev] [PATCH 4/5] net/mlx5: fix flow age event triggering Michael Baum
2021-04-26 12:42 ` [dpdk-dev] [PATCH 5/5] net/mlx5: use aging by counter when counter is existed Michael Baum
2021-04-29  9:55 ` [dpdk-dev] [PATCH v2 0/5] Add support of indirect action API for count action Viacheslav Ovsiienko
2021-04-29  9:55   ` [dpdk-dev] [PATCH v2 1/5] net/mlx5: support flow count action handle Viacheslav Ovsiienko
2021-04-30  8:34     ` Ferruh Yigit
2021-04-30  9:01       ` Slava Ovsiienko
2021-04-30  9:22         ` Ferruh Yigit
2021-04-29  9:55   ` [dpdk-dev] [PATCH v2 2/5] app/testpmd: remove indirect RSS action query Viacheslav Ovsiienko
2021-04-29  9:55   ` [dpdk-dev] [PATCH v2 3/5] app/testpmd: support indirect counter " Viacheslav Ovsiienko
2021-04-29  9:55   ` Viacheslav Ovsiienko [this message]
2021-04-29  9:55   ` [dpdk-dev] [PATCH v2 5/5] net/mlx5: use aging by counter when counter is existed Viacheslav Ovsiienko
2021-04-30 10:43   ` [dpdk-dev] [PATCH v2 0/5] Add support of indirect action API for count action Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210429095542.7800-5-viacheslavo@nvidia.com \
    --to=viacheslavo@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=matan@nvidia.com \
    --cc=michaelba@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).