Linux-RDMA Archive on lore.kernel.org
 help / color / Atom feed
From: liweihang <liweihang@huawei.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: "dledford@redhat.com" <dledford@redhat.com>,
	"jgg@ziepe.ca" <jgg@ziepe.ca>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	Linuxarm <linuxarm@huawei.com>
Subject: Re: [PATCH for-next 2/7] RDMA/hns: Refactor hns_roce_v2_set_hem()
Date: Mon, 27 Jul 2020 12:41:57 +0000
Message-ID: <21abb708ae414d90b24681809841ceaf@huawei.com> (raw)
In-Reply-To: <20200727105135.GC75549@unreal>

On 2020/7/27 18:51, Leon Romanovsky wrote:
> On Mon, Jul 27, 2020 at 04:10:44PM +0800, Weihang Li wrote:
>> The parts about preparing and sending mailbox to hardware is not strongly
>> related to other codes in hns_roce_v2_set_hem(), and can be encapsulated
>> into a separate function.
>>
>> Signed-off-by: Weihang Li <liweihang@huawei.com>
>> ---
>>  drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 45 +++++++++++++++++-------------
>>  1 file changed, 26 insertions(+), 19 deletions(-)
>>
>> diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
>> index 35d46b7..0eab92a 100644
>> --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
>> +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
>> @@ -3373,11 +3373,33 @@ static int get_op_for_set_hem(struct hns_roce_dev *hr_dev, u32 type,
>>  	return op + step_idx;
>>  }
>>
>> +static int set_hem_to_hw(struct hns_roce_dev *hr_dev, int obj, u64 bt_ba,
>> +			 u32 hem_type, int step_idx)
>> +{
>> +	struct hns_roce_cmd_mailbox *mailbox;
>> +	int ret;
>> +	int op;
>> +
>> +	op = get_op_for_set_hem(hr_dev, hem_type, step_idx);
>> +	if (op == -EINVAL)
>> +		return 0;
> 
> It is not how we write error checks "if (op < 0) return 0;"
> 
> Thanks
> 

Thanks for your comments, will modify it.

Weihang

  reply index

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-27  8:10 [PATCH for-next 0/7] RDMA/hns: Updates for kernel v5.8 Weihang Li
2020-07-27  8:10 ` [PATCH for-next 1/7] RDMA/hns: Remove redundant hardware opcode definitions Weihang Li
2020-07-27  8:10 ` [PATCH for-next 2/7] RDMA/hns: Refactor hns_roce_v2_set_hem() Weihang Li
2020-07-27 10:51   ` Leon Romanovsky
2020-07-27 12:41     ` liweihang [this message]
2020-07-27  8:10 ` [PATCH for-next 3/7] RDMA/hns: Remove support for HIP08A Weihang Li
2020-07-27  8:10 ` [PATCH for-next 4/7] RDMA/hns: Remove redundant parameters in set_rc_wqe() Weihang Li
2020-07-27  8:10 ` [PATCH for-next 5/7] RDMA/hns: Delete unnecessary memset when allocating VF resource Weihang Li
2020-07-27  8:10 ` [PATCH for-next 6/7] RDMA/hns: Fix error during modify qp RTS2RTS Weihang Li
2020-07-27  8:10 ` [PATCH for-next 7/7] RDMA/hns: Fix the unneeded process when getting a general type of CQE error Weihang Li

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=21abb708ae414d90b24681809841ceaf@huawei.com \
    --to=liweihang@huawei.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxarm@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

Linux-RDMA Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rdma/0 linux-rdma/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rdma linux-rdma/ https://lore.kernel.org/linux-rdma \
		linux-rdma@vger.kernel.org
	public-inbox-index linux-rdma

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rdma


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git