net/mlx5: Introduce new TIR creation core API
authorAriel Levkovich <lariel@mellanox.com>
Sun, 31 Mar 2019 16:44:49 +0000 (19:44 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Wed, 24 Apr 2019 19:33:37 +0000 (12:33 -0700)
Introducing new TIR creation core API which allows caller
to receive back from the call the full command outbox.

This comes as a preparation for the next patch that will
retrieve the TIR ICM address from the command outbox.

Signed-off-by: Ariel Levkovich <lariel@mellanox.com>
Reviewed-by: Eli Cohen <eli@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/transobj.c
include/linux/mlx5/transobj.h

index c4d4b76096dc2e5884965966e9e1e63913b5abd4..b1068500f1df59658a03ce1fb107bc1ca49f7032 100644 (file)
@@ -182,16 +182,24 @@ out:
 }
 EXPORT_SYMBOL_GPL(mlx5_core_query_sq_state);
 
+int mlx5_core_create_tir_out(struct mlx5_core_dev *dev,
+                            u32 *in, int inlen,
+                            u32 *out, int outlen)
+{
+       MLX5_SET(create_tir_in, in, opcode, MLX5_CMD_OP_CREATE_TIR);
+
+       return mlx5_cmd_exec(dev, in, inlen, out, outlen);
+}
+EXPORT_SYMBOL(mlx5_core_create_tir_out);
+
 int mlx5_core_create_tir(struct mlx5_core_dev *dev, u32 *in, int inlen,
                         u32 *tirn)
 {
-       u32 out[MLX5_ST_SZ_DW(create_tir_out)] = {0};
+       u32 out[MLX5_ST_SZ_DW(create_tir_out)] = {};
        int err;
 
-       MLX5_SET(create_tir_in, in, opcode, MLX5_CMD_OP_CREATE_TIR);
-
-       memset(out, 0, sizeof(out));
-       err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
+       err = mlx5_core_create_tir_out(dev, in, inlen,
+                                      out, sizeof(out));
        if (!err)
                *tirn = MLX5_GET(create_tir_out, out, tirn);
 
index a261d5528ff7e5b5382576d746d731175ac42e2c..dc6b1e7cb8c427a5eed859432e62ea0ff5d6ee3f 100644 (file)
@@ -50,6 +50,9 @@ int mlx5_core_query_sq(struct mlx5_core_dev *dev, u32 sqn, u32 *out);
 int mlx5_core_query_sq_state(struct mlx5_core_dev *dev, u32 sqn, u8 *state);
 int mlx5_core_create_tir(struct mlx5_core_dev *dev, u32 *in, int inlen,
                         u32 *tirn);
+int mlx5_core_create_tir_out(struct mlx5_core_dev *dev,
+                            u32 *in, int inlen,
+                            u32 *out, int outlen);
 int mlx5_core_modify_tir(struct mlx5_core_dev *dev, u32 tirn, u32 *in,
                         int inlen);
 void mlx5_core_destroy_tir(struct mlx5_core_dev *dev, u32 tirn);