All of lore.kernel.org
 help / color / mirror / Atom feed
From: tom.ty89@gmail.com
To: tj@kernel.org
Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org,
	Tom Yan <tom.ty89@gmail.com>
Subject: [PATCH 2/2] libata-scsi: do not return t10 designator if drive has WWN
Date: Thu,  7 Jul 2016 06:12:13 +0800	[thread overview]
Message-ID: <577d824d.a10c420a.da50c.ffff9544@mx.google.com> (raw)
In-Reply-To: <20160706221213.1928-1-me>

From: Tom Yan <tom.ty89@gmail.com>

SAT (as of sat4r05f.pdf) only requires the t10 designator if the
drive does not support/have WWN. Besides, we already have the ATA
information VPD.

Signed-off-by: Tom Yan <tom.ty89@gmail.com>

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 9f478ad..84b3d42 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2210,21 +2210,6 @@ static unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf)
 	rbuf[1] = 0x83;			/* this page code */
 	num = 4;
 
-	/* 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;
-	memcpy(rbuf + num, "ATA     ", 8);
-	num += 8;
-	ata_id_string(args->id, (unsigned char *) rbuf + num, ATA_ID_PROD,
-		      ATA_ID_PROD_LEN);
-	num += ATA_ID_PROD_LEN;
-	ata_id_string(args->id, (unsigned char *) rbuf + num, ATA_ID_SERNO,
-		      ATA_ID_SERNO_LEN);
-	num += ATA_ID_SERNO_LEN;
-
 	if (ata_id_has_wwn(args->id)) {
 		/* SAT defined lu world wide name */
 		/* piv=0, assoc=lu, code_set=binary, designator=NAA */
@@ -2236,6 +2221,23 @@ static unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf)
 			      ATA_ID_WWN, ATA_ID_WWN_LEN);
 		num += ATA_ID_WWN_LEN;
 	}
+	else {
+		/* 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;
+		memcpy(rbuf + num, "ATA     ", 8);
+		num += 8;
+		ata_id_string(args->id, (unsigned char *) rbuf + num, ATA_ID_PROD,
+			      ATA_ID_PROD_LEN);
+		num += ATA_ID_PROD_LEN;
+		ata_id_string(args->id, (unsigned char *) rbuf + num, ATA_ID_SERNO,
+			      ATA_ID_SERNO_LEN);
+		num += ATA_ID_SERNO_LEN;
+	}
+
 	rbuf[3] = num - 4;    /* page len (assume less than 256 bytes) */
 	return 0;
 }
-- 
2.9.0


       reply	other threads:[~2016-07-06 22:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20160706221213.1928-1-me>
2016-07-06 22:12 ` tom.ty89 [this message]
2016-07-07 10:51   ` [PATCH 2/2] libata-scsi: do not return t10 designator if drive has WWN Sergei Shtylyov
2016-07-07 10:56   ` Hannes Reinecke
2016-07-07 12:40     ` Tom Yan
2016-07-07 12:44       ` Hannes Reinecke
2016-07-07 13:18         ` Tom Yan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=577d824d.a10c420a.da50c.ffff9544@mx.google.com \
    --to=tom.ty89@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.