All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
	James Bottomley <james.bottomley@hansenpartnership.com>,
	Bart van Assche <bvanassche@acm.org>,
	John Garry <john.garry@huawei.com>,
	Don Brace <don.brace@microchip.com>,
	linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>
Subject: [PATCH 07/21] scsi: use real inquiry data when initialising devices
Date: Fri,  3 Jul 2020 15:01:08 +0200	[thread overview]
Message-ID: <20200703130122.111448-8-hare@suse.de> (raw)
In-Reply-To: <20200703130122.111448-1-hare@suse.de>

Use dummy inquiry data when initialising devices and not just
some 'nullnullnull' string.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/scsi_scan.c | 34 +++++++++++++++++++++++++---------
 1 file changed, 25 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index f2437a7570ce..871c7609c159 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -81,7 +81,27 @@
 #define SCSI_SCAN_TARGET_PRESENT	1
 #define SCSI_SCAN_LUN_PRESENT		2
 
-static const char *scsi_null_device_strs = "nullnullnullnull";
+/*
+ * Dummy inquiry for virtual LUNs:
+ *
+ * standard INQUIRY: [qualifier indicates no connected LU]
+ *  PQual=1  Device_type=31  RMB=0  LU_CONG=0  version=0x05  [SPC-3]
+ *  [AERC=0]  [TrmTsk=0]  NormACA=0  HiSUP=0  Resp_data_format=2
+ *  SCCS=0  ACC=0  TPGS=0  3PC=0  Protect=0  [BQue=0]
+ *  EncServ=0  MultiP=0  [MChngr=0]  [ACKREQQ=0]  Addr16=0
+ *  [RelAdr=0]  WBus16=0  Sync=0  [Linked=0]  [TranDis=0]  CmdQue=0
+ *    length=36 (0x24)   Peripheral device type: no physical device on this lu
+ * Vendor identification: LINUX
+ * Product identification: VIRTUALLUN
+ * Product revision level: 1.0
+ */
+static const unsigned char scsi_null_inquiry[36] = {
+	0x3f, 0x00, 0x05, 0x02, 0x1f, 0x00, 0x00, 0x00,
+	0x4c, 0x49, 0x4e, 0x55, 0x58, 0x20, 0x20, 0x20,
+	0x56, 0x49, 0x52, 0x54, 0x55, 0x41, 0x4c, 0x4c,
+	0x55, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+	0x31, 0x2e, 0x30, 0x20
+};
 
 #define MAX_SCSI_LUNS	512
 
@@ -224,9 +244,10 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
 	if (!sdev)
 		goto out;
 
-	sdev->vendor = scsi_null_device_strs;
-	sdev->model = scsi_null_device_strs;
-	sdev->rev = scsi_null_device_strs;
+	sdev->type = scsi_null_inquiry[0] & 0x1f;
+	sdev->vendor = scsi_null_inquiry + 8;
+	sdev->model = scsi_null_inquiry + 16;
+	sdev->rev = scsi_null_inquiry + 32;
 	sdev->host = shost;
 	sdev->queue_ramp_up_period = SCSI_DEFAULT_RAMP_UP_PERIOD;
 	sdev->id = starget->id;
@@ -253,11 +274,6 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
 	 * slave_configure function */
 	sdev->max_device_blocked = SCSI_DEFAULT_DEVICE_BLOCKED;
 
-	/*
-	 * Some low level driver could use device->type
-	 */
-	sdev->type = -1;
-
 	/*
 	 * Assume that the device will have handshaking problems,
 	 * and then fix this field later if it turns out it
-- 
2.16.4


  parent reply	other threads:[~2020-07-03 13:01 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-03 13:01 [PATCHv6 00/21] scsi: enable reserved commands for LLDDs Hannes Reinecke
2020-07-03 13:01 ` [PATCH 01/21] scsi: drop gdth driver Hannes Reinecke
2020-07-03 13:01 ` [PATCH 02/21] block: add flag for internal commands Hannes Reinecke
2020-07-08  9:27   ` John Garry
2020-07-09 20:02     ` Jens Axboe
2020-07-17 10:32       ` John Garry
2020-07-03 13:01 ` [PATCH 03/21] scsi: add scsi_{get,put}_internal_cmd() helper Hannes Reinecke
2020-07-07 13:54   ` John Garry
2020-11-16  8:56   ` John Garry
2020-11-16  9:03     ` Hannes Reinecke
2020-11-18 12:28       ` John Garry
2020-12-07 10:15       ` John Garry
2020-12-07 15:52         ` Hannes Reinecke
2020-07-03 13:01 ` [PATCH 04/21] fnic: use internal commands Hannes Reinecke
2020-07-03 13:01 ` [PATCH 05/21] fnic: use scsi_host_busy_iter() to traverse commands Hannes Reinecke
2020-07-03 13:01 ` [PATCH 06/21] fnic: check for started requests in fnic_wq_copy_cleanup_handler() Hannes Reinecke
2020-07-03 13:01 ` Hannes Reinecke [this message]
2020-07-03 13:01 ` [PATCH 08/21] scsi: Use dummy inquiry data for the host device Hannes Reinecke
2020-07-03 13:01 ` [PATCH 09/21] scsi: revamp host device handling Hannes Reinecke
2020-07-03 13:01 ` [PATCH 10/21] snic: use reserved commands Hannes Reinecke
2020-07-08 11:08   ` John Garry
2020-07-08 11:18     ` Hannes Reinecke
2020-07-03 13:01 ` [PATCH 11/21] snic: use tagset iter for traversing commands Hannes Reinecke
2020-07-03 13:01 ` [PATCH 12/21] snic: check for started requests in snic_hba_reset_cmpl_handler() Hannes Reinecke
2020-07-03 13:01 ` [PATCH 13/21] scsi: implement reserved command handling Hannes Reinecke
2020-07-08  9:39   ` John Garry
2020-07-03 13:01 ` [PATCH 14/21] hpsa: move hpsa_hba_inquiry after scsi_add_host() Hannes Reinecke
2020-07-03 13:01 ` [PATCH 15/21] hpsa: use reserved commands Hannes Reinecke
2020-07-03 13:01 ` [PATCH 16/21] hpsa: use scsi_host_busy_iter() to traverse outstanding commands Hannes Reinecke
2020-07-03 13:01 ` [PATCH 17/21] hpsa: drop refcount field from CommandList Hannes Reinecke
2020-07-03 13:01 ` [PATCH 18/21] aacraid: move scsi_add_host() Hannes Reinecke
2020-07-03 13:01 ` [PATCH 19/21] aacraid: store target id in host_scribble Hannes Reinecke
2020-07-03 13:01 ` [PATCH 20/21] aacraid: use scsi_get_internal_cmd() Hannes Reinecke
2020-07-03 13:01 ` [PATCH 21/21] aacraid: use scsi_host_busy_iter() to traverse outstanding commands Hannes Reinecke
2020-10-27 15:27 ` [PATCHv6 00/21] scsi: enable reserved commands for LLDDs John Garry
2020-10-27 15:53   ` Hannes Reinecke
2020-10-27 16:59     ` John Garry
2020-10-27 17:07       ` Hannes Reinecke

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=20200703130122.111448-8-hare@suse.de \
    --to=hare@suse.de \
    --cc=bvanassche@acm.org \
    --cc=don.brace@microchip.com \
    --cc=hch@lst.de \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=john.garry@huawei.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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.