Skip to contentSkip to conversation

hpsa: fallback to use legacy REPORT PHYS command

PATCH Applied Hannes Reinecke 3 participants 4 messages Dec 2, 2016 – Dec 5, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 hpsa: fallback to use legacy REPORT PHYS command

Older SmartArray controllers (eg SmartArray 64xx) do not support the extended REPORT PHYS command, so fallback to use the legacy version here.

---
 drivers/scsi/hpsa.c | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)
drivers/scsi/hpsa.c +26 -2
index 216c137..3783ef6 100644
@@ -3640,8 +3640,32 @@ static int hpsa_scsi_do_report_luns(struct ctlr_info *h, int logical,
 static inline int hpsa_scsi_do_report_phys_luns(struct ctlr_info *h,
 		struct ReportExtendedLUNdata *buf, int bufsize)
 {
-	return hpsa_scsi_do_report_luns(h, 0, buf, bufsize,
-						HPSA_REPORT_PHYS_EXTENDED);
+	int rc;
+	struct ReportLUNdata *lbuf;
+
+	rc = hpsa_scsi_do_report_luns(h, 0, buf, bufsize,
+				      HPSA_REPORT_PHYS_EXTENDED);
+	if (!rc || !hpsa_allow_any)
+		return rc;
+
+	/* REPORT PHYS EXTENDED is not supported */
+	lbuf = kzalloc(sizeof(*lbuf), GFP_KERNEL);
+	if (!lbuf)
+		return -ENOMEM;
+
+	rc = hpsa_scsi_do_report_luns(h, 0, lbuf, sizeof(*lbuf), 0);
+	if (!rc) {
+		int i;
+		u32 nphys;
+
+		/* Copy ReportLUNdata header */
+		memcpy(buf, lbuf, 8);
+		nphys = be32_to_cpu(*((__be32 *)lbuf->LUNListLength)) / 8;
+		for (i = 0; i < nphys; i++)
+			memcpy(buf->LUN[i].lunid, lbuf->LUN[i], 8);
+	}
+	kfree(lbuf);
+	return rc;
 }
 
 static inline int hpsa_scsi_do_report_log_luns(struct ctlr_info *h,
Signature · 1 line
1.8.5.6
Acked-by on v3 1/1
#1 lore raw
Quoted 59 lines

-----Original Message-----
From: Hannes Reinecke [mailto:[email protected]]
Sent: Friday, December 02, 2016 4:36 AM
To: Martin K. Petersen
Cc: Christoph Hellwig; James Bottomley; Don Brace; linux- [email protected]; Hannes Reinecke; Hannes Reinecke
Subject: [PATCHv3] hpsa: fallback to use legacy REPORT PHYS command

EXTERNAL EMAIL

Older SmartArray controllers (eg SmartArray 64xx) do not support the extended REPORT PHYS command, so fallback to use the legacy version here.

---
 drivers/scsi/hpsa.c | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)
drivers/scsi/hpsa.c +26 -2
index 216c137..3783ef6 100644
@@ -3640,8 +3640,32 @@ static int hpsa_scsi_do_report_luns(struct
 ctlr_info *h, int logical,
 static inline int hpsa_scsi_do_report_phys_luns(struct ctlr_info *h,
                struct ReportExtendedLUNdata *buf, int bufsize)
 {
-       return hpsa_scsi_do_report_luns(h, 0, buf, bufsize,
-                                               HPSA_REPORT_PHYS_EXTENDED);
+       int rc;
+       struct ReportLUNdata *lbuf;
+
+       rc = hpsa_scsi_do_report_luns(h, 0, buf, bufsize,
+                                     HPSA_REPORT_PHYS_EXTENDED);
+       if (!rc || !hpsa_allow_any)
+               return rc;
+
+       /* REPORT PHYS EXTENDED is not supported */
+       lbuf = kzalloc(sizeof(*lbuf), GFP_KERNEL);
+       if (!lbuf)
+               return -ENOMEM;
+
+       rc = hpsa_scsi_do_report_luns(h, 0, lbuf, sizeof(*lbuf), 0);
+       if (!rc) {
+               int i;
+               u32 nphys;
+
+               /* Copy ReportLUNdata header */
+               memcpy(buf, lbuf, 8);
+               nphys = be32_to_cpu(*((__be32 *)lbuf->LUNListLength)) / 8;
+               for (i = 0; i < nphys; i++)
+                       memcpy(buf->LUN[i].lunid, lbuf->LUN[i], 8);
+       }
+       kfree(lbuf);
+       return rc;
 }
 
Quoted 3 lines

static inline int hpsa_scsi_do_report_log_luns(struct ctlr_info *h,
--
1.8.5.6

Note: there has been zero testing on our end of these ancient controllers with the hpsa driver. While it might work there is no official support from either us or HPE on this configuration.

Thanks,
Don Brace
ESC - Smart Storage
Microsemi Corporation

#2 lore raw
Quoted 59 lines · Don Brace
Quoted 59 lines

-----Original Message-----
From: Hannes Reinecke [mailto:[email protected]]
Sent: Friday, December 02, 2016 4:36 AM
To: Martin K. Petersen
Cc: Christoph Hellwig; James Bottomley; Don Brace; linux- [email protected]; Hannes Reinecke; Hannes Reinecke
Subject: [PATCHv3] hpsa: fallback to use legacy REPORT PHYS command

EXTERNAL EMAIL

Older SmartArray controllers (eg SmartArray 64xx) do not support the extended REPORT PHYS command, so fallback to use the legacy version here.

---
 drivers/scsi/hpsa.c | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)
drivers/scsi/hpsa.c +26 -2
index 216c137..3783ef6 100644
@@ -3640,8 +3640,32 @@ static int hpsa_scsi_do_report_luns(struct
 ctlr_info *h, int logical,
 static inline int hpsa_scsi_do_report_phys_luns(struct ctlr_info *h,
                struct ReportExtendedLUNdata *buf, int bufsize)
 {
-       return hpsa_scsi_do_report_luns(h, 0, buf, bufsize,
-                                               HPSA_REPORT_PHYS_EXTENDED);
+       int rc;
+       struct ReportLUNdata *lbuf;
+
+       rc = hpsa_scsi_do_report_luns(h, 0, buf, bufsize,
+                                     HPSA_REPORT_PHYS_EXTENDED);
+       if (!rc || !hpsa_allow_any)
+               return rc;
+
+       /* REPORT PHYS EXTENDED is not supported */
+       lbuf = kzalloc(sizeof(*lbuf), GFP_KERNEL);
+       if (!lbuf)
+               return -ENOMEM;
+
+       rc = hpsa_scsi_do_report_luns(h, 0, lbuf, sizeof(*lbuf), 0);
+       if (!rc) {
+               int i;
+               u32 nphys;
+
+               /* Copy ReportLUNdata header */
+               memcpy(buf, lbuf, 8);
+               nphys = be32_to_cpu(*((__be32 *)lbuf->LUNListLength)) / 8;
+               for (i = 0; i < nphys; i++)
+                       memcpy(buf->LUN[i].lunid, lbuf->LUN[i], 8);
+       }
+       kfree(lbuf);
+       return rc;
 }
 
Quoted 9 lines
Quoted 3 lines

static inline int hpsa_scsi_do_report_log_luns(struct ctlr_info *h,
--
1.8.5.6

Note: there has been zero testing on our end of these ancient controllers with the hpsa driver. While it might work there is no official support from either us or HPE on this configuration.

Understood. Additionally this will only ever be used if the 'hpsa_allow_any' parameter is set, which already should be a hint to the user that he's about to enter unchartered territory.

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
#3 lore raw
In reply to Hannes Reinecke
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Hannes" == Hannes Reinecke <[email protected]> writes:

Hannes> Older SmartArray controllers (eg SmartArray 64xx) do not support Hannes> the extended REPORT PHYS command, so fallback to use the legacy Hannes> version here.

Applied to 4.10/scsi-queue.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering