* [PATCH] hpsa: fallback to use legacy REPORT PHYS command
@ 2016-12-02 10:32 Hannes Reinecke
2016-12-02 10:33 ` Hannes Reinecke
0 siblings, 1 reply; 2+ messages in thread
From: Hannes Reinecke @ 2016-12-02 10:32 UTC (permalink / raw)
To: Martin K. Petersen
Cc: Christoph Hellwig, James Bottomley, Don Brace, linux-scsi,
Hannes Reinecke, Hannes Reinecke
Older SmartArray controllers (eg SmartArray 64xx) do
not support the extended REPORT PHYS command, so
fallback to use the legacy version here.
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
drivers/scsi/hpsa.c | 30 +++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 216c137..0aed9d6 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3438,7 +3438,7 @@ static u64 hpsa_get_sas_address_from_report_physical(struct ctlr_info *h,
kfree(physdev);
return 0;
}
- nphysicals = get_unaligned_be32(physdev->LUNListLength) / 24;
+ nphysicals = get_unaligned_be32(physdev->LUNListLength) / 8;
for (i = 0; i < nphysicals; i++)
if (!memcmp(&physdev->LUN[i].lunid[0], scsi3addr, 8)) {
@@ -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)) / 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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hpsa: fallback to use legacy REPORT PHYS command
2016-12-02 10:32 [PATCH] hpsa: fallback to use legacy REPORT PHYS command Hannes Reinecke
@ 2016-12-02 10:33 ` Hannes Reinecke
0 siblings, 0 replies; 2+ messages in thread
From: Hannes Reinecke @ 2016-12-02 10:33 UTC (permalink / raw)
To: Martin K. Petersen
Cc: Christoph Hellwig, James Bottomley, Don Brace, linux-scsi,
Hannes Reinecke
On 12/02/2016 11:32 AM, Hannes Reinecke wrote:
> Older SmartArray controllers (eg SmartArray 64xx) do
> not support the extended REPORT PHYS command, so
> fallback to use the legacy version here.
>
> Signed-off-by: Hannes Reinecke <hare@suse.com>
> ---
> drivers/scsi/hpsa.c | 30 +++++++++++++++++++++++++++---
> 1 file changed, 27 insertions(+), 3 deletions(-)
>
Oh fsck.
I messed up.
Please ignore this patch.
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@suse.de +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)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-12-02 10:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-02 10:32 [PATCH] hpsa: fallback to use legacy REPORT PHYS command Hannes Reinecke
2016-12-02 10:33 ` Hannes Reinecke
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.