net/mlx5: Set uid as part of CQ commands
Set uid as part of CQ commands so that the firmware can manage the CQ object in a secured way. The firmware should mark this CQ with the given uid so that it can be used later on only by objects with the same uid. Upon DEVX flows that use this CQ (e.g. create QP command), the pointed CQ must have the same uid as of the issuer uid command. When a command is issued with uid=0 it means that the issuer of the command is trusted (i.e. kernel), in that case any pointed object can be used regardless of its uid. Signed-off-by: Yishai Hadas <yishaih@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
This commit is contained in:
Родитель
5d773ff41a
Коммит
9ba481e2eb
|
@ -109,6 +109,7 @@ int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
|
||||||
cq->cons_index = 0;
|
cq->cons_index = 0;
|
||||||
cq->arm_sn = 0;
|
cq->arm_sn = 0;
|
||||||
cq->eq = eq;
|
cq->eq = eq;
|
||||||
|
cq->uid = MLX5_GET(create_cq_in, in, uid);
|
||||||
refcount_set(&cq->refcount, 1);
|
refcount_set(&cq->refcount, 1);
|
||||||
init_completion(&cq->free);
|
init_completion(&cq->free);
|
||||||
if (!cq->comp)
|
if (!cq->comp)
|
||||||
|
@ -144,6 +145,7 @@ err_cmd:
|
||||||
memset(dout, 0, sizeof(dout));
|
memset(dout, 0, sizeof(dout));
|
||||||
MLX5_SET(destroy_cq_in, din, opcode, MLX5_CMD_OP_DESTROY_CQ);
|
MLX5_SET(destroy_cq_in, din, opcode, MLX5_CMD_OP_DESTROY_CQ);
|
||||||
MLX5_SET(destroy_cq_in, din, cqn, cq->cqn);
|
MLX5_SET(destroy_cq_in, din, cqn, cq->cqn);
|
||||||
|
MLX5_SET(destroy_cq_in, din, uid, cq->uid);
|
||||||
mlx5_cmd_exec(dev, din, sizeof(din), dout, sizeof(dout));
|
mlx5_cmd_exec(dev, din, sizeof(din), dout, sizeof(dout));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -165,6 +167,7 @@ int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq)
|
||||||
|
|
||||||
MLX5_SET(destroy_cq_in, in, opcode, MLX5_CMD_OP_DESTROY_CQ);
|
MLX5_SET(destroy_cq_in, in, opcode, MLX5_CMD_OP_DESTROY_CQ);
|
||||||
MLX5_SET(destroy_cq_in, in, cqn, cq->cqn);
|
MLX5_SET(destroy_cq_in, in, cqn, cq->cqn);
|
||||||
|
MLX5_SET(destroy_cq_in, in, uid, cq->uid);
|
||||||
err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
|
err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
@ -196,6 +199,7 @@ int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
|
||||||
u32 out[MLX5_ST_SZ_DW(modify_cq_out)] = {0};
|
u32 out[MLX5_ST_SZ_DW(modify_cq_out)] = {0};
|
||||||
|
|
||||||
MLX5_SET(modify_cq_in, in, opcode, MLX5_CMD_OP_MODIFY_CQ);
|
MLX5_SET(modify_cq_in, in, opcode, MLX5_CMD_OP_MODIFY_CQ);
|
||||||
|
MLX5_SET(modify_cq_in, in, uid, cq->uid);
|
||||||
return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
|
return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(mlx5_core_modify_cq);
|
EXPORT_SYMBOL(mlx5_core_modify_cq);
|
||||||
|
|
|
@ -61,6 +61,7 @@ struct mlx5_core_cq {
|
||||||
int reset_notify_added;
|
int reset_notify_added;
|
||||||
struct list_head reset_notify;
|
struct list_head reset_notify;
|
||||||
struct mlx5_eq *eq;
|
struct mlx5_eq *eq;
|
||||||
|
u16 uid;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5629,7 +5629,7 @@ enum {
|
||||||
|
|
||||||
struct mlx5_ifc_modify_cq_in_bits {
|
struct mlx5_ifc_modify_cq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6404,7 +6404,7 @@ struct mlx5_ifc_destroy_cq_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_destroy_cq_in_bits {
|
struct mlx5_ifc_destroy_cq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -7164,7 +7164,7 @@ struct mlx5_ifc_create_cq_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_create_cq_in_bits {
|
struct mlx5_ifc_create_cq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
|
Загрузка…
Ссылка в новой задаче