From: Rongwei Liu <rongweil@nvidia.com>
To: <dev@dpdk.org>, <matan@nvidia.com>, <viacheslavo@nvidia.com>,
<orika@nvidia.com>, <thomas@monjalon.net>
Subject: [PATCH v1 7/8] net/mlx5/hws: add setter for IPv6 routing push pop
Date: Mon, 17 Apr 2023 12:25:39 +0300 [thread overview]
Message-ID: <20230417092540.2617450-8-rongweil@nvidia.com> (raw)
In-Reply-To: <20230417092540.2617450-1-rongweil@nvidia.com>
The rte action will be translated to 3 dr_actions which need
3 setters to program them.
For each setter, it may have different reparsing properties.
Setter which requires no reparse can't share the same one with
the one has reparse enabled even if there is spare space.
Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr_action.c | 144 +++++++++++++++++++++++++++
1 file changed, 144 insertions(+)
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index fa38654644..9f2386479a 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -2318,6 +2318,57 @@ mlx5dr_action_setter_modify_header(struct mlx5dr_actions_apply_data *apply,
}
}
+static void
+mlx5dr_action_setter_ipv6_routing_pop1(struct mlx5dr_actions_apply_data *apply,
+ struct mlx5dr_actions_wqe_setter *setter)
+{
+ struct mlx5dr_rule_action *rule_action;
+ struct mlx5dr_action *action;
+
+ rule_action = &apply->rule_action[setter->idx_double];
+ action = rule_action->action;
+ MLX5_ASSERT(action->type == MLX5DR_ACTION_TYP_IPV6_ROUTING_POP);
+ rule_action->action = action->recom.action1;
+ MLX5_ASSERT(rule_action->action->flags & MLX5DR_ACTION_FLAG_SHARED);
+ MLX5_ASSERT(rule_action->action->type == MLX5DR_ACTION_TYP_MODIFY_HDR);
+ mlx5dr_action_setter_modify_header(apply, setter);
+ rule_action->action = action;
+}
+
+static void
+mlx5dr_action_setter_ipv6_routing_pop2(struct mlx5dr_actions_apply_data *apply,
+ struct mlx5dr_actions_wqe_setter *setter)
+{
+ struct mlx5dr_rule_action *rule_action;
+ struct mlx5dr_action *action;
+
+ rule_action = &apply->rule_action[setter->idx_double];
+ action = rule_action->action;
+ MLX5_ASSERT(action->type == MLX5DR_ACTION_TYP_IPV6_ROUTING_POP);
+ rule_action->action = action->recom.action2;
+ MLX5_ASSERT(rule_action->action->flags & MLX5DR_ACTION_FLAG_SHARED);
+ MLX5_ASSERT(rule_action->action->type == MLX5DR_ACTION_TYP_MODIFY_HDR);
+ mlx5dr_action_setter_modify_header(apply, setter);
+ rule_action->action = action;
+}
+
+static void
+mlx5dr_action_setter_ipv6_routing_pop3(struct mlx5dr_actions_apply_data *apply,
+ struct mlx5dr_actions_wqe_setter *setter)
+{
+ struct mlx5dr_rule_action *rule_action;
+ struct mlx5dr_action *action;
+
+ rule_action = &apply->rule_action[setter->idx_double];
+ action = rule_action->action;
+ MLX5_ASSERT(action->type == MLX5DR_ACTION_TYP_IPV6_ROUTING_POP);
+ rule_action->action = action->recom.action3;
+ MLX5_ASSERT(rule_action->action->flags & MLX5DR_ACTION_FLAG_SHARED);
+ MLX5_ASSERT(rule_action->action->type == MLX5DR_ACTION_TYP_IPV6_ROUTING_POP);
+ mlx5dr_action_setter_modify_header(apply, setter);
+ rule_action->action = action;
+}
+
static void
mlx5dr_action_setter_insert_ptr(struct mlx5dr_actions_apply_data *apply,
struct mlx5dr_actions_wqe_setter *setter)
@@ -2346,6 +2397,60 @@ mlx5dr_action_setter_insert_ptr(struct mlx5dr_actions_apply_data *apply,
}
}
+static void
+mlx5dr_action_setter_ipv6_routing_push1(struct mlx5dr_actions_apply_data *apply,
+ struct mlx5dr_actions_wqe_setter *setter)
+{
+ struct mlx5dr_rule_action *rule_action;
+ struct mlx5dr_rule_action tmp;
+
+ rule_action = &apply->rule_action[setter->idx_double];
+ tmp = *rule_action;
+ MLX5_ASSERT(rule_action->action->type == MLX5DR_ACTION_TYP_IPV6_ROUTING_PUSH);
+ rule_action->action = tmp.action->recom.action1;
+ MLX5_ASSERT(rule_action->action->type == MLX5DR_ACTION_TYP_IPV6_ROUTING_PUSH);
+ rule_action->reformat.offset = tmp.recom.offset;
+ rule_action->reformat.data = tmp.recom.data;
+ mlx5dr_action_setter_insert_ptr(apply, setter);
+ *rule_action = tmp;
+}
+
+static void
+mlx5dr_action_setter_ipv6_routing_push2(struct mlx5dr_actions_apply_data *apply,
+ struct mlx5dr_actions_wqe_setter *setter)
+{
+ struct mlx5dr_rule_action *rule_action;
+ struct mlx5dr_action *action;
+
+ rule_action = &apply->rule_action[setter->idx_double];
+ action = rule_action->action;
+ MLX5_ASSERT(action->type == MLX5DR_ACTION_TYP_IPV6_ROUTING_PUSH);
+ rule_action->action = action->recom.action2;
+ MLX5_ASSERT(rule_action->action->flags & MLX5DR_ACTION_FLAG_SHARED);
+ MLX5_ASSERT(rule_action->action->type == MLX5DR_ACTION_TYP_MODIFY_HDR);
+ mlx5dr_action_setter_modify_header(apply, setter);
+ rule_action->action = action;
+}
+
+static void
+mlx5dr_action_setter_ipv6_routing_push3(struct mlx5dr_actions_apply_data *apply,
+ struct mlx5dr_actions_wqe_setter *setter)
+{
+ struct mlx5dr_rule_action *rule_action;
+ struct mlx5dr_rule_action tmp;
+
+ rule_action = &apply->rule_action[setter->idx_double];
+ tmp = *rule_action;
+ MLX5_ASSERT(rule_action->action->type == MLX5DR_ACTION_TYP_IPV6_ROUTING_PUSH);
+ rule_action->action = tmp.action->recom.action3;
+ MLX5_ASSERT(rule_action->action->type == MLX5DR_ACTION_TYP_MODIFY_HDR);
+ rule_action->modify_header.offset = tmp.recom.offset;
+ rule_action->modify_header.data = tmp.recom.mhdr;
+ MLX5_ASSERT(rule_action->action->modify_header.num_of_actions > 1);
+ mlx5dr_action_setter_modify_header(apply, setter);
+ *rule_action = tmp;
+}
+
static void
mlx5dr_action_setter_tnl_l3_to_l2(struct mlx5dr_actions_apply_data *apply,
struct mlx5dr_actions_wqe_setter *setter)
@@ -2553,6 +2658,45 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
setter->idx_double = i;
break;
+ case MLX5DR_ACTION_TYP_IPV6_ROUTING_POP:
+ /* Double internal modify header list */
+ setter = mlx5dr_action_setter_find_first(last_setter,
+ ASF_DOUBLE | ASF_REMOVE);
+ setter->flags |= ASF_DOUBLE | ASF_MODIFY | ASF_REPARSE;
+ setter->set_double = &mlx5dr_action_setter_ipv6_routing_pop1;
+ setter->idx_double = i;
+ setter++;
+ setter->flags |= ASF_DOUBLE | ASF_MODIFY | ASF_REPARSE;
+ setter->set_double = &mlx5dr_action_setter_ipv6_routing_pop2;
+ setter->idx_double = i;
+ setter++;
+ /* restore IPv6 protocol + pop via modify list. */
+ setter->flags |= ASF_DOUBLE | ASF_MODIFY | ASF_REPARSE;
+ setter->set_double = &mlx5dr_action_setter_ipv6_routing_pop3;
+ setter->idx_double = i;
+ break;
+
+ case MLX5DR_ACTION_TYP_IPV6_ROUTING_PUSH:
+ /* Double insert header with pointer */
+ setter = mlx5dr_action_setter_find_first(last_setter, ASF_DOUBLE);
+ /* Can't squeeze with reparsing setter */
+ if (setter->flags & ASF_REPARSE)
+ setter++;
+ setter->flags |= ASF_DOUBLE;
+ setter->set_double = &mlx5dr_action_setter_ipv6_routing_push1;
+ setter->idx_double = i;
+ setter++;
+ /* Set IPv6 protocol to 0x2b */
+ setter->flags |= ASF_DOUBLE | ASF_MODIFY | ASF_REPARSE;
+ setter->set_double = &mlx5dr_action_setter_ipv6_routing_push2;
+ setter->idx_double = i;
+ setter++;
+ /* Load next hop IPv6 address and restore srv6.next_hdr */
+ setter->flags |= ASF_DOUBLE | ASF_MODIFY | ASF_REPARSE;
+ setter->set_double = &mlx5dr_action_setter_ipv6_routing_push3;
+ setter->idx_double = i;
+ break;
+
case MLX5DR_ACTION_TYP_MODIFY_HDR:
/* Double modify header list */
setter = mlx5dr_action_setter_find_first(last_setter, ASF_DOUBLE | ASF_REMOVE);
--
2.27.0
next prev parent reply other threads:[~2023-04-17 9:26 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 ` [PATCH v4 05/13] net/mlx5/hws: dynamic re-parse for modify header Rongwei Liu
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 ` Rongwei Liu [this message]
2023-04-17 9:25 ` [PATCH v1 8/8] net/mlx5: implement IPv6 routing push pop 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=20230417092540.2617450-8-rongweil@nvidia.com \
--to=rongweil@nvidia.com \
--cc=dev@dpdk.org \
--cc=matan@nvidia.com \
--cc=orika@nvidia.com \
--cc=thomas@monjalon.net \
--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).