All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Gal Pressman <galpress@amazon.com>
Cc: Lijun Ou <oulijun@huawei.com>,
	dledford@redhat.com, leon@kernel.org, linux-rdma@vger.kernel.org,
	linuxarm@huawei.com
Subject: Re: [PATCH for-next 01/13] RDMA/hns: Encapsulate some lines for setting sq size in user mode
Date: Tue, 30 Jul 2019 09:17:36 -0300	[thread overview]
Message-ID: <20190730121736.GA13921@ziepe.ca> (raw)
In-Reply-To: <01dace9b-593d-39dd-99e7-d8d60803949d@amazon.com>

On Tue, Jul 30, 2019 at 02:16:01PM +0300, Gal Pressman wrote:
> On 30/07/2019 11:56, Lijun Ou wrote:
> > It needs to check the sq size with integrity when configures
> > the relatived parameters of sq. Here moves the relatived code
> > into a special function.
> > 
> > Signed-off-by: Lijun Ou <oulijun@huawei.com>
> >  drivers/infiniband/hw/hns/hns_roce_qp.c | 29 ++++++++++++++++++++++-------
> >  1 file changed, 22 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c
> > index 9c272c2..35ef7e2 100644
> > +++ b/drivers/infiniband/hw/hns/hns_roce_qp.c
> > @@ -324,16 +324,12 @@ static int hns_roce_set_rq_size(struct hns_roce_dev *hr_dev,
> >  	return 0;
> >  }
> >  
> > -static int hns_roce_set_user_sq_size(struct hns_roce_dev *hr_dev,
> > -				     struct ib_qp_cap *cap,
> > -				     struct hns_roce_qp *hr_qp,
> > -				     struct hns_roce_ib_create_qp *ucmd)
> > +static int check_sq_size_with_integrity(struct hns_roce_dev *hr_dev,
> > +					struct ib_qp_cap *cap,
> > +					struct hns_roce_ib_create_qp *ucmd)
> >  {
> >  	u32 roundup_sq_stride = roundup_pow_of_two(hr_dev->caps.max_sq_desc_sz);
> >  	u8 max_sq_stride = ilog2(roundup_sq_stride);
> > -	u32 ex_sge_num;
> > -	u32 page_size;
> > -	u32 max_cnt;
> >  
> >  	/* Sanity check SQ size before proceeding */
> >  	if ((u32)(1 << ucmd->log_sq_bb_count) > hr_dev->caps.max_wqes ||
> > @@ -349,6 +345,25 @@ static int hns_roce_set_user_sq_size(struct hns_roce_dev *hr_dev,
> >  		return -EINVAL;
> >  	}
> >  
> > +	return 0;
> > +}
> > +
> > +static int hns_roce_set_user_sq_size(struct hns_roce_dev *hr_dev,
> > +				     struct ib_qp_cap *cap,
> > +				     struct hns_roce_qp *hr_qp,
> > +				     struct hns_roce_ib_create_qp *ucmd)
> > +{
> > +	u32 ex_sge_num;
> > +	u32 page_size;
> > +	u32 max_cnt;
> > +	int ret;
> > +
> > +	ret = check_sq_size_with_integrity(hr_dev, cap, ucmd);
> > +	if (ret) {
> > +		dev_err(hr_dev->dev, "Sanity check sq size fail\n");
> 
> Consider using ibdev_err, same applies for other patches.

It would be good if driver authors would convert their drivers to use
the new interfaces

Jason

  reply	other threads:[~2019-07-30 12:17 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-30  8:56 [PATCH for-next 00/13] Updates for 5.3-rc2 Lijun Ou
2019-07-30  8:56 ` [PATCH for-next 01/13] RDMA/hns: Encapsulate some lines for setting sq size in user mode Lijun Ou
2019-07-30 11:16   ` Gal Pressman
2019-07-30 12:17     ` Jason Gunthorpe [this message]
2019-07-30 13:37       ` oulijun
2019-07-30  8:56 ` [PATCH for-next 02/13] RDMA/hns: Optimize hns_roce_modify_qp function Lijun Ou
2019-07-30 11:19   ` Gal Pressman
2019-07-30 13:39     ` oulijun
2019-07-30  8:56 ` [PATCH for-next 03/13] RDMA/hns: Update the prompt message for creating and destroy qp Lijun Ou
2019-07-30  8:56 ` [PATCH for-next 04/13] RDMA/hns: Remove unnessary init for cmq reg Lijun Ou
2019-07-30  8:56 ` [PATCH for-next 05/13] RDMA/hns: Clean up unnecessary initial assignment Lijun Ou
2019-07-30  8:56 ` [PATCH for-next 06/13] RDMA/hns: Update some comments style Lijun Ou
2019-07-30  8:56 ` [PATCH for-next 07/13] RDMA/hns: Handling the error return value of hem function Lijun Ou
2019-07-30  8:56 ` [PATCH for-next 08/13] RDMA/hns: Split bool statement and assign statement Lijun Ou
2019-07-30  8:56 ` [PATCH for-next 09/13] RDMA/hns: Refactor irq request code Lijun Ou
2019-07-30  8:56 ` [PATCH for-next 10/13] RDMA/hns: Remove unnecessary kzalloc Lijun Ou
2019-07-30 13:40   ` Leon Romanovsky
2019-07-31  2:43     ` oulijun
2019-07-31  7:49       ` Leon Romanovsky
     [not found]         ` <fab1c105-b367-7ca7-fa2f-b46808ae1b24@huawei.com>
2019-07-31  9:59           ` Leon Romanovsky
2019-07-31 13:02             ` Jason Gunthorpe
2019-07-30  8:56 ` [PATCH for-next 11/13] RDMA/hns: Refactor hns_roce_v2_set_hem for hip08 Lijun Ou
2019-07-30  8:56 ` [PATCH for-next 12/13] RDMA/hns: Remove redundant print in hns_roce_v2_ceq_int() Lijun Ou
2019-07-30  8:56 ` [PATCH for-next 13/13] RDMA/hns: Disable alw_lcl_lpbk of SSU Lijun Ou
2019-07-30 12:33 ` [PATCH for-next 00/13] Updates for 5.3-rc2 Dennis Dalessandro
2019-07-30 13:41   ` oulijun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190730121736.GA13921@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=dledford@redhat.com \
    --cc=galpress@amazon.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=oulijun@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.