Skip to content

Commit b03b1ae

Browse files
bvanasschejgunthorpe
authored andcommitted
RDMA/srpt: Duplicate port name members
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/[email protected] Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent dd390cb commit b03b1ae

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

drivers/infiniband/ulp/srpt/ib_srpt.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,14 +566,17 @@ static int srpt_refresh_port(struct srpt_port *sport)
566566
return ret;
567567

568568
sport->port_guid_id.wwn.priv = sport;
569-
srpt_format_guid(sport->port_guid_id.name,
570-
sizeof(sport->port_guid_id.name),
569+
srpt_format_guid(sport->guid_name, ARRAY_SIZE(sport->guid_name),
571570
&sport->gid.global.interface_id);
571+
memcpy(sport->port_guid_id.name, sport->guid_name,
572+
ARRAY_SIZE(sport->guid_name));
572573
sport->port_gid_id.wwn.priv = sport;
573-
snprintf(sport->port_gid_id.name, sizeof(sport->port_gid_id.name),
574+
snprintf(sport->gid_name, ARRAY_SIZE(sport->gid_name),
574575
"0x%016llx%016llx",
575576
be64_to_cpu(sport->gid.global.subnet_prefix),
576577
be64_to_cpu(sport->gid.global.interface_id));
578+
memcpy(sport->port_gid_id.name, sport->gid_name,
579+
ARRAY_SIZE(sport->gid_name));
577580

578581
if (rdma_protocol_iwarp(sport->sdev->device, sport->port))
579582
return 0;

drivers/infiniband/ulp/srpt/ib_srpt.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ struct srpt_tpg {
376376
};
377377

378378
/**
379-
* struct srpt_port_id - information about an RDMA port name
379+
* struct srpt_port_id - LIO RDMA port information
380380
* @mutex: Protects @tpg_list changes.
381381
* @tpg_list: TPGs associated with the RDMA port name.
382382
* @wwn: WWN associated with the RDMA port name.
@@ -402,8 +402,10 @@ struct srpt_port_id {
402402
* @lid: cached value of the port's lid.
403403
* @gid: cached value of the port's gid.
404404
* @work: work structure for refreshing the aforementioned cached values.
405-
* @port_guid_id: target port GUID
406-
* @port_gid_id: target port GID
405+
* @guid_name: port name in GUID format.
406+
* @port_guid_id: LIO target port information for the port name in GUID format.
407+
* @gid_name: port name in GID format.
408+
* @port_gid_id: LIO target port information for the port name in GID format.
407409
* @port_attrib: Port attributes that can be accessed through configfs.
408410
* @refcount: Number of objects associated with this port.
409411
* @freed_channels: Completion that will be signaled once @refcount becomes 0.
@@ -419,7 +421,9 @@ struct srpt_port {
419421
u32 lid;
420422
union ib_gid gid;
421423
struct work_struct work;
424+
char guid_name[64];
422425
struct srpt_port_id port_guid_id;
426+
char gid_name[64];
423427
struct srpt_port_id port_gid_id;
424428
struct srpt_port_attrib port_attrib;
425429
atomic_t refcount;

0 commit comments

Comments
 (0)