Re: [PATCH rdma-rc] RDMA/mlx4: Ensure that maximal send/receive SGE less than supported by HW

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 03, 2018 at 12:58:38PM +0300, Yuval Shaia wrote:
> On Mon, Sep 03, 2018 at 09:11:14AM +0300, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> >
> > In calculating the global maximum number of the Scatter/Gather elements
> > supported, the following four maximum parameters must be taken into
> > consideration: max_sg_rq, max_sg_sq, max_desc_sz_rq and max_desc_sz_sq.
> >
> > However instead of bringing this complexity to query_device, which still
> > won't be sufficient anyway (the calculations are dependent on QP type),
> > the safer approach will be to restore old code, which will give us 32
> > SGEs.
> >
> > Fixes: 33023fb85a42 ("IB/core: add max_send_sge and max_recv_sge attributes")
> > Reported-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
> > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> > ---
> >  drivers/infiniband/hw/mlx4/main.c | 8 +++++---
> >  1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
> > index ca0f1ee26091..0bbeaaae47e0 100644
> > --- a/drivers/infiniband/hw/mlx4/main.c
> > +++ b/drivers/infiniband/hw/mlx4/main.c
> > @@ -517,9 +517,11 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
> >  	props->page_size_cap	   = dev->dev->caps.page_size_cap;
> >  	props->max_qp		   = dev->dev->quotas.qp;
> >  	props->max_qp_wr	   = dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE;
> > -	props->max_send_sge	   = dev->dev->caps.max_sq_sg;
> > -	props->max_recv_sge	   = dev->dev->caps.max_rq_sg;
> > -	props->max_sge_rd	   = MLX4_MAX_SGE_RD;
> > +	props->max_send_sge =
> > +		min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg);
> > +	props->max_recv_sge =
> > +		min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg);
>
> We can just do:
> 	props->max_recv_sge = props->max_send_sge
>
> right?

Yes, compiler will do it.

Thanks

>
> > +	props->max_sge_rd = MLX4_MAX_SGE_RD;
> >  	props->max_cq		   = dev->dev->quotas.cq;
> >  	props->max_cqe		   = dev->dev->caps.max_cqes;
> >  	props->max_mr		   = dev->dev->quotas.mpt;
> > --
> > 2.14.4
> >

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux