Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2871728rwb; Mon, 15 Aug 2022 13:02:26 -0700 (PDT) X-Received: by 2002:a17:907:da0:b0:730:d0ba:7b13 with SMTP id go32-20020a1709070da000b00730d0ba7b13mr11868844ejc.332.1660593506898; Mon, 15 Aug 2022 12:58:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR5j3xdanYv9kEfNnqt6QWQa0NNSSGpVGQaKPefsG9eIPssyjSDFakjKqQjsvh5Lq94N9XAg X-Received: by 2002:a17:907:da0:b0:730:d0ba:7b13 with SMTP id go32-20020a1709070da000b00730d0ba7b13mr11868715ejc.332.1660593505380; Mon, 15 Aug 2022 12:58:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660593505; cv=none; d=google.com; s=arc-20160816; b=BUtxMVOuwB42VBvFJPkpMH2Ga+F33lVnqf2B9K2N/XbSCu7g2P9KIyGE3sqslrAdgN n37j81+Zilox05Uy4wQ9n+vBNbfmrG7E+m5ecxpPriHI05yfyb50YvPHo4UX/LwXlJHA nH3YzcApkL9T4C8kQd6mYbqfHH/s8GFgzUBRFK+SAhWxBe1qprZMHvg/OHf+4+SctWB6 y+PtqM4NSjXjWBnUh1Cjcu95NXajnZqmM3eGSdGBJvEm2VwatruLGz/ky5MeZLJkYIOU 5HlI0C4i82lKPjiWomiOAsQRmLrGRoa3wmQ24rVyT3nchhiv4J6BqFhR6i5h7RgnoIJa 25Nw== 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=1mtR0IvFBQV57sKSHASoO59vSpzoaEXtGVHcnJvaR5U=; b=Wst94SHvRuzNOVaKD6zbwnpmW1jrVBglEIQBqbeo3mwluDxwf0ZGbkew4Chn+sTbif xBvkyLKERUkW3v4hyR8zHfPlYlesf6PVycN38kL+ol7MAL7jqhd3r0Q3C0FlBMt10I+E A+EQ9r87E4jEomwVoVdghuVjaLJvthbdotBAKuFbS39RmTaFsbBDCtp9PvA2ZO5MKQFl vlTvg/X9eq6rI05sgOrMj3CfkwlrHZN5Opelp6N4O/eS7wKqafBlYasRmc9tPhAscEW4 DFqsot+JKdlZABiOsphgdViJn5wZrLXG2ylA6hbX4cEljtmZC8oUTtgTkGDIHCOiMq9H KcvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Rxx2jQLt; 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 lz5-20020a170906fb0500b00730c1b3d753si6725234ejb.424.2022.08.15.12.57.59; Mon, 15 Aug 2022 12:58:25 -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=Rxx2jQLt; 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 S244174AbiHOT2T (ORCPT + 99 others); Mon, 15 Aug 2022 15:28:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244230AbiHOTYC (ORCPT ); Mon, 15 Aug 2022 15:24:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 701262ED50; Mon, 15 Aug 2022 11:40:54 -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 dfw.source.kernel.org (Postfix) with ESMTPS id E3855611C5; Mon, 15 Aug 2022 18:40:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA761C433C1; Mon, 15 Aug 2022 18:40:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588853; bh=hADJyJQE5NagnoxhSnl4VH2kvotc821VkXjIYGoKySs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rxx2jQLtaLlGGGByG88XleLQvgBJJSyrZWgWmqb4yg+1JjJpxZAU01joYxV6gJG5o OF2dhlgLOeYXqAhEjWos7w+XVMj4MhLu8j2FqrShDViIDlZJBgJGdDQA1wRtJYuVrF xRuvPoamzYXWUjoVsYZOS34Zpp0t3nzh5+ZlwxSw= 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.15 536/779] RDMA/srpt: Duplicate port name members Date: Mon, 15 Aug 2022 20:03:00 +0200 Message-Id: <20220815180400.214166883@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 3cadf1295417..d36873e6d8fa 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