All of lore.kernel.org
 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: [PATCH v2 1/3] net/mlx5: fix shared counter allocation logic
Date: Thu, 27 Dec 2018 22:20:17 +0000	[thread overview]
Message-ID: <1545949196-3355-2-git-send-email-motih@mellanox.com> (raw)
In-Reply-To: <1545748697-3385-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:[~2018-12-27 22:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-25 14:38 [PATCH v1 0/3] support flow counters using devx Mordechay Haimovsky
2018-12-25 14:38 ` [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 ` [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 ` [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   ` [PATCH v2 0/3] " Mordechay Haimovsky
2018-12-27 22:20   ` Mordechay Haimovsky [this message]
2018-12-29 20:12     ` [PATCH v2 1/3] net/mlx5: fix shared counter allocation logic Slava Ovsiienko
2018-12-31  7:23       ` Shahaf Shuler
2019-01-02  6:58       ` Mordechay Haimovsky
2018-12-27 22:20   ` [PATCH v2 2/3] net/mlx5: add devx functions to glue Mordechay Haimovsky
2018-12-27 22:20   ` [PATCH v2 3/3] net/mlx5: support flow counters using devx Mordechay Haimovsky
2019-01-02  9:43     ` [PATCH v3 0/3] " Mordechay Haimovsky
2019-01-02  9:43     ` [PATCH v3 1/3] net/mlx5: fix shared counter allocation logic Mordechay Haimovsky
2019-01-02  9:43     ` [PATCH v3 2/3] net/mlx5: add devx functions to glue Mordechay Haimovsky
2019-01-02  9:43     ` [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       ` [PATCH v4 0/3] " Mordechay Haimovsky
2019-01-06  7:43         ` Shahaf Shuler
2019-01-03 15:06       ` [PATCH v4 2/3] net/mlx5: add devx functions to glue Mordechay Haimovsky
2019-01-03 15:06       ` [PATCH v4 1/3] net/mlx5: fix shared counter allocation logic Mordechay Haimovsky
2019-01-03 15:06       ` [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=1545949196-3355-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.