linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] - scsi_transport_sas.c - display port identifier
@ 2006-01-26  1:05 Moore, Eric
  2006-01-26 19:35 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Moore, Eric @ 2006-01-26  1:05 UTC (permalink / raw)
  To: linux-scsi; +Cc: akpm, James.Bottomley, hch

[-- Attachment #1: Type: text/plain, Size: 298 bytes --]

This patch displays the port identifier on
the folder attributes; located in the middle digit.

/sys/class/sas_phy/phy-%x:%x:%x
/sys/class/sas_rphy/rphy-%x:%x:%x

The port identifier is basically the unique identifier
for each sas domain.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>

[-- Attachment #2: 1-sas-transport.patch --]
[-- Type: application/octet-stream, Size: 2116 bytes --]

--- b/include/scsi/scsi_transport_sas.h	2006-01-18 19:06:36.000000000 -0700
+++ a/include/scsi/scsi_transport_sas.h	2006-01-18 17:49:32.000000000 -0700
@@ -100,7 +100,7 @@
 
 extern void sas_remove_host(struct Scsi_Host *);
 
-extern struct sas_phy *sas_phy_alloc(struct device *, int);
+extern struct sas_phy *sas_phy_alloc(struct device *, u8, int);
 extern void sas_phy_free(struct sas_phy *);
 extern int sas_phy_add(struct sas_phy *);
 extern void sas_phy_delete(struct sas_phy *);
--- b/drivers/scsi/scsi_transport_sas.c	2006-01-18 10:07:05.000000000 -0700
+++ a/drivers/scsi/scsi_transport_sas.c	2006-01-25 16:45:10.000000000 -0700
@@ -377,7 +377,8 @@
 /**
  * sas_phy_alloc  --  allocates and initialize a SAS PHY structure
  * @parent:	Parent device
- * @number:	Port number
+ * @port_identifier: Port number
+ * @number:	Phy index
  *
  * Allocates an SAS PHY structure.  It will be added in the device tree
  * below the device specified by @parent, which has to be either a Scsi_Host
@@ -386,7 +387,7 @@
  * Returns:
  *	SAS PHY allocated or %NULL if the allocation failed.
  */
-struct sas_phy *sas_phy_alloc(struct device *parent, int number)
+struct sas_phy *sas_phy_alloc(struct device *parent, u8 port_identifier, int number)
 {
 	struct Scsi_Host *shost = dev_to_shost(parent);
 	struct sas_phy *phy;
@@ -399,11 +400,13 @@
 	get_device(parent);
 
 	phy->number = number;
+	phy->port_identifier = port_identifier;
 
 	device_initialize(&phy->dev);
 	phy->dev.parent = get_device(parent);
 	phy->dev.release = sas_phy_release;
-	sprintf(phy->dev.bus_id, "phy-%d:%d", shost->host_no, number);
+	sprintf(phy->dev.bus_id, "phy-%d:%d-%d",
+		shost->host_no, port_identifier, number);
 
 	transport_setup_device(&phy->dev);
 
@@ -595,8 +598,8 @@
 	device_initialize(&rphy->dev);
 	rphy->dev.parent = get_device(&parent->dev);
 	rphy->dev.release = sas_rphy_release;
-	sprintf(rphy->dev.bus_id, "rphy-%d:%d",
-		shost->host_no, parent->number);
+	sprintf(rphy->dev.bus_id, "rphy-%d:%d-%d",
+		shost->host_no, parent->port_identifier, parent->number);
 	transport_setup_device(&rphy->dev);
 
 	return rphy;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] - scsi_transport_sas.c - display port identifier
  2006-01-26  1:05 [PATCH] - scsi_transport_sas.c - display port identifier Moore, Eric
@ 2006-01-26 19:35 ` Christoph Hellwig
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2006-01-26 19:35 UTC (permalink / raw)
  To: Moore, Eric; +Cc: linux-scsi, akpm, James.Bottomley, hch

On Wed, Jan 25, 2006 at 06:05:07PM -0700, Moore, Eric wrote:
> This patch displays the port identifier on
> the folder attributes; located in the middle digit.
> 
> /sys/class/sas_phy/phy-%x:%x:%x
> /sys/class/sas_rphy/rphy-%x:%x:%x
> 
> The port identifier is basically the unique identifier
> for each sas domain.

The port identifier for a given phy could change when phys are removed from
one port and added to another.  So doing this for the phy is probably
a bad idea.  Doing it for the rphy should be fine because that object gets
removed and recreated in that case.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] - scsi_transport_sas.c - display port identifier
@ 2006-01-26 23:20 Moore, Eric
  0 siblings, 0 replies; 3+ messages in thread
From: Moore, Eric @ 2006-01-26 23:20 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-scsi, akpm, James.Bottomley

On Thursday, January 26, 2006 12:35 PM, Christoph Hellwig wrote:

> The port identifier for a given phy could change when phys 
> are removed from
> one port and added to another.  So doing this for the phy is probably
> a bad idea.  Doing it for the rphy should be fine because 
> that object gets
> removed and recreated in that case.
> 

Agreed, that makes sense.  

Here is new patch with only rphy displaying the port_identifier.


Signed-off-by: Eric Moore <Eric.Moore@lsil.com>

--- b/drivers/scsi/scsi_transport_sas.c	2006-01-18 10:07:05.000000000
-0700
+++ a/drivers/scsi/scsi_transport_sas.c	2006-01-26 15:52:38.000000000
-0700
@@ -377,7 +377,7 @@
 /**
  * sas_phy_alloc  --  allocates and initialize a SAS PHY structure
  * @parent:	Parent device
- * @number:	Port number
+ * @number:	Phy index
  *
  * Allocates an SAS PHY structure.  It will be added in the device tree
  * below the device specified by @parent, which has to be either a
Scsi_Host
@@ -595,8 +595,8 @@
 	device_initialize(&rphy->dev);
 	rphy->dev.parent = get_device(&parent->dev);
 	rphy->dev.release = sas_rphy_release;
-	sprintf(rphy->dev.bus_id, "rphy-%d:%d",
-		shost->host_no, parent->number);
+	sprintf(rphy->dev.bus_id, "rphy-%d:%d-%d",
+		shost->host_no, parent->port_identifier,
parent->number);
 	transport_setup_device(&rphy->dev);
 
 	return rphy;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-01-26 23:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-26  1:05 [PATCH] - scsi_transport_sas.c - display port identifier Moore, Eric
2006-01-26 19:35 ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2006-01-26 23:20 Moore, Eric

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).