Skip to contentSkip to conversation

scsi_transport_sas: add 'scsi_target_id' sysfs attribute

PATCH Superseded Hannes Reinecke 2 participants 3 messages Mar 11, 2016 – Mar 14, 2016 SCSI

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi_transport_sas: add 'scsi_target_id' sysfs attribute

There is no way to detect the scsi_target_id for any given SAS remote port, so add a new sysfs attribute 'scsi_target_id'.

---
 drivers/scsi/scsi_sas_internal.h  | 2 +-
 drivers/scsi/scsi_transport_sas.c | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/scsi_sas_internal.h +1 -1
index 6266a5d..e659912 100644
@@ -4,7 +4,7 @@
 #define SAS_HOST_ATTRS		0
 #define SAS_PHY_ATTRS		17
 #define SAS_PORT_ATTRS		1
-#define SAS_RPORT_ATTRS		7
+#define SAS_RPORT_ATTRS		8
 #define SAS_END_DEV_ATTRS	5
 #define SAS_EXPANDER_ATTRS	7
 
drivers/scsi/scsi_transport_sas.c +2 -0
index 80520e2..deb3fde 100644
@@ -1286,6 +1286,7 @@ sas_rphy_protocol_attr(identify.target_port_protocols, target_port_protocols);
 sas_rphy_simple_attr(identify.sas_address, sas_address, "0x%016llx\n",
 		unsigned long long);
 sas_rphy_simple_attr(identify.phy_identifier, phy_identifier, "%d\n", u8);
+sas_rphy_simple_attr(scsi_target_id, scsi_target_id, "%d\n", u8);
 
 /* only need 8 bytes of data plus header (4 or 8) */
 #define BUF_SIZE 64
@@ -1886,6 +1887,7 @@ sas_attach_transport(struct sas_function_template *ft)
 	SETUP_RPORT_ATTRIBUTE(rphy_device_type);
 	SETUP_RPORT_ATTRIBUTE(rphy_sas_address);
 	SETUP_RPORT_ATTRIBUTE(rphy_phy_identifier);
+	SETUP_RPORT_ATTRIBUTE(rphy_scsi_target_id);
 	SETUP_OPTIONAL_RPORT_ATTRIBUTE(rphy_enclosure_identifier,
 				       get_enclosure_identifier);
 	SETUP_OPTIONAL_RPORT_ATTRIBUTE(rphy_bay_identifier,
Signature · 1 line
1.8.5.6
#1 lore raw
Quoted 27 lines · Hannes Reinecke

There is no way to detect the scsi_target_id for any given SAS remote port, so add a new sysfs attribute 'scsi_target_id'.

---
  drivers/scsi/scsi_sas_internal.h  | 2 +-
  drivers/scsi/scsi_transport_sas.c | 2 ++
  2 files changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/scsi_sas_internal.h +1 -1
index 6266a5d..e659912 100644
@@ -4,7 +4,7 @@
  #define SAS_HOST_ATTRS		0
  #define SAS_PHY_ATTRS		17
  #define SAS_PORT_ATTRS		1
-#define SAS_RPORT_ATTRS		7
+#define SAS_RPORT_ATTRS		8
  #define SAS_END_DEV_ATTRS	5
  #define SAS_EXPANDER_ATTRS	7
 
drivers/scsi/scsi_transport_sas.c +0 -0
index 80520e2..deb3fde 100644

drivers/scsi/scsi_transport_sas.c sas_rphy_protocol_attr(identify.target_port_protocols, target_port_protocols); · line 1289

Quoted 4 lines
drivers/scsi/scsi_transport_sas.c +1 -0
@@ -1286,6 +1286,7 @@ sas_rphy_protocol_attr(identify.target_port_protocols, target_port_protocols);
  sas_rphy_simple_attr(identify.sas_address, sas_address, "0x%016llx\n",
  		unsigned long long);
  sas_rphy_simple_attr(identify.phy_identifier, phy_identifier, "%d\n", u8);
+sas_rphy_simple_attr(scsi_target_id, scsi_target_id, "%d\n", u8);

Hannes:

Shouldn't the last argument be u32?

- Manoj Kumar

#2 lore raw
Quoted 41 lines · Manoj Kumar
Quoted 35 lines · Hannes Reinecke

There is no way to detect the scsi_target_id for any given SAS remote port, so add a new sysfs attribute 'scsi_target_id'.

---
  drivers/scsi/scsi_sas_internal.h  | 2 +-
  drivers/scsi/scsi_transport_sas.c | 2 ++
  2 files changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/scsi_sas_internal.h +1 -1
index 6266a5d..e659912 100644
@@ -4,7 +4,7 @@
  #define SAS_HOST_ATTRS        0
  #define SAS_PHY_ATTRS        17
  #define SAS_PORT_ATTRS        1
-#define SAS_RPORT_ATTRS        7
+#define SAS_RPORT_ATTRS        8
  #define SAS_END_DEV_ATTRS    5
  #define SAS_EXPANDER_ATTRS    7
 
drivers/scsi/scsi_transport_sas.c +0 -0
index 80520e2..deb3fde 100644
@@ -1286,6 +1286,7 @@
 sas_rphy_protocol_attr(identify.target_port_protocols,
 target_port_protocols);
  sas_rphy_simple_attr(identify.sas_address, sas_address,
 "0x%016llx\n",
          unsigned long long);
  sas_rphy_simple_attr(identify.phy_identifier, phy_identifier,
Quoted 2 lines

"%d\n", u8);
+sas_rphy_simple_attr(scsi_target_id, scsi_target_id, "%d\n", u8);

Hannes:

Quoted 2 lines

Shouldn't the last argument be u32?

Errm. Yes. indeed. Thank you for spotting this.

Cheers,

Hannes

Signature · 9 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html