From patchwork Tue Jan 5 10:43:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gal Pressman X-Patchwork-Id: 11998633 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=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT 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 23E98C433E0 for ; Tue, 5 Jan 2021 10:44:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DC3C722525 for ; Tue, 5 Jan 2021 10:44:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728193AbhAEKon (ORCPT ); Tue, 5 Jan 2021 05:44:43 -0500 Received: from smtp-fw-4101.amazon.com ([72.21.198.25]:53674 "EHLO smtp-fw-4101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727764AbhAEKon (ORCPT ); Tue, 5 Jan 2021 05:44:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1609843482; x=1641379482; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KxmLL+Dg7ZM+ZqvgEhTuozX8RS69ga7QDPlsyuFx3x0=; b=VpUsQuNPNqlFMD9OzeF7iRJIfLiHI9mi/ZaeOBFNfWYDs9vQJ+Q7J9mJ i62WOtgircb8z1qGQn7VJhRsssFPbcEsjyV2O2iznFdBVCHNpSPvf/qOg EpfukVDPJ6Upjh9nBpP6X8SBQb/D/LjPjqJ0u+PWvSW/Wh8+aOqeTKiPX 4=; X-IronPort-AV: E=Sophos;i="5.78,476,1599523200"; d="scan'208";a="73134946" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-out-4101.iad4.amazon.com with ESMTP; 05 Jan 2021 10:43:54 +0000 Received: from EX13D13EUB002.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com (Postfix) with ESMTPS id D613EA2355; Tue, 5 Jan 2021 10:43:53 +0000 (UTC) Received: from EX13MTAUWB001.ant.amazon.com (10.43.161.207) by EX13D13EUB002.ant.amazon.com (10.43.166.205) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 5 Jan 2021 10:43:52 +0000 Received: from 8c85908914bf.ant.amazon.com (10.1.212.6) by mail-relay.amazon.com (10.43.161.249) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 5 Jan 2021 10:43:48 +0000 From: Gal Pressman To: Jason Gunthorpe , Doug Ledford CC: , Alexander Matushevsky , Gal Pressman , Firas JahJah , Leonid Feschuk , Yossi Leybovich Subject: [PATCH for-next 1/2] RDMA/efa: Move host info set to first ucontext allocation Date: Tue, 5 Jan 2021 12:43:25 +0200 Message-ID: <20210105104326.67895-2-galpress@amazon.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210105104326.67895-1-galpress@amazon.com> References: <20210105104326.67895-1-galpress@amazon.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Downstream patch will require the userspace version which is passed as part of ucontext allocation. Move the host info set there and make sure it's only called once (on the first allocation). Reviewed-by: Firas JahJah Reviewed-by: Leonid Feschuk Signed-off-by: Gal Pressman --- drivers/infiniband/hw/efa/efa.h | 7 +++++++ drivers/infiniband/hw/efa/efa_main.c | 4 +--- drivers/infiniband/hw/efa/efa_verbs.c | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/efa/efa.h b/drivers/infiniband/hw/efa/efa.h index e5d9712e98c4..9c9cd5867489 100644 --- a/drivers/infiniband/hw/efa/efa.h +++ b/drivers/infiniband/hw/efa/efa.h @@ -45,6 +45,11 @@ struct efa_stats { atomic64_t keep_alive_rcvd; }; +enum { + EFA_FLAGS_HOST_INFO_SET_BIT, + EFA_FLAGS_NUM, +}; + struct efa_dev { struct ib_device ibdev; struct efa_com_dev edev; @@ -62,6 +67,7 @@ struct efa_dev { struct efa_irq admin_irq; struct efa_stats stats; + DECLARE_BITMAP(flags, EFA_FLAGS_NUM); }; struct efa_ucontext { @@ -117,6 +123,7 @@ struct efa_ah { u8 id[EFA_GID_SIZE]; }; +void efa_set_host_info(struct efa_dev *dev); int efa_query_device(struct ib_device *ibdev, struct ib_device_attr *props, struct ib_udata *udata); diff --git a/drivers/infiniband/hw/efa/efa_main.c b/drivers/infiniband/hw/efa/efa_main.c index 0f578734bddb..90a033a6af6c 100644 --- a/drivers/infiniband/hw/efa/efa_main.c +++ b/drivers/infiniband/hw/efa/efa_main.c @@ -191,7 +191,7 @@ static void efa_stats_init(struct efa_dev *dev) atomic64_set(s, 0); } -static void efa_set_host_info(struct efa_dev *dev) +void efa_set_host_info(struct efa_dev *dev) { struct efa_admin_set_feature_resp resp = {}; struct efa_admin_set_feature_cmd cmd = {}; @@ -301,8 +301,6 @@ static int efa_ib_device_add(struct efa_dev *dev) if (err) goto err_release_doorbell_bar; - efa_set_host_info(dev); - dev->ibdev.node_type = RDMA_NODE_UNSPECIFIED; dev->ibdev.phys_port_cnt = 1; dev->ibdev.num_comp_vectors = 1; diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c index 2fe5708b2d9d..5c12bdc28ef0 100644 --- a/drivers/infiniband/hw/efa/efa_verbs.c +++ b/drivers/infiniband/hw/efa/efa_verbs.c @@ -1695,6 +1695,9 @@ int efa_alloc_ucontext(struct ib_ucontext *ibucontext, struct ib_udata *udata) goto err_out; } + if (!test_and_set_bit(EFA_FLAGS_HOST_INFO_SET_BIT, dev->flags)) + efa_set_host_info(dev); + err = efa_user_comp_handshake(ibucontext, &cmd); if (err) goto err_out; From patchwork Tue Jan 5 10:43:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gal Pressman X-Patchwork-Id: 11998635 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=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT 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 9F130C433E0 for ; Tue, 5 Jan 2021 10:44:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E0AE22515 for ; Tue, 5 Jan 2021 10:44:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728877AbhAEKou (ORCPT ); Tue, 5 Jan 2021 05:44:50 -0500 Received: from smtp-fw-9103.amazon.com ([207.171.188.200]:58611 "EHLO smtp-fw-9103.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728699AbhAEKot (ORCPT ); Tue, 5 Jan 2021 05:44:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1609843488; x=1641379488; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=G/jeKD5ZhxL0iwCYgl+luUnKJ4C8novY2hUT7oDQmoM=; b=CLE4GWQEGCYXdOI+oeVlSRpIfEwXHv8hcQ67iMtkOPOl+fqGLetI5BOV ynH96zvjU1q5Spi8ERMrjgPzXfV2Z/iZrtlC0BdM52JTdw4noToPNtiS1 ps9llG1yBEARmiTxfZnWMjjWpd7GM8Nga01Rbz7wkRkLfMtdGDwDAWqfU A=; X-IronPort-AV: E=Sophos;i="5.78,476,1599523200"; d="scan'208";a="908238428" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2b-5bdc5131.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9103.sea19.amazon.com with ESMTP; 05 Jan 2021 10:44:01 +0000 Received: from EX13D13EUA004.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2b-5bdc5131.us-west-2.amazon.com (Postfix) with ESMTPS id E4F43A1CDF; Tue, 5 Jan 2021 10:44:00 +0000 (UTC) Received: from EX13MTAUWB001.ant.amazon.com (10.43.161.207) by EX13D13EUA004.ant.amazon.com (10.43.165.22) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 5 Jan 2021 10:43:59 +0000 Received: from 8c85908914bf.ant.amazon.com (10.1.212.6) by mail-relay.amazon.com (10.43.161.249) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 5 Jan 2021 10:43:55 +0000 From: Gal Pressman To: Jason Gunthorpe , Doug Ledford CC: , Alexander Matushevsky , Gal Pressman , Firas JahJah , Leonid Feschuk , Yossi Leybovich , Jason Gunthorpe Subject: [PATCH for-next 2/2] RDMA/efa: Report userspace version in host info Date: Tue, 5 Jan 2021 12:43:26 +0200 Message-ID: <20210105104326.67895-3-galpress@amazon.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210105104326.67895-1-galpress@amazon.com> References: <20210105104326.67895-1-galpress@amazon.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Report the userspace version in the host information set feature admin command. Reviewed-by: Firas JahJah Reviewed-by: Leonid Feschuk Signed-off-by: Gal Pressman --- drivers/infiniband/hw/efa/efa.h | 2 +- drivers/infiniband/hw/efa/efa_admin_cmds_defs.h | 3 +++ drivers/infiniband/hw/efa/efa_main.c | 4 +++- drivers/infiniband/hw/efa/efa_verbs.c | 2 +- include/uapi/rdma/efa-abi.h | 3 ++- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/efa/efa.h b/drivers/infiniband/hw/efa/efa.h index 9c9cd5867489..e554b53997c4 100644 --- a/drivers/infiniband/hw/efa/efa.h +++ b/drivers/infiniband/hw/efa/efa.h @@ -123,7 +123,7 @@ struct efa_ah { u8 id[EFA_GID_SIZE]; }; -void efa_set_host_info(struct efa_dev *dev); +void efa_set_host_info(struct efa_dev *dev, u8 *userspace_ver); int efa_query_device(struct ib_device *ibdev, struct ib_device_attr *props, struct ib_udata *udata); diff --git a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h index b199e4ac6cf9..0822a5d5dcb6 100644 --- a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h +++ b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h @@ -884,6 +884,9 @@ struct efa_admin_host_info { * 31:2 : reserved2 */ u32 flags; + + /* Userspace version */ + u8 userspace_ver[32]; }; /* create_qp_cmd */ diff --git a/drivers/infiniband/hw/efa/efa_main.c b/drivers/infiniband/hw/efa/efa_main.c index 90a033a6af6c..027f9d0ebf25 100644 --- a/drivers/infiniband/hw/efa/efa_main.c +++ b/drivers/infiniband/hw/efa/efa_main.c @@ -191,7 +191,7 @@ static void efa_stats_init(struct efa_dev *dev) atomic64_set(s, 0); } -void efa_set_host_info(struct efa_dev *dev) +void efa_set_host_info(struct efa_dev *dev, u8 *userspace_ver) { struct efa_admin_set_feature_resp resp = {}; struct efa_admin_set_feature_cmd cmd = {}; @@ -230,6 +230,8 @@ void efa_set_host_info(struct efa_dev *dev) EFA_COMMON_SPEC_VERSION_MINOR); EFA_SET(&hinf->flags, EFA_ADMIN_HOST_INFO_INTREE, 1); EFA_SET(&hinf->flags, EFA_ADMIN_HOST_INFO_GDR, 0); + strlcpy(hinf->userspace_ver, userspace_ver, + sizeof(hinf->userspace_ver)); efa_com_set_feature_ex(&dev->edev, &resp, &cmd, EFA_ADMIN_HOST_INFO, hinf_dma, bufsz); diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c index 5c12bdc28ef0..d3e3787a9e1e 100644 --- a/drivers/infiniband/hw/efa/efa_verbs.c +++ b/drivers/infiniband/hw/efa/efa_verbs.c @@ -1696,7 +1696,7 @@ int efa_alloc_ucontext(struct ib_ucontext *ibucontext, struct ib_udata *udata) } if (!test_and_set_bit(EFA_FLAGS_HOST_INFO_SET_BIT, dev->flags)) - efa_set_host_info(dev); + efa_set_host_info(dev, cmd.userspace_ver); err = efa_user_comp_handshake(ibucontext, &cmd); if (err) diff --git a/include/uapi/rdma/efa-abi.h b/include/uapi/rdma/efa-abi.h index f89fbb5b1e8d..28a8e3f982a0 100644 --- a/include/uapi/rdma/efa-abi.h +++ b/include/uapi/rdma/efa-abi.h @@ -27,7 +27,8 @@ enum { struct efa_ibv_alloc_ucontext_cmd { __u32 comp_mask; - __u8 reserved_20[4]; + __u8 userspace_ver[32]; + __u8 reserved_120[4]; }; enum efa_ibv_user_cmds_supp_udata {