lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 20 Sep 2018 07:51:27 +0300
From:   Leon Romanovsky <leon@...nel.org>
To:     Jason Gunthorpe <jgg@...pe.ca>
Cc:     Doug Ledford <dledford@...hat.com>,
        RDMA mailing list <linux-rdma@...r.kernel.org>,
        Yishai Hadas <yishaih@...lanox.com>,
        Saeed Mahameed <saeedm@...lanox.com>,
        linux-netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH mlx5-next 02/25] net/mlx5: Set uid as part of QP commands

On Wed, Sep 19, 2018 at 11:27:31AM -0600, Jason Gunthorpe wrote:
> On Mon, Sep 17, 2018 at 02:03:55PM +0300, Leon Romanovsky wrote:
> > From: Yishai Hadas <yishaih@...lanox.com>
> >
> > 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.
> >
> > Signed-off-by: Yishai Hadas <yishaih@...lanox.com>
> > Signed-off-by: Leon Romanovsky <leonro@...lanox.com>
> >  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(-)
> >
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/qp.c b/drivers/net/ethernet/mellanox/mlx5/core/qp.c
> > index 4ca07bfb6b14..04f72a1cdbcc 100644
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/qp.c
> > @@ -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)
>
> These should get touched by clang-format to follow the usual
> formatting for macros..

Thanks, we will do.

>
> Jason

Download attachment "signature.asc" of type "application/pgp-signature" (802 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ