hpsa compatility fixes
Subsystems (2)
cover hpsa compatility fixes
Hi all,
this is a patchset to get hpsa working on older controllers. Most notably older controller do not support the extended REPORT PHYS command, so we need to fallback to the legacy version here. I've also added a new sysfs HBA attribute 'ctlr_num', which displays the current controller number. With that attribute one can construct legacy '/dev/ccissX' symlinks to facilitate an update from older installations using the cciss driver.
As usual, comments and reviews are welcome.
Hannes Reinecke (3):
hpsa: use correct DID_NO_CONNECT hostbyte
hpsa: fallback to use legacy REPORT PHYS command
hpsa: add 'ctlr_num' sysfs attribute
drivers/scsi/hpsa.c | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.5.6
PATCH 2/3 hpsa: fallback to use legacy REPORT PHYS command
Older SmartArray controller 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
@@ -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,
Signature · 1 line
1.8.5.6
PATCH 3/3 hpsa: add 'ctlr_num' sysfs attribute
In reply to Hannes ReineckeAdd a sysfs attribute 'ctlr_num' holding the current HPSA controller number. This is required to construct compability 'cciss' links.
--- drivers/scsi/hpsa.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/scsi/hpsa.c +13 -0
@@ -867,6 +867,16 @@ static ssize_t path_info_show(struct device *dev,return output_len; } +static ssize_t host_show_ctlr_num (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct ctlr_info *h; +struct Scsi_Host *shost =class_to_shost (dev); + + h =shost_to_hba (shost); +return snprintf (buf,20 ,"%d\n" , h->ctlr); +} + static DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL); static DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL); static DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL);
@@ -890,6 +900,8 @@ static DEVICE_ATTR(resettable, S_IRUGO, host_show_resettable, NULL); static DEVICE_ATTR(lockup_detected, S_IRUGO, host_show_lockup_detected, NULL); +static DEVICE_ATTR(ctlr_num, S_IRUGO, + host_show_ctlr_num, NULL);static struct device_attribute *hpsa_sdev_attrs[] = { &dev_attr_raid_level,
@@ -910,6 +922,7 @@ static DEVICE_ATTR(lockup_detected, S_IRUGO, &dev_attr_hp_ssd_smart_path_status, &dev_attr_raid_offload_debug, &dev_attr_lockup_detected, + &dev_attr_ctlr_num, NULL, };
Signature · 1 line
1.8.5.6
PATCH 1/3 hpsa: use correct DID_NO_CONNECT hostbyte
In reply to Hannes ReineckeNOT_READY is a sense key, not a legit scsi hostbyte value. Use DID_NO_CONNECT instead.
--- drivers/scsi/hpsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hpsa.c +1 -1
@@ -5493,7 +5493,7 @@ static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd) dev = cmd->device->hostdata;if (!dev) { - cmd->result =NOT_READY <<16 ;/* host byte */ + cmd->result =DID_NO_CONNECT <<16 ; cmd->scsi_done (cmd);return 0 ; }
Signature · 1 line
1.8.5.6
Re: [PATCH 2/3] hpsa: fallback to use legacy REPORT PHYS command
In reply to Hannes ReineckeQuoted 4 lines · Hannes Reinecke
Older SmartArray controller do not support the extended REPORT PHYS command, so fallback to use the legacy version here.
Signed-off-by Hannes Reinecke <[email protected]>
Quoted 3 lines
---
drivers/scsi/hpsa.c | 28 ++++++++++++++++++++++++++--1 file changed, 26 insertions(+), 2 deletions(-)
Signature · 3 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg)
RE: [PATCH 1/3] hpsa: use correct DID_NO_CONNECT hostbyte
In reply to Hannes ReineckeQuoted 33 lines
-----Original Message-----
From: Hannes Reinecke [mailto:[email protected]]
Sent: Friday, November 18, 2016 1:33 AM
To: Martin K. Petersen
Cc: Christoph Hellwig; James Bottomley; Don Brace; Martin Wilck; linux- [email protected]; Hannes Reinecke; Hannes Reinecke
Subject: [PATCH 1/3] hpsa: use correctDID_NO_CONNECThostbyteEXTERNAL EMAIL
NOT_READYis a sense key, not a legit scsi hostbyte value. UseDID_NO_CONNECTinstead.Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/hpsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/hpsa.c +1
-1@@ -5493,7 +5493,7 @@ static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd) dev = cmd->device->hostdata;if (!dev) { - cmd->result =NOT_READY <<16 ;/* host byte */ + cmd->result =DID_NO_CONNECT <<16 ; cmd->scsi_done (cmd);return 0 ;}
Quoted 2 lines
--
1.8.5.6
RE: [PATCH 3/3] hpsa: add 'ctlr_num' sysfs attribute
In reply to Hannes ReineckeQuoted 58 lines
-----Original Message-----
From: Hannes Reinecke [mailto:[email protected]]
Sent: Friday, November 18, 2016 1:33 AM
To: Martin K. Petersen
Cc: Christoph Hellwig; James Bottomley; Don Brace; Martin Wilck; linux- [email protected]; Hannes Reinecke; Hannes Reinecke
Subject: [PATCH 3/3] hpsa: add 'ctlr_num' sysfs attributeEXTERNAL EMAIL
Add a sysfs attribute '
ctlr_num' holding the current HPSA controller number. This is required to construct compability 'cciss' links.Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/hpsa.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/scsi/hpsa.c +13
-1@@ -867,6 +867,16 @@ static ssize_t path_info_show(struct device *dev,return output_len; } +static ssize_t host_show_ctlr_num (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct ctlr_info *h; +struct Scsi_Host *shost =class_to_shost (dev); + + h =shost_to_hba (shost); +return snprintf (buf,20 ,"%d\n" , h->ctlr); +} + static DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL); static DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL); static DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL);@@ -890,6 +900,8 @@ static DEVICE_ATTR(resettable, S_IRUGO, host_show_resettable, NULL); static DEVICE_ATTR(lockup_detected, S_IRUGO, host_show_lockup_detected, NULL); +static DEVICE_ATTR(ctlr_num, S_IRUGO, + host_show_ctlr_num, NULL);static struct device_attribute *hpsa_sdev_attrs[] = { &dev_attr_raid_level,@@ -910,6 +922,7 @@ static DEVICE_ATTR(lockup_detected, S_IRUGO, &dev_attr_hp_ssd_smart_path_status, &dev_attr_raid_offload_debug, &dev_attr_lockup_detected, + &dev_attr_ctlr_num, NULL, }; --
Quoted 1 line
1.8.5.6
Re: [PATCH 2/3] hpsa: fallback to use legacy REPORT PHYS command
In reply to Hannes ReineckeQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Hannes" == Hannes Reinecke <[email protected]> writes:
Hannes> Older SmartArray controller do not support the extended REPORT Hannes> PHYS command, so fallback to use the legacy version here.
Don: Please review.
Thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Hannes" == Hannes Reinecke <[email protected]> writes:
Hannes> Hi all, this is a patchset to get hpsa working on older Hannes> controllers. Most notably older controller do not support the Hannes> extended REPORT PHYS command, so we need to fallback to the Hannes> legacy version here. I've also added a new sysfs HBA attribute Hannes> 'ctlr_num', which displays the current controller number. With Hannes> that attribute one can construct legacy '/dev/ccissX' symlinks Hannes> to facilitate an update from older installations using the cciss Hannes> driver.
Applied patches 1 and 3. Patch 2 is awaiting feedback from Microsemi.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
RE: [PATCH 2/3] hpsa: fallback to use legacy REPORT PHYS command
In reply to Hannes ReineckeQuoted 59 lines
-----Original Message-----
From: Hannes Reinecke [mailto:[email protected]]
Sent: Friday, November 18, 2016 1:33 AM
To: Martin K. Petersen
Cc: Christoph Hellwig; James Bottomley; Don Brace; Martin Wilck; linux- [email protected]; Hannes Reinecke; Hannes Reinecke
Subject: [PATCH 2/3] hpsa: fallback to use legacy REPORT PHYS commandEXTERNAL 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 <[email protected]>--- drivers/scsi/hpsa.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)drivers/scsi/hpsa.c +26
-2@@ -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; }
Quoted 3 lines
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.
Thanks,
Don Brace
ESC - Smart Storage
Microsemi Corporation
Re: [PATCH 2/3] hpsa: fallback to use legacy REPORT PHYS command
Quoted 59 lines · Don Brace
Quoted 59 lines
-----Original Message-----
From: Hannes Reinecke [mailto:[email protected]]
Sent: Friday, November 18, 2016 1:33 AM
To: Martin K. Petersen
Cc: Christoph Hellwig; James Bottomley; Don Brace; Martin Wilck; linux- [email protected]; Hannes Reinecke; Hannes Reinecke
Subject: [PATCH 2/3] hpsa: fallback to use legacy REPORT PHYS commandEXTERNAL 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 <[email protected]>--- drivers/scsi/hpsa.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)drivers/scsi/hpsa.c +26
-2@@ -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; }
Quoted 8 lines
Quoted 3 lines
static inline int hpsa_scsi_do_report_log_luns(struct
ctlr_info*h,
--
1.8.5.6For a non-extended
REPORT_PHYS, the buffer size is 8, so the divisor needs to be 8.REPORT_PHYS_EXTENDEDhas 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
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +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)