patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
To: <stable@dpdk.org>
Cc: <christian.ehrhardt@canonical.com>, <xuemingl@nvidia.com>,
	<rasland@nvidia.com>, <matan@nvidia.com>, <alialnu@nvidia.com>,
	<michaelba@nvidia.com>, Dekel Peled <dekelp@nvidia.com>
Subject: [dpdk-stable] [PATC 19.11] net/mlx5: fix flow split combined with counter
Date: Mon, 5 Jul 2021 11:58:56 +0300	[thread overview]
Message-ID: <20210705085856.13971-1-viacheslavo@nvidia.com> (raw)

From: Dekel Peled <dekelp@nvidia.com>

[ upstream commit 63f4d5693ed8459f8867a23d0b87cf9c60983767 ]

Currently, for a flow containing a count action, if flow is split to
sub-flows, a new counter will be created for each sub-flow.
However only the counter created for the last sub-flow will be queried
on flow query and cleared on flow removal.

This behavior is wrong, causing a leak of resources.
Need to create just one counter per flow, and use it for all sub-flows.

This patch adds the required check to make sure a counter is
created just once per flow, and used by all sub-flows.

Fixes: fa2d01c87d2b ("net/mlx5: support flow aging")
Cc: stable@dpdk.org

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index cea45a6d96..42ae1bbe2c 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7377,12 +7377,13 @@ __flow_dv_translate(struct rte_eth_dev *dev,
 				rte_errno = ENOTSUP;
 				goto cnt_err;
 			}
-			flow->counter = flow_dv_counter_alloc(dev,
-							      count->shared,
-							      count->id,
-							      dev_flow->group);
-			if (flow->counter == NULL)
-				goto cnt_err;
+			if (!flow->counter) {
+				flow->counter =	flow_dv_counter_alloc
+						(dev, count->shared,
+						 count->id, dev_flow->group);
+				if (flow->counter == NULL)
+					goto cnt_err;
+			}
 			dev_flow->dv.actions[actions_n++] =
 				flow->counter->action;
 			action_flags |= MLX5_FLOW_ACTION_COUNT;
-- 
2.18.1


             reply	other threads:[~2021-07-05  8:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-05  8:58 Viacheslav Ovsiienko [this message]
2021-07-05 11:17 ` Christian Ehrhardt

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=20210705085856.13971-1-viacheslavo@nvidia.com \
    --to=viacheslavo@nvidia.com \
    --cc=alialnu@nvidia.com \
    --cc=christian.ehrhardt@canonical.com \
    --cc=dekelp@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=michaelba@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=xuemingl@nvidia.com \
    /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).