Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3093980rwb; Mon, 15 Aug 2022 17:59:08 -0700 (PDT) X-Received: by 2002:a17:902:7141:b0:170:9d76:e45 with SMTP id u1-20020a170902714100b001709d760e45mr19497840plm.19.1660611308759; Mon, 15 Aug 2022 17:55:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR6N1BEMw7Vtw5MDfk+pScjnilNxUE4L9dz8pfk1Ayf0WpGMlKY9gP+42Z4uPsiGj/0wzbru X-Received: by 2002:a17:902:7141:b0:170:9d76:e45 with SMTP id u1-20020a170902714100b001709d760e45mr19497755plm.19.1660611307433; Mon, 15 Aug 2022 17:55:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611307; cv=none; d=google.com; s=arc-20160816; b=QK4RvZP+Ie7KMjAPcWRdr/aMukuIwnQoQX9p5414R2aqY3ML0q8FIDo00HWcGgStxi Kw/T/Rr+FOH/c5Hq1qcfpBtaTOkGX/XuG2rKELOVvgeimhuPgKa/+Lbm3BieigfJb3S4 CJQCj/J2+cB9d+F7uaYvVXz053sQvk+9g2xlhUcdHZN1ntPIvmS04wP7nnuTmh9HpdL2 lwWzTBzy2ai7Of2MhucwjwrcpZeTRp1SLiGEeVCPvFQyMlY9RXQNwz0vM23yVg/nZOA1 V8AzewJw/uP8p8kqQjQEYqW/cLcpsWpWMmUIuauo44Ld91lj6CpUg4C52YGKtRQXVDfF /DyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=W76fLrEwkuG3YLGmYwa40NbveRy4wgg3cmBhaM8sKIg=; b=VyTe0hZLfLs7iHDwW7JdbMhpF5CPJEzjFngV6Xj8fdbuPkgdYRBVMeL4s3PwTvQsUt WHw0Iab5R610cirbyQoqJ1SF922IBVMABLOLdvqgbbkpji4orIY4td4uDkgNKRswzGCn uRYJgzhkH/IuhIYNvuoStI2BVpKoAV/8jMuwIvu7D47qd6XiiYv7HXRG0Fe5qPuFMuwW yOt3LTwZdCrHYVmBePudvrG7Agiamm9GgMIhHI8z6PAMIbzdxDlO3irQArOSAU1r15h2 wtZEL5aQV57T7T8bHUBTEqcXaLiMaW31dQKH+1eEN3vcUPr+e+BHWKJyadGMMLc9d3q7 KVnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qrmzpNV6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y200-20020a6264d1000000b0052b1d70991csi10777260pfb.242.2022.08.15.17.54.56; Mon, 15 Aug 2022 17:55:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qrmzpNV6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344961AbiHPAc6 (ORCPT + 99 others); Mon, 15 Aug 2022 20:32:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351819AbiHPAam (ORCPT ); Mon, 15 Aug 2022 20:30:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99DAD1849C8; Mon, 15 Aug 2022 13:35:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9E858B8114A; Mon, 15 Aug 2022 20:35:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8FA5C433D6; Mon, 15 Aug 2022 20:35:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595744; bh=6KB1K5LhbCZrhA4TaHgr+wvgq+MkkC0XdMw8XVVZ2RQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qrmzpNV6jO0BNxmVtZrbnxgMvFUmlmnQGSkTjzs20w9dFk/BMA3O3gSGSP/NS1Qg7 FgxXdo/9nytxANSLHoepoPcel+AAKlcGn/AxsZVNRcOglXW1+3NNJJddAr+5dG7UHw 8wMcXGt8KKXgIXtUpIqdGi3O/mj69l+IKyGxj+J8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.19 0860/1157] RDMA/srpt: Duplicate port name members Date: Mon, 15 Aug 2022 20:03:36 +0200 Message-Id: <20220815180513.864980811@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bart Van Assche [ Upstream commit b03b1ae2a3125d4475452e4f19f5d3a6e910ff6e ] Prepare for decoupling the lifetimes of struct srpt_port and struct srpt_port_id by duplicating the port name into struct srpt_port. Link: https://lore.kernel.org/r/20220727193415.1583860-2-bvanassche@acm.org Signed-off-by: Bart Van Assche Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/ulp/srpt/ib_srpt.c | 9 ++++++--- drivers/infiniband/ulp/srpt/ib_srpt.h | 10 +++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index f86ee1c4b970..8253d55b9c26 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -566,14 +566,17 @@ static int srpt_refresh_port(struct srpt_port *sport) return ret; sport->port_guid_id.wwn.priv = sport; - srpt_format_guid(sport->port_guid_id.name, - sizeof(sport->port_guid_id.name), + srpt_format_guid(sport->guid_name, ARRAY_SIZE(sport->guid_name), &sport->gid.global.interface_id); + memcpy(sport->port_guid_id.name, sport->guid_name, + ARRAY_SIZE(sport->guid_name)); sport->port_gid_id.wwn.priv = sport; - snprintf(sport->port_gid_id.name, sizeof(sport->port_gid_id.name), + snprintf(sport->gid_name, ARRAY_SIZE(sport->gid_name), "0x%016llx%016llx", be64_to_cpu(sport->gid.global.subnet_prefix), be64_to_cpu(sport->gid.global.interface_id)); + memcpy(sport->port_gid_id.name, sport->gid_name, + ARRAY_SIZE(sport->gid_name)); if (rdma_protocol_iwarp(sport->sdev->device, sport->port)) return 0; diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.h b/drivers/infiniband/ulp/srpt/ib_srpt.h index 76e66f630c17..3844a7058559 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.h +++ b/drivers/infiniband/ulp/srpt/ib_srpt.h @@ -376,7 +376,7 @@ struct srpt_tpg { }; /** - * struct srpt_port_id - information about an RDMA port name + * struct srpt_port_id - LIO RDMA port information * @mutex: Protects @tpg_list changes. * @tpg_list: TPGs associated with the RDMA port name. * @wwn: WWN associated with the RDMA port name. @@ -402,8 +402,10 @@ struct srpt_port_id { * @lid: cached value of the port's lid. * @gid: cached value of the port's gid. * @work: work structure for refreshing the aforementioned cached values. - * @port_guid_id: target port GUID - * @port_gid_id: target port GID + * @guid_name: port name in GUID format. + * @port_guid_id: LIO target port information for the port name in GUID format. + * @gid_name: port name in GID format. + * @port_gid_id: LIO target port information for the port name in GID format. * @port_attrib: Port attributes that can be accessed through configfs. * @refcount: Number of objects associated with this port. * @freed_channels: Completion that will be signaled once @refcount becomes 0. @@ -419,7 +421,9 @@ struct srpt_port { u32 lid; union ib_gid gid; struct work_struct work; + char guid_name[64]; struct srpt_port_id port_guid_id; + char gid_name[64]; struct srpt_port_id port_gid_id; struct srpt_port_attrib port_attrib; atomic_t refcount; -- 2.35.1