Skip to contentSkip to conversation

ib_srpt: Convert port_guid to use subnet_prefix + interface_id formatting

PATCH New Nicholas A. Bellinger 1 participant 1 message Nov 2, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ib_srpt: Convert port_guid to use subnet_prefix + interface_id formatting

From: Nicholas Bellinger <[email protected]>

This patch converts ib_srpt to use srpt_port->port_guid subnet_prefix + interface_id formatting in srpt_add_one() to identify individual HW target ports in /sys/kernel/config/target/srpt/$SRPT_WWPN

This layout for SRP Target WWPNs and explict SRP Initiator Node WWPNs will now appear as:

/ib_srpt> ls
o- ib_srpt ......................................................... [2 Targets]
o- 0xfe800000000000000002c903000e8acd .............................. [enabled]

  | o- acls ............................................................ [1 ACL]
  | | o- 0x00000000000000000002c903000e8be9 .................... [1 Mapped LUNs]
  | |   o- mapped_lun0 ............................................. [lun0 (rw)]
  | o- luns ........................................................... [1 LUNs]
  |   o- lun0 ................................... [iblock/scsi_debug (/dev/sdb)]
  o- 0xfe800000000000000002c903000e8ace .............................. [enabled]
    o- acls ............................................................ [1 ACL]
    | o- 0x00000000000000000002c903000e8bea .................... [1 Mapped LUNs]
    |   o- mapped_lun0 ............................................. [lun0 (rw)]
    o- luns ........................................................... [1 LUNs]
      o- lun0 .................................. [iblock/scsi_debug2 (/dev/sdc)]
---
 drivers/infiniband/ulp/srpt/ib_srpt.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/srpt/ib_srpt.c +3 -2
index 283bc65..4734e44 100644
@@ -3295,8 +3295,9 @@ static void srpt_add_one(struct ib_device *device)
 			goto err_ring;
 		}
 		snprintf(sport->port_guid, sizeof(sport->port_guid),
-				"0x0000000000000000%016llx",
-				be64_to_cpu(sport->gid.global.interface_id));
+			"0x%016llx%016llx",
+			be64_to_cpu(sport->gid.global.subnet_prefix),
+			be64_to_cpu(sport->gid.global.interface_id));
 	}
 
 	spin_lock(&srpt_dev_lock);
Signature · 1 line
1.7.2.5