From: Dariusz Sosnowski <dsosnowski@nvidia.com>
To: Matan Azrad <matan@nvidia.com>,
Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
Ori Kam <orika@nvidia.com>, Suanming Mou <suanmingm@nvidia.com>
Cc: <dev@dpdk.org>
Subject: [PATCH 2/2] net/mlx5: fix counter allocation from shared pool
Date: Tue, 27 Jun 2023 11:27:46 +0300 [thread overview]
Message-ID: <20230627082746.2466304-3-dsosnowski@nvidia.com> (raw)
In-Reply-To: <20230627082746.2466304-1-dsosnowski@nvidia.com>
mlx5_hws_cnt struct represents counter objects which are used
in flow rules. This struct contains a union which stores
the following information:
- If counter object is used:
- `share` is set to 1 if and only if counter object is used
in an indirect action.
- `age_idx` is set to the relevant AGE object index.
- Both of these fields are set at the time of allocatin
a counter object from the pool.
- If counter object is unused:
- `query_gen_when_free` is set to the current reset cycle
of the counter service at the time of freeing the counter object.
When ports were configured to share the flow engine resources,
counter object allocation logic in mlx5_hws_cnt_pool_get()
did not reset the `share` field.
This caused issues when previously released counter object
had the least significant bit of `query_gen_when_free` set to 1.
That counter object was treated as shared counter (indirect action),
even if it was allocated by using COUNT action directly in the flow
rule.
This patch fixes this issue by adding the explicit reset of `share`
field.
Fixes: 13ea6bdcc7ee ("net/mlx5: support counters in cross port shared mode")
Cc: viacheslavo@nvidia.com
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
drivers/net/mlx5/mlx5_hws_cnt.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/mlx5/mlx5_hws_cnt.h b/drivers/net/mlx5/mlx5_hws_cnt.h
index f37a7d6151..f462665eac 100644
--- a/drivers/net/mlx5/mlx5_hws_cnt.h
+++ b/drivers/net/mlx5/mlx5_hws_cnt.h
@@ -506,6 +506,7 @@ mlx5_hws_cnt_pool_get(struct mlx5_hws_cnt_pool *cpool, uint32_t *queue,
__hws_cnt_query_raw(cpool, *cnt_id,
&cpool->pool[iidx].reset.hits,
&cpool->pool[iidx].reset.bytes);
+ cpool->pool[iidx].share = 0;
MLX5_ASSERT(!cpool->pool[iidx].in_used);
cpool->pool[iidx].in_used = true;
cpool->pool[iidx].age_idx = age_idx;
--
2.25.1
next prev parent reply other threads:[~2023-06-27 8:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-27 8:27 [PATCH 0/2] net/mlx5: fix counter object leaks Dariusz Sosnowski
2023-06-27 8:27 ` [PATCH 1/2] net/mlx5: fix queue used to deallocate counter Dariusz Sosnowski
2023-06-27 8:27 ` Dariusz Sosnowski [this message]
2023-07-02 14:41 ` [PATCH 0/2] net/mlx5: fix counter object leaks Raslan Darawsheh
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=20230627082746.2466304-3-dsosnowski@nvidia.com \
--to=dsosnowski@nvidia.com \
--cc=dev@dpdk.org \
--cc=matan@nvidia.com \
--cc=orika@nvidia.com \
--cc=suanmingm@nvidia.com \
--cc=viacheslavo@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).