public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: liweihang <liweihang@huawei.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: "dledford@redhat.com" <dledford@redhat.com>,
	"leon@kernel.org" <leon@kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linuxarm@openeuler.org" <linuxarm@openeuler.org>
Subject: Re: [PATCH for-next 2/5] RDMA/hns: Reorganize hns_roce_create_cq()
Date: Sat, 27 Mar 2021 01:29:25 +0000	[thread overview]
Message-ID: <30e76bdea14a4a7bb00ab3a4e7a7515c@huawei.com> (raw)
In-Reply-To: 20210326144016.GA844532@nvidia.com

On 2021/3/26 22:40, Jason Gunthorpe wrote:
> On Wed, Mar 17, 2021 at 05:09:40PM +0800, Weihang Li wrote:
>> From: Yixing Liu <liuyixing1@huawei.com>
>>
>> Encapsulate two subprocesses into functions.
>>
>> Signed-off-by: Yixing Liu <liuyixing1@huawei.com>
>> Signed-off-by: Weihang Li <liweihang@huawei.com>
>>  drivers/infiniband/hw/hns/hns_roce_cq.c | 87 ++++++++++++++++++++++-----------
>>  1 file changed, 59 insertions(+), 28 deletions(-)
>>
>> diff --git a/drivers/infiniband/hw/hns/hns_roce_cq.c b/drivers/infiniband/hw/hns/hns_roce_cq.c
>> index 74fc494..467caa9 100644
>> +++ b/drivers/infiniband/hw/hns/hns_roce_cq.c
>> @@ -276,6 +276,58 @@ static void free_cq_db(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq,
>>  	}
>>  }
>>  
>> +static int verify_cq_create_attr(struct hns_roce_dev *hr_dev,
>> +				 const struct ib_cq_init_attr *attr)
>> +{
>> +	struct ib_device *ibdev = &hr_dev->ib_dev;
>> +
>> +	if (!attr->cqe || attr->cqe > hr_dev->caps.max_cqes) {
>> +		ibdev_err(ibdev, "failed to check CQ count %u, max = %u.\n",
>> +			  attr->cqe, hr_dev->caps.max_cqes);
>> +		return -EINVAL;
>> +	}
>> +
>> +	if (attr->comp_vector >= hr_dev->caps.num_comp_vectors) {
>> +		ibdev_err(ibdev, "failed to check CQ vector = %u, max = %d.\n",
>> +			  attr->comp_vector, hr_dev->caps.num_comp_vectors);
>> +		return -EINVAL;
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>> +static int get_cq_ucmd(struct hns_roce_cq *hr_cq, struct ib_udata *udata,
>> +		       struct hns_roce_ib_create_cq *ucmd)
>> +{
>> +	struct ib_device *ibdev = hr_cq->ib_cq.device;
>> +	int ret;
>> +
>> +	ret = ib_copy_from_udata(ucmd, udata, min(udata->inlen,
>> +						  sizeof(*ucmd)));
> 
> Is this leading up to something? Wrapping one function in another is
> getting a bit silly
> 
> Jason
> 

Thanks, I will use a variable instead.

Weihang

  reply	other threads:[~2021-03-27  1:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17  9:09 [PATCH for-next 0/5] RDMA/hns: Refactor and reorganization Weihang Li
2021-03-17  9:09 ` [PATCH for-next 1/5] RDMA/hns: Refactor hns_roce_v2_poll_one() Weihang Li
2021-03-17  9:09 ` [PATCH for-next 2/5] RDMA/hns: Reorganize hns_roce_create_cq() Weihang Li
2021-03-26 14:40   ` Jason Gunthorpe
2021-03-27  1:29     ` liweihang [this message]
2021-03-17  9:09 ` [PATCH for-next 3/5] RDMA/hns: Refactor reset state checking flow Weihang Li
2021-03-17  9:09 ` [PATCH for-next 4/5] RDMA/hns: Reorganize process of setting HEM Weihang Li
2021-03-17  9:09 ` [PATCH for-next 5/5] RDMA/hns: Simplify command fields for HEM base address configuration Weihang Li
2021-03-26 14:47 ` [PATCH for-next 0/5] RDMA/hns: Refactor and reorganization Jason Gunthorpe
2021-03-27  1:40   ` liweihang

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=30e76bdea14a4a7bb00ab3a4e7a7515c@huawei.com \
    --to=liweihang@huawei.com \
    --cc=dledford@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxarm@openeuler.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox