From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA489C433DF for ; Mon, 27 Jul 2020 12:42:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 896182072E for ; Mon, 27 Jul 2020 12:42:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728458AbgG0MmA convert rfc822-to-8bit (ORCPT ); Mon, 27 Jul 2020 08:42:00 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:42768 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728362AbgG0MmA (ORCPT ); Mon, 27 Jul 2020 08:42:00 -0400 Received: from DGGEMM401-HUB.china.huawei.com (unknown [172.30.72.54]) by Forcepoint Email with ESMTP id 9EE12D196B7E3770873D; Mon, 27 Jul 2020 20:41:58 +0800 (CST) Received: from dggema752-chm.china.huawei.com (10.1.198.194) by DGGEMM401-HUB.china.huawei.com (10.3.20.209) with Microsoft SMTP Server (TLS) id 14.3.487.0; Mon, 27 Jul 2020 20:41:58 +0800 Received: from dggema753-chm.china.huawei.com (10.1.198.195) by dggema752-chm.china.huawei.com (10.1.198.194) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1913.5; Mon, 27 Jul 2020 20:41:57 +0800 Received: from dggema753-chm.china.huawei.com ([10.9.48.84]) by dggema753-chm.china.huawei.com ([10.9.48.84]) with mapi id 15.01.1913.007; Mon, 27 Jul 2020 20:41:57 +0800 From: liweihang To: Leon Romanovsky CC: "dledford@redhat.com" , "jgg@ziepe.ca" , "linux-rdma@vger.kernel.org" , Linuxarm Subject: Re: [PATCH for-next 2/7] RDMA/hns: Refactor hns_roce_v2_set_hem() Thread-Topic: [PATCH for-next 2/7] RDMA/hns: Refactor hns_roce_v2_set_hem() Thread-Index: AQHWY+2ZQom8feTowU6oGB6RPmNnTw== Date: Mon, 27 Jul 2020 12:41:57 +0000 Message-ID: <21abb708ae414d90b24681809841ceaf@huawei.com> References: <1595837449-29193-1-git-send-email-liweihang@huawei.com> <1595837449-29193-3-git-send-email-liweihang@huawei.com> <20200727105135.GC75549@unreal> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.40.168.149] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org 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 >> --- >> 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