DPDK patches and discussions
 help / color / mirror / Atom feed
From: Itamar Gozlan <igozlan@nvidia.com>
To: <igozlan@nvidia.com>, <erezsh@nvidia.com>, <hamdani@nvidia.com>,
	<kliteyn@nvidia.com>, <viacheslavo@nvidia.com>,
	<thomas@monjalon.net>, <suanmingm@nvidia.com>,
	Dariusz Sosnowski <dsosnowski@nvidia.com>,
	Ori Kam <orika@nvidia.com>, Matan Azrad <matan@nvidia.com>
Cc: <dev@dpdk.org>
Subject: [v2 09/10] net/mlx5/hws: support push_esp flag for insert header action
Date: Sun, 18 Feb 2024 07:11:23 +0200	[thread overview]
Message-ID: <20240218051125.717011-9-igozlan@nvidia.com> (raw)
In-Reply-To: <20240218051125.717011-1-igozlan@nvidia.com>

From: Hamdan Igbaria <hamdani@nvidia.com>

support push_esp flag for insert header action, it must be set when
inserting an ESP header, it's also sets the next_protocol field in
the IPsec trailer.

Signed-off-by: Hamdan Igbaria <hamdani@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/common/mlx5/mlx5_prm.h       | 3 ++-
 drivers/net/mlx5/hws/mlx5dr.h        | 4 ++++
 drivers/net/mlx5/hws/mlx5dr_action.c | 4 ++++
 drivers/net/mlx5/hws/mlx5dr_action.h | 1 +
 drivers/net/mlx5/hws/mlx5dr_cmd.c    | 2 ++
 drivers/net/mlx5/hws/mlx5dr_cmd.h    | 1 +
 6 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index 787211c85c..282e59e52c 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -3616,7 +3616,8 @@ struct mlx5_ifc_stc_ste_param_insert_bits {
 	u8 action_type[0x4];
 	u8 encap[0x1];
 	u8 inline_data[0x1];
-	u8 reserved_at_6[0x4];
+	u8 push_esp[0x1];
+	u8 reserved_at_7[0x3];
 	u8 insert_anchor[0x6];
 	u8 reserved_at_10[0x1];
 	u8 insert_offset[0x7];
diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index 3647e25cf2..d612f300c6 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -192,6 +192,10 @@ struct mlx5dr_action_insert_header {
 	 * requiring device to update offloaded fields (for example IPv4 total length).
 	 */
 	bool encap;
+	/* It must be set when adding ESP header.
+	 * It's also sets the next_protocol value in the ipsec trailer.
+	 */
+	bool push_esp;
 };
 
 enum mlx5dr_action_remove_header_type {
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 8589de5557..f55069c675 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -598,6 +598,7 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
 		attr->action_type = MLX5_IFC_STC_ACTION_TYPE_HEADER_INSERT;
 		attr->action_offset = MLX5DR_ACTION_OFFSET_DW6;
 		attr->insert_header.encap = action->reformat.encap;
+		attr->insert_header.push_esp = action->reformat.push_esp;
 		attr->insert_header.insert_anchor = action->reformat.anchor;
 		attr->insert_header.arg_id = action->reformat.arg_obj->id;
 		attr->insert_header.header_size = action->reformat.header_size;
@@ -635,6 +636,7 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
 		attr->action_offset = MLX5DR_ACTION_OFFSET_DW6;
 		attr->reparse_mode = MLX5_IFC_STC_REPARSE_ALWAYS;
 		attr->insert_header.encap = 0;
+		attr->insert_header.push_esp = 0;
 		attr->insert_header.is_inline = 1;
 		attr->insert_header.insert_anchor = MLX5_HEADER_ANCHOR_PACKET_START;
 		attr->insert_header.insert_offset = MLX5DR_ACTION_HDR_LEN_L2_MACS;
@@ -1340,6 +1342,7 @@ mlx5dr_action_handle_insert_with_ptr(struct mlx5dr_action *action,
 			action[i].reformat.anchor = MLX5_HEADER_ANCHOR_PACKET_START;
 			action[i].reformat.offset = 0;
 			action[i].reformat.encap = 1;
+			action[i].reformat.push_esp = 0;
 		}
 
 		if (likely(reparse == MLX5DR_ACTION_STC_REPARSE_DEFAULT))
@@ -2087,6 +2090,7 @@ mlx5dr_action_create_insert_header_reparse(struct mlx5dr_context *ctx,
 
 		action[i].reformat.anchor = hdrs[i].anchor;
 		action[i].reformat.encap = hdrs[i].encap;
+		action[i].reformat.push_esp = hdrs[i].push_esp;
 		action[i].reformat.offset = hdrs[i].offset;
 		reformat_hdrs[i].sz = hdrs[i].hdr.sz;
 		reformat_hdrs[i].data = hdrs[i].hdr.data;
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.h b/drivers/net/mlx5/hws/mlx5dr_action.h
index a8d9720c42..0c8e4bbb5a 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.h
+++ b/drivers/net/mlx5/hws/mlx5dr_action.h
@@ -149,6 +149,7 @@ struct mlx5dr_action {
 					uint8_t offset;
 					bool encap;
 					uint8_t require_reparse;
+					bool push_esp;
 				} reformat;
 				struct {
 					struct mlx5dr_action
diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c
index f77b194708..4676f65d60 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.c
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c
@@ -486,6 +486,8 @@ mlx5dr_cmd_stc_modify_set_stc_param(struct mlx5dr_cmd_stc_modify_attr *stc_attr,
 			 MLX5_MODIFICATION_TYPE_INSERT);
 		MLX5_SET(stc_ste_param_insert, stc_parm, encap,
 			 stc_attr->insert_header.encap);
+		MLX5_SET(stc_ste_param_insert, stc_parm, push_esp,
+			 stc_attr->insert_header.push_esp);
 		MLX5_SET(stc_ste_param_insert, stc_parm, inline_data,
 			 stc_attr->insert_header.is_inline);
 		MLX5_SET(stc_ste_param_insert, stc_parm, insert_anchor,
diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.h b/drivers/net/mlx5/hws/mlx5dr_cmd.h
index 694231e08f..ee4a61b7eb 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.h
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.h
@@ -122,6 +122,7 @@ struct mlx5dr_cmd_stc_modify_attr {
 			uint8_t encap;
 			uint16_t insert_anchor;
 			uint16_t insert_offset;
+			uint8_t push_esp;
 		} insert_header;
 		struct {
 			uint8_t aso_type;
-- 
2.39.3


  parent reply	other threads:[~2024-02-18  5:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13  9:50 [PATCH 1/9] net/mlx5/hws: skip RTE item when inserting rules by index Itamar Gozlan
2024-02-13  9:50 ` [PATCH 2/9] net/mlx5/hws: add check for not supported fields in VXLAN Itamar Gozlan
2024-02-13  9:50 ` [PATCH 3/9] net/mlx5/hws: add support for resizable matchers Itamar Gozlan
2024-02-13  9:50 ` [PATCH 4/9] net/mlx5/hws: reordering the STE fields to improve hash Itamar Gozlan
2024-02-13  9:50 ` [PATCH 5/9] net/mlx5/hws: check the rule status on rule update Itamar Gozlan
2024-02-13  9:50 ` [PATCH 6/9] net/mlx5/hws: fix VLAN item handling on non relaxed mode Itamar Gozlan
2024-02-13  9:50 ` [PATCH 7/9] net/mlx5/hws: extend action template creation API Itamar Gozlan
2024-02-13  9:50 ` [PATCH 8/9] net/mlx5/hws: add missing actions STE limitation Itamar Gozlan
2024-02-13  9:50 ` [PATCH 9/9] net/mlx5/hws: support push_esp flag for insert header action Itamar Gozlan
2024-02-18  5:11   ` [v2 01/10] net/mlx5/hws: skip RTE item when inserting rules by index Itamar Gozlan
2024-02-18  5:11     ` [v2 02/10] net/mlx5/hws: add check for not supported fields in VXLAN Itamar Gozlan
2024-02-18  5:11     ` [v2 03/10] net/mlx5/hws: add support for resizable matchers Itamar Gozlan
2024-02-18  5:11     ` [v2 04/10] net/mlx5/hws: reordering the STE fields to improve hash Itamar Gozlan
2024-02-18  5:11     ` [v2 05/10] net/mlx5/hws: check the rule status on rule update Itamar Gozlan
2024-02-18  5:11     ` [v2 06/10] net/mlx5/hws: fix VLAN item handling on non relaxed mode Itamar Gozlan
2024-02-18  5:11     ` [v2 07/10] net/mlx5/hws: extend action template creation API Itamar Gozlan
2024-02-18  5:11     ` [v2 08/10] net/mlx5/hws: add missing actions STE limitation Itamar Gozlan
2024-02-18  5:11     ` Itamar Gozlan [this message]
2024-02-18  5:11     ` [v2 10/10] net/mlx5/hws: typo fix parm to param Itamar Gozlan
2024-02-26 10:16     ` [v2 01/10] net/mlx5/hws: skip RTE item when inserting rules by index 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=20240218051125.717011-9-igozlan@nvidia.com \
    --to=igozlan@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=erezsh@nvidia.com \
    --cc=hamdani@nvidia.com \
    --cc=kliteyn@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=suanmingm@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).