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=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 8B9F6C47083 for ; Thu, 3 Jun 2021 03:12:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7292461263 for ; Thu, 3 Jun 2021 03:12:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229629AbhFCDOB convert rfc822-to-8bit (ORCPT ); Wed, 2 Jun 2021 23:14:01 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:7079 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229611AbhFCDOA (ORCPT ); Wed, 2 Jun 2021 23:14:00 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4FwW8V0xfhzYnVj; Thu, 3 Jun 2021 11:09:30 +0800 (CST) Received: from dggpeml100021.china.huawei.com (7.185.36.148) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 3 Jun 2021 11:12:15 +0800 Received: from dggema753-chm.china.huawei.com (10.1.198.195) by dggpeml100021.china.huawei.com (7.185.36.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Thu, 3 Jun 2021 11:12:14 +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.2176.012; Thu, 3 Jun 2021 11:12:14 +0800 From: liweihang To: Leon Romanovsky CC: "dledford@redhat.com" , "jgg@nvidia.com" , "linux-rdma@vger.kernel.org" , Linuxarm , "wangxi (M)" Subject: Re: [PATCH for-next 1/2] RDMA/hns: Refactor hns uar mmap flow Thread-Topic: [PATCH for-next 1/2] RDMA/hns: Refactor hns uar mmap flow Thread-Index: AQHXU6KIYF57APVpj02AMxmljmiQ3A== Date: Thu, 3 Jun 2021 03:12:14 +0000 Message-ID: <2fd072cd42804bc9aa2948123fcf48cf@huawei.com> References: <1622193545-3281-1-git-send-email-liweihang@huawei.com> <1622193545-3281-2-git-send-email-liweihang@huawei.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.67.100.165] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On 2021/6/2 19:16, Leon Romanovsky wrote: > On Fri, May 28, 2021 at 05:19:04PM +0800, Weihang Li wrote: >> From: Xi Wang >> >> Classify the uar address by wrapping the uar type and start page as offset >> for hns rdma io mmap. >> >> Signed-off-by: Xi Wang >> Signed-off-by: Weihang Li >> --- >> drivers/infiniband/hw/hns/hns_roce_main.c | 27 ++++++++++++++++++++++++--- >> include/uapi/rdma/hns-abi.h | 4 ++++ >> 2 files changed, 28 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c >> index 6c6e82b..00dbbf1 100644 >> --- a/drivers/infiniband/hw/hns/hns_roce_main.c >> +++ b/drivers/infiniband/hw/hns/hns_roce_main.c >> @@ -338,12 +338,23 @@ static void hns_roce_dealloc_ucontext(struct ib_ucontext *ibcontext) >> hns_roce_uar_free(to_hr_dev(ibcontext->device), &context->uar); >> } >> >> -static int hns_roce_mmap(struct ib_ucontext *context, >> - struct vm_area_struct *vma) >> +/* command value is offset[15:8] */ >> +static inline int hns_roce_mmap_get_command(unsigned long offset) >> +{ >> + return (offset >> 8) & 0xff; >> +} >> + >> +/* index value is offset[63:16] | offset[7:0] */ >> +static inline unsigned long hns_roce_mmap_get_index(unsigned long offset) >> +{ >> + return ((offset >> 16) << 8) | (offset & 0xff); >> +} > > Let's follow the common practice and don't introduce inline functions in .c files. > > Thanks > Sure, thanks. Weihang