linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv3 0/6]  Support 64-bit LUNs
@ 2014-05-31  9:01 Hannes Reinecke
  2014-05-31  9:01 ` [PATCH 1/6] scsi: Remove CONFIG_SCSI_MULTI_LUN Hannes Reinecke
                   ` (6 more replies)
  0 siblings, 7 replies; 20+ messages in thread
From: Hannes Reinecke @ 2014-05-31  9:01 UTC (permalink / raw)
  To: James Bottomley
  Cc: Christoph Hellwig, Ewan Milne, linux-scsi, Hannes Reinecke

Hi all,

this patchset updates the SCSI stack to support full 64-bit LUNs.
The first patch is a simple fix; the next patch updates
the sequential scan logic to be compliant with SPC.
The third patch addresses a firmware issue with earlier
qla2xxx HBAs.
The next two patches update the SCSI stack and all drivers
to use 64-bit LUNs where appropriate.
And finally we need to update the conversion routine
scsilun_to_int() to cope with 64bit LUNs.

Two drivers have issues with 64bit LUNs:
- The qla2xxx driver uses a 32-bit LUN value for TMFs.
  But as the driver uses a max_lun value from 0xFFFF
  we should be safe for the time being.
- The zfcp driver uses a 32-bit LUN for debug records; the
  record format would need to be updated to cope with
  64-bit LUNs. But again, this driver uses 0xFFFFFFFF
  for max_lun, so it doesn't do any harm.

The other changes have been pretty straightforward.

Changed to v2:
- Add patch to fixup scsilun_to_int
- Add Reviewed-by: where applicable
- Remove last references to SCSI_MULTI_LUN

Hannes Reinecke (6):
  scsi: Remove CONFIG_SCSI_MULTI_LUN
  scsi_scan: Restrict sequential scan to 256 LUNs
  qla2xxx: Restrict max_lun to 16-bit for older HBAs
  scsi: use 64-bit LUNs
  scsi: use 64-bit value for 'max_luns'
  scsi_scan: Fixup scsilun_to_int()

 Documentation/scsi/tmscsim.txt       |  2 -
 drivers/ata/libata-scsi.c            |  2 +-
 drivers/ata/libata.h                 |  2 +-
 drivers/message/fusion/mptscsih.c    |  2 +-
 drivers/message/i2o/i2o_scsi.c       | 11 ++--
 drivers/s390/scsi/zfcp_dbf.c         |  3 +-
 drivers/s390/scsi/zfcp_unit.c        |  4 +-
 drivers/scsi/Kconfig                 | 14 ------
 drivers/scsi/NCR5380.c               |  2 +-
 drivers/scsi/aacraid/linit.c         |  2 +-
 drivers/scsi/advansys.c              |  2 +-
 drivers/scsi/aha152x.c               |  6 +--
 drivers/scsi/aic7xxx/aic79xx.h       |  2 +-
 drivers/scsi/aic7xxx/aic79xx_osm.c   |  6 +--
 drivers/scsi/aic7xxx/aic79xx_proc.c  |  2 +-
 drivers/scsi/aic7xxx/aic7xxx_osm.c   | 11 ++--
 drivers/scsi/aic7xxx/aic7xxx_proc.c  |  2 +-
 drivers/scsi/arcmsr/arcmsr_hba.c     |  8 +--
 drivers/scsi/csiostor/csio_scsi.c    | 24 ++++-----
 drivers/scsi/cxgbi/libcxgbi.c        |  2 +-
 drivers/scsi/cxgbi/libcxgbi.h        |  2 +-
 drivers/scsi/dc395x.c                | 51 ++++++++-----------
 drivers/scsi/eata.c                  |  4 +-
 drivers/scsi/fnic/fnic_scsi.c        |  4 +-
 drivers/scsi/hpsa.c                  |  2 +-
 drivers/scsi/ibmvscsi/ibmvfc.c       |  4 +-
 drivers/scsi/libiscsi.c              |  8 +--
 drivers/scsi/libsas/sas_scsi_host.c  | 11 ++--
 drivers/scsi/lpfc/lpfc_attr.c        | 10 +++-
 drivers/scsi/lpfc/lpfc_scsi.c        | 36 ++++++-------
 drivers/scsi/megaraid.c              |  6 +--
 drivers/scsi/megaraid/mega_common.h  |  2 +-
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |  4 +-
 drivers/scsi/ncr53c8xx.h             |  4 --
 drivers/scsi/pmcraid.c               |  2 +-
 drivers/scsi/qla2xxx/qla_def.h       |  6 +--
 drivers/scsi/qla2xxx/qla_gbl.h       | 18 +++----
 drivers/scsi/qla2xxx/qla_iocb.c      | 11 ++--
 drivers/scsi/qla2xxx/qla_isr.c       |  4 +-
 drivers/scsi/qla2xxx/qla_mbx.c       | 12 ++---
 drivers/scsi/qla2xxx/qla_mr.c        |  8 +--
 drivers/scsi/qla2xxx/qla_os.c        | 48 ++++++++++--------
 drivers/scsi/qla4xxx/ql4_glbl.h      |  4 +-
 drivers/scsi/qla4xxx/ql4_iocb.c      |  2 +-
 drivers/scsi/qla4xxx/ql4_isr.c       | 22 ++++----
 drivers/scsi/qla4xxx/ql4_mbx.c       |  6 +--
 drivers/scsi/qla4xxx/ql4_os.c        | 20 ++++----
 drivers/scsi/scsi.c                  |  8 +--
 drivers/scsi/scsi_debug.c            | 15 +++---
 drivers/scsi/scsi_priv.h             |  2 +-
 drivers/scsi/scsi_proc.c             |  2 +-
 drivers/scsi/scsi_scan.c             | 97 +++++++++++++++---------------------
 drivers/scsi/scsi_sysfs.c            | 14 +++---
 drivers/scsi/scsi_transport_fc.c     |  4 +-
 drivers/scsi/scsi_transport_iscsi.c  |  4 +-
 drivers/scsi/scsi_transport_sas.c    |  2 +-
 drivers/scsi/sg.c                    |  4 +-
 drivers/scsi/sym53c8xx_2/sym_glue.c  |  2 +-
 drivers/scsi/sym53c8xx_2/sym_hipd.h  |  2 +-
 drivers/target/loopback/tcm_loop.c   |  2 +-
 drivers/target/target_core_pscsi.c   | 12 ++---
 drivers/usb/storage/Kconfig          |  4 +-
 drivers/usb/storage/sddr09.c         |  4 +-
 drivers/usb/storage/usb.c            | 10 ++--
 include/linux/moduleparam.h          |  5 ++
 include/scsi/scsi.h                  |  2 +-
 include/scsi/scsi_device.h           | 22 ++++----
 include/scsi/scsi_devinfo.h          |  2 +
 include/scsi/scsi_host.h             |  6 +--
 include/scsi/scsi_transport.h        |  2 +-
 kernel/params.c                      |  1 +
 71 files changed, 314 insertions(+), 334 deletions(-)

-- 
1.7.12.4


^ permalink raw reply	[flat|nested] 20+ messages in thread
* [PATCHv4 0/6]  Support 64-bit LUNs
@ 2014-06-03  8:58 Hannes Reinecke
  2014-06-03  8:58 ` [PATCH 6/6] scsi_scan: Fixup scsilun_to_int() Hannes Reinecke
  0 siblings, 1 reply; 20+ messages in thread
From: Hannes Reinecke @ 2014-06-03  8:58 UTC (permalink / raw)
  To: James Bottomley
  Cc: Christoph Hellwig, Ewan Milne, linux-scsi, Hannes Reinecke

Hi all,

this patchset updates the SCSI stack to support full 64-bit LUNs.
The first patch is a simple fix; the next patch updates
the sequential scan logic to be compliant with SPC.
The third patch addresses a firmware issue with earlier
qla2xxx HBAs.
The next two patches update the SCSI stack and all drivers
to use 64-bit LUNs where appropriate.
And finally we need to update the conversion routines
scsilun_to_int to cope with 64bit LUNs.

Two drivers have issues with 64bit LUNs:
- The qla2xxx driver uses a 32-bit LUN value for TMFs.
  But as the driver uses a max_lun value from 0xFFFF
  we should be safe for the time being.
- The zfcp driver uses a 32-bit LUN for debug records; the
  record format would need to be updated to cope with
  64-bit LUNs. But again, this driver uses 0xFFFFFFFF
  for max_lun, so it doesn't do any harm.

The other changes have been pretty straightforward.

Changes to v3:
- Modified scsilun_to_int() as suggested by James B.

Changes to v2:
- Add patch to fixup scsilun_to_int
- Add Reviewed-by: where applicable
- Remove last references to SCSI_MULTI_LUN

Hannes Reinecke (6):
  scsi: Remove CONFIG_SCSI_MULTI_LUN
  scsi_scan: Restrict sequential scan to 256 LUNs
  qla2xxx: Restrict max_lun to 16-bit for older HBAs
  scsi: use 64-bit LUNs
  scsi: use 64-bit value for 'max_luns'
  scsi_scan: Fixup scsilun_to_int()

 Documentation/scsi/tmscsim.txt       |  2 -
 drivers/ata/libata-scsi.c            |  2 +-
 drivers/ata/libata.h                 |  2 +-
 drivers/message/fusion/mptscsih.c    |  2 +-
 drivers/message/i2o/i2o_scsi.c       | 11 ++---
 drivers/s390/scsi/zfcp_dbf.c         |  3 +-
 drivers/s390/scsi/zfcp_unit.c        |  4 +-
 drivers/scsi/Kconfig                 | 14 ------
 drivers/scsi/NCR5380.c               |  2 +-
 drivers/scsi/aacraid/linit.c         |  2 +-
 drivers/scsi/advansys.c              |  2 +-
 drivers/scsi/aha152x.c               |  6 +--
 drivers/scsi/aic7xxx/aic79xx.h       |  2 +-
 drivers/scsi/aic7xxx/aic79xx_osm.c   |  6 +--
 drivers/scsi/aic7xxx/aic79xx_proc.c  |  2 +-
 drivers/scsi/aic7xxx/aic7xxx_osm.c   | 11 +++--
 drivers/scsi/aic7xxx/aic7xxx_proc.c  |  2 +-
 drivers/scsi/arcmsr/arcmsr_hba.c     |  8 ++--
 drivers/scsi/csiostor/csio_scsi.c    | 24 +++++-----
 drivers/scsi/cxgbi/libcxgbi.c        |  2 +-
 drivers/scsi/cxgbi/libcxgbi.h        |  2 +-
 drivers/scsi/dc395x.c                | 51 +++++++++-----------
 drivers/scsi/eata.c                  |  4 +-
 drivers/scsi/fnic/fnic_scsi.c        |  4 +-
 drivers/scsi/hpsa.c                  |  2 +-
 drivers/scsi/ibmvscsi/ibmvfc.c       |  4 +-
 drivers/scsi/libiscsi.c              |  8 ++--
 drivers/scsi/libsas/sas_scsi_host.c  | 11 +++--
 drivers/scsi/lpfc/lpfc_attr.c        | 10 +++-
 drivers/scsi/lpfc/lpfc_scsi.c        | 36 +++++++--------
 drivers/scsi/megaraid.c              |  6 +--
 drivers/scsi/megaraid/mega_common.h  |  2 +-
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |  4 +-
 drivers/scsi/ncr53c8xx.h             |  4 --
 drivers/scsi/pmcraid.c               |  2 +-
 drivers/scsi/qla2xxx/qla_def.h       |  6 +--
 drivers/scsi/qla2xxx/qla_gbl.h       | 18 ++++----
 drivers/scsi/qla2xxx/qla_iocb.c      | 11 ++---
 drivers/scsi/qla2xxx/qla_isr.c       |  4 +-
 drivers/scsi/qla2xxx/qla_mbx.c       | 12 ++---
 drivers/scsi/qla2xxx/qla_mr.c        |  8 ++--
 drivers/scsi/qla2xxx/qla_os.c        | 48 +++++++++++--------
 drivers/scsi/qla4xxx/ql4_glbl.h      |  4 +-
 drivers/scsi/qla4xxx/ql4_iocb.c      |  2 +-
 drivers/scsi/qla4xxx/ql4_isr.c       | 22 ++++-----
 drivers/scsi/qla4xxx/ql4_mbx.c       |  6 +--
 drivers/scsi/qla4xxx/ql4_os.c        | 20 ++++----
 drivers/scsi/scsi.c                  |  8 ++--
 drivers/scsi/scsi_debug.c            | 15 +++---
 drivers/scsi/scsi_priv.h             |  2 +-
 drivers/scsi/scsi_proc.c             |  2 +-
 drivers/scsi/scsi_scan.c             | 90 +++++++++++++++---------------------
 drivers/scsi/scsi_sysfs.c            | 14 +++---
 drivers/scsi/scsi_transport_fc.c     |  4 +-
 drivers/scsi/scsi_transport_iscsi.c  |  4 +-
 drivers/scsi/scsi_transport_sas.c    |  2 +-
 drivers/scsi/sg.c                    |  4 +-
 drivers/scsi/sym53c8xx_2/sym_glue.c  |  2 +-
 drivers/scsi/sym53c8xx_2/sym_hipd.h  |  2 +-
 drivers/target/loopback/tcm_loop.c   |  2 +-
 drivers/target/target_core_pscsi.c   | 12 ++---
 drivers/usb/storage/Kconfig          |  4 +-
 drivers/usb/storage/sddr09.c         |  4 +-
 drivers/usb/storage/usb.c            | 10 ++--
 include/linux/moduleparam.h          |  5 ++
 include/scsi/scsi.h                  |  2 +-
 include/scsi/scsi_device.h           | 22 ++++-----
 include/scsi/scsi_devinfo.h          |  2 +
 include/scsi/scsi_host.h             |  6 +--
 include/scsi/scsi_transport.h        |  2 +-
 kernel/params.c                      |  1 +
 71 files changed, 312 insertions(+), 329 deletions(-)

-- 
1.7.12.4


^ permalink raw reply	[flat|nested] 20+ messages in thread
* [PATCH 6/6] scsi_scan: Fixup scsilun_to_int()
@ 2014-06-25 11:20 Hannes Reinecke
  0 siblings, 0 replies; 20+ messages in thread
From: Hannes Reinecke @ 2014-06-25 11:20 UTC (permalink / raw)
  To: linux-scsi; +Cc: Hannes Reinecke, Bart van Assche, Christoph Hellwig

scsilun_to_int() has an error which prevents it from generating
correct LUN numbers for 64bit values.
Also we should remove the misleading comment about portions of
the LUN being ignored; the initiator should treat the LUN as
an opaque value.
And, finally, the example given should use the correct
prefix (here: extended flat space addressing scheme).

This patch includes the modifications suggested by
Bart van Assche.

Cc: Bart van Assche <bvanassche@acm.org>
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: James Bottomley <jbottomley@parallels.com>
---
 drivers/scsi/scsi_scan.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index fa57a04..553e1c7 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1263,14 +1263,15 @@ static void scsi_sequential_lun_scan(struct scsi_target *starget,
  *     truncation before using this function.
  *
  * Notes:
- *     The struct scsi_lun is assumed to be four levels, with each level
- *     effectively containing a SCSI byte-ordered (big endian) short; the
- *     addressing bits of each level are ignored (the highest two bits).
  *     For a description of the LUN format, post SCSI-3 see the SCSI
  *     Architecture Model, for SCSI-3 see the SCSI Controller Commands.
  *
- *     Given a struct scsi_lun of: 0a 04 0b 03 00 00 00 00, this function returns
- *     the integer: 0x0b030a04
+ *     Given a struct scsi_lun of: d2 04 0b 03 00 00 00 00, this function
+ *     returns the integer: 0x0b03d204
+ *
+ *     This encoding will return a standard integer LUN for LUNs smaller
+ *     than 256, which typically use a single level LUN structure with
+ *     addressing method 0.
  **/
 u64 scsilun_to_int(struct scsi_lun *scsilun)
 {
@@ -1279,8 +1280,8 @@ u64 scsilun_to_int(struct scsi_lun *scsilun)
 
 	lun = 0;
 	for (i = 0; i < sizeof(lun); i += 2)
-		lun = lun | (((scsilun->scsi_lun[i] << 8) |
-			      scsilun->scsi_lun[i + 1]) << (i * 8));
+		lun = lun | (((u64)scsilun->scsi_lun[i] << ((i + 1) *8)) |
+			     ((u64)scsilun->scsi_lun[i + 1] << (i * 8)));
 	return lun;
 }
 EXPORT_SYMBOL(scsilun_to_int);
@@ -1294,13 +1295,10 @@ EXPORT_SYMBOL(scsilun_to_int);
  *     Reverts the functionality of the scsilun_to_int, which packed
  *     an 8-byte lun value into an int. This routine unpacks the int
  *     back into the lun value.
- *     Note: the scsilun_to_int() routine does not truly handle all
- *     8bytes of the lun value. This functions restores only as much
- *     as was set by the routine.
  *
  * Notes:
- *     Given an integer : 0x0b030a04,  this function returns a
- *     scsi_lun of : struct scsi_lun of: 0a 04 0b 03 00 00 00 00
+ *     Given an integer : 0x0b03d204,  this function returns a
+ *     struct scsi_lun of: d2 04 0b 03 00 00 00 00
  *
  **/
 void int_to_scsilun(u64 lun, struct scsi_lun *scsilun)
-- 
1.7.12.4


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

end of thread, other threads:[~2014-06-25 11:20 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-31  9:01 [PATCHv3 0/6] Support 64-bit LUNs Hannes Reinecke
2014-05-31  9:01 ` [PATCH 1/6] scsi: Remove CONFIG_SCSI_MULTI_LUN Hannes Reinecke
2014-05-31  9:01 ` [PATCH 2/6] scsi_scan: Restrict sequential scan to 256 LUNs Hannes Reinecke
2014-05-31  9:01 ` [PATCH 3/6] qla2xxx: Restrict max_lun to 16-bit for older HBAs Hannes Reinecke
2014-05-31  9:01 ` [PATCH 4/6] scsi: use 64-bit LUNs Hannes Reinecke
2014-06-02 16:13   ` Bart Van Assche
2014-05-31  9:01 ` [PATCH 5/6] scsi: use 64-bit value for 'max_luns' Hannes Reinecke
2014-05-31  9:01 ` [PATCH 6/6] scsi_scan: Fixup scsilun_to_int() Hannes Reinecke
2014-06-02 16:03   ` James Bottomley
2014-06-02 16:16   ` Bart Van Assche
2014-06-02  8:15 ` [PATCHv3 0/6] Support 64-bit LUNs Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2014-06-03  8:58 [PATCHv4 " Hannes Reinecke
2014-06-03  8:58 ` [PATCH 6/6] scsi_scan: Fixup scsilun_to_int() Hannes Reinecke
2014-06-10 11:37   ` Bart Van Assche
2014-06-10 13:41     ` Douglas Gilbert
2014-06-10 14:06     ` James Bottomley
2014-06-10 14:48       ` Bart Van Assche
2014-06-10 15:01         ` James Bottomley
2014-06-10 16:08           ` Bart Van Assche
2014-06-10 14:55       ` Douglas Gilbert
2014-06-25 11:20 Hannes Reinecke

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