DPDK patches and discussions
 help / color / mirror / Atom feed
From: Mordechay Haimovsky <motih@mellanox.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Cc: Mordechay Haimovsky <motih@mellanox.com>,
	"stable@dpdk.org" <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH v4 1/3] net/mlx5: fix shared counter allocation logic
Date: Thu, 3 Jan 2019 15:06:36 +0000	[thread overview]
Message-ID: <1546527981-23028-2-git-send-email-motih@mellanox.com> (raw)
In-Reply-To: <1546422185-30813-4-git-send-email-motih@mellanox.com>

This commit fixes the logic for searching and allocating a shared
counter in mlx5_flow_verbs.
Now only the shared counters in the counters list are checked for
a match and not all the counters as before.

Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
Cc: stable@dpdk.org

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
---
v2:
* Modified commit header
---
 drivers/net/mlx5/mlx5_flow_verbs.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 81ec59d..409e1cd 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -121,13 +121,13 @@
 	struct mlx5_flow_counter *cnt;
 	int ret;
 
-	LIST_FOREACH(cnt, &priv->flow_counters, next) {
-		if (!cnt->shared || cnt->shared != shared)
-			continue;
-		if (cnt->id != id)
-			continue;
-		cnt->ref_cnt++;
-		return cnt;
+	if (shared) {
+		LIST_FOREACH(cnt, &priv->flow_counters, next) {
+			if (cnt->shared && cnt->id == id) {
+				cnt->ref_cnt++;
+				return cnt;
+			}
+		}
 	}
 	cnt = rte_calloc(__func__, 1, sizeof(*cnt), 0);
 	if (!cnt) {
-- 
1.8.3.1

  parent reply	other threads:[~2019-01-03 15:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-25 14:38 [dpdk-dev] [PATCH v1 0/3] support flow counters using devx Mordechay Haimovsky
2018-12-25 14:38 ` [dpdk-dev] [PATCH v1 1/3] net/mlx5: modify shared counter allocation logic Mordechay Haimovsky
2018-12-27  8:12   ` Shahaf Shuler
2018-12-25 14:38 ` [dpdk-dev] [PATCH v1 2/3] net/mlx5: add devx functions to glue Mordechay Haimovsky
2018-12-27  8:12   ` Shahaf Shuler
2018-12-25 14:38 ` [dpdk-dev] [PATCH v1 3/3] net/mlx5: support flow counters using devx Mordechay Haimovsky
2018-12-27  8:15   ` Shahaf Shuler
2018-12-27 22:20   ` [dpdk-dev] [PATCH v2 0/3] " Mordechay Haimovsky
2018-12-27 22:20   ` [dpdk-dev] [PATCH v2 1/3] net/mlx5: fix shared counter allocation logic Mordechay Haimovsky
2018-12-29 20:12     ` Slava Ovsiienko
2018-12-31  7:23       ` Shahaf Shuler
2019-01-02  6:58       ` Mordechay Haimovsky
2018-12-27 22:20   ` [dpdk-dev] [PATCH v2 2/3] net/mlx5: add devx functions to glue Mordechay Haimovsky
2018-12-27 22:20   ` [dpdk-dev] [PATCH v2 3/3] net/mlx5: support flow counters using devx Mordechay Haimovsky
2019-01-02  9:43     ` [dpdk-dev] [PATCH v3 0/3] " Mordechay Haimovsky
2019-01-02  9:43     ` [dpdk-dev] [PATCH v3 1/3] net/mlx5: fix shared counter allocation logic Mordechay Haimovsky
2019-01-02  9:43     ` [dpdk-dev] [PATCH v3 2/3] net/mlx5: add devx functions to glue Mordechay Haimovsky
2019-01-02  9:43     ` [dpdk-dev] [PATCH v3 3/3] net/mlx5: support flow counters using devx Mordechay Haimovsky
2019-01-03  8:29       ` Shahaf Shuler
2019-01-03 15:06       ` [dpdk-dev] [PATCH v4 0/3] " Mordechay Haimovsky
2019-01-06  7:43         ` Shahaf Shuler
2019-01-03 15:06       ` Mordechay Haimovsky [this message]
2019-01-03 15:06       ` [dpdk-dev] [PATCH v4 2/3] net/mlx5: add devx functions to glue Mordechay Haimovsky
2019-01-03 15:06       ` [dpdk-dev] [PATCH v4 3/3] net/mlx5: support flow counters using devx Mordechay Haimovsky

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=1546527981-23028-2-git-send-email-motih@mellanox.com \
    --to=motih@mellanox.com \
    --cc=dev@dpdk.org \
    --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).