From: Gregory Etelson <getelson@nvidia.com>
To: <dev@dpdk.org>
Cc: getelson@nvidia.com, <mkashani@nvidia.com>,
rasland@nvidia.com, "Dariusz Sosnowski" <dsosnowski@nvidia.com>,
"Viacheslav Ovsiienko" <viacheslavo@nvidia.com>,
"Bing Zhao" <bingz@nvidia.com>, "Ori Kam" <orika@nvidia.com>,
"Suanming Mou" <suanmingm@nvidia.com>,
"Matan Azrad" <matan@nvidia.com>
Subject: [PATCH 2/5] net/mlx5: add mlx5_hw_create_mirror function.
Date: Tue, 17 Jun 2025 16:39:30 +0300 [thread overview]
Message-ID: <20250617133933.313443-2-getelson@nvidia.com> (raw)
In-Reply-To: <20250617133933.313443-1-getelson@nvidia.com>
The new mlx5_hw_create_mirror() function separates existing HWS mirror
functionality into mirror action creation and indirect list
handle creation.
The new mirror creation function will be used in non-template SAMPLE
action implementation.
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
drivers/net/mlx5/mlx5_flow.h | 21 +++++++++++++++++++++
drivers/net/mlx5/mlx5_flow_hw.c | 29 ++++++++++++++++++++---------
2 files changed, 41 insertions(+), 9 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 9816ed9238..23c5833290 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -201,6 +201,21 @@ enum mlx5_feature_name {
MLX5_SAMPLE_ID,
};
+#define MLX5_MIRROR_MAX_CLONES_NUM 3
+#define MLX5_MIRROR_MAX_SAMPLE_ACTIONS_LEN 4
+
+struct mlx5_mirror_clone {
+ enum rte_flow_action_type type;
+ void *action_ctx;
+};
+
+struct mlx5_mirror {
+ struct mlx5_indirect_list indirect;
+ uint32_t clones_num;
+ struct mlx5dr_action *mirror_action;
+ struct mlx5_mirror_clone clone[MLX5_MIRROR_MAX_CLONES_NUM];
+};
+
/* Default queue number. */
#define MLX5_RSSQ_DEFAULT_NUM 16
@@ -3722,5 +3737,11 @@ mlx5_flow_nta_update_copy_table(struct rte_eth_dev *dev,
struct mlx5_ecpri_parser_profile *flow_hw_get_ecpri_parser_profile(void *dr_ctx);
+struct mlx5_mirror *
+mlx5_hw_create_mirror(struct rte_eth_dev *dev,
+ const struct mlx5_flow_template_table_cfg *table_cfg,
+ const struct rte_flow_action *actions,
+ struct rte_flow_error *error);
+
#endif
#endif /* RTE_PMD_MLX5_FLOW_H_ */
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index a8a3f3872a..9b3e56938a 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -14589,11 +14589,11 @@ hw_mirror_format_clone(struct rte_eth_dev *dev,
return 0;
}
-static struct rte_flow_action_list_handle *
-mlx5_hw_mirror_handle_create(struct rte_eth_dev *dev,
- const struct mlx5_flow_template_table_cfg *table_cfg,
- const struct rte_flow_action *actions,
- struct rte_flow_error *error)
+struct mlx5_mirror *
+mlx5_hw_create_mirror(struct rte_eth_dev *dev,
+ const struct mlx5_flow_template_table_cfg *table_cfg,
+ const struct rte_flow_action *actions,
+ struct rte_flow_error *error)
{
uint32_t hws_flags;
int ret = 0, i, clones_num;
@@ -14656,15 +14656,26 @@ mlx5_hw_mirror_handle_create(struct rte_eth_dev *dev,
actions, "Failed to create HWS mirror action");
goto error;
}
-
- mlx5_indirect_list_add_entry(&priv->indirect_list_head, &mirror->indirect);
- return (struct rte_flow_action_list_handle *)mirror;
-
+ return mirror;
error:
mlx5_hw_mirror_destroy(dev, mirror);
return NULL;
}
+static struct rte_flow_action_list_handle *
+mlx5_hw_mirror_handle_create(struct rte_eth_dev *dev,
+ const struct mlx5_flow_template_table_cfg *table_cfg,
+ const struct rte_flow_action *actions,
+ struct rte_flow_error *error)
+{
+ struct mlx5_priv *priv = dev->data->dev_private;
+ struct mlx5_mirror *mirror = mlx5_hw_create_mirror(dev, table_cfg, actions, error);
+
+ if (mirror)
+ mlx5_indirect_list_add_entry(&priv->indirect_list_head, &mirror->indirect);
+ return (struct rte_flow_action_list_handle *)mirror;
+}
+
void
mlx5_destroy_legacy_indirect(__rte_unused struct rte_eth_dev *dev,
struct mlx5_indirect_list *ptr)
--
2.48.1
next prev parent reply other threads:[~2025-06-17 13:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-17 13:39 [PATCH 1/5] net/mlx5: fix the table flags of mirror action Gregory Etelson
2025-06-17 13:39 ` Gregory Etelson [this message]
2025-06-17 13:39 ` [PATCH 3/5] net/mlx5: create utility functions for non-template sample action Gregory Etelson
2025-06-17 13:39 ` [PATCH 4/5] net/mlx5: add MLX5 mirror flow action Gregory Etelson
2025-06-17 13:39 ` [PATCH 5/5] net/mlx5: support non-template SAMPLE " Gregory Etelson
2025-06-26 7:59 ` [PATCH v2 0/4] net/mlx5: support non template " Gregory Etelson
2025-06-26 7:59 ` [PATCH v2 1/4] net/mlx5: fix the table flags of mirror action Gregory Etelson
2025-06-26 7:59 ` [PATCH v2 2/4] net/mlx5: add a stand alone function for mirror creation Gregory Etelson
2025-06-26 7:59 ` [PATCH v2 3/4] net/mlx5: add functions for non template sample action Gregory Etelson
2025-06-26 7:59 ` [PATCH v2 4/4] net/mlx5: support non-template SAMPLE flow action Gregory Etelson
2025-06-26 15:28 ` [PATCH v2 0/4] net/mlx5: support non template " Thomas Monjalon
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=20250617133933.313443-2-getelson@nvidia.com \
--to=getelson@nvidia.com \
--cc=bingz@nvidia.com \
--cc=dev@dpdk.org \
--cc=dsosnowski@nvidia.com \
--cc=matan@nvidia.com \
--cc=mkashani@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 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.