From patchwork Tue Oct 2 07:52:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10623151 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8760214BD for ; Tue, 2 Oct 2018 07:52:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86934286D3 for ; Tue, 2 Oct 2018 07:52:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A529286F3; Tue, 2 Oct 2018 07:52:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 017E0286D3 for ; Tue, 2 Oct 2018 07:52:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727285AbeJBOed (ORCPT ); Tue, 2 Oct 2018 10:34:33 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:54704 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726884AbeJBOed (ORCPT ); Tue, 2 Oct 2018 10:34:33 -0400 Received: by mail-wm1-f66.google.com with SMTP id r63-v6so1186426wma.4 for ; Tue, 02 Oct 2018 00:52:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=/A0YnIQQrlYchl+vmJ9ZsUddyn6RXJ1JFR56E8f2Pls=; b=RFC38kFBpdW+RrU9J+NM22LB02lm0h9EGTOaUJXXbc7XbRFfvSKjUlK7tB5ow3q0yn r74ZhNGLBB7ppl43lMfJmLPdNrMF1TbNMacSDVthV4R6zhrkyykJnrq/uChInmNZjgeb XqV8Optp1u48nijzFrXoYn1MnsZ8fIYtlfaiOZhtwecjGWnMIWptGh5TTrlkNqa4DJK9 FFCIaEwFmmbXpzidAuXSRjKo0sNGBgbQA3w9KlJ4lgdGPUMaQ+lNpz2NhtUYlXSQ2jBU 7eeFuKZrsS05VwJxuayoKbHxfwF7I0+Vfnlgfi5+UIZDXJ0KV6WK+ilW1Ome5T7DyP82 Zc8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/A0YnIQQrlYchl+vmJ9ZsUddyn6RXJ1JFR56E8f2Pls=; b=sBYkIBYev41I8mVO3AitbwkUIAKt2UrNkPOdXMjosuRbeIIlwERsbRcVWgjWihxj1e vWYtSKaMp/iOBGdRFymevTLJtaZrtU3zKJx7jNfzt2ImWAckOzMJelZlUFlTFNETUZa/ 90XkuT1XcgOLu7xUN5JZYRtHVwfvnymWlGcJlpoQLnDHYTlR0Qf7j0A+V74PCYWa9wfb vyTvIa8ocjIsrz2YCMhQ+TF7QTWLjociMQvrSv7hhDXEGtPrGr7H1qXvY4kgK//gOKhR q9BUp+PnLxvbLZTwGitwpGv1SxmK1FliEqlgvc71YC1rfsLUA6rorLxL6qyRFtc5ENGC 69QQ== X-Gm-Message-State: ABuFfogkwJGtld+vvqr9U2g4P0EjzEnIPNZLiftxp47uvFZwvdNsb9zU oydq3DHmfLuHp7tzdJgEYnc= X-Google-Smtp-Source: ACcGV60Yh3XVqhIe35HX6+lIZhrSGOh8Y2l5xpmSiGRFJNdTPvWGYQlya0X65jzcDGAj9Xt3ghZSIA== X-Received: by 2002:a1c:ac82:: with SMTP id v124-v6mr1006127wme.10.1538466755576; Tue, 02 Oct 2018 00:52:35 -0700 (PDT) Received: from kheib-workstation.redhat.com ([192.116.94.216]) by smtp.gmail.com with ESMTPSA id 20-v6sm16062748wml.10.2018.10.02.00.52.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Oct 2018 00:52:35 -0700 (PDT) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, kamalheib1@gmail.com Subject: [PATCH rdma-next] RDMA: Adding a new device managed gids cap Date: Tue, 2 Oct 2018 10:52:12 +0300 Message-Id: <20181002075212.20729-1-kamalheib1@gmail.com> X-Mailer: git-send-email 2.14.4 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To avoid checking if add_gid() and del_gid() are implemented adding a new device cap flag that will indicate whether a specific device does support managing his RoCE GIDs table or not. Signed-off-by: Kamal Heib --- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 3 ++- drivers/infiniband/hw/hns/hns_roce_main.c | 3 ++- drivers/infiniband/hw/mlx4/main.c | 3 ++- drivers/infiniband/hw/mlx5/main.c | 3 ++- drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c | 3 ++- include/rdma/ib_verbs.h | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c index bc2b9e038439..50d77ca23d76 100644 --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c @@ -165,7 +165,8 @@ int bnxt_re_query_device(struct ib_device *ibdev, | IB_DEVICE_N_NOTIFY_CQ | IB_DEVICE_MEM_WINDOW | IB_DEVICE_MEM_WINDOW_TYPE_2B - | IB_DEVICE_MEM_MGT_EXTENSIONS; + | IB_DEVICE_MEM_MGT_EXTENSIONS + | IB_DEVICE_MANAGED_GIDS; ib_attr->max_send_sge = dev_attr->max_qp_sges; ib_attr->max_recv_sge = dev_attr->max_qp_sges; ib_attr->max_sge_rd = dev_attr->max_qp_sges; diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c index 8c5160ec3a4d..63d64e1166a5 100644 --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c @@ -205,7 +205,8 @@ static int hns_roce_query_device(struct ib_device *ib_dev, props->max_qp = hr_dev->caps.num_qps; props->max_qp_wr = hr_dev->caps.max_wqes; props->device_cap_flags = IB_DEVICE_PORT_ACTIVE_EVENT | - IB_DEVICE_RC_RNR_NAK_GEN; + IB_DEVICE_RC_RNR_NAK_GEN | + IB_DEVICE_MANAGED_GIDS; props->max_send_sge = hr_dev->caps.max_sq_sg; props->max_recv_sge = hr_dev->caps.max_rq_sg; props->max_sge_rd = 1; diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index fa5d20eccc21..546028129fef 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c @@ -471,7 +471,8 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, IB_DEVICE_PORT_ACTIVE_EVENT | IB_DEVICE_SYS_IMAGE_GUID | IB_DEVICE_RC_RNR_NAK_GEN | - IB_DEVICE_BLOCK_MULTICAST_LOOPBACK; + IB_DEVICE_BLOCK_MULTICAST_LOOPBACK | + IB_DEVICE_MANAGED_GIDS; if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR) props->device_cap_flags |= IB_DEVICE_BAD_PKEY_CNTR; if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 597cd3c171c9..814a17e229bf 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -765,7 +765,8 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, props->device_cap_flags = IB_DEVICE_CHANGE_PHY_PORT | IB_DEVICE_PORT_ACTIVE_EVENT | IB_DEVICE_SYS_IMAGE_GUID | - IB_DEVICE_RC_RNR_NAK_GEN; + IB_DEVICE_RC_RNR_NAK_GEN | + IB_DEVICE_MANAGED_GIDS; if (MLX5_CAP_GEN(mdev, pkv)) props->device_cap_flags |= IB_DEVICE_BAD_PKEY_CNTR; diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c index b65d10b0a875..792edfb796ad 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c @@ -113,7 +113,8 @@ int pvrdma_query_device(struct ib_device *ibdev, } props->device_cap_flags |= IB_DEVICE_PORT_ACTIVE_EVENT | - IB_DEVICE_RC_RNR_NAK_GEN; + IB_DEVICE_RC_RNR_NAK_GEN | + IB_DEVICE_MANAGED_GIDS; return 0; } diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 9897d2329f2c..402320958172 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -241,6 +241,7 @@ enum ib_device_cap_flags { IB_DEVICE_RDMA_NETDEV_OPA_VNIC = (1ULL << 35), /* The device supports padding incoming writes to cacheline. */ IB_DEVICE_PCI_WRITE_END_PADDING = (1ULL << 36), + IB_DEVICE_MANAGED_GIDS = (1ULL << 37), }; enum ib_signature_prot_cap { @@ -3094,7 +3095,7 @@ static inline bool rdma_cap_roce_gid_table(const struct ib_device *device, u8 port_num) { return rdma_protocol_roce(device, port_num) && - device->add_gid && device->del_gid; + (device->attrs.device_cap_flags & IB_DEVICE_MANAGED_GIDS); } /*