[v2,09/10] net/mlx5/hws: support push_esp flag for insert header action
Checks
Commit Message
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(-)
@@ -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];
@@ -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 {
@@ -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;
@@ -149,6 +149,7 @@ struct mlx5dr_action {
uint8_t offset;
bool encap;
uint8_t require_reparse;
+ bool push_esp;
} reformat;
struct {
struct mlx5dr_action
@@ -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,
@@ -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;