From: Rongwei Liu <rongweil@nvidia.com>
To: <dev@dpdk.org>, <matan@nvidia.com>, <viacheslavo@nvidia.com>,
<orika@nvidia.com>, <suanmingm@nvidia.com>, <thomas@monjalon.net>
Cc: Alex Vesker <valex@nvidia.com>, Erez Shitrit <erezsh@nvidia.com>
Subject: [PATCH v4 05/13] net/mlx5/hws: dynamic re-parse for modify header
Date: Wed, 1 Nov 2023 06:44:11 +0200 [thread overview]
Message-ID: <20231101044419.732726-6-rongweil@nvidia.com> (raw)
In-Reply-To: <20231101044419.732726-1-rongweil@nvidia.com>
From: Alex Vesker <valex@nvidia.com>
With dynamic re-parse we would always require re-parse but
this is not always necessary. Re-parse is only needed when
the packet structure is changed. This support will allow
dynamically deciding based on the action pattern if re-parse
is required or no.
Signed-off-by: Alex Vesker <valex@nvidia.com>
Reviewed-by: Erez Shitrit <erezsh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr_action.c | 15 +++++++---
drivers/net/mlx5/hws/mlx5dr_action.h | 1 +
drivers/net/mlx5/hws/mlx5dr_pat_arg.c | 41 +++++++++++++++++++++++++--
drivers/net/mlx5/hws/mlx5dr_pat_arg.h | 2 ++
4 files changed, 53 insertions(+), 6 deletions(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 85987fe2ea..98bb556b7b 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -547,7 +547,9 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
case MLX5DR_ACTION_TYP_MODIFY_HDR:
attr->action_offset = MLX5DR_ACTION_OFFSET_DW6;
- attr->reparse_mode = MLX5_IFC_STC_REPARSE_ALWAYS;
+ if (action->modify_header.require_reparse)
+ attr->reparse_mode = MLX5_IFC_STC_REPARSE_ALWAYS;
+
if (action->modify_header.num_of_actions == 1) {
attr->modify_action.data = action->modify_header.single_action;
attr->action_type = mlx5dr_action_get_mh_stc_type(attr->modify_action.data);
@@ -1474,6 +1476,8 @@ mlx5dr_action_handle_tunnel_l3_to_l2(struct mlx5dr_action *action,
action[i].modify_header.num_of_actions = num_of_actions;
action[i].modify_header.arg_obj = arg_obj;
action[i].modify_header.pat_obj = pat_obj;
+ action[i].modify_header.require_reparse =
+ mlx5dr_pat_require_reparse((__be64 *)mh_data, num_of_actions);
ret = mlx5dr_action_create_stcs(&action[i], NULL);
if (ret) {
@@ -1620,7 +1624,7 @@ mlx5dr_action_create_modify_header_hws(struct mlx5dr_action *action,
{
struct mlx5dr_devx_obj *pat_obj, *arg_obj = NULL;
struct mlx5dr_context *ctx = action->ctx;
- uint16_t max_mh_actions = 0;
+ uint16_t num_actions, max_mh_actions = 0;
int i, ret;
/* Calculate maximum number of mh actions for shared arg allocation */
@@ -1646,11 +1650,14 @@ mlx5dr_action_create_modify_header_hws(struct mlx5dr_action *action,
goto free_stc_and_pat;
}
+ num_actions = pattern[i].sz / MLX5DR_MODIFY_ACTION_SIZE;
action[i].modify_header.num_of_patterns = num_of_patterns;
action[i].modify_header.max_num_of_actions = max_mh_actions;
- action[i].modify_header.num_of_actions = pattern[i].sz / MLX5DR_MODIFY_ACTION_SIZE;
+ action[i].modify_header.num_of_actions = num_actions;
+ action[i].modify_header.require_reparse =
+ mlx5dr_pat_require_reparse(pattern[i].data, num_actions);
- if (action[i].modify_header.num_of_actions == 1) {
+ if (num_actions == 1) {
pat_obj = NULL;
/* Optimize single modify action to be used inline */
action[i].modify_header.single_action = pattern[i].data[0];
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.h b/drivers/net/mlx5/hws/mlx5dr_action.h
index 4bd3d3b26b..7e5063b57e 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.h
+++ b/drivers/net/mlx5/hws/mlx5dr_action.h
@@ -127,6 +127,7 @@ struct mlx5dr_action {
uint8_t single_action_type;
uint8_t num_of_actions;
uint8_t max_num_of_actions;
+ uint8_t require_reparse;
} modify_header;
struct {
struct mlx5dr_devx_obj *arg_obj;
diff --git a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
index 349d77f296..a949844d24 100644
--- a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
+++ b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
@@ -37,6 +37,43 @@ uint32_t mlx5dr_arg_get_arg_size(uint16_t num_of_actions)
return BIT(mlx5dr_arg_get_arg_log_size(num_of_actions));
}
+bool mlx5dr_pat_require_reparse(__be64 *actions, uint16_t num_of_actions)
+{
+ uint16_t i, field;
+ uint8_t action_id;
+
+ for (i = 0; i < num_of_actions; i++) {
+ action_id = MLX5_GET(set_action_in, &actions[i], action_type);
+
+ switch (action_id) {
+ case MLX5_MODIFICATION_TYPE_NOP:
+ field = MLX5_MODI_OUT_NONE;
+ break;
+
+ case MLX5_MODIFICATION_TYPE_SET:
+ case MLX5_MODIFICATION_TYPE_ADD:
+ field = MLX5_GET(set_action_in, &actions[i], field);
+ break;
+
+ case MLX5_MODIFICATION_TYPE_COPY:
+ case MLX5_MODIFICATION_TYPE_ADD_FIELD:
+ field = MLX5_GET(copy_action_in, &actions[i], dst_field);
+ break;
+
+ default:
+ /* Insert/Remove/Unknown actions require reparse */
+ return true;
+ }
+
+ /* Below fields can change packet structure require a reparse */
+ if (field == MLX5_MODI_OUT_ETHERTYPE ||
+ field == MLX5_MODI_OUT_IPV6_NEXT_HDR)
+ return true;
+ }
+
+ return false;
+}
+
/* Cache and cache element handling */
int mlx5dr_pat_init_pattern_cache(struct mlx5dr_pattern_cache **cache)
{
@@ -228,8 +265,8 @@ mlx5dr_pat_get_pattern(struct mlx5dr_context *ctx,
}
pat_obj = mlx5dr_cmd_header_modify_pattern_create(ctx->ibv_ctx,
- pattern_sz,
- (uint8_t *)pattern);
+ pattern_sz,
+ (uint8_t *)pattern);
if (!pat_obj) {
DR_LOG(ERR, "Failed to create pattern FW object");
goto out_unlock;
diff --git a/drivers/net/mlx5/hws/mlx5dr_pat_arg.h b/drivers/net/mlx5/hws/mlx5dr_pat_arg.h
index 2a38891c4d..bbe313102f 100644
--- a/drivers/net/mlx5/hws/mlx5dr_pat_arg.h
+++ b/drivers/net/mlx5/hws/mlx5dr_pat_arg.h
@@ -79,6 +79,8 @@ void mlx5dr_pat_put_pattern(struct mlx5dr_context *ctx,
bool mlx5dr_arg_is_valid_arg_request_size(struct mlx5dr_context *ctx,
uint32_t arg_size);
+bool mlx5dr_pat_require_reparse(__be64 *actions, uint16_t num_of_actions);
+
void mlx5dr_arg_write(struct mlx5dr_send_engine *queue,
void *comp_data,
uint32_t arg_idx,
--
2.27.0
next prev parent reply other threads:[~2023-11-01 4:45 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-17 9:25 [PATCH v1 0/8] add IPv6 extension push remove Rongwei Liu
2023-04-17 9:25 ` [PATCH v1 1/8] ethdev: add IPv6 extension push remove action Rongwei Liu
2023-05-24 6:55 ` Ori Kam
2023-05-24 7:39 ` [PATCH v1 0/2] add IPv6 extension push remove Rongwei Liu
2023-05-24 7:39 ` [PATCH v1 1/2] ethdev: add IPv6 extension push remove action Rongwei Liu
2023-05-24 10:30 ` Ori Kam
2023-05-24 7:39 ` [PATCH v1 2/2] app/testpmd: add IPv6 extension push remove cli Rongwei Liu
2023-06-02 14:39 ` [PATCH v1 0/2] add IPv6 extension push remove Ferruh Yigit
2023-07-10 2:32 ` Rongwei Liu
2023-07-10 8:55 ` Ferruh Yigit
2023-07-10 14:41 ` Stephen Hemminger
2023-07-11 6:16 ` Thomas Monjalon
2023-09-19 8:12 ` [PATCH v3] net/mlx5: add test for live migration Rongwei Liu
2023-10-16 8:19 ` Thomas Monjalon
2023-10-16 8:25 ` Rongwei Liu
2023-10-16 9:26 ` Rongwei Liu
2023-10-16 9:26 ` Thomas Monjalon
2023-10-16 9:29 ` Rongwei Liu
2023-10-25 9:07 ` Rongwei Liu
2023-10-16 9:22 ` [PATCH v4] " Rongwei Liu
2023-10-25 9:36 ` [PATCH v5] " Rongwei Liu
2023-10-25 9:41 ` Thomas Monjalon
2023-10-25 9:45 ` [PATCH v6] " Rongwei Liu
2023-10-25 9:48 ` [PATCH v5] " Rongwei Liu
2023-10-25 9:50 ` [PATCH v7] " Rongwei Liu
2023-10-25 13:10 ` Thomas Monjalon
2023-10-26 8:15 ` Raslan Darawsheh
2023-04-17 9:25 ` [PATCH v1 2/8] app/testpmd: add IPv6 extension push remove cli Rongwei Liu
2023-05-24 7:06 ` Ori Kam
2023-04-17 9:25 ` [PATCH v1 3/8] net/mlx5/hws: add no reparse support Rongwei Liu
2023-04-17 9:25 ` [PATCH v1 4/8] net/mlx5: sample the srv6 last segment Rongwei Liu
2023-10-31 9:42 ` [PATCH v2 0/6] support IPv6 extension push remove Rongwei Liu
2023-10-31 9:42 ` [PATCH v2 1/6] net/mlx5: sample the srv6 last segment Rongwei Liu
2023-10-31 9:42 ` [PATCH v2 2/6] net/mlx5/hws: fix potential wrong errno value Rongwei Liu
2023-10-31 9:42 ` [PATCH v2 3/6] net/mlx5/hws: add IPv6 routing extension push remove actions Rongwei Liu
2023-10-31 9:42 ` [PATCH v2 4/6] net/mlx5/hws: add setter for IPv6 routing push remove Rongwei Liu
2023-10-31 9:42 ` [PATCH v2 5/6] net/mlx5: implement " Rongwei Liu
2023-10-31 9:42 ` [PATCH v2 6/6] net/mlx5/hws: add stc reparse support for srv6 push pop Rongwei Liu
2023-10-31 10:51 ` [PATCH v3 0/6] support IPv6 extension push remove Rongwei Liu
2023-10-31 10:51 ` [PATCH v3 1/6] net/mlx5: sample the srv6 last segment Rongwei Liu
2023-10-31 10:51 ` [PATCH v3 2/6] net/mlx5/hws: fix potential wrong errno value Rongwei Liu
2023-10-31 10:51 ` [PATCH v3 3/6] net/mlx5/hws: add IPv6 routing extension push remove actions Rongwei Liu
2023-10-31 10:51 ` [PATCH v3 4/6] net/mlx5/hws: add setter for IPv6 routing push remove Rongwei Liu
2023-10-31 10:51 ` [PATCH v3 5/6] net/mlx5: implement " Rongwei Liu
2023-10-31 10:51 ` [PATCH v3 6/6] net/mlx5/hws: add stc reparse support for srv6 push pop Rongwei Liu
2023-11-01 4:44 ` [PATCH v4 00/13] support IPv6 push remove action Rongwei Liu
2023-11-01 4:44 ` [PATCH v4 01/13] net/mlx5/hws: support insert header action Rongwei Liu
2023-11-01 4:44 ` [PATCH v4 02/13] net/mlx5/hws: support remove " Rongwei Liu
2023-11-01 4:44 ` [PATCH v4 03/13] net/mlx5/hws: allow jump to TIR over FDB Rongwei Liu
2023-11-01 4:44 ` [PATCH v4 04/13] net/mlx5/hws: support dynamic re-parse Rongwei Liu
2023-11-01 4:44 ` Rongwei Liu [this message]
2023-11-01 4:44 ` [PATCH v4 06/13] net/mlx5/hws: fix incorrect re-parse on complex rules Rongwei Liu
2023-11-01 4:44 ` [PATCH v4 07/13] net/mlx5: sample the srv6 last segment Rongwei Liu
2023-11-01 4:44 ` [PATCH v4 08/13] net/mlx5/hws: fix potential wrong rte_errno value Rongwei Liu
2023-11-01 4:44 ` [PATCH v4 09/13] net/mlx5/hws: add IPv6 routing extension push remove actions Rongwei Liu
2023-11-01 4:44 ` [PATCH v4 10/13] net/mlx5/hws: add setter for IPv6 routing push remove Rongwei Liu
2023-11-01 4:44 ` [PATCH v4 11/13] net/mlx5: implement " Rongwei Liu
2023-11-01 4:44 ` [PATCH v4 12/13] net/mlx5/hws: fix srv6 push compilation failure Rongwei Liu
2023-11-01 4:44 ` [PATCH v4 13/13] net/mlx5/hws: add stc reparse support for srv6 push pop Rongwei Liu
2023-11-02 13:44 ` [PATCH v4 00/13] support IPv6 push remove action Raslan Darawsheh
2023-04-17 9:25 ` [PATCH v1 5/8] net/mlx5: generate srv6 modify header resource Rongwei Liu
2023-04-17 9:25 ` [PATCH v1 6/8] net/mlx5/hws: add IPv6 routing extension push pop actions Rongwei Liu
2023-04-17 9:25 ` [PATCH v1 7/8] net/mlx5/hws: add setter for IPv6 routing push pop Rongwei Liu
2023-04-17 9:25 ` [PATCH v1 8/8] net/mlx5: implement " Rongwei Liu
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=20231101044419.732726-6-rongweil@nvidia.com \
--to=rongweil@nvidia.com \
--cc=dev@dpdk.org \
--cc=erezsh@nvidia.com \
--cc=matan@nvidia.com \
--cc=orika@nvidia.com \
--cc=suanmingm@nvidia.com \
--cc=thomas@monjalon.net \
--cc=valex@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).