All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] scsi_lib: Decode T-10 vendor IDs
@ 2016-05-09  7:14 Hannes Reinecke
  2016-05-10 20:08 ` Bart Van Assche
  2016-05-11  1:34 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Hannes Reinecke @ 2016-05-09  7:14 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, Paul Mackerras, linux-scsi, Hannes Reinecke,
	Hannes Reinecke

Some arrays / HBAs will only present T-10 vendor IDs, so we
should be decoding them, too.

Suggested-by: Paul Mackerras <paulus@ozlabs.org>
Tested-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/scsi_lib.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index b920c5d..3082de2 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -3064,6 +3064,7 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len)
 	 * - EUI-64 based 12-byte
 	 * - NAA IEEE Registered
 	 * - NAA IEEE Extended
+	 * - T10 Vendor ID
 	 * as longer descriptors reduce the likelyhood
 	 * of identification clashes.
 	 */
@@ -3082,6 +3083,21 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len)
 			goto next_desig;
 
 		switch (d[1] & 0xf) {
+		case 0x1:
+			/* T-10 Vendor ID */
+			if (cur_id_size > d[3])
+				break;
+			/* Prefer anything */
+			if (cur_id_type > 0x01 && cur_id_type != 0xff)
+				break;
+			cur_id_size = d[3];
+			if (cur_id_size + 4 > id_len)
+				cur_id_size = id_len - 4;
+			cur_id_str = d + 4;
+			cur_id_type = d[1] & 0xf;
+			id_size = snprintf(id, id_len, "t10.%*pE",
+					   cur_id_size, cur_id_str);
+			break;
 		case 0x2:
 			/* EUI-64 */
 			if (cur_id_size > d[3])
-- 
1.8.5.6


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

* Re: [PATCHv2] scsi_lib: Decode T-10 vendor IDs
  2016-05-09  7:14 [PATCHv2] scsi_lib: Decode T-10 vendor IDs Hannes Reinecke
@ 2016-05-10 20:08 ` Bart Van Assche
  2016-05-11  1:34 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2016-05-10 20:08 UTC (permalink / raw)
  To: Hannes Reinecke, Martin K. Petersen
  Cc: Christoph Hellwig, Paul Mackerras, linux-scsi, Hannes Reinecke

On 05/09/2016 12:14 AM, Hannes Reinecke wrote:
> Some arrays / HBAs will only present T-10 vendor IDs, so we
> should be decoding them, too.
>
> Suggested-by: Paul Mackerras <paulus@ozlabs.org>
> Tested-by: Paul Mackerras <paulus@ozlabs.org>
> Signed-off-by: Hannes Reinecke <hare@suse.com>

Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>

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

* Re: [PATCHv2] scsi_lib: Decode T-10 vendor IDs
  2016-05-09  7:14 [PATCHv2] scsi_lib: Decode T-10 vendor IDs Hannes Reinecke
  2016-05-10 20:08 ` Bart Van Assche
@ 2016-05-11  1:34 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2016-05-11  1:34 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Martin K. Petersen, Christoph Hellwig, Paul Mackerras,
	linux-scsi, Hannes Reinecke

>>>>> "Hannes" == Hannes Reinecke <hare@suse.de> writes:

Hannes> Some arrays / HBAs will only present T-10 vendor IDs, so we
Hannes> should be decoding them, too.

Applied to 4.7/scsi-queue.

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2016-05-11  1:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-09  7:14 [PATCHv2] scsi_lib: Decode T-10 vendor IDs Hannes Reinecke
2016-05-10 20:08 ` Bart Van Assche
2016-05-11  1:34 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.