Preparation to DevX extension series
Subsystems (5)
cover Preparation to DevX extension series
From: Leon Romanovsky <[email protected]>
Changelog v0->v1:
* Update commit messages
* Split DevX series to small sub-series.
* Change static initialization from {0} to be {}
------- From Yishai,
Set uid as part of various IB commands so that the firmware can manage the IB object in a secured way.
The firmware should mark this IB object 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 objec, the pointed object 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.
Thanks
Leon Romanovsky (1):
net/mlx5: Update mlx5_ifc with DEVX UID bits
Yishai Hadas (6):
net/mlx5: Set uid as part of CQ commands
net/mlx5: Set uid as part of QP commands
net/mlx5: Set uid as part of RQ commands
net/mlx5: Set uid as part of SQ commands
net/mlx5: Set uid as part of SRQ commands
net/mlx5: Set uid as part of DCT commands
drivers/net/ethernet/mellanox/mlx5/core/cq.c | 4 + drivers/net/ethernet/mellanox/mlx5/core/qp.c | 81 +++++++++++----- drivers/net/ethernet/mellanox/mlx5/core/srq.c | 30 +++++- include/linux/mlx5/cq.h | 1 + include/linux/mlx5/driver.h | 1 + include/linux/mlx5/mlx5_ifc.h | 135 +++++++++++++++----------- include/linux/mlx5/qp.h | 1 + include/linux/mlx5/srq.h | 1 + 8 files changed, 171 insertions(+), 83 deletions(-)
PATCH 1/7 net/mlx5: Set uid as part of CQ commands
From: Yishai Hadas <[email protected]>
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.
--- drivers/net/ethernet/mellanox/mlx5/core/cq.c | 4 ++++ include/linux/mlx5/cq.h | 1 + include/linux/mlx5/mlx5_ifc.h | 6 +++--- 3 files changed, 8 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/cq.c +4 -0
@@ -109,6 +109,7 @@ int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, cq->cons_index =0 ; cq->arm_sn =0 ; cq->eq = eq; + cq->uid =MLX5_GET (create_cq_in, in, uid);refcount_set (&cq->refcount,1 );init_completion (&cq->free);if (!cq->comp)
@@ -144,6 +145,7 @@ int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,memset (dout,0 ,sizeof (dout));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, uid, cq->uid);mlx5_cmd_exec (dev, din,sizeof (din), dout,sizeof (dout));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, cqn, cq->cqn); +MLX5_SET (destroy_cq_in, in, uid, cq->uid); err =mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out));if (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 };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)); }EXPORT_SYMBOL (mlx5_core_modify_cq);
include/linux/mlx5/cq.h +1 -0
@@ -61,6 +61,7 @@ struct mlx5_core_cq {int reset_notify_added;struct list_head reset_notify;struct mlx5_eq *eq; +u16 uid; };
include/linux/mlx5/mlx5_ifc.h +3 -3
@@ -5630,7 +5630,7 @@ enum {struct mlx5_ifc_modify_cq_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6405,7 +6405,7 @@ struct mlx5_ifc_destroy_cq_out_bits {struct mlx5_ifc_destroy_cq_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -7165,7 +7165,7 @@ struct mlx5_ifc_create_cq_out_bits {struct mlx5_ifc_create_cq_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
PATCH 2/7 net/mlx5: Set uid as part of QP commands
In reply to Leon RomanovskyFrom: Yishai Hadas <[email protected]>
Set uid as part of QP commands so that the firmware can manage the QP object in a secured way.
That will enable using a QP that was created by verbs application to be used by the DEVX flow in case the uid is equal.
--- drivers/net/ethernet/mellanox/mlx5/core/qp.c | 45 +++++++++++++++++----------- include/linux/mlx5/mlx5_ifc.h | 22 +++++++------- include/linux/mlx5/qp.h | 1 + 3 files changed, 39 insertions(+), 29 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/qp.c +27 -18
@@ -240,6 +240,7 @@ int mlx5_core_create_qp(struct mlx5_core_dev *dev,if (err)return err; + qp->uid =MLX5_GET (create_qp_in, in, uid); qp->qpn =MLX5_GET (create_qp_out, out, qpn);mlx5_core_dbg (dev,"qpn = 0x%x\n" , qp->qpn);
@@ -261,6 +262,7 @@ int mlx5_core_create_qp(struct mlx5_core_dev *dev,memset (dout,0 ,sizeof (dout));MLX5_SET (destroy_qp_in, din, opcode,MLX5_CMD_OP_DESTROY_QP );MLX5_SET (destroy_qp_in, din, qpn, qp->qpn); +MLX5_SET (destroy_qp_in, din, uid, qp->uid);mlx5_cmd_exec (dev, din,sizeof (din), dout,sizeof (dout));return err; }
@@ -320,6 +322,7 @@ int mlx5_core_destroy_qp(struct mlx5_core_dev *dev,MLX5_SET (destroy_qp_in, in, opcode,MLX5_CMD_OP_DESTROY_QP );MLX5_SET (destroy_qp_in, in, qpn, qp->qpn); +MLX5_SET (destroy_qp_in, in, uid, qp->uid); err =mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out));if (err)return err;
@@ -373,7 +376,7 @@ static void mbox_free(struct mbox_info *mbox)static int modify_qp_mbox_alloc (struct mlx5_core_dev *dev,u16 opcode,int qpn,u32 opt_param_mask,void *qpc, -struct mbox_info *mbox) +struct mbox_info *mbox,u16 uid) { mbox->out =NULL ; mbox->in =NULL ;
@@ -381,26 +384,32 @@ static int modify_qp_mbox_alloc(struct mlx5_core_dev *dev, u16 opcode, int qpn,#define MBOX_ALLOC (mbox, typ) \ mbox_alloc(mbox, MLX5_ST_SZ_BYTES(typ##_in), MLX5_ST_SZ_BYTES(typ##_out)) -#define MOD_QP_IN_SET (typ, in, _opcode, _qpn) \ - MLX5_SET(typ##_in, in, opcode, _opcode); \ - MLX5_SET(typ##_in, in, qpn, _qpn) - -#define MOD_QP_IN_SET_QPC (typ, in, _opcode, _qpn, _opt_p, _qpc) \ - MOD_QP_IN_SET(typ, in, _opcode, _qpn); \ - MLX5_SET(typ##_in, in, opt_param_mask, _opt_p); \ - memcpy(MLX5_ADDR_OF(typ##_in, in, qpc), _qpc, MLX5_ST_SZ_BYTES(qpc)) +#define MOD_QP_IN_SET (typ, in, _opcode, _qpn, _uid) \ + do { \ + MLX5_SET(typ##_in, in, opcode, _opcode); \ + MLX5_SET(typ##_in, in, qpn, _qpn); \ + MLX5_SET(typ##_in, in, uid, _uid); \ + } while (0) + +#define MOD_QP_IN_SET_QPC (typ, in, _opcode, _qpn, _opt_p, _qpc, _uid) \ + do { \ + MOD_QP_IN_SET(typ, in, _opcode, _qpn, _uid); \ + MLX5_SET(typ##_in, in, opt_param_mask, _opt_p); \ + memcpy(MLX5_ADDR_OF(typ##_in, in, qpc), _qpc, \ + MLX5_ST_SZ_BYTES(qpc)); \ + } while (0)switch (opcode) {/* 2RST & 2ERR */ case MLX5_CMD_OP_2RST_QP :if (MBOX_ALLOC (mbox, qp_2rst))return -ENOMEM ; -MOD_QP_IN_SET (qp_2rst, mbox->in, opcode, qpn); +MOD_QP_IN_SET (qp_2rst, mbox->in, opcode, qpn, uid);break ;case MLX5_CMD_OP_2ERR_QP :if (MBOX_ALLOC (mbox, qp_2err))return -ENOMEM ; -MOD_QP_IN_SET (qp_2err, mbox->in, opcode, qpn); +MOD_QP_IN_SET (qp_2err, mbox->in, opcode, qpn, uid);break ;/* MODIFY with QPC */
@@ -408,37 +417,37 @@ static int modify_qp_mbox_alloc(struct mlx5_core_dev *dev, u16 opcode, int qpn,if (MBOX_ALLOC (mbox, rst2init_qp))return -ENOMEM ;MOD_QP_IN_SET_QPC (rst2init_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid);break ;case MLX5_CMD_OP_INIT2RTR_QP :if (MBOX_ALLOC (mbox, init2rtr_qp))return -ENOMEM ;MOD_QP_IN_SET_QPC (init2rtr_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid);break ;case MLX5_CMD_OP_RTR2RTS_QP :if (MBOX_ALLOC (mbox, rtr2rts_qp))return -ENOMEM ;MOD_QP_IN_SET_QPC (rtr2rts_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid);break ;case MLX5_CMD_OP_RTS2RTS_QP :if (MBOX_ALLOC (mbox, rts2rts_qp))return -ENOMEM ;MOD_QP_IN_SET_QPC (rts2rts_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid);break ;case MLX5_CMD_OP_SQERR2RTS_QP :if (MBOX_ALLOC (mbox, sqerr2rts_qp))return -ENOMEM ;MOD_QP_IN_SET_QPC (sqerr2rts_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid);break ;case MLX5_CMD_OP_INIT2INIT_QP :if (MBOX_ALLOC (mbox, init2init_qp))return -ENOMEM ;MOD_QP_IN_SET_QPC (init2init_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid);break ;default : mlx5_core_err(dev, "Unknown transition for modify QP: OP(0x%x) QPN(0x%x)\n",
@@ -456,7 +465,7 @@ int mlx5_core_qp_modify(struct mlx5_core_dev *dev, u16 opcode,int err; err =modify_qp_mbox_alloc (dev, opcode, qp->qpn, - opt_param_mask, qpc, &mbox); + opt_param_mask, qpc, &mbox, qp->uid);if (err)return err;
include/linux/mlx5/mlx5_ifc.h +11 -11
@@ -3395,7 +3395,7 @@ struct mlx5_ifc_sqerr2rts_qp_out_bits {struct mlx5_ifc_sqerr2rts_qp_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -3425,7 +3425,7 @@ struct mlx5_ifc_sqd2rts_qp_out_bits {struct mlx5_ifc_sqd2rts_qp_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -3630,7 +3630,7 @@ struct mlx5_ifc_rts2rts_qp_out_bits {struct mlx5_ifc_rts2rts_qp_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -3660,7 +3660,7 @@ struct mlx5_ifc_rtr2rts_qp_out_bits {struct mlx5_ifc_rtr2rts_qp_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -3690,7 +3690,7 @@ struct mlx5_ifc_rst2init_qp_out_bits {struct mlx5_ifc_rst2init_qp_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -5193,7 +5193,7 @@ struct mlx5_ifc_qp_2rst_out_bits {struct mlx5_ifc_qp_2rst_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -5215,7 +5215,7 @@ struct mlx5_ifc_qp_2err_out_bits {struct mlx5_ifc_qp_2err_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -5790,7 +5790,7 @@ struct mlx5_ifc_init2rtr_qp_out_bits {struct mlx5_ifc_init2rtr_qp_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -5820,7 +5820,7 @@ struct mlx5_ifc_init2init_qp_out_bits {struct mlx5_ifc_init2init_qp_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6231,7 +6231,7 @@ struct mlx5_ifc_destroy_qp_out_bits {struct mlx5_ifc_destroy_qp_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6896,7 +6896,7 @@ struct mlx5_ifc_create_qp_out_bits {struct mlx5_ifc_create_qp_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
include/linux/mlx5/qp.h +1 -0
@@ -471,6 +471,7 @@ struct mlx5_core_qp {int qpn;struct mlx5_rsc_debug *dbg;int pid; +u16 uid; };struct mlx5_core_dct {
PATCH 3/7 net/mlx5: Set uid as part of RQ commands
In reply to Leon RomanovskyFrom: Yishai Hadas <[email protected]>
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.
--- drivers/net/ethernet/mellanox/mlx5/core/qp.c | 16 ++++++++++++++-- include/linux/mlx5/mlx5_ifc.h | 6 +++--- 2 files changed, 17 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/qp.c +14 -2
@@ -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);
include/linux/mlx5/mlx5_ifc.h +3 -3
@@ -5489,7 +5489,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 ];
@@ -6165,7 +6165,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 ];
@@ -6848,7 +6848,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 ];
PATCH 4/7 net/mlx5: Set uid as part of SQ commands
In reply to Leon RomanovskyFrom: Yishai Hadas <[email protected]>
Set uid as part of SQ commands so that the firmware can manage the SQ object in a secured way.
That will enable using an SQ that was created by verbs application to be used by the DEVX flow in case the uid is equal.
--- drivers/net/ethernet/mellanox/mlx5/core/qp.c | 16 ++++++++++++++-- include/linux/mlx5/mlx5_ifc.h | 6 +++--- 2 files changed, 17 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/qp.c +14 -2
@@ -584,6 +584,17 @@ void mlx5_core_destroy_rq_tracked(struct mlx5_core_dev *dev, }EXPORT_SYMBOL (mlx5_core_destroy_rq_tracked); +static void destroy_sq_tracked (struct mlx5_core_dev *dev,u32 sqn,u16 uid) +{ +u32 in[MLX5_ST_SZ_DW (destroy_sq_in)] = {}; +u32 out[MLX5_ST_SZ_DW (destroy_sq_out)] = {}; + +MLX5_SET (destroy_sq_in, in, opcode,MLX5_CMD_OP_DESTROY_SQ ); +MLX5_SET (destroy_sq_in, in, sqn, sqn); +MLX5_SET (destroy_sq_in, in, uid, uid); +mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +} +int mlx5_core_create_sq_tracked (struct mlx5_core_dev *dev,u32 *in,int inlen,struct mlx5_core_qp *sq) {
@@ -594,6 +605,7 @@ int mlx5_core_create_sq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen,if (err)return err; + sq->uid =MLX5_GET (create_sq_in, in, uid); sq->qpn = sqn; err =create_resource_common (dev, sq,MLX5_RES_SQ );if (err)
@@ -602,7 +614,7 @@ int mlx5_core_create_sq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen,return 0 ; err_destroy_sq: -mlx5_core_destroy_sq (dev, sq->qpn); +destroy_sq_tracked (dev, sq->qpn, sq->uid);return err; }
@@ -612,7 +624,7 @@ void mlx5_core_destroy_sq_tracked(struct mlx5_core_dev *dev, struct mlx5_core_qp *sq) {destroy_resource_common (dev, sq); -mlx5_core_destroy_sq (dev, sq->qpn); +destroy_sq_tracked (dev, sq->qpn, sq->uid); }EXPORT_SYMBOL (mlx5_core_destroy_sq_tracked);
include/linux/mlx5/mlx5_ifc.h +3 -3
@@ -5382,7 +5382,7 @@ struct mlx5_ifc_modify_sq_out_bits {struct mlx5_ifc_modify_sq_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6097,7 +6097,7 @@ struct mlx5_ifc_destroy_sq_out_bits {struct mlx5_ifc_destroy_sq_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6770,7 +6770,7 @@ struct mlx5_ifc_create_sq_out_bits {struct mlx5_ifc_create_sq_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
PATCH 5/7 net/mlx5: Set uid as part of SRQ commands
In reply to Leon RomanovskyFrom: Yishai Hadas <[email protected]>
Set uid as part of SRQ commands so that the firmware can manage the SRQ object in a secured way.
That will enable using an SRQ that was created by verbs application to be used by the DEVX flow in case the uid is equal.
--- drivers/net/ethernet/mellanox/mlx5/core/srq.c | 30 ++++++++++++++++++++++++--- include/linux/mlx5/driver.h | 1 + include/linux/mlx5/mlx5_ifc.h | 22 ++++++++++---------- include/linux/mlx5/srq.h | 1 + 4 files changed, 40 insertions(+), 14 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/srq.c +27 -3
@@ -166,6 +166,7 @@ static int create_srq_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,if (!create_in)return -ENOMEM ; +MLX5_SET (create_srq_in, create_in, uid, in->uid); srqc =MLX5_ADDR_OF (create_srq_in, create_in, srq_context_entry); pas =MLX5_ADDR_OF (create_srq_in, create_in, pas);
@@ -178,8 +179,10 @@ static int create_srq_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq, err =mlx5_cmd_exec (dev, create_in, inlen, create_out,sizeof (create_out));kvfree (create_in); -if (!err) +if (!err) { srq->srqn =MLX5_GET (create_srq_out, create_out, srqn); + srq->uid = in->uid; + }return err; }
@@ -193,6 +196,7 @@ static int destroy_srq_cmd(struct mlx5_core_dev *dev,MLX5_SET (destroy_srq_in, srq_in, opcode,MLX5_CMD_OP_DESTROY_SRQ );MLX5_SET (destroy_srq_in, srq_in, srqn, srq->srqn); +MLX5_SET (destroy_srq_in, srq_in, uid, srq->uid);return mlx5_cmd_exec (dev, srq_in,sizeof (srq_in), srq_out,sizeof (srq_out));
@@ -208,6 +212,7 @@ static int arm_srq_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,MLX5_SET (arm_rq_in, srq_in, op_mod,MLX5_ARM_RQ_IN_OP_MOD_SRQ );MLX5_SET (arm_rq_in, srq_in, srq_number, srq->srqn);MLX5_SET (arm_rq_in, srq_in, lwm, lwm); +MLX5_SET (arm_rq_in, srq_in, uid, srq->uid);return mlx5_cmd_exec (dev, srq_in,sizeof (srq_in), srq_out,sizeof (srq_out));
@@ -260,6 +265,7 @@ static int create_xrc_srq_cmd(struct mlx5_core_dev *dev,if (!create_in)return -ENOMEM ; +MLX5_SET (create_xrc_srq_in, create_in, uid, in->uid); xrc_srqc =MLX5_ADDR_OF (create_xrc_srq_in, create_in, xrc_srq_context_entry); pas =MLX5_ADDR_OF (create_xrc_srq_in, create_in, pas);
@@ -277,6 +283,7 @@ static int create_xrc_srq_cmd(struct mlx5_core_dev *dev, goto out; srq->srqn =MLX5_GET (create_xrc_srq_out, create_out, xrc_srqn); + srq->uid = in->uid; out:kvfree (create_in);return err;
@@ -291,6 +298,7 @@ static int destroy_xrc_srq_cmd(struct mlx5_core_dev *dev,MLX5_SET (destroy_xrc_srq_in, xrcsrq_in, opcode,MLX5_CMD_OP_DESTROY_XRC_SRQ );MLX5_SET (destroy_xrc_srq_in, xrcsrq_in, xrc_srqn, srq->srqn); +MLX5_SET (destroy_xrc_srq_in, xrcsrq_in, uid, srq->uid);return mlx5_cmd_exec (dev, xrcsrq_in,sizeof (xrcsrq_in), xrcsrq_out,sizeof (xrcsrq_out));
@@ -306,6 +314,7 @@ static int arm_xrc_srq_cmd(struct mlx5_core_dev *dev,MLX5_SET (arm_xrc_srq_in, xrcsrq_in, op_mod,MLX5_ARM_XRC_SRQ_IN_OP_MOD_XRC_SRQ );MLX5_SET (arm_xrc_srq_in, xrcsrq_in, xrc_srqn, srq->srqn);MLX5_SET (arm_xrc_srq_in, xrcsrq_in, lwm, lwm); +MLX5_SET (arm_xrc_srq_in, xrcsrq_in, uid, srq->uid);return mlx5_cmd_exec (dev, xrcsrq_in,sizeof (xrcsrq_in), xrcsrq_out,sizeof (xrcsrq_out));
@@ -365,10 +374,13 @@ static int create_rmp_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq, wq =MLX5_ADDR_OF (rmpc, rmpc, wq);MLX5_SET (rmpc, rmpc, state,MLX5_RMPC_STATE_RDY ); +MLX5_SET (create_rmp_in, create_in, uid, in->uid);set_wq (wq, in);memcpy (MLX5_ADDR_OF (rmpc, rmpc, wq.pas), in->pas, pas_size); err =mlx5_core_create_rmp (dev, create_in, inlen, &srq->srqn); +if (!err) + srq->uid = in->uid;kvfree (create_in);return err;
@@ -377,7 +389,13 @@ static int create_rmp_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,static int destroy_rmp_cmd (struct mlx5_core_dev *dev,struct mlx5_core_srq *srq) { -return mlx5_core_destroy_rmp (dev, srq->srqn); +u32 in[MLX5_ST_SZ_DW (destroy_rmp_in)] = {}; +u32 out[MLX5_ST_SZ_DW (destroy_rmp_out)] = {}; + +MLX5_SET (destroy_rmp_in, in, opcode,MLX5_CMD_OP_DESTROY_RMP ); +MLX5_SET (destroy_rmp_in, in, rmpn, srq->srqn); +MLX5_SET (destroy_rmp_in, in, uid, srq->uid); +return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); } static int arm_rmp_cmd(struct mlx5_core_dev *dev,
@@ -400,6 +418,7 @@ static int arm_rmp_cmd(struct mlx5_core_dev *dev,MLX5_SET (modify_rmp_in, in, rmp_state,MLX5_RMPC_STATE_RDY );MLX5_SET (modify_rmp_in, in, rmpn, srq->srqn); +MLX5_SET (modify_rmp_in, in, uid, srq->uid);MLX5_SET (wq, wq, lwm, lwm);MLX5_SET (rmp_bitmask, bitmask, lwm,1 );MLX5_SET (rmpc, rmpc, state,MLX5_RMPC_STATE_RDY );
@@ -469,11 +488,14 @@ static int create_xrq_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,MLX5_SET (xrqc, xrqc, user_index, in->user_index);MLX5_SET (xrqc, xrqc, cqn, in->cqn);MLX5_SET (create_xrq_in, create_in, opcode,MLX5_CMD_OP_CREATE_XRQ ); +MLX5_SET (create_xrq_in, create_in, uid, in->uid); err =mlx5_cmd_exec (dev, create_in, inlen, create_out,sizeof (create_out));kvfree (create_in); -if (!err) +if (!err) { srq->srqn =MLX5_GET (create_xrq_out, create_out, xrqn); + srq->uid = in->uid; + }return err; }
@@ -485,6 +507,7 @@ static int destroy_xrq_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq)MLX5_SET (destroy_xrq_in, in, opcode,MLX5_CMD_OP_DESTROY_XRQ );MLX5_SET (destroy_xrq_in, in, xrqn, srq->srqn); +MLX5_SET (destroy_xrq_in, in, uid, srq->uid);return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); }
@@ -500,6 +523,7 @@ static int arm_xrq_cmd(struct mlx5_core_dev *dev,MLX5_SET (arm_rq_in, in, op_mod,MLX5_ARM_RQ_IN_OP_MOD_XRQ );MLX5_SET (arm_rq_in, in, srq_number, srq->srqn);MLX5_SET (arm_rq_in, in, lwm, lwm); +MLX5_SET (arm_rq_in, in, uid, srq->uid);return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); }
include/linux/mlx5/driver.h +1 -0
@@ -474,6 +474,7 @@ struct mlx5_core_srq {atomic_t refcount;struct completion free; +u16 uid; };struct mlx5_eq_table {
include/linux/mlx5/mlx5_ifc.h +11 -11
@@ -5525,7 +5525,7 @@ struct mlx5_ifc_rmp_bitmask_bits {struct mlx5_ifc_modify_rmp_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -5987,7 +5987,7 @@ struct mlx5_ifc_destroy_xrq_out_bits {struct mlx5_ifc_destroy_xrq_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6009,7 +6009,7 @@ struct mlx5_ifc_destroy_xrc_srq_out_bits {struct mlx5_ifc_destroy_xrc_srq_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6075,7 +6075,7 @@ struct mlx5_ifc_destroy_srq_out_bits {struct mlx5_ifc_destroy_srq_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6209,7 +6209,7 @@ struct mlx5_ifc_destroy_rmp_out_bits {struct mlx5_ifc_destroy_rmp_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6642,7 +6642,7 @@ struct mlx5_ifc_create_xrq_out_bits {struct mlx5_ifc_create_xrq_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6666,7 +6666,7 @@ struct mlx5_ifc_create_xrc_srq_out_bits {struct mlx5_ifc_create_xrc_srq_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6742,7 +6742,7 @@ struct mlx5_ifc_create_srq_out_bits {struct mlx5_ifc_create_srq_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6872,7 +6872,7 @@ struct mlx5_ifc_create_rmp_out_bits {struct mlx5_ifc_create_rmp_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -7273,7 +7273,7 @@ enum {struct mlx5_ifc_arm_xrc_srq_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -7301,7 +7301,7 @@ enum {struct mlx5_ifc_arm_rq_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
include/linux/mlx5/srq.h +1 -0
@@ -61,6 +61,7 @@ struct mlx5_srq_attr {u32 tm_next_tag;u32 tm_hw_phase_cnt;u32 tm_sw_phase_cnt; +u16 uid; };struct mlx5_core_dev ;
PATCH 6/7 net/mlx5: Set uid as part of DCT commands
In reply to Leon RomanovskyFrom: Yishai Hadas <[email protected]>
Set uid as part of DCT commands so that the firmware can manage the DCT object in a secured way.
That will enable using a DCT that was created by verbs application to be used by the DEVX flow in case the uid is equal.
--- drivers/net/ethernet/mellanox/mlx5/core/qp.c | 4 ++++ include/linux/mlx5/mlx5_ifc.h | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/qp.c +4 -0
@@ -211,6 +211,7 @@ int mlx5_core_create_dct(struct mlx5_core_dev *dev, } qp->qpn =MLX5_GET (create_dct_out, out, dctn); + qp->uid =MLX5_GET (create_dct_in, in, uid); err =create_resource_common (dev, qp,MLX5_RES_DCT );if (err) goto err_cmd;
@@ -219,6 +220,7 @@ int mlx5_core_create_dct(struct mlx5_core_dev *dev, err_cmd:MLX5_SET (destroy_dct_in, din, opcode,MLX5_CMD_OP_DESTROY_DCT );MLX5_SET (destroy_dct_in, din, dctn, qp->qpn); +MLX5_SET (destroy_dct_in, din, uid, qp->uid);mlx5_cmd_exec (dev, (void *)&in,sizeof (din), (void *)&out,sizeof (dout));return err;
@@ -277,6 +279,7 @@ static int mlx5_core_drain_dct(struct mlx5_core_dev *dev,MLX5_SET (drain_dct_in, in, opcode,MLX5_CMD_OP_DRAIN_DCT );MLX5_SET (drain_dct_in, in, dctn, qp->qpn); +MLX5_SET (drain_dct_in, in, uid, qp->uid);return mlx5_cmd_exec (dev, (void *)&in,sizeof (in), (void *)&out,sizeof (out)); }
@@ -303,6 +306,7 @@ int mlx5_core_destroy_dct(struct mlx5_core_dev *dev,destroy_resource_common (dev, &dct->mqp);MLX5_SET (destroy_dct_in, in, opcode,MLX5_CMD_OP_DESTROY_DCT );MLX5_SET (destroy_dct_in, in, dctn, qp->qpn); +MLX5_SET (destroy_dct_in, in, uid, qp->uid); err =mlx5_cmd_exec (dev, (void *)&in,sizeof (in), (void *)&out,sizeof (out));return err;
include/linux/mlx5/mlx5_ifc.h +3 -3
@@ -5919,7 +5919,7 @@ struct mlx5_ifc_drain_dct_out_bits {struct mlx5_ifc_drain_dct_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6383,7 +6383,7 @@ struct mlx5_ifc_destroy_dct_out_bits {struct mlx5_ifc_destroy_dct_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -7139,7 +7139,7 @@ struct mlx5_ifc_create_dct_out_bits {struct mlx5_ifc_create_dct_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
PATCH 7/7 net/mlx5: Update mlx5_ifc with DEVX UID bits
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Add DEVX information to WQ, SRQ, CQ, TRI, TIS, QP, RQ, XRCD, PD, MKEY and MCG.
--- include/linux/mlx5/mlx5_ifc.h | 67 +++++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 24 deletions(-)
include/linux/mlx5/mlx5_ifc.h +43 -24
@@ -1291,7 +1291,9 @@ struct mlx5_ifc_wq_bits {u8 reserved_at_118[0x3 ];u8 log_wq_sz[0x5 ]; -u8 reserved_at_120[0x3 ]; +u8 dbr_umem_valid[0x1 ]; +u8 wq_umem_valid[0x1 ]; +u8 reserved_at_122[0x1 ];u8 log_hairpin_num_packets[0x5 ];u8 reserved_at_128[0x3 ];u8 log_hairpin_data_sz[0x5 ];
@@ -2365,7 +2367,10 @@ struct mlx5_ifc_qpc_bits {u8 dc_access_key[0x40 ]; -u8 reserved_at_680[0xc0 ]; +u8 reserved_at_680[0x3 ]; +u8 dbr_umem_valid[0x1 ]; + +u8 reserved_at_684[0xbc ]; };struct mlx5_ifc_roce_addr_layout_bits {
@@ -2465,7 +2470,7 @@ struct mlx5_ifc_xrc_srqc_bits {u8 wq_signature[0x1 ];u8 cont_srq[0x1 ]; -u8 reserved_at_22[0x1 ]; +u8 dbr_umem_valid[0x1 ];u8 rlky[0x1 ];u8 basic_cyclic_rcv_wqe[0x1 ];u8 log_rq_stride[0x3 ];
@@ -3129,7 +3134,9 @@ enum {struct mlx5_ifc_cqc_bits {u8 status[0x4 ]; -u8 reserved_at_4[0x4 ]; +u8 reserved_at_4[0x2 ]; +u8 dbr_umem_valid[0x1 ]; +u8 reserved_at_7[0x1 ];u8 cqe_sz[0x3 ];u8 cc[0x1 ];u8 reserved_at_c[0x1 ];
@@ -5315,7 +5322,7 @@ struct mlx5_ifc_modify_tis_bitmask_bits {struct mlx5_ifc_modify_tis_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -5354,7 +5361,7 @@ struct mlx5_ifc_modify_tir_out_bits {struct mlx5_ifc_modify_tir_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -5455,7 +5462,7 @@ struct mlx5_ifc_rqt_bitmask_bits {struct mlx5_ifc_modify_rqt_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -5642,7 +5649,10 @@ struct mlx5_ifc_modify_cq_in_bits {struct mlx5_ifc_cqc_bits cq_context; -u8 reserved_at_280[0x600 ]; +u8 reserved_at_280[0x40 ]; + +u8 cq_umem_valid[0x1 ]; +u8 reserved_at_2c1[0x5bf ];u8 pas[0 ][0x40 ]; };
@@ -5963,7 +5973,7 @@ struct mlx5_ifc_detach_from_mcg_out_bits {struct mlx5_ifc_detach_from_mcg_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6031,7 +6041,7 @@ struct mlx5_ifc_destroy_tis_out_bits {struct mlx5_ifc_destroy_tis_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6053,7 +6063,7 @@ struct mlx5_ifc_destroy_tir_out_bits {struct mlx5_ifc_destroy_tir_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6143,7 +6153,7 @@ struct mlx5_ifc_destroy_rqt_out_bits {struct mlx5_ifc_destroy_rqt_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6508,7 +6518,7 @@ struct mlx5_ifc_dealloc_xrcd_out_bits {struct mlx5_ifc_dealloc_xrcd_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6596,7 +6606,7 @@ struct mlx5_ifc_dealloc_pd_out_bits {struct mlx5_ifc_dealloc_pd_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6675,7 +6685,9 @@ struct mlx5_ifc_create_xrc_srq_in_bits {struct mlx5_ifc_xrc_srqc_bits xrc_srq_context_entry; -u8 reserved_at_280[0x600 ]; +u8 reserved_at_280[0x40 ]; +u8 xrc_srq_umem_valid[0x1 ]; +u8 reserved_at_2c1[0x5bf ];u8 pas[0 ][0x40 ]; };
@@ -6694,7 +6706,7 @@ struct mlx5_ifc_create_tis_out_bits {struct mlx5_ifc_create_tis_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6718,7 +6730,7 @@ struct mlx5_ifc_create_tir_out_bits {struct mlx5_ifc_create_tir_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6824,7 +6836,7 @@ struct mlx5_ifc_create_rqt_out_bits {struct mlx5_ifc_create_rqt_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -6909,7 +6921,10 @@ struct mlx5_ifc_create_qp_in_bits {struct mlx5_ifc_qpc_bits qpc; -u8 reserved_at_800[0x80 ]; +u8 reserved_at_800[0x60 ]; + +u8 wq_umem_valid[0x1 ]; +u8 reserved_at_861[0x1f ];u8 pas[0 ][0x40 ]; };
@@ -6971,7 +6986,8 @@ struct mlx5_ifc_create_mkey_in_bits {u8 reserved_at_40[0x20 ];u8 pg_access[0x1 ]; -u8 reserved_at_61[0x1f ]; +u8 mkey_umem_valid[0x1 ]; +u8 reserved_at_62[0x1e ];struct mlx5_ifc_mkc_bits memory_key_mkey_entry;
@@ -7174,7 +7190,10 @@ struct mlx5_ifc_create_cq_in_bits {struct mlx5_ifc_cqc_bits cq_context; -u8 reserved_at_280[0x600 ]; +u8 reserved_at_280[0x60 ]; + +u8 cq_umem_valid[0x1 ]; +u8 reserved_at_2e1[0x59f ];u8 pas[0 ][0x40 ]; };
@@ -7222,7 +7241,7 @@ struct mlx5_ifc_attach_to_mcg_out_bits {struct mlx5_ifc_attach_to_mcg_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -7349,7 +7368,7 @@ struct mlx5_ifc_alloc_xrcd_out_bits {struct mlx5_ifc_alloc_xrcd_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -7437,7 +7456,7 @@ struct mlx5_ifc_alloc_pd_out_bits {struct mlx5_ifc_alloc_pd_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
Re: [PATCH mlx5-next v1 7/7] net/mlx5: Update mlx5_ifc with DEVX UID bits
Quoted 252 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
Add DEVX information to WQ, SRQ, CQ, TRI, TIS, QP, RQ, XRCD, PD, MKEY and MCG.
Signed-off-by Leon Romanovsky <[email protected]>--- include/linux/mlx5/mlx5_ifc.h | 67 +++++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 24 deletions(-)include/linux/mlx5/mlx5_ifc.h +43
-25@@ -1291,7 +1291,9 @@ struct mlx5_ifc_wq_bits {u8 reserved_at_118[0x3 ];u8 log_wq_sz[0x5 ]; -u8 reserved_at_120[0x3 ]; +u8 dbr_umem_valid[0x1 ]; +u8 wq_umem_valid[0x1 ]; +u8 reserved_at_122[0x1 ];u8 log_hairpin_num_packets[0x5 ];u8 reserved_at_128[0x3 ];u8 log_hairpin_data_sz[0x5 ];@@ -2365,7 +2367,10 @@ struct mlx5_ifc_qpc_bits {u8 dc_access_key[0x40 ]; -u8 reserved_at_680[0xc0 ]; +u8 reserved_at_680[0x3 ]; +u8 dbr_umem_valid[0x1 ]; + +u8 reserved_at_684[0xbc ]; };struct mlx5_ifc_roce_addr_layout_bits {@@ -2465,7 +2470,7 @@ struct mlx5_ifc_xrc_srqc_bits {u8 wq_signature[0x1 ];u8 cont_srq[0x1 ]; -u8 reserved_at_22[0x1 ]; +u8 dbr_umem_valid[0x1 ];u8 rlky[0x1 ];u8 basic_cyclic_rcv_wqe[0x1 ];u8 log_rq_stride[0x3 ];@@ -3129,7 +3134,9 @@ enum {struct mlx5_ifc_cqc_bits {u8 status[0x4 ]; -u8 reserved_at_4[0x4 ]; +u8 reserved_at_4[0x2 ]; +u8 dbr_umem_valid[0x1 ]; +u8 reserved_at_7[0x1 ];u8 cqe_sz[0x3 ];u8 cc[0x1 ];u8 reserved_at_c[0x1 ];@@ -5315,7 +5322,7 @@ struct mlx5_ifc_modify_tis_bitmask_bits {struct mlx5_ifc_modify_tis_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];@@ -5354,7 +5361,7 @@ struct mlx5_ifc_modify_tir_out_bits {struct mlx5_ifc_modify_tir_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];@@ -5455,7 +5462,7 @@ struct mlx5_ifc_rqt_bitmask_bits {struct mlx5_ifc_modify_rqt_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];@@ -5642,7 +5649,10 @@ struct mlx5_ifc_modify_cq_in_bits {struct mlx5_ifc_cqc_bits cq_context; -u8 reserved_at_280[0x600 ]; +u8 reserved_at_280[0x40 ]; + +u8 cq_umem_valid[0x1 ]; +u8 reserved_at_2c1[0x5bf ];u8 pas[0 ][0x40 ]; };@@ -5963,7 +5973,7 @@ struct mlx5_ifc_detach_from_mcg_out_bits {struct mlx5_ifc_detach_from_mcg_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];@@ -6031,7 +6041,7 @@ struct mlx5_ifc_destroy_tis_out_bits {struct mlx5_ifc_destroy_tis_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];@@ -6053,7 +6063,7 @@ struct mlx5_ifc_destroy_tir_out_bits {struct mlx5_ifc_destroy_tir_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];@@ -6143,7 +6153,7 @@ struct mlx5_ifc_destroy_rqt_out_bits {struct mlx5_ifc_destroy_rqt_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];@@ -6508,7 +6518,7 @@ struct mlx5_ifc_dealloc_xrcd_out_bits {struct mlx5_ifc_dealloc_xrcd_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];@@ -6596,7 +6606,7 @@ struct mlx5_ifc_dealloc_pd_out_bits {struct mlx5_ifc_dealloc_pd_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];@@ -6675,7 +6685,9 @@ struct mlx5_ifc_create_xrc_srq_in_bits {struct mlx5_ifc_xrc_srqc_bits xrc_srq_context_entry; -u8 reserved_at_280[0x600 ]; +u8 reserved_at_280[0x40 ]; +u8 xrc_srq_umem_valid[0x1 ]; +u8 reserved_at_2c1[0x5bf ];u8 pas[0 ][0x40 ]; };@@ -6694,7 +6706,7 @@ struct mlx5_ifc_create_tis_out_bits {struct mlx5_ifc_create_tis_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];@@ -6718,7 +6730,7 @@ struct mlx5_ifc_create_tir_out_bits {struct mlx5_ifc_create_tir_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];@@ -6824,7 +6836,7 @@ struct mlx5_ifc_create_rqt_out_bits {struct mlx5_ifc_create_rqt_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];@@ -6909,7 +6921,10 @@ struct mlx5_ifc_create_qp_in_bits {struct mlx5_ifc_qpc_bits qpc; -u8 reserved_at_800[0x80 ]; +u8 reserved_at_800[0x60 ]; + +u8 wq_umem_valid[0x1 ]; +u8 reserved_at_861[0x1f ];u8 pas[0 ][0x40 ]; };@@ -6971,7 +6986,8 @@ struct mlx5_ifc_create_mkey_in_bits {u8 reserved_at_40[0x20 ];u8 pg_access[0x1 ]; -u8 reserved_at_61[0x1f ]; +u8 mkey_umem_valid[0x1 ]; +u8 reserved_at_62[0x1e ];struct mlx5_ifc_mkc_bits memory_key_mkey_entry;@@ -7174,7 +7190,10 @@ struct mlx5_ifc_create_cq_in_bits {struct mlx5_ifc_cqc_bits cq_context; -u8 reserved_at_280[0x600 ]; +u8 reserved_at_280[0x60 ]; + +u8 cq_umem_valid[0x1 ]; +u8 reserved_at_2e1[0x59f ];u8 pas[0 ][0x40 ]; };@@ -7222,7 +7241,7 @@ struct mlx5_ifc_attach_to_mcg_out_bits {struct mlx5_ifc_attach_to_mcg_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];@@ -7349,7 +7368,7 @@ struct mlx5_ifc_alloc_xrcd_out_bits {struct mlx5_ifc_alloc_xrcd_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];@@ -7437,7 +7456,7 @@ struct mlx5_ifc_alloc_pd_out_bits {struct mlx5_ifc_alloc_pd_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ]; --2.14.4
Re: [PATCH mlx5-next v1 7/7] net/mlx5: Update mlx5_ifc with DEVX UID bits
In reply to Leon RomanovskyQuoted 2 lines · Leon Romanovsky
Add DEVX information to WQ, SRQ, CQ, TRI, TIS, QP, RQ, XRCD, PD, MKEY and MCG.
typo - TRI --> TIR
"DEVX information" is a bit cryptic - what does xxx_valid means for the devx use case (fw command is issued by devx process) - and what semantics does it have for non-devx callers -- e.g the Eth driver when they deal with tir/tis/etc
Explain and elaborate further at the change log
Or.
Quoted 4 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
Set uid as part of various IB commands so that the firmware can manage the IB object in a secured way.
This series deals with FS core and commands used by the Ethernet driver
Quoted 4 lines
net/mlx5: Update
mlx5_ifcwith DEVX UID bits
net/mlx5: Set uid as part of CQ commands
net/mlx5: Set uid as part of RQ commands
net/mlx5: Set uid as part of SQ commands
such as the life-cycle (create, modify, destroy) of objects like:
RQ/SQ/CQ/etc --
saying IB commands is inaccurate, please be more precise
Quoted 3 lines
The firmware should mark this IB object with the given uid so that it can be used later on only by objects with the same uid.
these are not IB objects, but rather Ethernet objects
Quoted 3 lines
Upon DEVX flows that use this objec, the pointed object must have the same uid as of the issuer uid command.
typo - objec --> object
Quoted 10 lines
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.
Thanks
net/mlx5: Set uid as part of SRQ commands
net/mlx5: Set uid as part of DCT commands
net/mlx5: Set uid as part of QP commands
Quoted 26 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
Changelog
v0->v1:
* Update commit messages
* Split DevX series to small sub-series.
* Change static initialization from {0} to be {}Set uid as part of various IB commands so that the firmware can manage the IB object in a secured way.
The firmware should mark this IB object 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 objec, the pointed object 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.
Thanks
Leon Romanovsky (1):
net/mlx5: Updatemlx5_ifcwith DEVX UID bits
Quoted 7 lines
Yishai Hadas (6):
net/mlx5: Set uid as part of CQ commands
net/mlx5: Set uid as part of QP commands
net/mlx5: Set uid as part of RQ commands
net/mlx5: Set uid as part of SQ commands
net/mlx5: Set uid as part of SRQ commands
net/mlx5: Set uid as part of DCT commands
This and the next series look OK to me. Let me know when it is applied to the mlx branch
Thanks,
Jason
Quoted 35 lines · Jason Gunthorpe
Quoted 26 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
Changelog
v0->v1:
* Update commit messages
* Split DevX series to small sub-series.
* Change static initialization from {0} to be {}Set uid as part of various IB commands so that the firmware can manage the IB object in a secured way.
The firmware should mark this IB object 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 objec, the pointed object 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.
Thanks
Leon Romanovsky (1):
net/mlx5: Updatemlx5_ifcwith DEVX UID bitsQuoted 7 lines
Yishai Hadas (6):
net/mlx5: Set uid as part of CQ commands
net/mlx5: Set uid as part of QP commands
net/mlx5: Set uid as part of RQ commands
net/mlx5: Set uid as part of SQ commands
net/mlx5: Set uid as part of SRQ commands
net/mlx5: Set uid as part of DCT commands
Quoted 2 lines
This and the next series look OK to me. Let me know when it is applied to the mlx branch
Applied after fixing Or's comments (typo and extra description in last patch).
bd37197554eb net/mlx5: Update mlx5_ifc with DEVX UID bits 774ea6eea290 net/mlx5: Set uid as part of DCT commands a0d8c0543189 net/mlx5: Set uid as part of SRQ commands 430ae0d5a3ce net/mlx5: Set uid as part of SQ commands d269b3afffcb net/mlx5: Set uid as part of RQ commands 4ac63ec72587 net/mlx5: Set uid as part of QP commands 9ba481e2eb3b net/mlx5: Set uid as part of CQ commands
Thanks
Quoted 3 lines
Thanks,
Jason