Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3024160rwb; Mon, 15 Aug 2022 16:21:56 -0700 (PDT) X-Received: by 2002:a17:906:8b81:b0:733:183b:988e with SMTP id nr1-20020a1709068b8100b00733183b988emr11723505ejc.457.1660605476235; Mon, 15 Aug 2022 16:17:56 -0700 (PDT) X-Google-Smtp-Source: AA6agR7PMk7tRrUUlcvJy8L9yGwIs/3iV0uC3jBeKRUK3JXfTAqmnAInjRTfJ6c3Djr8Ny/Wwav7 X-Received: by 2002:a17:906:8b81:b0:733:183b:988e with SMTP id nr1-20020a1709068b8100b00733183b988emr11723390ejc.457.1660605474491; Mon, 15 Aug 2022 16:17:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605474; cv=none; d=google.com; s=arc-20160816; b=rLxLgRmyU60tzXma0W1LJiGP1NvMQalNMOk7OdWnlirRhTkLpbdyDXHCT8rAWevOCr 7ypV37O+VMGvEcAW8RqBpUvQw38l/zvhS9KPtS6iizNjPIBeVaOtf0qQiYcdbyti6Hna A+iKJU0kktleQpaVrBmR4wZgZ49icg105glVwjssCKu/g770XeBuaCCPZy6L0QhnN4wd O73bOKFNdNcZLuNH3AqXWVly5vH4Bqlmf1YIdwIWAhKNEb/gqTp6HmkgL+pbBVzJ3NbN AfTK9nSMSDaviqb/PiXhRo/bO3/Ked0cTauVGI4/nqjUspR+1UEGbHX6QytObyyyqzpl yeIA== 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=K2Fo7nBHivtr0B3oXXlnLof339A29U6nTlwBfGGaqi6t98ZHD6udR2oaly43wPWbiJ sh+mDVDYNcyC8nYIy/J9QD9ljjl2A9FFD5bnTubkKW3LNhUB8fCZ/3YrJMkljJRoB+vp S4m5huWQ8BFtv3S9IcVYP3jq2apYOJminNB+Tq/UVQDQyub8TPyquRcxYSTgSp++Wrn7 wWY5YGvIqbbpOx+TcNzI/35XrZCRhwbkUYfz7AkC28memH6Y1H9vYJNMaDSy27+L6Cme a+nO6MbNLdoow3hfiHuTcDqT8A6jxz/05zKE45aBEPf6BV74+Tbm6rrIBxG+tmOTD8g6 yesw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oMoBi+7I; 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 g12-20020a056402090c00b0043df7e2a990si10247801edz.264.2022.08.15.16.17.28; Mon, 15 Aug 2022 16:17:54 -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=oMoBi+7I; 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 S1347977AbiHOWZG (ORCPT + 99 others); Mon, 15 Aug 2022 18:25:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350798AbiHOWSf (ORCPT ); Mon, 15 Aug 2022 18:18:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6898865577; Mon, 15 Aug 2022 12:41:58 -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 05E386068D; Mon, 15 Aug 2022 19:41:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3DBEC433C1; Mon, 15 Aug 2022 19:41:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592517; bh=6KB1K5LhbCZrhA4TaHgr+wvgq+MkkC0XdMw8XVVZ2RQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oMoBi+7IcVzf5z4y1jiE+kg3WxuQb1EU5ju+jCknV3xsuJeC906gR8JTQkhJ7zs4C xaBeexnJ/G/lzvlZwIg5JCesRGgXnliT9LzGuIhXeFnSLrvxkmT99luccemimPJc1C vO0jvmSatjQGmQBQqIk39U93IyX9FORiephU0RWg= 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.18 0802/1095] RDMA/srpt: Duplicate port name members Date: Mon, 15 Aug 2022 20:03:21 +0200 Message-Id: <20220815180502.442574572@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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