OSDN Git Service

net/mlx5: Set uid as part of RQ commands
authorYishai Hadas <yishaih@mellanox.com>
Thu, 20 Sep 2018 18:35:22 +0000 (21:35 +0300)
committerLeon Romanovsky <leonro@mellanox.com>
Tue, 25 Sep 2018 06:52:44 +0000 (09:52 +0300)
Set uid as part of RQ commands so that the firmware can manage the
RQ object in a secured way.

That will enable using an RQ that was created by verbs application
to be used by the DEVX flow in case the uid is equal.

Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/qp.c
include/linux/mlx5/mlx5_ifc.h

index 4e2ab3c..f57e08d 100644 (file)
@@ -540,6 +540,17 @@ int mlx5_core_xrcd_dealloc(struct mlx5_core_dev *dev, u32 xrcdn)
 }
 EXPORT_SYMBOL_GPL(mlx5_core_xrcd_dealloc);
 
+static void destroy_rq_tracked(struct mlx5_core_dev *dev, u32 rqn, u16 uid)
+{
+       u32 in[MLX5_ST_SZ_DW(destroy_rq_in)]   = {};
+       u32 out[MLX5_ST_SZ_DW(destroy_rq_out)] = {};
+
+       MLX5_SET(destroy_rq_in, in, opcode, MLX5_CMD_OP_DESTROY_RQ);
+       MLX5_SET(destroy_rq_in, in, rqn, rqn);
+       MLX5_SET(destroy_rq_in, in, uid, uid);
+       mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
+}
+
 int mlx5_core_create_rq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen,
                                struct mlx5_core_qp *rq)
 {
@@ -550,6 +561,7 @@ int mlx5_core_create_rq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen,
        if (err)
                return err;
 
+       rq->uid = MLX5_GET(create_rq_in, in, uid);
        rq->qpn = rqn;
        err = create_resource_common(dev, rq, MLX5_RES_RQ);
        if (err)
@@ -558,7 +570,7 @@ int mlx5_core_create_rq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen,
        return 0;
 
 err_destroy_rq:
-       mlx5_core_destroy_rq(dev, rq->qpn);
+       destroy_rq_tracked(dev, rq->qpn, rq->uid);
 
        return err;
 }
@@ -568,7 +580,7 @@ void mlx5_core_destroy_rq_tracked(struct mlx5_core_dev *dev,
                                  struct mlx5_core_qp *rq)
 {
        destroy_resource_common(dev, rq);
-       mlx5_core_destroy_rq(dev, rq->qpn);
+       destroy_rq_tracked(dev, rq->qpn, rq->uid);
 }
 EXPORT_SYMBOL(mlx5_core_destroy_rq_tracked);
 
index 3b6a612..689631c 100644 (file)
@@ -5488,7 +5488,7 @@ enum {
 
 struct mlx5_ifc_modify_rq_in_bits {
        u8         opcode[0x10];
-       u8         reserved_at_10[0x10];
+       u8         uid[0x10];
 
        u8         reserved_at_20[0x10];
        u8         op_mod[0x10];
@@ -6164,7 +6164,7 @@ struct mlx5_ifc_destroy_rq_out_bits {
 
 struct mlx5_ifc_destroy_rq_in_bits {
        u8         opcode[0x10];
-       u8         reserved_at_10[0x10];
+       u8         uid[0x10];
 
        u8         reserved_at_20[0x10];
        u8         op_mod[0x10];
@@ -6847,7 +6847,7 @@ struct mlx5_ifc_create_rq_out_bits {
 
 struct mlx5_ifc_create_rq_in_bits {
        u8         opcode[0x10];
-       u8         reserved_at_10[0x10];
+       u8         uid[0x10];
 
        u8         reserved_at_20[0x10];
        u8         op_mod[0x10];