OSDN Git Service

net/mlx5: Update rl.c new cmd interface
authorLeon Romanovsky <leonro@mellanox.com>
Thu, 9 Apr 2020 14:05:31 +0000 (17:05 +0300)
committerLeon Romanovsky <leonro@mellanox.com>
Thu, 23 Apr 2020 18:42:14 +0000 (21:42 +0300)
Do mass update of rl.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/rl.c

index c9599f7..99039c4 100644 (file)
@@ -39,8 +39,8 @@
 int mlx5_create_scheduling_element_cmd(struct mlx5_core_dev *dev, u8 hierarchy,
                                       void *ctx, u32 *element_id)
 {
-       u32 in[MLX5_ST_SZ_DW(create_scheduling_element_in)]  = {0};
-       u32 out[MLX5_ST_SZ_DW(create_scheduling_element_in)] = {0};
+       u32 out[MLX5_ST_SZ_DW(create_scheduling_element_in)] = {};
+       u32 in[MLX5_ST_SZ_DW(create_scheduling_element_in)] = {};
        void *schedc;
        int err;
 
@@ -52,7 +52,7 @@ int mlx5_create_scheduling_element_cmd(struct mlx5_core_dev *dev, u8 hierarchy,
                 hierarchy);
        memcpy(schedc, ctx, MLX5_ST_SZ_BYTES(scheduling_context));
 
-       err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
+       err = mlx5_cmd_exec_inout(dev, create_scheduling_element, in, out);
        if (err)
                return err;
 
@@ -65,8 +65,7 @@ int mlx5_modify_scheduling_element_cmd(struct mlx5_core_dev *dev, u8 hierarchy,
                                       void *ctx, u32 element_id,
                                       u32 modify_bitmask)
 {
-       u32 in[MLX5_ST_SZ_DW(modify_scheduling_element_in)]  = {0};
-       u32 out[MLX5_ST_SZ_DW(modify_scheduling_element_in)] = {0};
+       u32 in[MLX5_ST_SZ_DW(modify_scheduling_element_in)] = {};
        void *schedc;
 
        schedc = MLX5_ADDR_OF(modify_scheduling_element_in, in,
@@ -81,14 +80,13 @@ int mlx5_modify_scheduling_element_cmd(struct mlx5_core_dev *dev, u8 hierarchy,
                 hierarchy);
        memcpy(schedc, ctx, MLX5_ST_SZ_BYTES(scheduling_context));
 
-       return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
+       return mlx5_cmd_exec_in(dev, modify_scheduling_element, in);
 }
 
 int mlx5_destroy_scheduling_element_cmd(struct mlx5_core_dev *dev, u8 hierarchy,
                                        u32 element_id)
 {
-       u32 in[MLX5_ST_SZ_DW(destroy_scheduling_element_in)]  = {0};
-       u32 out[MLX5_ST_SZ_DW(destroy_scheduling_element_in)] = {0};
+       u32 in[MLX5_ST_SZ_DW(destroy_scheduling_element_in)] = {};
 
        MLX5_SET(destroy_scheduling_element_in, in, opcode,
                 MLX5_CMD_OP_DESTROY_SCHEDULING_ELEMENT);
@@ -97,7 +95,7 @@ int mlx5_destroy_scheduling_element_cmd(struct mlx5_core_dev *dev, u8 hierarchy,
        MLX5_SET(destroy_scheduling_element_in, in, scheduling_hierarchy,
                 hierarchy);
 
-       return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
+       return mlx5_cmd_exec_in(dev, destroy_scheduling_element, in);
 }
 
 static bool mlx5_rl_are_equal_raw(struct mlx5_rl_entry *entry, void *rl_in,
@@ -144,8 +142,7 @@ static struct mlx5_rl_entry *find_rl_entry(struct mlx5_rl_table *table,
 static int mlx5_set_pp_rate_limit_cmd(struct mlx5_core_dev *dev,
                                      struct mlx5_rl_entry *entry, bool set)
 {
-       u32 in[MLX5_ST_SZ_DW(set_pp_rate_limit_in)]   = {};
-       u32 out[MLX5_ST_SZ_DW(set_pp_rate_limit_out)] = {};
+       u32 in[MLX5_ST_SZ_DW(set_pp_rate_limit_in)] = {};
        void *pp_context;
 
        pp_context = MLX5_ADDR_OF(set_pp_rate_limit_in, in, ctx);
@@ -155,7 +152,7 @@ static int mlx5_set_pp_rate_limit_cmd(struct mlx5_core_dev *dev,
        MLX5_SET(set_pp_rate_limit_in, in, rate_limit_index, entry->index);
        if (set)
                memcpy(pp_context, entry->rl_raw, sizeof(entry->rl_raw));
-       return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
+       return mlx5_cmd_exec_in(dev, set_pp_rate_limit, in);
 }
 
 bool mlx5_rl_is_in_range(struct mlx5_core_dev *dev, u32 rate)