From patchwork Wed Feb 20 14:57:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 10822265 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 00257184E for ; Wed, 20 Feb 2019 14:58:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD7F72E620 for ; Wed, 20 Feb 2019 14:58:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D15CC2E7E4; Wed, 20 Feb 2019 14:58:02 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY 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 5E45B2E620 for ; Wed, 20 Feb 2019 14:58:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726557AbfBTO6B (ORCPT ); Wed, 20 Feb 2019 09:58:01 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:33032 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726219AbfBTO6A (ORCPT ); Wed, 20 Feb 2019 09:58:00 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 20 Feb 2019 16:57:55 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [10.7.2.17]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x1KEvs1k030844; Wed, 20 Feb 2019 16:57:54 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [127.0.0.1]) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8) with ESMTP id x1KEvsPR013380; Wed, 20 Feb 2019 16:57:54 +0200 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id x1KEvsrO013378; Wed, 20 Feb 2019 16:57:54 +0200 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, monis@mellanox.com, artemyko@mellanox.com, jgg@mellanox.com, majd@mellanox.com Subject: [PATCH rdma-core 1/6] verbs: Add xrc_odp_caps field to response of query_device Date: Wed, 20 Feb 2019 16:57:33 +0200 Message-Id: <1550674658-13295-2-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1550674658-13295-1-git-send-email-yishaih@mellanox.com> References: <1550674658-13295-1-git-send-email-yishaih@mellanox.com> 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 From: Moni Shoua ODP support is described by per-transport bit array, an array for XRC transport is added. In addition, ibv_devinfo was updated to report this capability. Signed-off-by: Moni Shoua Signed-off-by: Yishai Hadas --- libibverbs/cmd.c | 9 +++++++++ libibverbs/examples/devinfo.c | 7 +++++-- libibverbs/man/ibv_query_device_ex.3 | 1 + libibverbs/verbs.h | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c index 34c71e5..ec551e2 100644 --- a/libibverbs/cmd.c +++ b/libibverbs/cmd.c @@ -265,6 +265,15 @@ int ibv_cmd_query_device_ex(struct ibv_context *context, } } + if (attr_size >= offsetof(struct ibv_device_attr_ex, xrc_odp_caps) + + sizeof(attr->xrc_odp_caps)) { + if (resp->response_length >= + offsetof(struct ib_uverbs_ex_query_device_resp, xrc_odp_caps) + + sizeof(resp->xrc_odp_caps)) { + attr->xrc_odp_caps = resp->xrc_odp_caps; + } + } + return 0; } diff --git a/libibverbs/examples/devinfo.c b/libibverbs/examples/devinfo.c index 735adb1..75bdd8c 100644 --- a/libibverbs/examples/devinfo.c +++ b/libibverbs/examples/devinfo.c @@ -309,9 +309,10 @@ static void print_odp_trans_caps(uint32_t trans) } } -static void print_odp_caps(const struct ibv_odp_caps *caps) +static void print_odp_caps(const struct ibv_device_attr_ex *device_attr) { uint64_t unknown_general_caps = ~(IBV_ODP_SUPPORT); + const struct ibv_odp_caps *caps = &device_attr->odp_caps; /* general odp caps */ printf("\tgeneral_odp_caps:\n"); @@ -328,6 +329,8 @@ static void print_odp_caps(const struct ibv_odp_caps *caps) print_odp_trans_caps(caps->per_transport_caps.uc_odp_caps); printf("\tud_odp_caps:\n"); print_odp_trans_caps(caps->per_transport_caps.ud_odp_caps); + printf("\txrc_odp_caps:\n"); + print_odp_trans_caps(device_attr->xrc_odp_caps); } static void print_device_cap_flags_ex(uint64_t device_cap_flags_ex) @@ -531,7 +534,7 @@ static int print_hca_cap(struct ibv_device *ib_dev, uint8_t ib_port) printf("\tmax_pkeys:\t\t\t%d\n", device_attr.orig_attr.max_pkeys); printf("\tlocal_ca_ack_delay:\t\t%d\n", device_attr.orig_attr.local_ca_ack_delay); - print_odp_caps(&device_attr.odp_caps); + print_odp_caps(&device_attr); if (device_attr.completion_timestamp_mask) printf("\tcompletion timestamp_mask:\t\t\t0x%016" PRIx64 "\n", device_attr.completion_timestamp_mask); diff --git a/libibverbs/man/ibv_query_device_ex.3 b/libibverbs/man/ibv_query_device_ex.3 index 15a430d..3ad9eec 100644 --- a/libibverbs/man/ibv_query_device_ex.3 +++ b/libibverbs/man/ibv_query_device_ex.3 @@ -37,6 +37,7 @@ struct ibv_tm_caps tm_caps; /* Tag matching capabilities struct ibv_cq_moderation_caps cq_mod_caps; /* CQ moderation max capabilities */ uint64_t max_dm_size; /* Max Device Memory size (in bytes) available for allocation */ struct ibv_pci_atomic_caps atomic_caps; /* PCI atomic operations capabilities, use enum ibv_pci_atomic_op_size */ +uint32_t xrc_odp_caps; /* Mask with enum ibv_odp_transport_cap_bits to know which operations are supported. */ .in -8 }; diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 4cc8720..94e4916 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -325,6 +325,7 @@ struct ibv_device_attr_ex { struct ibv_cq_moderation_caps cq_mod_caps; uint64_t max_dm_size; struct ibv_pci_atomic_caps pci_atomic_caps; + uint32_t xrc_odp_caps; }; enum ibv_mtu {