Re: [PATCH 2/3] hpsa: fallback to use legacy REPORT PHYS command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/01/2016 10:50 PM, Don Brace wrote:

-----Original Message-----
From: Hannes Reinecke [mailto:hare@xxxxxxx]
Sent: Friday, November 18, 2016 1:33 AM
To: Martin K. Petersen
Cc: Christoph Hellwig; James Bottomley; Don Brace; Martin Wilck; linux-
scsi@xxxxxxxxxxxxxxx; Hannes Reinecke; Hannes Reinecke
Subject: [PATCH 2/3] hpsa: fallback to use legacy REPORT PHYS command

EXTERNAL EMAIL


Older SmartArray controller do not support the extended REPORT PHYS
command, so fallback to use the legacy version here.

Signed-off-by: Hannes Reinecke <hare@xxxxxxxx>
---
 drivers/scsi/hpsa.c | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 488e17c..3d89f74 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3628,8 +3628,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)) / 24;
+               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,
--
1.8.5.6

For a non-extended REPORT_PHYS, the buffer size is 8, so the divisor needs to be 8.
REPORT_PHYS_EXTENDED has been around a long time, which controller and fw are you testing this on so I can
Also run some tests.

That was seen on an Smart Array 64xx.
Yes, I know, horribly ancient.

But this was sort-of the idea, namely that we can use 'hpsa' as a complete replacement for cciss.

I'll be fixing up the patch and resubmit it.

Cheers,

Hannes
--
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@xxxxxxx			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux