net/mlx5: HWS, remove the use of duplicated structs
authorYevgeny Kliteynik <kliteyn@nvidia.com>
Thu, 2 Jan 2025 18:14:00 +0000 (20:14 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 7 Jan 2025 00:33:39 +0000 (16:33 -0800)
Remove definition in HWS of structs that are already defined
in mlx5_ifc.h, and fix the usage of these structs.

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: Itamar Gozlan <igozlan@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20250102181415.1477316-2-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/cmd.c
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/prm.h

index c00c138..13689c0 100644 (file)
@@ -622,12 +622,12 @@ int mlx5hws_cmd_arg_create(struct mlx5_core_dev *mdev,
                           u32 pd,
                           u32 *arg_id)
 {
+       u32 in[MLX5_ST_SZ_DW(create_modify_header_arg_in)] = {0};
        u32 out[MLX5_ST_SZ_DW(general_obj_out_cmd_hdr)] = {0};
-       u32 in[MLX5_ST_SZ_DW(create_arg_in)] = {0};
        void *attr;
        int ret;
 
-       attr = MLX5_ADDR_OF(create_arg_in, in, hdr);
+       attr = MLX5_ADDR_OF(create_modify_header_arg_in, in, hdr);
        MLX5_SET(general_obj_in_cmd_hdr,
                 attr, opcode, MLX5_CMD_OP_CREATE_GENERAL_OBJECT);
        MLX5_SET(general_obj_in_cmd_hdr,
@@ -635,8 +635,8 @@ int mlx5hws_cmd_arg_create(struct mlx5_core_dev *mdev,
        MLX5_SET(general_obj_in_cmd_hdr,
                 attr, op_param.create.log_obj_range, log_obj_range);
 
-       attr = MLX5_ADDR_OF(create_arg_in, in, arg);
-       MLX5_SET(arg, attr, access_pd, pd);
+       attr = MLX5_ADDR_OF(create_modify_header_arg_in, in, arg);
+       MLX5_SET(modify_header_arg, attr, access_pd, pd);
 
        ret = mlx5_cmd_exec(mdev, in, sizeof(in), out, sizeof(out));
        if (ret) {
@@ -812,7 +812,7 @@ int mlx5hws_cmd_packet_reformat_create(struct mlx5_core_dev *mdev,
                                       struct mlx5hws_cmd_packet_reformat_create_attr *attr,
                                       u32 *reformat_id)
 {
-       u32 out[MLX5_ST_SZ_DW(alloc_packet_reformat_out)] = {0};
+       u32 out[MLX5_ST_SZ_DW(alloc_packet_reformat_context_out)] = {0};
        size_t insz, cmd_data_sz, cmd_total_sz;
        void *prctx;
        void *pdata;
@@ -845,7 +845,7 @@ int mlx5hws_cmd_packet_reformat_create(struct mlx5_core_dev *mdev,
                goto out;
        }
 
-       *reformat_id = MLX5_GET(alloc_packet_reformat_out, out, packet_reformat_id);
+       *reformat_id = MLX5_GET(alloc_packet_reformat_context_out, out, packet_reformat_id);
 out:
        kfree(in);
        return ret;
@@ -854,13 +854,13 @@ out:
 int mlx5hws_cmd_packet_reformat_destroy(struct mlx5_core_dev *mdev,
                                        u32 reformat_id)
 {
-       u32 out[MLX5_ST_SZ_DW(dealloc_packet_reformat_out)] = {0};
-       u32 in[MLX5_ST_SZ_DW(dealloc_packet_reformat_in)] = {0};
+       u32 out[MLX5_ST_SZ_DW(dealloc_packet_reformat_context_out)] = {0};
+       u32 in[MLX5_ST_SZ_DW(dealloc_packet_reformat_context_in)] = {0};
        int ret;
 
-       MLX5_SET(dealloc_packet_reformat_in, in, opcode,
+       MLX5_SET(dealloc_packet_reformat_context_in, in, opcode,
                 MLX5_CMD_OP_DEALLOC_PACKET_REFORMAT_CONTEXT);
-       MLX5_SET(dealloc_packet_reformat_in, in,
+       MLX5_SET(dealloc_packet_reformat_context_in, in,
                 packet_reformat_id, reformat_id);
 
        ret = mlx5_cmd_exec(mdev, in, sizeof(in), out, sizeof(out));
index de92cec..271490a 100644 (file)
@@ -390,11 +390,6 @@ struct mlx5_ifc_definer_bits {
        u8 match_mask[0x160];
 };
 
-struct mlx5_ifc_arg_bits {
-       u8 rsvd0[0x88];
-       u8 access_pd[0x18];
-};
-
 struct mlx5_ifc_header_modify_pattern_in_bits {
        u8 modify_field_select[0x40];
 
@@ -428,11 +423,6 @@ struct mlx5_ifc_create_definer_in_bits {
        struct mlx5_ifc_definer_bits definer;
 };
 
-struct mlx5_ifc_create_arg_in_bits {
-       struct mlx5_ifc_general_obj_in_cmd_hdr_bits hdr;
-       struct mlx5_ifc_arg_bits arg;
-};
-
 struct mlx5_ifc_create_header_modify_pattern_in_bits {
        struct mlx5_ifc_general_obj_in_cmd_hdr_bits hdr;
        struct mlx5_ifc_header_modify_pattern_in_bits pattern;
@@ -479,36 +469,4 @@ enum {
        MLX5_IFC_MODIFY_FLOW_TABLE_MISS_ACTION_GOTO_TBL = 1,
 };
 
-struct mlx5_ifc_alloc_packet_reformat_out_bits {
-       u8 status[0x8];
-       u8 reserved_at_8[0x18];
-
-       u8 syndrome[0x20];
-
-       u8 packet_reformat_id[0x20];
-
-       u8 reserved_at_60[0x20];
-};
-
-struct mlx5_ifc_dealloc_packet_reformat_in_bits {
-       u8 opcode[0x10];
-       u8 reserved_at_10[0x10];
-
-       u8 reserved_at_20[0x10];
-       u8 op_mod[0x10];
-
-       u8 packet_reformat_id[0x20];
-
-       u8 reserved_at_60[0x20];
-};
-
-struct mlx5_ifc_dealloc_packet_reformat_out_bits {
-       u8 status[0x8];
-       u8 reserved_at_8[0x18];
-
-       u8 syndrome[0x20];
-
-       u8 reserved_at_40[0x40];
-};
-
 #endif /* MLX5_PRM_H_ */