RDMA/srpt: Duplicate port name members
[ 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 <bvanassche@acm.org> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
5ba56d9bd0
commit
204a8486d7
@@ -566,14 +566,17 @@ static int srpt_refresh_port(struct srpt_port *sport)
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
sport->port_guid_id.wwn.priv = sport;
|
sport->port_guid_id.wwn.priv = sport;
|
||||||
srpt_format_guid(sport->port_guid_id.name,
|
srpt_format_guid(sport->guid_name, ARRAY_SIZE(sport->guid_name),
|
||||||
sizeof(sport->port_guid_id.name),
|
|
||||||
&sport->gid.global.interface_id);
|
&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;
|
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",
|
"0x%016llx%016llx",
|
||||||
be64_to_cpu(sport->gid.global.subnet_prefix),
|
be64_to_cpu(sport->gid.global.subnet_prefix),
|
||||||
be64_to_cpu(sport->gid.global.interface_id));
|
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))
|
if (rdma_protocol_iwarp(sport->sdev->device, sport->port))
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -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.
|
* @mutex: Protects @tpg_list changes.
|
||||||
* @tpg_list: TPGs associated with the RDMA port name.
|
* @tpg_list: TPGs associated with the RDMA port name.
|
||||||
* @wwn: WWN 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.
|
* @lid: cached value of the port's lid.
|
||||||
* @gid: cached value of the port's gid.
|
* @gid: cached value of the port's gid.
|
||||||
* @work: work structure for refreshing the aforementioned cached values.
|
* @work: work structure for refreshing the aforementioned cached values.
|
||||||
* @port_guid_id: target port GUID
|
* @guid_name: port name in GUID format.
|
||||||
* @port_gid_id: target port GID
|
* @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.
|
* @port_attrib: Port attributes that can be accessed through configfs.
|
||||||
* @refcount: Number of objects associated with this port.
|
* @refcount: Number of objects associated with this port.
|
||||||
* @freed_channels: Completion that will be signaled once @refcount becomes 0.
|
* @freed_channels: Completion that will be signaled once @refcount becomes 0.
|
||||||
@@ -419,7 +421,9 @@ struct srpt_port {
|
|||||||
u32 lid;
|
u32 lid;
|
||||||
union ib_gid gid;
|
union ib_gid gid;
|
||||||
struct work_struct work;
|
struct work_struct work;
|
||||||
|
char guid_name[64];
|
||||||
struct srpt_port_id port_guid_id;
|
struct srpt_port_id port_guid_id;
|
||||||
|
char gid_name[64];
|
||||||
struct srpt_port_id port_gid_id;
|
struct srpt_port_id port_gid_id;
|
||||||
struct srpt_port_attrib port_attrib;
|
struct srpt_port_attrib port_attrib;
|
||||||
atomic_t refcount;
|
atomic_t refcount;
|
||||||
|
Reference in New Issue
Block a user