From patchwork Thu Jun 16 14:35:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: oulijun X-Patchwork-Id: 636451 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3rVlyM5y8Rz9sCY for ; Fri, 17 Jun 2016 00:24:43 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754896AbcFPOXk (ORCPT ); Thu, 16 Jun 2016 10:23:40 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:2331 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754776AbcFPOX3 (ORCPT ); Thu, 16 Jun 2016 10:23:29 -0400 Received: from 172.24.1.136 (EHLO szxeml432-hub.china.huawei.com) ([172.24.1.136]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DMI20458; Thu, 16 Jun 2016 22:23:26 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by szxeml432-hub.china.huawei.com (10.82.67.209) with Microsoft SMTP Server id 14.3.235.1; Thu, 16 Jun 2016 22:23:13 +0800 From: Lijun Ou To: , , , , , , CC: , , , , , , , , , , , Subject: [PATCH v10 20/22] IB/hns: Add operation for getting immutable port Date: Thu, 16 Jun 2016 22:35:28 +0800 Message-ID: <1466087730-54856-21-git-send-email-oulijun@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466087730-54856-1-git-send-email-oulijun@huawei.com> References: <1466087730-54856-1-git-send-email-oulijun@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.71.200.31] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090204.5762B65F.0006, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 6451fb6607df50e668e5535d3a1f5e3e Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch added a new verbs that is getting port immutable. It is added in the 4.5 kernel and latest. It is necessary to solve the fail questions for registering ib device. Signed-off-by: Wei Hu Signed-off-by: Lijun Ou --- PATCH v9: - No change over the PATCH v8 PATCH v8: - The initial patch --- --- drivers/infiniband/hw/hns/hns_roce_main.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c index 3a14c64..27c2650 100644 --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c @@ -571,6 +571,25 @@ static int hns_roce_mmap(struct ib_ucontext *context, return 0; } +static int hns_roce_port_immutable(struct ib_device *ib_dev, u8 port_num, + struct ib_port_immutable *immutable) +{ + struct ib_port_attr attr; + int ret; + + ret = hns_roce_query_port(ib_dev, port_num, &attr); + if (ret) + return ret; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + + immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE; + immutable->max_mad_size = IB_MGMT_MAD_SIZE; + + return 0; +} + static void hns_roce_unregister_device(struct hns_roce_dev *hr_dev) { struct hns_roce_ib_iboe *iboe = &hr_dev->iboe; @@ -656,6 +675,9 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev) ib_dev->reg_user_mr = hns_roce_reg_user_mr; ib_dev->dereg_mr = hns_roce_dereg_mr; + /* OTHERS */ + ib_dev->get_port_immutable = hns_roce_port_immutable; + ret = ib_register_device(ib_dev, NULL); if (ret) { dev_err(dev, "ib_register_device failed!\n");