From: Maayan Kashani <mkashani@nvidia.com>
To: <dev@dpdk.org>
Cc: <mkashani@nvidia.com>, <dsosnowski@nvidia.com>,
<rasland@nvidia.com>, Gregory Etelson <getelson@nvidia.com>,
Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
Ori Kam <orika@nvidia.com>, Suanming Mou <suanmingm@nvidia.com>,
Matan Azrad <matan@nvidia.com>
Subject: [PATCH v2 19/34] net/mlx5: update ASO resources in non-template setup
Date: Mon, 3 Jun 2024 11:10:40 +0300 [thread overview]
Message-ID: <20240603081042.3109-4-mkashani@nvidia.com> (raw)
In-Reply-To: <20240603081042.3109-1-mkashani@nvidia.com>
From: Gregory Etelson <getelson@nvidia.com>
Non-template PMD implementation allocates ASO flow actions resources
on-demand.
Current PMD implementation iterated over actions array in search for
actions that required ASO resources allocations.
The patch replaced the iteration with actions flags bitmap queries.
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
drivers/net/mlx5/mlx5_flow_hw.c | 102 ++++++++++++++------------------
1 file changed, 45 insertions(+), 57 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 9f43fbfb35..f2ed2d8e46 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -12671,79 +12671,67 @@ static int flow_hw_register_matcher(struct rte_eth_dev *dev,
NULL, "fail to register matcher");
}
-static int flow_hw_ensure_action_pools_allocated(struct rte_eth_dev *dev,
- const struct rte_flow_action actions[],
- struct rte_flow_error *error)
+static int
+flow_hw_allocate_actions(struct rte_eth_dev *dev,
+ uint64_t action_flags,
+ struct rte_flow_error *error)
{
- bool actions_end = false;
struct mlx5_priv *priv = dev->data->dev_private;
int ret;
uint obj_num;
- for (; !actions_end; actions++) {
- switch ((int)actions->type) {
- case RTE_FLOW_ACTION_TYPE_AGE:
- /* If no age objects were previously allocated. */
- if (!priv->hws_age_req) {
- /* If no counters were previously allocated. */
- if (!priv->hws_cpool) {
- obj_num = MLX5_CNT_NT_MAX(priv);
- ret = mlx5_hws_cnt_pool_create(dev, obj_num,
- priv->nb_queue, NULL);
- if (ret)
- goto err;
- }
- if (priv->hws_cpool) {
- /* Allocate same number of counters. */
- ret = mlx5_hws_age_pool_init(dev,
- priv->hws_cpool->cfg.request_num,
- priv->nb_queue, false);
- if (ret)
- goto err;
- }
- }
- break;
- case RTE_FLOW_ACTION_TYPE_COUNT:
+ if (action_flags & MLX5_FLOW_ACTION_AGE) {
+ /* If no age objects were previously allocated. */
+ if (!priv->hws_age_req) {
/* If no counters were previously allocated. */
if (!priv->hws_cpool) {
obj_num = MLX5_CNT_NT_MAX(priv);
ret = mlx5_hws_cnt_pool_create(dev, obj_num,
- priv->nb_queue, NULL);
- if (ret)
- goto err;
- }
- break;
- case RTE_FLOW_ACTION_TYPE_CONNTRACK:
- /* If no CT were previously allocated. */
- if (!priv->hws_ctpool) {
- obj_num = MLX5_CT_NT_MAX(priv);
- ret = mlx5_flow_ct_init(dev, obj_num, priv->nb_queue);
- if (ret)
- goto err;
- }
- break;
- case RTE_FLOW_ACTION_TYPE_METER_MARK:
- /* If no meters were previously allocated. */
- if (!priv->hws_mpool) {
- obj_num = MLX5_MTR_NT_MAX(priv);
- ret = mlx5_flow_meter_init(dev, obj_num, 0, 0,
- priv->nb_queue);
+ priv->nb_queue, NULL);
if (ret)
goto err;
}
- break;
- case RTE_FLOW_ACTION_TYPE_END:
- actions_end = true;
- break;
- default:
- break;
+ /* Allocate same number of counters. */
+ ret = mlx5_hws_age_pool_init(dev, priv->hws_cpool->cfg.request_num,
+ priv->nb_queue, false);
+ if (ret)
+ goto err;
+ }
+ }
+ if (action_flags & MLX5_FLOW_ACTION_COUNT) {
+ /* If no counters were previously allocated. */
+ if (!priv->hws_cpool) {
+ obj_num = MLX5_CNT_NT_MAX(priv);
+ ret = mlx5_hws_cnt_pool_create(dev, obj_num,
+ priv->nb_queue, NULL);
+ if (ret)
+ goto err;
+ }
+ }
+ if (action_flags & MLX5_FLOW_ACTION_CT) {
+ /* If no CT were previously allocated. */
+ if (!priv->hws_ctpool) {
+ obj_num = MLX5_CT_NT_MAX(priv);
+ ret = mlx5_flow_ct_init(dev, obj_num, priv->nb_queue);
+ if (ret)
+ goto err;
+ }
+ }
+ if (action_flags & MLX5_FLOW_ACTION_METER) {
+ /* If no meters were previously allocated. */
+ if (!priv->hws_mpool) {
+ obj_num = MLX5_MTR_NT_MAX(priv);
+ ret = mlx5_flow_meter_init(dev, obj_num, 0, 0,
+ priv->nb_queue);
+ if (ret)
+ goto err;
}
}
return 0;
err:
return rte_flow_error_set(error, ret,
- RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
- NULL, "fail to allocate actions");
+ RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+ NULL, "fail to allocate actions");
}
/* TODO: remove dev if not used */
@@ -12861,7 +12849,7 @@ flow_hw_create_flow(struct rte_eth_dev *dev, enum mlx5_flow_type type,
* The output actions bit mask instead of
* looping on the actions array twice.
*/
- ret = flow_hw_ensure_action_pools_allocated(dev, actions, error);
+ ret = flow_hw_allocate_actions(dev, action_flags, error);
if (ret)
goto error;
--
2.25.1
next prev parent reply other threads:[~2024-06-03 8:11 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-02 10:28 [PATCH 1/6] net/mlx5: update NTA rule pattern and actions flags Maayan Kashani
2024-06-03 8:10 ` [PATCH v2 16/34] " Maayan Kashani
2024-06-03 8:10 ` [PATCH v2 17/34] net/mlx5: support RSS expansion in non-template HWS setup Maayan Kashani
2024-06-03 8:10 ` [PATCH v2 18/34] net/mlx5: support indirect actions in non-template setup Maayan Kashani
2024-06-03 8:10 ` Maayan Kashani [this message]
2024-06-03 8:10 ` [PATCH v2 20/34] net/mlx5: update HWS ASO actions validation Maayan Kashani
2024-06-03 8:10 ` [PATCH v2 21/34] net/mlx5: support FDB in non-template mode Maayan Kashani
2024-06-03 10:52 ` [PATCH v3 1/6] net/mlx5: update NTA rule pattern and actions flags Maayan Kashani
2024-06-03 10:52 ` [PATCH v3 2/6] net/mlx5: support RSS expansion in non-template HWS setup Maayan Kashani
2024-06-03 10:52 ` [PATCH v3 3/6] net/mlx5: support indirect actions in non-template setup Maayan Kashani
2024-06-03 10:52 ` [PATCH v3 4/6] net/mlx5: update ASO resources " Maayan Kashani
2024-06-03 10:52 ` [PATCH v3 5/6] net/mlx5: update HWS ASO actions validation Maayan Kashani
2024-06-03 10:52 ` [PATCH v3 6/6] net/mlx5: support FDB in non-template mode Maayan Kashani
2024-06-06 10:12 ` [PATCH v4 0/6] non-template pmd advanced Maayan Kashani
2024-06-06 10:12 ` [PATCH v4 1/6] net/mlx5: update NTA rule pattern and actions flags Maayan Kashani
2024-06-06 10:12 ` [PATCH v4 2/6] net/mlx5: support RSS expansion in non-template HWS setup Maayan Kashani
2024-06-06 10:12 ` [PATCH v4 3/6] net/mlx5: support indirect actions in non-template setup Maayan Kashani
2024-06-06 10:12 ` [PATCH v4 4/6] net/mlx5: update ASO resources " Maayan Kashani
2024-06-06 10:12 ` [PATCH v4 5/6] net/mlx5: update HWS ASO actions validation Maayan Kashani
2024-06-06 10:12 ` [PATCH v4 6/6] net/mlx5: support FDB in non-template mode Maayan Kashani
2024-06-10 8:50 ` [PATCH v5 1/6] net/mlx5: update NTA rule pattern and actions flags Maayan Kashani
2024-06-10 8:50 ` [PATCH v5 2/6] net/mlx5: support RSS expansion in non-template HWS setup Maayan Kashani
2024-06-10 8:50 ` [PATCH v5 3/6] net/mlx5: support indirect actions in non-template setup Maayan Kashani
2024-06-10 8:50 ` [PATCH v5 4/6] net/mlx5: update ASO resources " Maayan Kashani
2024-06-10 8:50 ` [PATCH v5 5/6] net/mlx5: update HWS ASO actions validation Maayan Kashani
2024-06-10 8:50 ` [PATCH v5 6/6] net/mlx5: support FDB in non-template mode Maayan Kashani
2024-06-11 11:20 ` [PATCH v5 1/6] net/mlx5: update NTA rule pattern and actions flags 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=20240603081042.3109-4-mkashani@nvidia.com \
--to=mkashani@nvidia.com \
--cc=dev@dpdk.org \
--cc=dsosnowski@nvidia.com \
--cc=getelson@nvidia.com \
--cc=matan@nvidia.com \
--cc=orika@nvidia.com \
--cc=rasland@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).