linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: /dev/disk/by-id incomplete and unhelpful for SATA drives
       [not found]             ` <20060106013640.GA27841@aracnet.com>
@ 2006-01-06  2:57               ` Douglas Gilbert
  2006-01-06 12:39                 ` [PATCH] " Douglas Gilbert
  0 siblings, 1 reply; 8+ messages in thread
From: Douglas Gilbert @ 2006-01-06  2:57 UTC (permalink / raw)
  To: patman
  Cc: Chris Paulson-Ellis, Bill Nottingham, linux-hotplug-devel,
	linux-scsi, linux-ide

patman@aracnet.com wrote:
> On Fri, Dec 23, 2005 at 12:12:18AM +0000, Chris Paulson-Ellis wrote:
> 
> 
>>>Why not just fix the kernel when it's filling in the page 83
>>>data to pull the serial from page 80 instead of putting *that* there?
>>>
>>>Bill
>>
>>Indeed. Here's the patch. Now I have 3 ways to fix this. Any more anyone?
> 
> 
> This is the best approach, I think you could even remove page 0x83 support
> and still be SCSI compliant.

Pat,
Not since 2000/2001 ... The VPD device identification page
(0x83) and the "Supported VPD pages" page (0x0) are
mandatory in SPC-2 (ANSI INCITS 351-2001), SPC-3 (soon
to be a standard) and SPC-4. Recent SCSI to ATA
Translation drafts (e.g. sat-r07a.pdf) define a mapping
for the naa-5 identifier defined in ATA/ATAPI-7 and
ATA/ATAPI-8 (IDENTIFY DEVICE response words 108 to 111)
to VPD page 0x83. There are also moves afoot to get a
similar wwn identifier into the IDENTIFY PACKET DEVICE
response.

SAT defines two device id descriptors for VPD page 0x83:
  - based on WWN naa-5 (described above)
  - based on model number and serial number (IDENTIFY
    DEVICE response words 27-46 and 10-19)

So removing VPD page 0x83 would be a retrograde step
IMO. The libata implementation should be enhanced to
support one or both of the above descriptors as they
have a defined format (unlike serial number VPD page (0x80)).
libata's current approach to yield "Linux ATA-SCSI simulator"
for the loosely formatted ASCII identification descriptor
is just a place holder.

libata should do a lot more work in the VPD 0x83 page
area. For example when SATA disk is connected via SAS
(behind an expander rather that directly connected)
then a "device port" association descriptor should have
the SAS address (also naa-5) of the SATA bridge (in the
expander).

libata is not the only way that the SCSI subsystem
will be seeing SATA disks. There are FC exclosures
out there filled with SATA disks that have a SAT
layer in the enclosure.


Doug Gilbert
cc-ed to linux-ide

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

* [PATCH] /dev/disk/by-id incomplete and unhelpful for SATA drives
  2006-01-06  2:57               ` /dev/disk/by-id incomplete and unhelpful for SATA drives Douglas Gilbert
@ 2006-01-06 12:39                 ` Douglas Gilbert
  2006-01-06 13:34                   ` Chris Paulson-Ellis
                                     ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Douglas Gilbert @ 2006-01-06 12:39 UTC (permalink / raw)
  To: dougg
  Cc: patman, Chris Paulson-Ellis, Bill Nottingham, linux-hotplug-devel,
	linux-scsi, linux-ide, jgarzik

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

Douglas Gilbert wrote:
> patman@aracnet.com wrote:
> 
>>On Fri, Dec 23, 2005 at 12:12:18AM +0000, Chris Paulson-Ellis wrote:
>>
>>
>>
>>>>Why not just fix the kernel when it's filling in the page 83
>>>>data to pull the serial from page 80 instead of putting *that* there?
>>>>
>>>>Bill
>>>
>>>Indeed. Here's the patch. Now I have 3 ways to fix this. Any more anyone?
>>
>>
>>This is the best approach, I think you could even remove page 0x83 support
>>and still be SCSI compliant.
> 
> 
> Pat,
> Not since 2000/2001 ... The VPD device identification page
> (0x83) and the "Supported VPD pages" page (0x0) are
> mandatory in SPC-2 (ANSI INCITS 351-2001), SPC-3 (soon
> to be a standard) and SPC-4. Recent SCSI to ATA
> Translation drafts (e.g. sat-r07a.pdf) define a mapping
> for the naa-5 identifier defined in ATA/ATAPI-7 and
> ATA/ATAPI-8 (IDENTIFY DEVICE response words 108 to 111)
> to VPD page 0x83. There are also moves afoot to get a
> similar wwn identifier into the IDENTIFY PACKET DEVICE
> response.
> 
> SAT defines two device id descriptors for VPD page 0x83:
>   - based on WWN naa-5 (described above)
>   - based on model number and serial number (IDENTIFY
>     DEVICE response words 27-46 and 10-19)
> 
> So removing VPD page 0x83 would be a retrograde step
> IMO. The libata implementation should be enhanced to
> support one or both of the above descriptors as they
> have a defined format (unlike serial number VPD page (0x80)).
> libata's current approach to yield "Linux ATA-SCSI simulator"
> for the loosely formatted ASCII identification descriptor
> is just a place holder.

The attachment adds the second item above to the patch
suggested by Chris Paulson-Ellis <chris@edesix.com> in:
http://marc.theaimsgroup.com/?l=linux-hotplug-devel&m=113529667019652&w=2

The patch is against lk 2.6.15 and was tested on a sil
controller with a Seagate ST380013AS sata disk.

Changelog:
  - make existing libata VPD device identification page (0x83)
    supply the ATA serial number in the libata "vendor
    specific" designator (from Chris Paulson-Ellis)
  - add a "t10 vendor id based" designator as defined in
    SAT rev 07a (section 10.3.4.2.3) that supplies ATA
    model and serial numbers
  - make the libata VPD page 0x83 more extensible (for
    adding more designators in the future).

Signed-off-by: Douglas Gilbert <dougg@torque.net>

Doug Gilbert


[-- Attachment #2: libata_vpd83_2615.diff --]
[-- Type: text/x-patch, Size: 2486 bytes --]

--- linux/drivers/scsi/libata-scsi.c	2006-01-04 08:50:42.000000000 +1000
+++ linux/drivers/scsi/libata-scsi.c2615vpd	2006-01-06 20:16:25.000000000 +1000
@@ -1532,16 +1532,16 @@
 	return 0;
 }
 
-static const char *inq_83_str = "Linux ATA-SCSI simulator";
-
 /**
  *	ata_scsiop_inq_83 - Simulate INQUIRY EVPD page 83, device identity
  *	@args: device IDENTIFY data / SCSI command of interest.
  *	@rbuf: Response buffer, to which simulated SCSI cmd output is sent.
  *	@buflen: Response buffer length.
  *
- *	Returns device identification.  Currently hardcoded to
- *	return "Linux ATA-SCSI simulator".
+ *	Yields two logocal unit device identification designators:
+ *	  - vendor specific ASCII containing the ATA serial number
+ *	  - SAT defined "t10 vendor id based" containing ASCII vendor
+ *	    name ("ATA     "), model and serial numbers.
  *
  *	LOCKING:
  *	spin_lock_irqsave(host_set lock)
@@ -1550,16 +1550,39 @@
 unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf,
 			      unsigned int buflen)
 {
+	int num;
+	const int sat_model_serial_desc_len = 68;
+	const int ata_model_byte_len = 40;
+
 	rbuf[1] = 0x83;			/* this page code */
-	rbuf[3] = 4 + strlen(inq_83_str);	/* page len */
+	num = 4;
 
-	/* our one and only identification descriptor (vendor-specific) */
-	if (buflen > (strlen(inq_83_str) + 4 + 4 - 1)) {
-		rbuf[4 + 0] = 2;	/* code set: ASCII */
-		rbuf[4 + 3] = strlen(inq_83_str);
-		memcpy(rbuf + 4 + 4, inq_83_str, strlen(inq_83_str));
+	if (buflen > (ATA_SERNO_LEN + num + 3)) {
+		/* piv=0, assoc=lu, code_set=ACSII, designator=vendor */
+		rbuf[num + 0] = 2;	
+		rbuf[num + 3] = ATA_SERNO_LEN;
+		num += 4;
+		ata_dev_id_string(args->id, (unsigned char *) rbuf + num,
+				  ATA_ID_SERNO_OFS, ATA_SERNO_LEN);
+		num += ATA_SERNO_LEN;
 	}
-
+	if (buflen > (sat_model_serial_desc_len + num + 3)) {
+		/* SAT defined lu model and serial numbers descriptor */
+		/* piv=0, assoc=lu, code_set=ACSII, designator=t10 vendor id */
+		rbuf[num + 0] = 2;	
+		rbuf[num + 1] = 1;	
+		rbuf[num + 3] = sat_model_serial_desc_len;
+		num += 4;
+		strncpy(rbuf + num, "ATA     ", 8);
+		num += 8;
+		ata_dev_id_string(args->id, (unsigned char *) rbuf + num,
+				  ATA_ID_PROD_OFS, ata_model_byte_len);
+		num += ata_model_byte_len;
+		ata_dev_id_string(args->id, (unsigned char *) rbuf + num,
+				  ATA_ID_SERNO_OFS, ATA_SERNO_LEN);
+		num += ATA_SERNO_LEN;
+	}
+	rbuf[3] = num - 4;    /* page len (assume less than 256 bytes) */
 	return 0;
 }
 


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

* Re: [PATCH] /dev/disk/by-id incomplete and unhelpful for SATA drives
  2006-01-06 12:39                 ` [PATCH] " Douglas Gilbert
@ 2006-01-06 13:34                   ` Chris Paulson-Ellis
  2006-01-06 18:58                     ` Patrick Mansfield
  2006-01-06 19:46                   ` Patrick Mansfield
  2006-03-06 20:08                   ` Jeff Garzik
  2 siblings, 1 reply; 8+ messages in thread
From: Chris Paulson-Ellis @ 2006-01-06 13:34 UTC (permalink / raw)
  To: dougg
  Cc: patman, Bill Nottingham, linux-hotplug-devel, linux-scsi,
	linux-ide, jgarzik

Douglas Gilbert wrote:
> Douglas Gilbert wrote:
> [snip]

I can confirm that your patch works for me too.

Original scsi_id output:

# scsi_id -g -x -s /block/sda | grep ID_SERIAL
ID_SERIAL=0ATA_Maxtor_6Y160M0_Linux_ATA-SCSI_simulator

After my patch:

# scsi_id -g -x -s /block/sda | grep ID_SERIAL
ID_SERIAL=0ATA_Maxtor_6Y160M0_Y4DCTR3E

After your patch:

# scsi_id -g -x -s /block/sda | grep ID_SERIAL
ID_SERIAL=1ATA_Maxtor_6Y160M0_Y4DCTR3E

Note that it is still a bit different to the page 0x80 output, but I 
don't think this matters (unless that '0' or '1' is a bug not a 
feature). For my purposes, it just needs to be unique.

# ( scsi_id -p 0x80 -g -x -s /block/sda ; \
     scsi_id -p 0x83 -g -x -s /block/sda ) | grep ID_SERIAL
ID_SERIAL=SATA_Maxtor_6Y160M0_Y4DCTR3E
ID_SERIAL=1ATA_Maxtor_6Y160M0_Y4DCTR3E

Many thanks,
Chris.

> 
> 
> The attachment adds the second item above to the patch
> suggested by Chris Paulson-Ellis <chris@edesix.com> in:
> http://marc.theaimsgroup.com/?l=linux-hotplug-devel&m=113529667019652&w=2
> 
> The patch is against lk 2.6.15 and was tested on a sil
> controller with a Seagate ST380013AS sata disk.
> 
> Changelog:
>   - make existing libata VPD device identification page (0x83)
>     supply the ATA serial number in the libata "vendor
>     specific" designator (from Chris Paulson-Ellis)
>   - add a "t10 vendor id based" designator as defined in
>     SAT rev 07a (section 10.3.4.2.3) that supplies ATA
>     model and serial numbers
>   - make the libata VPD page 0x83 more extensible (for
>     adding more designators in the future).
> 
> Signed-off-by: Douglas Gilbert <dougg@torque.net>
> 
> Doug Gilbert
> 
> 
> 
> ------------------------------------------------------------------------
> 
> --- linux/drivers/scsi/libata-scsi.c	2006-01-04 08:50:42.000000000 +1000
> +++ linux/drivers/scsi/libata-scsi.c2615vpd	2006-01-06 20:16:25.000000000 +1000
> @@ -1532,16 +1532,16 @@
>  	return 0;
>  }
>  
> -static const char *inq_83_str = "Linux ATA-SCSI simulator";
> -
>  /**
>   *	ata_scsiop_inq_83 - Simulate INQUIRY EVPD page 83, device identity
>   *	@args: device IDENTIFY data / SCSI command of interest.
>   *	@rbuf: Response buffer, to which simulated SCSI cmd output is sent.
>   *	@buflen: Response buffer length.
>   *
> - *	Returns device identification.  Currently hardcoded to
> - *	return "Linux ATA-SCSI simulator".
> + *	Yields two logocal unit device identification designators:
> + *	  - vendor specific ASCII containing the ATA serial number
> + *	  - SAT defined "t10 vendor id based" containing ASCII vendor
> + *	    name ("ATA     "), model and serial numbers.
>   *
>   *	LOCKING:
>   *	spin_lock_irqsave(host_set lock)
> @@ -1550,16 +1550,39 @@
>  unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf,
>  			      unsigned int buflen)
>  {
> +	int num;
> +	const int sat_model_serial_desc_len = 68;
> +	const int ata_model_byte_len = 40;
> +
>  	rbuf[1] = 0x83;			/* this page code */
> -	rbuf[3] = 4 + strlen(inq_83_str);	/* page len */
> +	num = 4;
>  
> -	/* our one and only identification descriptor (vendor-specific) */
> -	if (buflen > (strlen(inq_83_str) + 4 + 4 - 1)) {
> -		rbuf[4 + 0] = 2;	/* code set: ASCII */
> -		rbuf[4 + 3] = strlen(inq_83_str);
> -		memcpy(rbuf + 4 + 4, inq_83_str, strlen(inq_83_str));
> +	if (buflen > (ATA_SERNO_LEN + num + 3)) {
> +		/* piv=0, assoc=lu, code_set=ACSII, designator=vendor */
> +		rbuf[num + 0] = 2;	
> +		rbuf[num + 3] = ATA_SERNO_LEN;
> +		num += 4;
> +		ata_dev_id_string(args->id, (unsigned char *) rbuf + num,
> +				  ATA_ID_SERNO_OFS, ATA_SERNO_LEN);
> +		num += ATA_SERNO_LEN;
>  	}
> -
> +	if (buflen > (sat_model_serial_desc_len + num + 3)) {
> +		/* SAT defined lu model and serial numbers descriptor */
> +		/* piv=0, assoc=lu, code_set=ACSII, designator=t10 vendor id */
> +		rbuf[num + 0] = 2;	
> +		rbuf[num + 1] = 1;	
> +		rbuf[num + 3] = sat_model_serial_desc_len;
> +		num += 4;
> +		strncpy(rbuf + num, "ATA     ", 8);
> +		num += 8;
> +		ata_dev_id_string(args->id, (unsigned char *) rbuf + num,
> +				  ATA_ID_PROD_OFS, ata_model_byte_len);
> +		num += ata_model_byte_len;
> +		ata_dev_id_string(args->id, (unsigned char *) rbuf + num,
> +				  ATA_ID_SERNO_OFS, ATA_SERNO_LEN);
> +		num += ATA_SERNO_LEN;
> +	}
> +	rbuf[3] = num - 4;    /* page len (assume less than 256 bytes) */
>  	return 0;
>  }
>  
> 


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

* Re: [PATCH] /dev/disk/by-id incomplete and unhelpful for SATA drives
  2006-01-06 13:34                   ` Chris Paulson-Ellis
@ 2006-01-06 18:58                     ` Patrick Mansfield
  0 siblings, 0 replies; 8+ messages in thread
From: Patrick Mansfield @ 2006-01-06 18:58 UTC (permalink / raw)
  To: Chris Paulson-Ellis
  Cc: dougg, Bill Nottingham, linux-hotplug-devel, linux-scsi,
	linux-ide, jgarzik

On Fri, Jan 06, 2006 at 01:34:59PM +0000, Chris Paulson-Ellis wrote:

> Note that it is still a bit different to the page 0x80 output, but I 
> don't think this matters (unless that '0' or '1' is a bug not a 
> feature). For my purposes, it just needs to be unique.
> 
> # ( scsi_id -p 0x80 -g -x -s /block/sda ; \
>     scsi_id -p 0x83 -g -x -s /block/sda ) | grep ID_SERIAL
> ID_SERIAL=SATA_Maxtor_6Y160M0_Y4DCTR3E
> ID_SERIAL=1ATA_Maxtor_6Y160M0_Y4DCTR3E

Yes, the above is a feature. The SATA in the above is actually S + ATA,
the 'S' is added to guarantee no overlap with page 83 names.

For page 80 the output is concatenation of 'S', vendor, model, and page 80
result, 

For page 83 the output puts the id type as a prefix, so the name spaces
for page 83 can't collide - they are mostly unique across a given id type,
but not for vendor specific, hence we also add model + vendor for vendor
specific.

And for '-x', extra spaces are removed and then spaces converted to '_'.

-- Patrick Mansfield


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click

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

* Re: [PATCH] /dev/disk/by-id incomplete and unhelpful for SATA drives
  2006-01-06 12:39                 ` [PATCH] " Douglas Gilbert
  2006-01-06 13:34                   ` Chris Paulson-Ellis
@ 2006-01-06 19:46                   ` Patrick Mansfield
  2006-01-06 23:44                     ` Douglas Gilbert
  2006-03-06 20:08                   ` Jeff Garzik
  2 siblings, 1 reply; 8+ messages in thread
From: Patrick Mansfield @ 2006-01-06 19:46 UTC (permalink / raw)
  To: Douglas Gilbert
  Cc: Chris Paulson-Ellis, Bill Nottingham, linux-hotplug-devel,
	linux-scsi, linux-ide, jgarzik

On Fri, Jan 06, 2006 at 10:39:34PM +1000, Douglas Gilbert wrote:

> Changelog:
>   - make existing libata VPD device identification page (0x83)
>     supply the ATA serial number in the libata "vendor
>     specific" designator (from Chris Paulson-Ellis)
>   - add a "t10 vendor id based" designator as defined in
>     SAT rev 07a (section 10.3.4.2.3) that supplies ATA
>     model and serial numbers

> --- linux/drivers/scsi/libata-scsi.c	2006-01-04 08:50:42.000000000 +1000
> +++ linux/drivers/scsi/libata-scsi.c2615vpd	2006-01-06 20:16:25.000000000 +1000

>  unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf,
>  			      unsigned int buflen)
>  {
> +	int num;
> +	const int sat_model_serial_desc_len = 68;
> +	const int ata_model_byte_len = 40;
> +
>  	rbuf[1] = 0x83;			/* this page code */
> -	rbuf[3] = 4 + strlen(inq_83_str);	/* page len */
> +	num = 4;
>  
> -	/* our one and only identification descriptor (vendor-specific) */
> -	if (buflen > (strlen(inq_83_str) + 4 + 4 - 1)) {
> -		rbuf[4 + 0] = 2;	/* code set: ASCII */
> -		rbuf[4 + 3] = strlen(inq_83_str);
> -		memcpy(rbuf + 4 + 4, inq_83_str, strlen(inq_83_str));
> +	if (buflen > (ATA_SERNO_LEN + num + 3)) {
> +		/* piv=0, assoc=lu, code_set=ACSII, designator=vendor */
> +		rbuf[num + 0] = 2;	
> +		rbuf[num + 3] = ATA_SERNO_LEN;
> +		num += 4;
> +		ata_dev_id_string(args->id, (unsigned char *) rbuf + num,
> +				  ATA_ID_SERNO_OFS, ATA_SERNO_LEN);
> +		num += ATA_SERNO_LEN;
>  	}
> -
> +	if (buflen > (sat_model_serial_desc_len + num + 3)) {
> +		/* SAT defined lu model and serial numbers descriptor */
> +		/* piv=0, assoc=lu, code_set=ACSII, designator=t10 vendor id */
> +		rbuf[num + 0] = 2;	
> +		rbuf[num + 1] = 1;	
> +		rbuf[num + 3] = sat_model_serial_desc_len;
> +		num += 4;
> +		strncpy(rbuf + num, "ATA     ", 8);
> +		num += 8;
> +		ata_dev_id_string(args->id, (unsigned char *) rbuf + num,
> +				  ATA_ID_PROD_OFS, ata_model_byte_len);
> +		num += ata_model_byte_len;
> +		ata_dev_id_string(args->id, (unsigned char *) rbuf + num,
> +				  ATA_ID_SERNO_OFS, ATA_SERNO_LEN);
> +		num += ATA_SERNO_LEN;
> +	}
> +	rbuf[3] = num - 4;    /* page len (assume less than 256 bytes) */


I was trying to figure out if we are guranteed will have unique values
across all ATA devices with Doug's patch. I am not familiar with ATA and
IDENTIFY DEVICE.

For page 0x83, Doug's change above gives us:

	ATA + 40 bytes of model/product (must have white space) + serial number

Under "10.3.4.2.3 Logical unit name derived from the model number and
serial number" the spec says:

	NOTE 9 The logical unit name using the T10 vendor identification
	format is not guaranteed to be worldwide unique, since ATA/ATAPI-7
	only requires the combination of the MODEL NUMBER field and SERIAL
	NUMBER field to be unique for a given manufacturer but defines no
	manufacturer identification field.

I don't know why they have this given the above. So it is possible (though
unlikely?) that model numbers will overlap, and so scsi_id values too?

If we put had an actual vendor in the sdev->vendor, we could use page 0x83
type 0 with no name collisions (if that vendor + model actually gives us
unique serial numbers). 

Why does the SAT translation spec have the vendor identification of ATA???

The "logical unit name derived from the world wide name" looks nicer, but I
assume not all vendors support that.

-- Patrick Mansfield


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click

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

* Re: [PATCH] /dev/disk/by-id incomplete and unhelpful for SATA drives
  2006-01-06 19:46                   ` Patrick Mansfield
@ 2006-01-06 23:44                     ` Douglas Gilbert
  0 siblings, 0 replies; 8+ messages in thread
From: Douglas Gilbert @ 2006-01-06 23:44 UTC (permalink / raw)
  To: Patrick Mansfield
  Cc: Chris Paulson-Ellis, Bill Nottingham, linux-hotplug-devel,
	linux-scsi, linux-ide, jgarzik

Patrick Mansfield wrote:
> On Fri, Jan 06, 2006 at 10:39:34PM +1000, Douglas Gilbert wrote:
> 
<snip>
> 
> I was trying to figure out if we are guranteed will have unique values
> across all ATA devices with Doug's patch. I am not familiar with ATA and
> IDENTIFY DEVICE.

http://www.t13.org/docs2005/D1699r2a-ATA8-ACS.pdf
is the most recent draft of the ATA-8 command set.

> For page 0x83, Doug's change above gives us:
> 
> 	ATA + 40 bytes of model/product (must have white space) + serial number
> 
> Under "10.3.4.2.3 Logical unit name derived from the model number and
> serial number" the spec says:
> 
> 	NOTE 9 The logical unit name using the T10 vendor identification
> 	format is not guaranteed to be worldwide unique, since ATA/ATAPI-7
> 	only requires the combination of the MODEL NUMBER field and SERIAL
> 	NUMBER field to be unique for a given manufacturer but defines no
> 	manufacturer identification field.
> 
> I don't know why they have this given the above. So it is possible (though
> unlikely?) that model numbers will overlap, and so scsi_id values too?

Unlikely but two vendors could use the same model and
serial numbers.

> If we put had an actual vendor in the sdev->vendor, we could use page 0x83
> type 0 with no name collisions (if that vendor + model actually gives us
> unique serial numbers). 
> 
> Why does the SAT translation spec have the vendor identification of ATA???

I guess because there is no requirement for a manufacturer
of (s)ATA disks to have a registered t10 vendor id ...
IEEE wants money for OUI registrations, t10 probably wants
money for a t10 vendor id, t13 probably wants money etc ...
BTW As I have mentioned in the past, linux probably should
have a OUI registration (paid by whom??).

> The "logical unit name derived from the world wide name" looks nicer, but I
> assume not all vendors support that.

Yes and not yet, until it becomes mandatory, if ever. ATA8-ACS shows
a naa-5 (8 byte, 4 word) identifier
starting at word 108 in the IDENTIFY DEVICE response. I like the
ACS wording: "Words 111-108 shall contain the optional value of the
world wide name"! The "shall" implies it is mandatory but obviously
the "optional" doesn't. Perhaps it was written by a lawyer :-)

We probably could and should add the naa-5 designator in VPD
page 0x83, perhaps dependent on whether there is a 0x5 in
word 108 bits 15-12 . For example, an old-ish Seagate ST380013AS
sata disks has zero in those 8 bytes.

Perhaps others could check their sata disks and report back if
any have a real naa-5 wwn starting at word 108. ["sg_inq -AH"
on a (s/p)ATA disk will dump the IDENTIFY DEVICE response in hex.]

Doug Gilbert


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

* Re: [PATCH] /dev/disk/by-id incomplete and unhelpful for SATA drives
  2006-01-06 12:39                 ` [PATCH] " Douglas Gilbert
  2006-01-06 13:34                   ` Chris Paulson-Ellis
  2006-01-06 19:46                   ` Patrick Mansfield
@ 2006-03-06 20:08                   ` Jeff Garzik
  2006-03-07 17:05                     ` Douglas Gilbert
  2 siblings, 1 reply; 8+ messages in thread
From: Jeff Garzik @ 2006-03-06 20:08 UTC (permalink / raw)
  To: dougg
  Cc: patman, Chris Paulson-Ellis, Bill Nottingham, linux-hotplug-devel,
	linux-scsi, linux-ide

Douglas Gilbert wrote:

> Changelog:
>   - make existing libata VPD device identification page (0x83)
>     supply the ATA serial number in the libata "vendor
>     specific" designator (from Chris Paulson-Ellis)
>   - add a "t10 vendor id based" designator as defined in
>     SAT rev 07a (section 10.3.4.2.3) that supplies ATA
>     model and serial numbers
>   - make the libata VPD page 0x83 more extensible (for
>     adding more designators in the future).
> 
> Signed-off-by: Douglas Gilbert <dougg@torque.net>

> ------------------------------------------------------------------------
> 
> --- linux/drivers/scsi/libata-scsi.c	2006-01-04 08:50:42.000000000 +1000
> +++ linux/drivers/scsi/libata-scsi.c2615vpd	2006-01-06 20:16:25.000000000 +1000
> @@ -1532,16 +1532,16 @@
>  	return 0;
>  }
>  
> -static const char *inq_83_str = "Linux ATA-SCSI simulator";
> -
>  /**
>   *	ata_scsiop_inq_83 - Simulate INQUIRY EVPD page 83, device identity
>   *	@args: device IDENTIFY data / SCSI command of interest.
>   *	@rbuf: Response buffer, to which simulated SCSI cmd output is sent.
>   *	@buflen: Response buffer length.
>   *
> - *	Returns device identification.  Currently hardcoded to
> - *	return "Linux ATA-SCSI simulator".
> + *	Yields two logocal unit device identification designators:
> + *	  - vendor specific ASCII containing the ATA serial number
> + *	  - SAT defined "t10 vendor id based" containing ASCII vendor
> + *	    name ("ATA     "), model and serial numbers.
>   *
>   *	LOCKING:
>   *	spin_lock_irqsave(host_set lock)
> @@ -1550,16 +1550,39 @@
>  unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf,
>  			      unsigned int buflen)
>  {
> +	int num;
> +	const int sat_model_serial_desc_len = 68;
> +	const int ata_model_byte_len = 40;
> +
>  	rbuf[1] = 0x83;			/* this page code */
> -	rbuf[3] = 4 + strlen(inq_83_str);	/* page len */
> +	num = 4;
>  
> -	/* our one and only identification descriptor (vendor-specific) */
> -	if (buflen > (strlen(inq_83_str) + 4 + 4 - 1)) {
> -		rbuf[4 + 0] = 2;	/* code set: ASCII */
> -		rbuf[4 + 3] = strlen(inq_83_str);
> -		memcpy(rbuf + 4 + 4, inq_83_str, strlen(inq_83_str));
> +	if (buflen > (ATA_SERNO_LEN + num + 3)) {
> +		/* piv=0, assoc=lu, code_set=ACSII, designator=vendor */
> +		rbuf[num + 0] = 2;	
> +		rbuf[num + 3] = ATA_SERNO_LEN;
> +		num += 4;
> +		ata_dev_id_string(args->id, (unsigned char *) rbuf + num,
> +				  ATA_ID_SERNO_OFS, ATA_SERNO_LEN);
> +		num += ATA_SERNO_LEN;
>  	}
> -
> +	if (buflen > (sat_model_serial_desc_len + num + 3)) {
> +		/* SAT defined lu model and serial numbers descriptor */
> +		/* piv=0, assoc=lu, code_set=ACSII, designator=t10 vendor id */
> +		rbuf[num + 0] = 2;	
> +		rbuf[num + 1] = 1;	
> +		rbuf[num + 3] = sat_model_serial_desc_len;
> +		num += 4;
> +		strncpy(rbuf + num, "ATA     ", 8);
> +		num += 8;
> +		ata_dev_id_string(args->id, (unsigned char *) rbuf + num,
> +				  ATA_ID_PROD_OFS, ata_model_byte_len);
> +		num += ata_model_byte_len;
> +		ata_dev_id_string(args->id, (unsigned char *) rbuf + num,
> +				  ATA_ID_SERNO_OFS, ATA_SERNO_LEN);
> +		num += ATA_SERNO_LEN;
> +	}
> +	rbuf[3] = num - 4;    /* page len (assume less than 256 bytes) */
>  	return 0;


This removes the identifier that has existed since libata was created, 
which could break something.

At the very least, update the existing code to indicate assoc=port, and 
then append the other descriptor data you wish to add after that.

	Jeff



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

* Re: [PATCH] /dev/disk/by-id incomplete and unhelpful for SATA drives
  2006-03-06 20:08                   ` Jeff Garzik
@ 2006-03-07 17:05                     ` Douglas Gilbert
  0 siblings, 0 replies; 8+ messages in thread
From: Douglas Gilbert @ 2006-03-07 17:05 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: patman, Chris Paulson-Ellis, Bill Nottingham, linux-hotplug-devel,
	linux-scsi, linux-ide

Jeff Garzik wrote:
> Douglas Gilbert wrote:
> 
>> Changelog:
>>   - make existing libata VPD device identification page (0x83)
>>     supply the ATA serial number in the libata "vendor
>>     specific" designator (from Chris Paulson-Ellis)
>>   - add a "t10 vendor id based" designator as defined in
>>     SAT rev 07a (section 10.3.4.2.3) that supplies ATA
>>     model and serial numbers
>>   - make the libata VPD page 0x83 more extensible (for
>>     adding more designators in the future).
>>
>> Signed-off-by: Douglas Gilbert <dougg@torque.net>
> 
> 
>> ------------------------------------------------------------------------
>>
>> --- linux/drivers/scsi/libata-scsi.c    2006-01-04 08:50:42.000000000
>> +1000
>> +++ linux/drivers/scsi/libata-scsi.c2615vpd    2006-01-06
>> 20:16:25.000000000 +1000
>> @@ -1532,16 +1532,16 @@
>>      return 0;
>>  }
>>  
>> -static const char *inq_83_str = "Linux ATA-SCSI simulator";
>> -
>>  /**
>>   *    ata_scsiop_inq_83 - Simulate INQUIRY EVPD page 83, device identity
>>   *    @args: device IDENTIFY data / SCSI command of interest.
>>   *    @rbuf: Response buffer, to which simulated SCSI cmd output is
>> sent.
>>   *    @buflen: Response buffer length.
>>   *
>> - *    Returns device identification.  Currently hardcoded to
>> - *    return "Linux ATA-SCSI simulator".
>> + *    Yields two logocal unit device identification designators:
>> + *      - vendor specific ASCII containing the ATA serial number
>> + *      - SAT defined "t10 vendor id based" containing ASCII vendor
>> + *        name ("ATA     "), model and serial numbers.
>>   *
>>   *    LOCKING:
>>   *    spin_lock_irqsave(host_set lock)
>> @@ -1550,16 +1550,39 @@
>>  unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf,
>>                    unsigned int buflen)
>>  {
>> +    int num;
>> +    const int sat_model_serial_desc_len = 68;
>> +    const int ata_model_byte_len = 40;
>> +
>>      rbuf[1] = 0x83;            /* this page code */
>> -    rbuf[3] = 4 + strlen(inq_83_str);    /* page len */
>> +    num = 4;
>>  
>> -    /* our one and only identification descriptor (vendor-specific) */
>> -    if (buflen > (strlen(inq_83_str) + 4 + 4 - 1)) {
>> -        rbuf[4 + 0] = 2;    /* code set: ASCII */
>> -        rbuf[4 + 3] = strlen(inq_83_str);
>> -        memcpy(rbuf + 4 + 4, inq_83_str, strlen(inq_83_str));
>> +    if (buflen > (ATA_SERNO_LEN + num + 3)) {
>> +        /* piv=0, assoc=lu, code_set=ACSII, designator=vendor */
>> +        rbuf[num + 0] = 2;   
>> +        rbuf[num + 3] = ATA_SERNO_LEN;
>> +        num += 4;
>> +        ata_dev_id_string(args->id, (unsigned char *) rbuf + num,
>> +                  ATA_ID_SERNO_OFS, ATA_SERNO_LEN);
>> +        num += ATA_SERNO_LEN;
>>      }
>> -
>> +    if (buflen > (sat_model_serial_desc_len + num + 3)) {
>> +        /* SAT defined lu model and serial numbers descriptor */
>> +        /* piv=0, assoc=lu, code_set=ACSII, designator=t10 vendor id */
>> +        rbuf[num + 0] = 2;   
>> +        rbuf[num + 1] = 1;   
>> +        rbuf[num + 3] = sat_model_serial_desc_len;
>> +        num += 4;
>> +        strncpy(rbuf + num, "ATA     ", 8);
>> +        num += 8;
>> +        ata_dev_id_string(args->id, (unsigned char *) rbuf + num,
>> +                  ATA_ID_PROD_OFS, ata_model_byte_len);
>> +        num += ata_model_byte_len;
>> +        ata_dev_id_string(args->id, (unsigned char *) rbuf + num,
>> +                  ATA_ID_SERNO_OFS, ATA_SERNO_LEN);
>> +        num += ATA_SERNO_LEN;
>> +    }
>> +    rbuf[3] = num - 4;    /* page len (assume less than 256 bytes) */
>>      return 0;
> 
> 
> 
> This removes the identifier that has existed since libata was created,
> which could break something.

Jeff,
That patch was sent on 6th January 2006. That is a long
time to respond.

The existing "Linux ATA-SCSI simulator" has assoc=lu and
designator_type=vendor. That claims to be the device identifier
for the SATA disk (i.e. the logical unit) in vendor format.
That is just plain wrong. Chris Paulson-Ellis was correct to
replace it with identification information related to the SATA
disk. I then went a step further and added the SAT defined
way of doing a similar thing. In the future when SATA disks
start supporting a naa-5 world wide unique identifier (word 108
to 111 in a IDENTIFY DEVICE response) then a third designator
can be added (assoc=lu designator_type=naa).

> At the very least, update the existing code to indicate assoc=port, and
> then append the other descriptor data you wish to add after that.

So change it (i.e. assoc=lu -> assoc=port) and keep the
"Linux ATA-SCSI simulator" string for (partial) backward
compatibility. Hmmmm.

A SAT layer identifiers itself generically with "ATA       "
in the vendor string. It could also use a version descriptor
in the standard INQUIRY response to identify which level
of SAT it supported. As for identifying that this was
the linux libata implementation of SAT, I'm not sure where
that should go. VPD page 0x83 for device identification
doesn't seem appropriate. If a linux box was being used
as a FC to SATA bridge then the bridge should be putting
FC related stuff in assoc=port and assoc=device while
keeping what libata put in assoc=lu.

Doug Gilbert



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

end of thread, other threads:[~2006-03-07 17:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <doc5jl$acv$1@sea.gmane.org>
     [not found] ` <20051221185518.GA9100@vrfy.org>
     [not found]   ` <43A9CFE0.2070103@edesix.com>
     [not found]     ` <20051222043527.GA13175@vrfy.org>
     [not found]       ` <43AA8D0B.10504@edesix.com>
     [not found]         ` <20051222183525.GA17871@devserv.devel.redhat.com>
     [not found]           ` <43AB40E2.1050009@edesix.com>
     [not found]             ` <20060106013640.GA27841@aracnet.com>
2006-01-06  2:57               ` /dev/disk/by-id incomplete and unhelpful for SATA drives Douglas Gilbert
2006-01-06 12:39                 ` [PATCH] " Douglas Gilbert
2006-01-06 13:34                   ` Chris Paulson-Ellis
2006-01-06 18:58                     ` Patrick Mansfield
2006-01-06 19:46                   ` Patrick Mansfield
2006-01-06 23:44                     ` Douglas Gilbert
2006-03-06 20:08                   ` Jeff Garzik
2006-03-07 17:05                     ` Douglas Gilbert

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).