aacraid: Refactor for sas transport and bug fixes
Subsystems (2)
cover aacraid: Refactor for sas transport and bug fixes
This patchset primarily lays the foundation for adding sas transport support to the aacraid driver. Being said these patches are mainly code refactors, bug fixes and improvements.
- Fixed a udev inquiry race condition
- Fixed a kdump hang issue which occurs in case of error recovery in kdump
- Made improvements to ioctl reset and reset_host sysfs reset paths
- Changed the code to retrieve lun information into stand alone functions.
- Merged container and hba hotplug event processing (device addition and and removal into single function)
- Removed scsi_scan_host for safw devices and now explicitly add devices retrieved from the fw.
- Reschedule scan in driver fails to retrieve lun information from fw. (usually works in a few attempts)
- Rescan worker waits for any pending EH recovery before rescanning
- Do not trigger rescan worker in kdump kernel
Changes in V2:
- Added kmemdup intead of kmalloc and memcpy
- Changed incorrect reported-by credit
- Fixed missing colon in function doc
- Used get_unaligned_be32
- Removed unused phy_luns variable
- Removed unnecessary bus variable check and assignment
- Added patch to increment driver version to 50877 (Missed that one)
Raghava Aditya Renukunta (30):
scsi: aacraid: Fix udev inquiry race condition
scsi: aacraid: Do not attempt abort when Fw panicked
scsi: aacraid: Fix hang in kdump
scsi: aacraid: Do not remove offlined devices
scsi: aacraid: Fix ioctl reset hang
scsi: aacraid: Allow reset_host sysfs var to recover Panicked Fw
scsi: aacraid: Refactor reset_host store function
scsi: aacraid: Move code to wait for IO completion to shutdown func
scsi: aacraid: Create bmic submission function from bmic identify
scsi: aacraid: Change phy luns function to use common bmic function
scsi: aacraid: Refactor and rename to make mirror existing changes
scsi: aacraid: Add target setup helper function
scsi: aacraid: Untangle targets setup from report phy luns
scsi: aacraid: Move function around to match existing code
scsi: aacraid: Create helper functions to get lun info
scsi: aacraid: Save bmic phy information for each phy
scsi: aacraid: Add helper function to set queue depth
scsi: aacraid: Merge func to get container information
scsi: aacraid: Process hba and container hot plug events in single
function
scsi: aacraid: Added macros to help loop through known buses and
targets
scsi: aacraid: Refactor resolve luns code and scsi functions
scsi: aacraid: Merge adapter setup with resolve luns
scsi: aacraid: Block concurrent hotplug event handling
scsi: aacraid: Use hotplug handling function in place of
scsi_scan_host
scsi: aacraid: Reschedule host scan in case of failure
scsi: aacraid: Fix hang while scanning in eh recovery
scsi: aacraid: Skip schedule rescan in case of kdump
scsi: aacraid: Remove unused rescan variable
scsi: aacraid: Remove AAC_HIDE_DISK check in queue command
scsi: aacraid: Update driver version to 50877
drivers/scsi/aacraid/aachba.c | 468 +++++++++++++++++++++++++++------------- drivers/scsi/aacraid/aacraid.h | 54 ++++- drivers/scsi/aacraid/commctrl.c | 6 +- drivers/scsi/aacraid/comminit.c | 49 ++++- drivers/scsi/aacraid/commsup.c | 220 ++++++++++--------- drivers/scsi/aacraid/linit.c | 23 +- 6 files changed, 547 insertions(+), 273 deletions(-)
Signature · 1 line
2.9.4
PATCH v2 1/30 scsi: aacraid: Fix udev inquiry race condition
When udev requests for a devices inquiry string, it might create multiple threads causing a race condition on the shared inquiry resource string.
Created a buffer with the string for each thread.
---
Changes in V2:
Replaced kmalloc and memcpy adapter_type_text with kmemdup
drivers/scsi/aacraid/aachba.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/scsi/aacraid/aachba.c +12 -4
@@ -913,8 +913,16 @@ static void setinqstr(struct aac_dev *dev, void *data, int tindex)memset (str,' ' ,sizeof (*str));if (sup_adap_info->adapter_type_text[0 ]) { -char *cp = sup_adap_info->adapter_type_text;int c; +char *cp; +char *cname =kmemdup (sup_adap_info->adapter_type_text, +sizeof (sup_adap_info->adapter_type_text), +GFP_ATOMIC ); + +if (!cname) +return ; + + cp = cname;if ((cp[0 ] =='A' ) && (cp[1 ] =='O' ) && (cp[2 ] =='C' ))inqstrcpy ("SMC" , str->vid);else {
@@ -923,7 +931,7 @@ static void setinqstr(struct aac_dev *dev, void *data, int tindex) ++cp; c = *cp; *cp ='\0' ; -inqstrcpy (sup_adap_info->adapter_type_text, str->vid); +inqstrcpy (cname, str->vid); *cp = c;while (*cp && *cp !=' ' ) ++cp;
@@ -937,8 +945,8 @@ static void setinqstr(struct aac_dev *dev, void *data, int tindex) cp[sizeof (str->pid)] ='\0' ; }inqstrcpy (cp, str->pid); -if (c) - cp[sizeof (str->pid)] = c; + +kfree (cname); }else {struct aac_driver_ident *mp =aac_get_driver_ident (dev->cardtype);
Signature · 1 line
2.9.4
PATCH v2 2/30 scsi: aacraid: Do not attempt abort when Fw panicked
In reply to Raghava Aditya RenukuntaCheck if the adapter can receive abort requests, before sending aborts
---
Changes in V2:
None
drivers/scsi/aacraid/linit.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/aacraid/linit.c +3 -0
@@ -683,6 +683,9 @@ static int aac_eh_abort(struct scsi_cmnd* cmd)u32 bus, cid;int ret =FAILED ; +if (aac_adapter_check_health (aac)) +return ret; + bus =aac_logical_to_phys (scmd_channel (cmd)); cid =scmd_id (cmd);if (aac->hba_map[bus][cid].devtype ==AAC_DEVTYPE_NATIVE_RAW ) {
Signature · 1 line
2.9.4
PATCH v2 3/30 scsi: aacraid: Fix hang in kdump
In reply to Raghava Aditya RenukuntaDriver attempts to perform a device scan and device add after coming out of reset. At times when the kdump kernel loads and it tries to perform eh recovery, the device scan hangs since its commands are blocked because of the eh recovery. This should have shown up in normal eh recovery path (Should have been obvious)
Remove the code that performs scanning.I can live without the rescanning support in the stable kernels but a hanging kdump/eh recovery needs to be fixed.
---
Changes in V2:
Changed reported by from Guilherme G. Piccoli to Douglas Miller
drivers/scsi/aacraid/aachba.c | 1 - drivers/scsi/aacraid/commsup.c | 9 +-------- 2 files changed, 1 insertion(+), 9 deletions(-)
drivers/scsi/aacraid/aachba.c +0 -1
@@ -918,7 +918,6 @@ static void setinqstr(struct aac_dev *dev, void *data, int tindex)char *cname =kmemdup (sup_adap_info->adapter_type_text,sizeof (sup_adap_info->adapter_type_text),GFP_ATOMIC ); -if (!cname)return ;
drivers/scsi/aacraid/commsup.c +1 -8
@@ -1672,14 +1672,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type) out: aac->in_reset =0 ;scsi_unblock_requests (host); -/* -* Issue bus rescan to catch any configuration that might have -* occurred -*/ -if (!retval) { -dev_info (&aac->pdev->dev,"Issuing bus rescan\n" ); -scsi_scan_host (host); - } +if (jafo) {spin_lock_irq (host->host_lock); }
Signature · 1 line
2.9.4
PATCH v2 4/30 scsi: aacraid: Do not remove offlined devices
In reply to Raghava Aditya RenukuntaAs part of the recovery process, the drivers removes offline devices ( done by the kernel) and then tries to add them back in the rescan code. Removing the device is like taking a sledgehammer to a nail.
Set the device as running if it is marked offline.
---
Changes in V2:
None
drivers/scsi/aacraid/commsup.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/scsi/aacraid/commsup.c +4 -6
@@ -1658,14 +1658,12 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type) command->scsi_done (command); }/* -* Any Device that was already marked offline needs to be cleaned up +* Any Device that was already marked offline needs to be marked +* running */ __shost_for_each_device (dev, host) { -if (!scsi_device_online (dev)) { -sdev_printk (KERN_INFO , dev,"Removing offline device\n" ); -scsi_remove_device (dev); -scsi_device_put (dev); - } +if (!scsi_device_online (dev)) +scsi_device_set_state (dev,SDEV_RUNNING ); } retval =0 ;
Signature · 1 line
2.9.4
PATCH v2 5/30 scsi: aacraid: Fix ioctl reset hang
In reply to Raghava Aditya RenukuntaDriver would hang when attempting to send reset from the ioctl interface, since it would wait to retrieve the ioctl mutex at send shutdown.
Set adapter shutdown and unlock mutex before sending down reset request.
---
Changes in V2:
None
drivers/scsi/aacraid/commctrl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/scsi/aacraid/commctrl.c +5 -1
@@ -1052,9 +1052,13 @@ static int aac_send_reset_adapter(struct aac_dev *dev, void __user *arg)if (copy_from_user ((void *)&reset, arg,sizeof (struct aac_reset_iop )))return -EFAULT ; + dev->adapter_shutdown =1 ; + +mutex_unlock (&dev->ioctl_mutex); retval =aac_reset_adapter (dev,0 , reset.reset_type); -return retval; +mutex_lock (&dev->ioctl_mutex); +return retval; }int aac_do_ioctl (struct aac_dev * dev,int cmd,void __user *arg)
Signature · 1 line
2.9.4
PATCH v2 6/30 scsi: aacraid: Allow reset_host sysfs var to recover Panicked Fw
In reply to Raghava Aditya RenukuntaIt is possible to restart the controller via the use of the reset_host sysfs variable. This does work for controllers that can no longer respond, since driver will attempt to send down a shutdown in this path.
Check if the controller is able to receive commands before sending down a shutdown
---
Changes in V2:
None
drivers/scsi/aacraid/comminit.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/scsi/aacraid/comminit.c +8 -5
@@ -295,12 +295,10 @@ int aac_send_shutdown(struct aac_dev * dev) {struct fib * fibctx;struct aac_close *cmd; -int status; +int status =0 ; - fibctx =aac_fib_alloc (dev); -if (!fibctx) -return -ENOMEM ; -aac_fib_init (fibctx); +if (aac_adapter_check_health (dev)) +return status;if (!dev->adapter_shutdown) {mutex_lock (&dev->ioctl_mutex);
@@ -308,6 +306,11 @@ int aac_send_shutdown(struct aac_dev * dev)mutex_unlock (&dev->ioctl_mutex); } + fibctx =aac_fib_alloc (dev); +if (!fibctx) +return -ENOMEM ; +aac_fib_init (fibctx); + cmd = (struct aac_close *)fib_data (fibctx); cmd->command =cpu_to_le32 (VM_CloseAll); cmd->cid =cpu_to_le32 (0xfffffffe );
Signature · 1 line
2.9.4
PATCH v2 7/30 scsi: aacraid: Refactor reset_host store function
In reply to Raghava Aditya RenukuntaRefactored the reset_host store function to make consistent across code bases
---
Changes in V2:
None
drivers/scsi/aacraid/linit.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/scsi/aacraid/linit.c +3 -6
@@ -1375,18 +1375,15 @@ static ssize_t aac_store_reset_adapter(struct device *device, const char *buf, size_t count) { int retval = -EACCES; -int bled =0 ; -struct aac_dev *aac; -if (!capable (CAP_SYS_ADMIN ))return retval; - aac = (struct aac_dev *)class_to_shost (device)->hostdata; - bled = buf[0 ] =='!' ?1 :0 ; - retval =aac_reset_adapter (aac, bled,IOP_HWSOFT_RESET ); + retval =aac_reset_adapter (shost_priv (class_to_shost (device)), + buf[0 ] =='!' ,IOP_HWSOFT_RESET );if (retval >=0 ) retval = count; +return retval; }
Signature · 1 line
2.9.4
PATCH v2 8/30 scsi: aacraid: Move code to wait for IO completion to shutdown func
In reply to Raghava Aditya RenukuntaIdeally driver needs to wait for IO to be submitted or responded to before shutdown.
Move code to wait for IO completion into shutdown path
---
Changes in V2:
None
drivers/scsi/aacraid/comminit.c | 36 ++++++++++++++++++++++++++++++++++++ drivers/scsi/aacraid/commsup.c | 25 ------------------------- 2 files changed, 36 insertions(+), 25 deletions(-)
drivers/scsi/aacraid/comminit.c +36 -0
@@ -42,6 +42,8 @@#include <linux/completion.h> #include <linux/mm.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_cmnd.h> #include "aacraid.h"
@@ -284,6 +286,38 @@ static void aac_queue_init(struct aac_dev * dev, struct aac_queue * q, u32 *mem, q->entries = qsize; } +static void aac_wait_for_io_completion (struct aac_dev *aac) +{ +unsigned long flagv =0 ; +int i =0 ; + +for (i =60 ; i; --i) { +struct scsi_device *dev; +struct scsi_cmnd *command; +int active =0 ; + +__shost_for_each_device (dev, aac->scsi_host_ptr) { +spin_lock_irqsave (&dev->list_lock, flagv); +list_for_each_entry (command, &dev->cmd_list, list) { +if (command->SCp.phase ==AAC_OWNER_FIRMWARE ) { + active++; +break ; + } + } +spin_unlock_irqrestore (&dev->list_lock, flagv); +if (active) +break ; + + } +/* +* We can exit If all the commands are complete +*/ +if (active ==0 ) +break ; +ssleep (1 ); + } +} +/** * aac_send_shutdown - shutdown an adapter * @dev: Adapter to shutdown
@@ -306,6 +340,8 @@ int aac_send_shutdown(struct aac_dev * dev)mutex_unlock (&dev->ioctl_mutex); } +aac_wait_for_io_completion (dev); + fibctx =aac_fib_alloc (dev);if (!fibctx)return -ENOMEM ;
drivers/scsi/aacraid/commsup.c +0 -25
@@ -1701,31 +1701,6 @@ int aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)*/ host = aac->scsi_host_ptr;scsi_block_requests (host); -if (forced <2 )for (retval =60 ; retval; --retval) { -struct scsi_device * dev; -struct scsi_cmnd * command; -int active =0 ; - -__shost_for_each_device (dev, host) { -spin_lock_irqsave (&dev->list_lock, flagv); -list_for_each_entry (command, &dev->cmd_list, list) { -if (command->SCp.phase ==AAC_OWNER_FIRMWARE ) { - active++; -break ; - } - } -spin_unlock_irqrestore (&dev->list_lock, flagv); -if (active) -break ; - - } -/* -* We can exit If all the commands are complete -*/ -if (active ==0 ) -break ; -ssleep (1 ); - }/* Quiesce build, flush cache, write through mode */ if (forced <2 )
Signature · 1 line
2.9.4
PATCH v2 9/30 scsi: aacraid: Create bmic submission function from bmic identify
In reply to Raghava Aditya Renukuntasafw command submission is duplicated across many functions.
Move the safw submission code from bmic identify into its own function for common use
---
Changes in V2:
None
drivers/scsi/aacraid/aachba.c | 147 +++++++++++++++++++++++++++-------------- drivers/scsi/aacraid/aacraid.h | 7 +- 2 files changed, 105 insertions(+), 49 deletions(-)
drivers/scsi/aacraid/aachba.c +99 -48
@@ -1667,60 +1667,116 @@ static int aac_adapter_hba(struct fib *fib, struct scsi_cmnd *cmd) (void *) cmd); } -int aac_issue_bmic_identify (struct aac_dev *dev,u32 bus,u32 target) +static int aac_send_safw_bmic_cmd (struct aac_dev *dev, +struct aac_srb_unit *srbu,void *xfer_buf,int xfer_len) { -struct fib *fibptr; -struct aac_srb *srbcmd; -struct sgmap64 *sg64; -struct aac_ciss_identify_pd *identify_resp; -dma_addr_t addr; -u32 vbus, vid; -u16 fibsize, datasize; -int rcode = -ENOMEM ; - +struct fib *fibptr; +dma_addr_t addr; +int rcode; +int fibsize; +struct aac_srb *srb; +struct aac_srb_reply *srb_reply; +struct sgmap64 *sg64; +u32 vbus; +u32 vid; + +if (!dev->sa_firmware) +return 0 ; +/* allocate FIB */ fibptr =aac_fib_alloc (dev);if (!fibptr) - goto out; +return -ENOMEM ; - fibsize =sizeof (struct aac_srb ) - -sizeof (struct sgentry ) +sizeof (struct sgentry64 ); - datasize =sizeof (struct aac_ciss_identify_pd ); +aac_fib_init (fibptr); + fibptr->hw_fib_va->header.XferState &= + ~cpu_to_le32 (FastResponseCapable); - identify_resp =dma_alloc_coherent (&dev->pdev->dev, datasize, &addr, -GFP_KERNEL ); -if (!identify_resp) - goto fib_free_ptr; + fibsize =sizeof (struct aac_srb ) -sizeof (struct sgentry ) + +sizeof (struct sgentry64 ); - vbus = (u32 )le16_to_cpu (dev->supplement_adapter_info.virt_device_bus); - vid = (u32 )le16_to_cpu (dev->supplement_adapter_info.virt_device_target); +/* allocate DMA buffer for response */ + addr =dma_map_single (&dev->pdev->dev, xfer_buf, xfer_len, +DMA_BIDIRECTIONAL ); +if (dma_mapping_error (&dev->pdev->dev, addr)) { + rcode = -ENOMEM ; + goto fib_error; + } -aac_fib_init (fibptr); + srb =fib_data (fibptr); +memcpy (srb, &srbu->srb,sizeof (struct aac_srb )); - srbcmd = (struct aac_srb *)fib_data (fibptr); - srbcmd->function =cpu_to_le32 (SRBF_ExecuteScsi); - srbcmd->channel =cpu_to_le32 (vbus); - srbcmd->id =cpu_to_le32 (vid); - srbcmd->lun =0 ; - srbcmd->flags =cpu_to_le32 (SRB_DataIn); - srbcmd->timeout =cpu_to_le32 (10 ); - srbcmd->retry_limit =0 ; - srbcmd->cdb_size =cpu_to_le32 (12 ); - srbcmd->count =cpu_to_le32 (datasize); + vbus = (u32 )le16_to_cpu ( + dev->supplement_adapter_info.virt_device_bus); + vid = (u32 )le16_to_cpu ( + dev->supplement_adapter_info.virt_device_target); -memset (srbcmd->cdb,0 ,sizeof (srbcmd->cdb)); - srbcmd->cdb[0 ] =0x26 ; - srbcmd->cdb[2 ] = (u8)((AAC_MAX_LUN + target) &0x00FF ); - srbcmd->cdb[6 ] =CISS_IDENTIFY_PHYSICAL_DEVICE ; +/* set the common request fields */ + srb->channel =cpu_to_le32 (vbus); + srb->id =cpu_to_le32 (vid); + srb->lun =0 ; + srb->function =cpu_to_le32 (SRBF_ExecuteScsi); + srb->timeout =0 ; + srb->retry_limit =0 ; + srb->cdb_size =cpu_to_le32 (16 ); + srb->count =cpu_to_le32 (xfer_len); + + sg64 = (struct sgmap64 *)&srb->sg; + sg64->count =cpu_to_le32 (1 ); + sg64->sg[0 ].addr[1 ] =cpu_to_le32 (upper_32_bits (addr)); + sg64->sg[0 ].addr[0 ] =cpu_to_le32 (lower_32_bits (addr)); + sg64->sg[0 ].count =cpu_to_le32 (xfer_len); - sg64 = (struct sgmap64 *)&srbcmd->sg; - sg64->count =cpu_to_le32 (1 ); - sg64->sg[0 ].addr[1 ] =cpu_to_le32 ((u32)(((addr) >>16 ) >>16 )); - sg64->sg[0 ].addr[0 ] =cpu_to_le32 ((u32)(addr &0xffffffff )); - sg64->sg[0 ].count =cpu_to_le32 (datasize); +/* +* Copy the updated data for other dumping or other usage if needed +*/ +memcpy (&srbu->srb, srb,sizeof (struct aac_srb )); + +/* issue request to the controller */ + rcode =aac_fib_send (ScsiPortCommand64, fibptr, fibsize, FsaNormal, +1 ,1 ,NULL ,NULL ); + +if (rcode == -ERESTARTSYS ) + rcode = -ERESTART ; + +if (unlikely (rcode <0 )) + goto bmic_error; + + srb_reply = (struct aac_srb_reply *)fib_data (fibptr); +memcpy (&srbu->srb_reply, srb_reply,sizeof (struct aac_srb_reply )); + +bmic_error: +dma_unmap_single (&dev->pdev->dev, addr, xfer_len,DMA_BIDIRECTIONAL ); +fib_error: +aac_fib_complete (fibptr); +aac_fib_free (fibptr); +return rcode; +} + +static int aac_issue_bmic_identify (struct aac_dev *dev,u32 bus,u32 target) +{ +int rcode = -ENOMEM ; +u16 datasize; +struct aac_srb_unit srbu; +struct aac_srb *srbcmd; +struct aac_ciss_identify_pd *identify_resp; + + datasize =sizeof (struct aac_ciss_identify_pd ); + identify_resp =kmalloc (datasize,GFP_KERNEL ); +if (!identify_resp) + goto out; + +memset (&srbu,0 ,sizeof (struct aac_srb_unit )); - rcode =aac_fib_send (ScsiPortCommand64, - fibptr, fibsize, FsaNormal,1 ,1 ,NULL ,NULL ); + srbcmd = &srbu.srb; + srbcmd->flags =cpu_to_le32 (SRB_DataIn); + srbcmd->cdb[0 ] =0x26 ; + srbcmd->cdb[2 ] = (u8)((AAC_MAX_LUN + target) &0x00FF ); + srbcmd->cdb[6 ] =CISS_IDENTIFY_PHYSICAL_DEVICE ; + + rcode =aac_send_safw_bmic_cmd (dev, &srbu, identify_resp, datasize); +if (unlikely (rcode <0 )) + goto out;if (identify_resp->current_queue_depth_limit <=0 || identify_resp->current_queue_depth_limit >32 )
@@ -1729,12 +1785,7 @@ int aac_issue_bmic_identify(struct aac_dev *dev, u32 bus, u32 target) dev->hba_map[bus][target].qd_limit = identify_resp->current_queue_depth_limit; -dma_free_coherent (&dev->pdev->dev, datasize, identify_resp, addr); - -aac_fib_complete (fibptr); - -fib_free_ptr: -aac_fib_free (fibptr); +kfree (identify_resp); out:return rcode; }
drivers/scsi/aacraid/aacraid.h +6 -1
@@ -2021,6 +2021,12 @@ struct aac_srb_reply__le32 sense_data_size;u8 sense_data[AAC_SENSE_BUFFERSIZE ];// Can this be SCSI_SENSE_BUFFERSIZE }; + +struct aac_srb_unit { +struct aac_srb srb; +struct aac_srb_reply srb_reply; +}; +/* * SRB Flags */
@@ -2634,7 +2640,6 @@ static inline int aac_adapter_check_health(struct aac_dev *dev)int aac_acquire_irq (struct aac_dev *dev);void aac_free_irq (struct aac_dev *dev);int aac_report_phys_luns (struct aac_dev *dev,struct fib *fibptr,int rescan); -int aac_issue_bmic_identify (struct aac_dev *dev,u32 bus,u32 target);const char *aac_driverinfo (struct Scsi_Host *);void aac_fib_vector_assign (struct aac_dev *dev);struct fib *aac_fib_alloc (struct aac_dev *dev);
Signature · 1 line
2.9.4
PATCH v2 10/30 scsi: aacraid: Change phy luns function to use common bmic function
In reply to Raghava Aditya RenukuntaEdit function that retrieves phy lun information to use common bmic function
---
Changes in V2:
Added missing colon to match kernel coding style
drivers/scsi/aacraid/aachba.c | 75 +++++++++++++----------------------------- drivers/scsi/aacraid/aacraid.h | 2 +- drivers/scsi/aacraid/commsup.c | 11 +------ 3 files changed, 25 insertions(+), 63 deletions(-)
drivers/scsi/aacraid/aachba.c +23 -52
@@ -1853,66 +1853,37 @@ void aac_update_hba_map(struct aac_dev *dev,/** * aac_report_phys_luns() Process topology change * @dev: aac_dev structure -* @fibptr: fib pointer +* @rescan: Indicates rescan * * Execute a CISS REPORT PHYS LUNS and process the results into * the current hba_map. */ -int aac_report_phys_luns (struct aac_dev *dev,struct fib *fibptr,int rescan) +int aac_report_phys_luns (struct aac_dev *dev,int rescan) { -int fibsize, datasize; -struct aac_ciss_phys_luns_resp *phys_luns; +int rcode = -ENOMEM ; +int datasize;struct aac_srb *srbcmd; -struct sgmap64 *sg64; -dma_addr_t addr; -u32 vbus, vid; -int rcode =0 ; - -/* Thor SA Firmware -> CISS_REPORT_PHYSICAL_LUNS */ - fibsize =sizeof (struct aac_srb ) -sizeof (struct sgentry ) - +sizeof (struct sgentry64 ); - datasize =sizeof (struct aac_ciss_phys_luns_resp ) - + (AAC_MAX_TARGETS -1 ) *sizeof (struct _ciss_lun ); - - phys_luns =dma_alloc_coherent (&dev->pdev->dev, datasize, &addr, -GFP_KERNEL ); -if (phys_luns ==NULL ) { - rcode = -ENOMEM ; - goto err_out; - } - - vbus = (u32 )le16_to_cpu ( - dev->supplement_adapter_info.virt_device_bus); - vid = (u32 )le16_to_cpu ( - dev->supplement_adapter_info.virt_device_target); - -aac_fib_init (fibptr); +struct aac_srb_unit srbu; +struct aac_ciss_phys_luns_resp *phys_luns; - srbcmd = (struct aac_srb *)fib_data (fibptr); - srbcmd->function =cpu_to_le32 (SRBF_ExecuteScsi); - srbcmd->channel =cpu_to_le32 (vbus); - srbcmd->id =cpu_to_le32 (vid); - srbcmd->lun =0 ; - srbcmd->flags =cpu_to_le32 (SRB_DataIn); - srbcmd->timeout =cpu_to_le32 (10 ); - srbcmd->retry_limit =0 ; - srbcmd->cdb_size =cpu_to_le32 (12 ); - srbcmd->count =cpu_to_le32 (datasize); + datasize =sizeof (struct aac_ciss_phys_luns_resp ) + + (AAC_MAX_TARGETS -1 ) *sizeof (struct _ciss_lun ); + phys_luns =kmalloc (datasize,GFP_KERNEL ); +if (phys_luns ==NULL ) + goto err_out; -memset (srbcmd->cdb,0 ,sizeof (srbcmd->cdb)); - srbcmd->cdb[0 ] =CISS_REPORT_PHYSICAL_LUNS ; - srbcmd->cdb[1 ] =2 ;/* extended reporting */ - srbcmd->cdb[8 ] = (u8)(datasize >>8 ); - srbcmd->cdb[9 ] = (u8)(datasize); +memset (&srbu,0 ,sizeof (struct aac_srb_unit )); - sg64 = (struct sgmap64 *) &srbcmd->sg; - sg64->count =cpu_to_le32 (1 ); - sg64->sg[0 ].addr[1 ] =cpu_to_le32 (upper_32_bits (addr)); - sg64->sg[0 ].addr[0 ] =cpu_to_le32 (lower_32_bits (addr)); - sg64->sg[0 ].count =cpu_to_le32 (datasize); + srbcmd = &srbu.srb; + srbcmd->flags =cpu_to_le32 (SRB_DataIn); + srbcmd->cdb[0 ] =CISS_REPORT_PHYSICAL_LUNS ; + srbcmd->cdb[1 ] =2 ;/* extended reporting */ + srbcmd->cdb[8 ] = (u8)(datasize >>8 ); + srbcmd->cdb[9 ] = (u8)(datasize); - rcode =aac_fib_send (ScsiPortCommand64, fibptr, fibsize, - FsaNormal,1 ,1 ,NULL ,NULL ); + rcode =aac_send_safw_bmic_cmd (dev, &srbu, phys_luns, datasize); +if (unlikely (rcode <0 )) + goto err_out;/* analyse data */ if (rcode >=0 && phys_luns->resp_flag ==2 ) {
@@ -1920,7 +1891,7 @@ int aac_report_phys_luns(struct aac_dev *dev, struct fib *fibptr, int rescan)aac_update_hba_map (dev, phys_luns, rescan); } -dma_free_coherent (&dev->pdev->dev, datasize, phys_luns, addr); +kfree (phys_luns); err_out:return rcode; }
@@ -2030,7 +2001,7 @@ int aac_get_adapter_info(struct aac_dev* dev)if (!dev->sync_mode && dev->sa_firmware && dev->supplement_adapter_info.virt_device_bus !=0xffff ) {/* Thor SA Firmware -> CISS_REPORT_PHYSICAL_LUNS */ - rcode =aac_report_phys_luns (dev, fibptr,AAC_INIT ); + rcode =aac_report_phys_luns (dev,AAC_INIT ); }if (!dev->in_reset) {
drivers/scsi/aacraid/aacraid.h +1 -1
@@ -2639,7 +2639,7 @@ static inline int aac_adapter_check_health(struct aac_dev *dev)int aac_acquire_irq (struct aac_dev *dev);void aac_free_irq (struct aac_dev *dev); -int aac_report_phys_luns (struct aac_dev *dev,struct fib *fibptr,int rescan); +int aac_report_phys_luns (struct aac_dev *dev,int rescan);const char *aac_driverinfo (struct Scsi_Host *);void aac_fib_vector_assign (struct aac_dev *dev);struct fib *aac_fib_alloc (struct aac_dev *dev);
drivers/scsi/aacraid/commsup.c +1 -10
@@ -1919,7 +1919,6 @@ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr) {int i, bus, target, container, rcode =0 ;u32 events =0 ; -struct fib *fib;struct scsi_device *sdev;if (fibptr->hbacmd_size &SA_AIF_HOTPLUG )
@@ -1942,19 +1941,11 @@ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr)case SA_AIF_LDEV_CHANGE :case SA_AIF_BPCFG_CHANGE : - fib =aac_fib_alloc (dev); -if (!fib) { -pr_err ("aac_handle_sa_aif: out of memory\n" ); -return ; - }for (bus =0 ; bus <AAC_MAX_BUSES ; bus++)for (target =0 ; target <AAC_MAX_TARGETS ; target++) dev->hba_map[bus][target].new_devtype =0 ; - rcode =aac_report_phys_luns (dev, fib,AAC_RESCAN ); - -if (rcode != -ERESTARTSYS ) -aac_fib_free (fib); + rcode =aac_report_phys_luns (dev,AAC_RESCAN );aac_resolve_luns (dev);
Signature · 1 line
2.9.4
PATCH v2 11/30 scsi: aacraid: Refactor and rename to make mirror existing changes
In reply to Raghava Aditya RenukuntaRename variables and functions to make bmic identify, report phy luns to make them consistent across code internal existing code bases
---
Changes in V2:
None
drivers/scsi/aacraid/aachba.c | 36 +++++++++++++++++++----------------- drivers/scsi/aacraid/aacraid.h | 2 +- drivers/scsi/aacraid/commsup.c | 2 +- 3 files changed, 21 insertions(+), 19 deletions(-)
drivers/scsi/aacraid/aachba.c +19 -17
@@ -1753,17 +1753,18 @@ static int aac_send_safw_bmic_cmd(struct aac_dev *dev,return rcode; } -static int aac_issue_bmic_identify (struct aac_dev *dev,u32 bus,u32 target) +static int aac_issue_safw_bmic_identify (struct aac_dev *dev, +u32 bus,u32 target) {int rcode = -ENOMEM ; -u16 datasize; +int datasize;struct aac_srb_unit srbu;struct aac_srb *srbcmd; -struct aac_ciss_identify_pd *identify_resp; +struct aac_ciss_identify_pd *identify_reply; datasize =sizeof (struct aac_ciss_identify_pd ); - identify_resp =kmalloc (datasize,GFP_KERNEL ); -if (!identify_resp) + identify_reply =kmalloc (datasize,GFP_KERNEL ); +if (!identify_reply) goto out;memset (&srbu,0 ,sizeof (struct aac_srb_unit ));
@@ -1774,30 +1775,31 @@ static int aac_issue_bmic_identify(struct aac_dev *dev, u32 bus, u32 target) srbcmd->cdb[2 ] = (u8)((AAC_MAX_LUN + target) &0x00FF ); srbcmd->cdb[6 ] =CISS_IDENTIFY_PHYSICAL_DEVICE ; - rcode =aac_send_safw_bmic_cmd (dev, &srbu, identify_resp, datasize); + rcode =aac_send_safw_bmic_cmd (dev, &srbu, identify_reply, datasize);if (unlikely (rcode <0 )) goto out; -if (identify_resp->current_queue_depth_limit <=0 || - identify_resp->current_queue_depth_limit >32 ) +if (identify_reply->current_queue_depth_limit <=0 || + identify_reply->current_queue_depth_limit >32 ) dev->hba_map[bus][target].qd_limit =32 ;else dev->hba_map[bus][target].qd_limit = - identify_resp->current_queue_depth_limit; + identify_reply->current_queue_depth_limit; -kfree (identify_resp); +kfree (identify_reply); out:return rcode; }/** -* aac_update hba_map()- update current hba map with data from FW +* aac_set_safw_attr_all_targets- update current hba map with data from FW * @dev: aac_dev structure * @phys_luns: FW information from report phys luns +* @rescan: Indicates scan type * * Update our hba map with the information gathered from the FW */ -void aac_update_hba_map (struct aac_dev *dev, +static void aac_set_safw_attr_all_targets (struct aac_dev *dev,struct aac_ciss_phys_luns_resp *phys_luns,int rescan) {/* ok and extended reporting */
@@ -1839,7 +1841,7 @@ void aac_update_hba_map(struct aac_dev *dev,if (devtype !=AAC_DEVTYPE_NATIVE_RAW ) goto update_devtype; -if (aac_issue_bmic_identify (dev, bus, target) <0 ) +if (aac_issue_safw_bmic_identify (dev, bus, target) <0 ) dev->hba_map[bus][target].qd_limit =32 ; update_devtype:
@@ -1851,14 +1853,14 @@ void aac_update_hba_map(struct aac_dev *dev, }/** -* aac_report_phys_luns() Process topology change +* aac_get_safw_ciss_luns() Process topology change * @dev: aac_dev structure * @rescan: Indicates rescan * * Execute a CISS REPORT PHYS LUNS and process the results into * the current hba_map. */ -int aac_report_phys_luns (struct aac_dev *dev,int rescan) +int aac_get_safw_ciss_luns (struct aac_dev *dev,int rescan) {int rcode = -ENOMEM ;int datasize;
@@ -1888,7 +1890,7 @@ int aac_report_phys_luns(struct aac_dev *dev, int rescan)/* analyse data */ if (rcode >=0 && phys_luns->resp_flag ==2 ) {/* ok and extended reporting */ -aac_update_hba_map (dev, phys_luns, rescan); +aac_set_safw_attr_all_targets (dev, phys_luns, rescan); }kfree (phys_luns);
@@ -2001,7 +2003,7 @@ int aac_get_adapter_info(struct aac_dev* dev)if (!dev->sync_mode && dev->sa_firmware && dev->supplement_adapter_info.virt_device_bus !=0xffff ) {/* Thor SA Firmware -> CISS_REPORT_PHYSICAL_LUNS */ - rcode =aac_report_phys_luns (dev,AAC_INIT ); + rcode =aac_get_safw_ciss_luns (dev,AAC_INIT ); }if (!dev->in_reset) {
drivers/scsi/aacraid/aacraid.h +1 -1
@@ -2639,7 +2639,7 @@ static inline int aac_adapter_check_health(struct aac_dev *dev)int aac_acquire_irq (struct aac_dev *dev);void aac_free_irq (struct aac_dev *dev); -int aac_report_phys_luns (struct aac_dev *dev,int rescan); +int aac_get_safw_ciss_luns (struct aac_dev *dev,int rescan);const char *aac_driverinfo (struct Scsi_Host *);void aac_fib_vector_assign (struct aac_dev *dev);struct fib *aac_fib_alloc (struct aac_dev *dev);
drivers/scsi/aacraid/commsup.c +1 -1
@@ -1945,7 +1945,7 @@ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr)for (target =0 ; target <AAC_MAX_TARGETS ; target++) dev->hba_map[bus][target].new_devtype =0 ; - rcode =aac_report_phys_luns (dev,AAC_RESCAN ); + rcode =aac_get_safw_ciss_luns (dev,AAC_RESCAN );aac_resolve_luns (dev);
Signature · 1 line
2.9.4
PATCH v2 12/30 scsi: aacraid: Add target setup helper function
In reply to Raghava Aditya RenukuntaAdd helper function to setup targets devices and create the base for the upcoming patches
---
Changes in V2:
None
drivers/scsi/aacraid/aachba.c | 18 +++++++++++++----- drivers/scsi/aacraid/aacraid.h | 2 +- drivers/scsi/aacraid/commsup.c | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-)
drivers/scsi/aacraid/aachba.c +13 -5
@@ -1860,7 +1860,7 @@ static void aac_set_safw_attr_all_targets(struct aac_dev *dev,* Execute a CISS REPORT PHYS LUNS and process the results into * the current hba_map. */ -int aac_get_safw_ciss_luns (struct aac_dev *dev,int rescan) +static int aac_get_safw_ciss_luns (struct aac_dev *dev,int rescan) {int rcode = -ENOMEM ;int datasize;
@@ -1898,6 +1898,16 @@ int aac_get_safw_ciss_luns(struct aac_dev *dev, int rescan)return rcode; } +static int aac_setup_safw_targets (struct aac_dev *dev,int rescan) +{ +return aac_get_safw_ciss_luns (dev, rescan); +} + +int aac_setup_safw_adapter (struct aac_dev *dev,int rescan) +{ +return aac_setup_safw_targets (dev, rescan); +} +int aac_get_adapter_info (struct aac_dev * dev) {struct fib * fibptr;
@@ -2001,10 +2011,8 @@ int aac_get_adapter_info(struct aac_dev* dev) }if (!dev->sync_mode && dev->sa_firmware && - dev->supplement_adapter_info.virt_device_bus !=0xffff ) { -/* Thor SA Firmware -> CISS_REPORT_PHYSICAL_LUNS */ - rcode =aac_get_safw_ciss_luns (dev,AAC_INIT ); - } + dev->supplement_adapter_info.virt_device_bus !=0xffff ) + rcode =aac_setup_safw_adapter (dev,AAC_INIT );if (!dev->in_reset) {char buffer[16 ];
drivers/scsi/aacraid/aacraid.h +1 -1
@@ -2639,7 +2639,7 @@ static inline int aac_adapter_check_health(struct aac_dev *dev)int aac_acquire_irq (struct aac_dev *dev);void aac_free_irq (struct aac_dev *dev); -int aac_get_safw_ciss_luns (struct aac_dev *dev,int rescan); +int aac_setup_safw_adapter (struct aac_dev *dev,int rescan);const char *aac_driverinfo (struct Scsi_Host *);void aac_fib_vector_assign (struct aac_dev *dev);struct fib *aac_fib_alloc (struct aac_dev *dev);
drivers/scsi/aacraid/commsup.c +1 -1
@@ -1945,7 +1945,7 @@ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr)for (target =0 ; target <AAC_MAX_TARGETS ; target++) dev->hba_map[bus][target].new_devtype =0 ; - rcode =aac_get_safw_ciss_luns (dev,AAC_RESCAN ); + rcode =aac_setup_safw_adapter (dev,AAC_RESCAN );aac_resolve_luns (dev);
Signature · 1 line
2.9.4
PATCH v2 13/30 scsi: aacraid: Untangle targets setup from report phy luns
In reply to Raghava Aditya RenukuntaRemove function call to process targets from the report phy luns function and make it a function in its own right. This will help understand the flow of the code.
---
Changes in V2:
None
drivers/scsi/aacraid/aachba.c | 44 +++++++++++++++++++++++++++++++----------- drivers/scsi/aacraid/aacraid.h | 1 + 2 files changed, 34 insertions(+), 11 deletions(-)
drivers/scsi/aacraid/aachba.c +33 -11
@@ -1799,14 +1799,16 @@ static int aac_issue_safw_bmic_identify(struct aac_dev *dev,* * Update our hba map with the information gathered from the FW */ -static void aac_set_safw_attr_all_targets (struct aac_dev *dev, -struct aac_ciss_phys_luns_resp *phys_luns,int rescan) +static void aac_set_safw_attr_all_targets (struct aac_dev *dev,int rescan) {/* ok and extended reporting */ u32 lun_count, nexus;u32 i, bus, target;u8 expose_flag, attribs;u8 devtype; +struct aac_ciss_phys_luns_resp *phys_luns; + + phys_luns = dev->safw_phys_luns; lun_count = ((phys_luns->list_length[0 ] <<24 ) + (phys_luns->list_length[1] << 16)
@@ -1852,6 +1854,12 @@ static void aac_set_safw_attr_all_targets(struct aac_dev *dev, } } +static inline void aac_free_safw_ciss_luns (struct aac_dev *dev) +{ +kfree (dev->safw_phys_luns); + dev->safw_phys_luns =NULL ; +} +/** * aac_get_safw_ciss_luns() Process topology change * @dev: aac_dev structure
@@ -1872,7 +1880,7 @@ static int aac_get_safw_ciss_luns(struct aac_dev *dev, int rescan) (AAC_MAX_TARGETS -1 ) *sizeof (struct _ciss_lun ); phys_luns =kmalloc (datasize,GFP_KERNEL );if (phys_luns ==NULL ) - goto err_out; + goto out;memset (&srbu,0 ,sizeof (struct aac_srb_unit ));
@@ -1885,22 +1893,36 @@ static int aac_get_safw_ciss_luns(struct aac_dev *dev, int rescan) rcode =aac_send_safw_bmic_cmd (dev, &srbu, phys_luns, datasize);if (unlikely (rcode <0 )) - goto err_out; + goto mem_free_all; -/* analyse data */ -if (rcode >=0 && phys_luns->resp_flag ==2 ) { -/* ok and extended reporting */ -aac_set_safw_attr_all_targets (dev, phys_luns, rescan); +if (phys_luns->resp_flag !=2 ) { + rcode = -ENOMSG ; + goto mem_free_all; } -kfree (phys_luns); -err_out: + dev->safw_phys_luns = phys_luns; + +out:return rcode; +mem_free_all: +kfree (phys_luns); + goto out; + }static int aac_setup_safw_targets (struct aac_dev *dev,int rescan) { -return aac_get_safw_ciss_luns (dev, rescan); +int rcode =0 ; + + rcode =aac_get_safw_ciss_luns (dev, rescan); +if (unlikely (rcode <0 )) + goto out; + +aac_set_safw_attr_all_targets (dev, rescan); + +aac_free_safw_ciss_luns (dev); +out: +return rcode; }int aac_setup_safw_adapter (struct aac_dev *dev,int rescan)
drivers/scsi/aacraid/aacraid.h +1 -0
@@ -1671,6 +1671,7 @@ struct aac_devstruct msix_entry msixentry[AAC_MAX_MSIX ];struct aac_msix_ctx aac_msix[AAC_MAX_MSIX ];/* context */ struct aac_hba_map_info hba_map[AAC_MAX_BUSES ][AAC_MAX_TARGETS ]; +struct aac_ciss_phys_luns_resp *safw_phys_luns;u8 adapter_shutdown;u32 handle_pci_error; };
Signature · 1 line
2.9.4
PATCH v2 14/30 scsi: aacraid: Move function around to match existing code
In reply to Raghava Aditya RenukuntaMove the function to get phy luns information to the top of function to set target information
---
Changes in V2:
None
drivers/scsi/aacraid/aachba.c | 112 +++++++++++++++++++++--------------------- 1 file changed, 56 insertions(+), 56 deletions(-)
drivers/scsi/aacraid/aachba.c +56 -56
@@ -1791,6 +1791,62 @@ static int aac_issue_safw_bmic_identify(struct aac_dev *dev,return rcode; } +static inline void aac_free_safw_ciss_luns (struct aac_dev *dev) +{ +kfree (dev->safw_phys_luns); + dev->safw_phys_luns =NULL ; +} + +/** +* aac_get_safw_ciss_luns() Process topology change +* @dev: aac_dev structure +* @rescan: Indicates rescan +* +* Execute a CISS REPORT PHYS LUNS and process the results into +* the current hba_map. +*/ +static int aac_get_safw_ciss_luns (struct aac_dev *dev,int rescan) +{ +int rcode = -ENOMEM ; +int datasize; +struct aac_srb *srbcmd; +struct aac_srb_unit srbu; +struct aac_ciss_phys_luns_resp *phys_luns; + + datasize =sizeof (struct aac_ciss_phys_luns_resp ) + + (AAC_MAX_TARGETS -1 ) *sizeof (struct _ciss_lun ); + phys_luns =kmalloc (datasize,GFP_KERNEL ); +if (phys_luns ==NULL ) + goto out; + +memset (&srbu,0 ,sizeof (struct aac_srb_unit )); + + srbcmd = &srbu.srb; + srbcmd->flags =cpu_to_le32 (SRB_DataIn); + srbcmd->cdb[0 ] =CISS_REPORT_PHYSICAL_LUNS ; + srbcmd->cdb[1 ] =2 ;/* extended reporting */ + srbcmd->cdb[8 ] = (u8)(datasize >>8 ); + srbcmd->cdb[9 ] = (u8)(datasize); + + rcode =aac_send_safw_bmic_cmd (dev, &srbu, phys_luns, datasize); +if (unlikely (rcode <0 )) + goto mem_free_all; + +if (phys_luns->resp_flag !=2 ) { + rcode = -ENOMSG ; + goto mem_free_all; + } + + dev->safw_phys_luns = phys_luns; + +out: +return rcode; +mem_free_all: +kfree (phys_luns); + goto out; + +} +/** * aac_set_safw_attr_all_targets- update current hba map with data from FW * @dev: aac_dev structure
@@ -1854,62 +1910,6 @@ static void aac_set_safw_attr_all_targets(struct aac_dev *dev, int rescan) } } -static inline void aac_free_safw_ciss_luns (struct aac_dev *dev) -{ -kfree (dev->safw_phys_luns); - dev->safw_phys_luns =NULL ; -} - -/** -* aac_get_safw_ciss_luns() Process topology change -* @dev: aac_dev structure -* @rescan: Indicates rescan -* -* Execute a CISS REPORT PHYS LUNS and process the results into -* the current hba_map. -*/ -static int aac_get_safw_ciss_luns (struct aac_dev *dev,int rescan) -{ -int rcode = -ENOMEM ; -int datasize; -struct aac_srb *srbcmd; -struct aac_srb_unit srbu; -struct aac_ciss_phys_luns_resp *phys_luns; - - datasize =sizeof (struct aac_ciss_phys_luns_resp ) + - (AAC_MAX_TARGETS -1 ) *sizeof (struct _ciss_lun ); - phys_luns =kmalloc (datasize,GFP_KERNEL ); -if (phys_luns ==NULL ) - goto out; - -memset (&srbu,0 ,sizeof (struct aac_srb_unit )); - - srbcmd = &srbu.srb; - srbcmd->flags =cpu_to_le32 (SRB_DataIn); - srbcmd->cdb[0 ] =CISS_REPORT_PHYSICAL_LUNS ; - srbcmd->cdb[1 ] =2 ;/* extended reporting */ - srbcmd->cdb[8 ] = (u8)(datasize >>8 ); - srbcmd->cdb[9 ] = (u8)(datasize); - - rcode =aac_send_safw_bmic_cmd (dev, &srbu, phys_luns, datasize); -if (unlikely (rcode <0 )) - goto mem_free_all; - -if (phys_luns->resp_flag !=2 ) { - rcode = -ENOMSG ; - goto mem_free_all; - } - - dev->safw_phys_luns = phys_luns; - -out: -return rcode; -mem_free_all: -kfree (phys_luns); - goto out; - -} -static int aac_setup_safw_targets (struct aac_dev *dev,int rescan) {int rcode =0 ;
Signature · 1 line
2.9.4
PATCH v2 15/30 scsi: aacraid: Create helper functions to get lun info
In reply to Raghava Aditya RenukuntaCreated inline function to retrieve lun info for each device from the phy luns structure.
---
Changes in V2:
Use get_unaligned_be32 instead of open ended conversion
drivers/scsi/aacraid/aachba.c | 54 +++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 12 deletions(-)
drivers/scsi/aacraid/aachba.c +42 -12
@@ -42,6 +42,8 @@#include <linux/highmem.h> /* For flush_kernel_dcache_page */ #include <linux/module.h> +#include <asm/unaligned.h> +#include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> #include <scsi/scsi_device.h>
@@ -1844,7 +1846,41 @@ static int aac_get_safw_ciss_luns(struct aac_dev *dev, int rescan) mem_free_all:kfree (phys_luns); goto out; +} + +static inline u32 aac_get_safw_phys_lun_count (struct aac_dev *dev) +{ +return get_unaligned_be32 (&dev->safw_phys_luns->list_length[0 ]); +} + +static inline u32 aac_get_safw_phys_bus (struct aac_dev *dev,int lun) +{ +return dev->safw_phys_luns->lun[lun].level2[1 ] &0x3f ; +} + +static inline u32 aac_get_safw_phys_target (struct aac_dev *dev,int lun) +{ +return dev->safw_phys_luns->lun[lun].level2[0 ]; +} +static inline u32 aac_get_safw_phys_expose_flag (struct aac_dev *dev,int lun) +{ +return dev->safw_phys_luns->lun[lun].bus >>6 ; +} + +static inline u32 aac_get_safw_phys_attribs (struct aac_dev *dev,int lun) +{ +return dev->safw_phys_luns->lun[lun].node_ident[9 ]; +} + +static inline u32 aac_get_safw_phys_nexus (struct aac_dev *dev,int lun) +{ +return *((u32 *)&dev->safw_phys_luns->lun[lun].node_ident[12 ]); +} + +static inline u32 aac_get_safw_phys_device_type (struct aac_dev *dev,int lun) +{ +return dev->safw_phys_luns->lun[lun].node_ident[8 ]; }/**
@@ -1862,22 +1898,16 @@ static void aac_set_safw_attr_all_targets(struct aac_dev *dev, int rescan)u32 i, bus, target;u8 expose_flag, attribs;u8 devtype; -struct aac_ciss_phys_luns_resp *phys_luns; - - phys_luns = dev->safw_phys_luns; - lun_count = ((phys_luns->list_length[0 ] <<24 ) - + (phys_luns->list_length[1 ] <<16 ) - + (phys_luns->list_length[2 ] <<8 ) - + (phys_luns->list_length[3 ])) /24 ; + lun_count =aac_get_safw_phys_lun_count (dev);for (i =0 ; i < lun_count; ++i) { - bus = phys_luns->lun[i].level2[1 ] &0x3f ; - target = phys_luns->lun[i].level2[0 ]; - expose_flag = phys_luns->lun[i].bus >>6 ; - attribs = phys_luns->lun[i].node_ident[9 ]; - nexus = *((u32 *) &phys_luns->lun[i].node_ident[12 ]); + bus =aac_get_safw_phys_bus (dev, i); + target =aac_get_safw_phys_target (dev, i); + expose_flag =aac_get_safw_phys_expose_flag (dev, i); + attribs =aac_get_safw_phys_attribs (dev, i); + nexus =aac_get_safw_phys_nexus (dev, i);if (bus >=AAC_MAX_BUSES || target >=AAC_MAX_TARGETS )continue ;
Signature · 1 line
2.9.4
PATCH v2 16/30 scsi: aacraid: Save bmic phy information for each phy
In reply to Raghava Aditya RenukuntaSave the bmic information for each phy, so that it can processed in target setup function.
---
Changes in V2:
Removed unused phy_luns variable
drivers/scsi/aacraid/aachba.c | 84 +++++++++++++++++++++++++++++++++++++++--- drivers/scsi/aacraid/aacraid.h | 1 + 2 files changed, 79 insertions(+), 6 deletions(-)
drivers/scsi/aacraid/aachba.c +78 -6
@@ -1756,7 +1756,7 @@ static int aac_send_safw_bmic_cmd(struct aac_dev *dev, }static int aac_issue_safw_bmic_identify (struct aac_dev *dev, -u32 bus,u32 target) +struct aac_ciss_identify_pd **identify_resp,u32 bus,u32 target) {int rcode = -ENOMEM ;int datasize;
@@ -1779,7 +1779,7 @@ static int aac_issue_safw_bmic_identify(struct aac_dev *dev, rcode =aac_send_safw_bmic_cmd (dev, &srbu, identify_reply, datasize);if (unlikely (rcode <0 )) - goto out; + goto mem_free_all;if (identify_reply->current_queue_depth_limit <=0 || identify_reply->current_queue_depth_limit >32 )
@@ -1788,9 +1788,13 @@ static int aac_issue_safw_bmic_identify(struct aac_dev *dev, dev->hba_map[bus][target].qd_limit = identify_reply->current_queue_depth_limit; -kfree (identify_reply); + *identify_resp = identify_reply; + out:return rcode; +mem_free_all: +kfree (identify_reply); + goto out; }static inline void aac_free_safw_ciss_luns (struct aac_dev *dev)
@@ -1883,6 +1887,71 @@ static inline u32 aac_get_safw_phys_device_type(struct aac_dev *dev, int lun)return dev->safw_phys_luns->lun[lun].node_ident[8 ]; } +static inline void aac_free_safw_identify_resp (struct aac_dev *dev, +int bus,int target) +{ +kfree (dev->hba_map[bus][target].safw_identify_resp); + dev->hba_map[bus][target].safw_identify_resp =NULL ; +} + +static inline void aac_free_safw_all_identify_resp (struct aac_dev *dev, +int lun_count) +{ +int luns; +int i; +u32 bus; +u32 target; + + luns =aac_get_safw_phys_lun_count (dev); + +if (luns < lun_count) + lun_count = luns; +else if (lun_count <0 ) + lun_count = luns; + +for (i =0 ; i < lun_count; i++) { + bus =aac_get_safw_phys_bus (dev, i); + target =aac_get_safw_phys_target (dev, i); + +aac_free_safw_identify_resp (dev, bus, target); + } +} + +static int aac_get_safw_attr_all_targets (struct aac_dev *dev,int rescan) +{ +int i; +int rcode =0 ; +u32 lun_count; +u32 bus; +u32 target; +struct aac_ciss_identify_pd *identify_resp =NULL ; + + lun_count =aac_get_safw_phys_lun_count (dev); + +for (i =0 ; i < lun_count; ++i) { + + bus =aac_get_safw_phys_bus (dev, i); + target =aac_get_safw_phys_target (dev, i); + + rcode =aac_issue_safw_bmic_identify (dev, + &identify_resp, bus, target); + +if (unlikely (rcode <0 )) { + dev->hba_map[bus][target].qd_limit =32 ; + goto free_identify_resp; + } + + dev->hba_map[bus][target].safw_identify_resp = identify_resp; + } + +out: +return rcode; + +free_identify_resp: +aac_free_safw_all_identify_resp (dev, i); + goto out; +} +/** * aac_set_safw_attr_all_targets- update current hba map with data from FW * @dev: aac_dev structure
@@ -1929,9 +1998,6 @@ static void aac_set_safw_attr_all_targets(struct aac_dev *dev, int rescan)if (devtype !=AAC_DEVTYPE_NATIVE_RAW ) goto update_devtype; -if (aac_issue_safw_bmic_identify (dev, bus, target) <0 ) - dev->hba_map[bus][target].qd_limit =32 ; - update_devtype:if (rescan ==AAC_INIT ) dev->hba_map[bus][target].devtype = devtype;
@@ -1948,8 +2014,14 @@ static int aac_setup_safw_targets(struct aac_dev *dev, int rescan)if (unlikely (rcode <0 )) goto out; + rcode =aac_get_safw_attr_all_targets (dev, rescan); +if (unlikely (rcode <0 )) + goto free_ciss_luns; +aac_set_safw_attr_all_targets (dev, rescan); +aac_free_safw_all_identify_resp (dev,-1 ); +free_ciss_luns:aac_free_safw_ciss_luns (dev); out:return rcode;
drivers/scsi/aacraid/aacraid.h +1 -0
@@ -1345,6 +1345,7 @@ struct aac_hba_map_info {/* after xth TM LUN reset */ u16 qd_limit;u8 expose;/*checks if to expose or not*/ +struct aac_ciss_identify_pd *safw_identify_resp; };/*
Signature · 1 line
2.9.4
PATCH v2 17/30 scsi: aacraid: Add helper function to set queue depth
In reply to Raghava Aditya RenukuntaAdd helper function to set queue depth from information retrieved from the bmic phy structure.
---
Changes in V2:
None
drivers/scsi/aacraid/aachba.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-)
drivers/scsi/aacraid/aachba.c +24 -13
@@ -1755,6 +1755,28 @@ static int aac_send_safw_bmic_cmd(struct aac_dev *dev,return rcode; } +static void aac_set_safw_target_qd (struct aac_dev *dev,int bus,int target) +{ + +struct aac_ciss_identify_pd *identify_resp; + +if (dev->hba_map[bus][target].devtype !=AAC_DEVTYPE_NATIVE_RAW ) +return ; + + identify_resp = dev->hba_map[bus][target].safw_identify_resp; +if (identify_resp ==NULL ) { + dev->hba_map[bus][target].qd_limit =32 ; +return ; + } + +if (identify_resp->current_queue_depth_limit <=0 || + identify_resp->current_queue_depth_limit >255 ) + dev->hba_map[bus][target].qd_limit =32 ; +else + dev->hba_map[bus][target].qd_limit = + identify_resp->current_queue_depth_limit; +} +static int aac_issue_safw_bmic_identify (struct aac_dev *dev,struct aac_ciss_identify_pd **identify_resp,u32 bus,u32 target) {
@@ -1781,13 +1803,6 @@ static int aac_issue_safw_bmic_identify(struct aac_dev *dev,if (unlikely (rcode <0 )) goto mem_free_all; -if (identify_reply->current_queue_depth_limit <=0 || - identify_reply->current_queue_depth_limit >32 ) - dev->hba_map[bus][target].qd_limit =32 ; -else - dev->hba_map[bus][target].qd_limit = - identify_reply->current_queue_depth_limit; - *identify_resp = identify_reply; out:
@@ -1936,17 +1951,14 @@ static int aac_get_safw_attr_all_targets(struct aac_dev *dev, int rescan) rcode =aac_issue_safw_bmic_identify (dev, &identify_resp, bus, target); -if (unlikely (rcode <0 )) { - dev->hba_map[bus][target].qd_limit =32 ; +if (unlikely (rcode <0 )) goto free_identify_resp; - } dev->hba_map[bus][target].safw_identify_resp = identify_resp; } out:return rcode; - free_identify_resp:aac_free_safw_all_identify_resp (dev, i); goto out;
@@ -1995,8 +2007,7 @@ static void aac_set_safw_attr_all_targets(struct aac_dev *dev, int rescan) }else devtype =AAC_DEVTYPE_ARC_RAW ; -if (devtype !=AAC_DEVTYPE_NATIVE_RAW ) - goto update_devtype; +aac_set_safw_target_qd (dev, bus, target); update_devtype:if (rescan ==AAC_INIT )
Signature · 1 line
2.9.4
PATCH v2 18/30 scsi: aacraid: Merge func to get container information
In reply to Raghava Aditya RenukuntaMerge aac_get_containers to setup target function, so that information about all the present devices can be retrieved in one shot.
---
Changes in V2:
None
drivers/scsi/aacraid/aachba.c | 4 ++++ drivers/scsi/aacraid/commsup.c | 34 +++++++++++++++------------------- 2 files changed, 19 insertions(+), 19 deletions(-)
drivers/scsi/aacraid/aachba.c +4 -0
@@ -2021,6 +2021,10 @@ static int aac_setup_safw_targets(struct aac_dev *dev, int rescan) {int rcode =0 ; + rcode =aac_get_containers (dev); +if (unlikely (rcode <0 )) + goto out; + rcode =aac_get_safw_ciss_luns (dev, rescan);if (unlikely (rcode <0 )) goto out;
drivers/scsi/aacraid/commsup.c +15 -19
@@ -1949,26 +1949,22 @@ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr)aac_resolve_luns (dev); -if (events ==SA_AIF_LDEV_CHANGE || - events ==SA_AIF_BPCFG_CHANGE ) { -aac_get_containers (dev); -for (container =0 ; container < +for (container =0 ; container < dev->maximum_num_containers; ++container) { - sdev =scsi_device_lookup (dev->scsi_host_ptr, -CONTAINER_CHANNEL , - container,0 ); -if (dev->fsa_dev[container].valid && !sdev) { -scsi_add_device (dev->scsi_host_ptr, -CONTAINER_CHANNEL , - container,0 ); - }else if (!dev->fsa_dev[container].valid && - sdev) { -scsi_remove_device (sdev); -scsi_device_put (sdev); - }else if (sdev) { -scsi_rescan_device (&sdev->sdev_gendev); -scsi_device_put (sdev); - } + sdev =scsi_device_lookup (dev->scsi_host_ptr, +CONTAINER_CHANNEL , + container,0 ); +if (dev->fsa_dev[container].valid && !sdev) { +scsi_add_device (dev->scsi_host_ptr, +CONTAINER_CHANNEL , + container,0 ); + }else if (!dev->fsa_dev[container].valid && + sdev) { +scsi_remove_device (sdev); +scsi_device_put (sdev); + }else if (sdev) { +scsi_rescan_device (&sdev->sdev_gendev); +scsi_device_put (sdev); } }break ;
Signature · 1 line
2.9.4
PATCH v2 19/30 scsi: aacraid: Process hba and container hot plug events in single function
In reply to Raghava Aditya RenukuntaThe hotplug handler code is duplicated for hba handling and container handling.
Merged function to handle hba and container hot plug events into the resolve luns functions. Added a bunch of helper functions to check the validity of a given target and to check if bus, target is container device.
---
Changes in V2:
None
drivers/scsi/aacraid/aachba.c | 9 ++++--- drivers/scsi/aacraid/aacraid.h | 3 ++- drivers/scsi/aacraid/commsup.c | 59 ++++++++++++++++-------------------------- 3 files changed, 30 insertions(+), 41 deletions(-)
drivers/scsi/aacraid/aachba.c +5 -4
@@ -1982,6 +1982,8 @@ static void aac_set_safw_attr_all_targets(struct aac_dev *dev, int rescan) lun_count =aac_get_safw_phys_lun_count (dev); + dev->scan_counter++; +for (i =0 ; i < lun_count; ++i) { bus =aac_get_safw_phys_bus (dev, i);
@@ -2007,13 +2009,12 @@ static void aac_set_safw_attr_all_targets(struct aac_dev *dev, int rescan) }else devtype =AAC_DEVTYPE_ARC_RAW ; + dev->hba_map[bus][target].scan_counter = dev->scan_counter; +aac_set_safw_target_qd (dev, bus, target); update_devtype: -if (rescan ==AAC_INIT ) - dev->hba_map[bus][target].devtype = devtype; -else - dev->hba_map[bus][target].new_devtype = devtype; + dev->hba_map[bus][target].devtype = devtype; } }
drivers/scsi/aacraid/aacraid.h +2 -1
@@ -1340,11 +1340,11 @@ struct fib {struct aac_hba_map_info {__le32 rmw_nexus;/* nexus for native HBA devices */ u8 devtype;/* device type */ -u8 new_devtype;u8 reset_state;/* 0 - no reset, 1..x - */ /* after xth TM LUN reset */ u16 qd_limit;u8 expose;/*checks if to expose or not*/ +u32 scan_counter;struct aac_ciss_identify_pd *safw_identify_resp; };
@@ -1669,6 +1669,7 @@ struct aac_devu32 vector_cap;/* MSI-X vector capab.*/ int msi_enabled;/* MSI/MSI-X enabled */ atomic_t msix_counter; +u32 scan_counter;struct msix_entry msixentry[AAC_MAX_MSIX ];struct aac_msix_ctx aac_msix[AAC_MAX_MSIX ];/* context */ struct aac_hba_map_info hba_map[AAC_MAX_BUSES ][AAC_MAX_TARGETS ];
drivers/scsi/aacraid/commsup.c +23 -36
101 lines not on this page · raw message
Signature · 1 line
2.9.4
PATCH v2 20/30 scsi: aacraid: Added macros to help loop through known buses and targets
In reply to Raghava Aditya RenukuntaAdded macros to loop through the MAX SUPPORTED Buses and Targets. This will make the code a bit easier to read.
---
Changes in V2:
None
drivers/scsi/aacraid/aacraid.h | 4 ++++ drivers/scsi/aacraid/commsup.c | 34 +++++++++++++++++----------------- 2 files changed, 21 insertions(+), 17 deletions(-)
drivers/scsi/aacraid/aacraid.h +4 -0
@@ -117,9 +117,13 @@ enum {/* Thor: 5 phys. buses: #0: empty, 1-4: 256 targets each */ #define AAC_MAX_BUSES 5#define AAC_MAX_TARGETS 256 +#define AAC_BUS_TARGET_LOOP (AAC_MAX_BUSES * AAC_MAX_TARGETS)#define AAC_MAX_NATIVE_SIZE 2048#define FW_ERROR_BUFFER_SIZE 512 +#define get_bus_number (x) (x/AAC_MAX_TARGETS) +#define get_target_number (x) (x%AAC_MAX_TARGETS) +/* Thor AIF events */ #define SA_AIF_HOTPLUG (1<<1)#define SA_AIF_HARDWARE (1<<2)
drivers/scsi/aacraid/commsup.c +17 -17
@@ -1890,31 +1890,31 @@ static int aac_is_safw_target_valid(struct aac_dev *dev, int bus, int target)static void aac_resolve_luns (struct aac_dev *dev) { +int i;int bus, target, channel;struct scsi_device *sdev; -for (bus =0 ; bus <AAC_MAX_BUSES ; bus++) { -for (target =0 ; target <AAC_MAX_TARGETS ; target++) { +for (i =0 ; i <AAC_BUS_TARGET_LOOP ; i++) { -if (bus ==CONTAINER_CHANNEL ) - channel =CONTAINER_CHANNEL ; -else - channel =aac_phys_to_logical (bus); + bus =get_bus_number (i); + target =get_target_number (i); - sdev =scsi_device_lookup (dev->scsi_host_ptr, channel, - target,0 ); +if (bus ==CONTAINER_CHANNEL ) + channel =CONTAINER_CHANNEL ; +else + channel =aac_phys_to_logical (bus); -if (!sdev &&aac_is_safw_target_valid (dev, bus, target)) -scsi_add_device (dev->scsi_host_ptr, channel, - target,0 ); -else if (sdev &&aac_is_safw_target_valid (dev, - bus, target)) -scsi_remove_device (sdev); + sdev =scsi_device_lookup (dev->scsi_host_ptr, channel, + target,0 ); -if (sdev) -scsi_device_put (sdev); +if (!sdev &&aac_is_safw_target_valid (dev, bus, target)) +scsi_add_device (dev->scsi_host_ptr, channel, + target,0 ); +else if (sdev &&aac_is_safw_target_valid (dev, bus, target)) +scsi_remove_device (sdev); - } +if (sdev) +scsi_device_put (sdev); } }
Signature · 1 line
2.9.4
PATCH v2 21/30 scsi: aacraid: Refactor resolve luns code and scsi functions
In reply to Raghava Aditya RenukuntaResolve luns checks the if a sdev is already present in the os to figure out if it needs to be removed. Internally the driver exposes HBA on bus 2 even though its bus 1 in the fw. Its mildly confusing.
Refactor out the sdev lookup into its function to check if sdev has been added to the kernel or not. Add helper functions to add, remove and put devices based on their fw bus and target number.
---
Changes in V2:
Removed unnecessary check and assignment for bus number
drivers/scsi/aacraid/commsup.c | 71 ++++++++++++++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 17 deletions(-)
drivers/scsi/aacraid/commsup.c +54 -17
@@ -1874,6 +1874,39 @@ static inline int is_safw_raid_volume(struct aac_dev *aac, int bus, int target)return bus ==CONTAINER_CHANNEL && target < aac->maximum_num_containers; } +static struct scsi_device *aac_lookup_safw_scsi_device (struct aac_dev *dev, +int bus, +int target) +{ +if (bus !=CONTAINER_CHANNEL ) + bus =aac_phys_to_logical (bus); + +return scsi_device_lookup (dev->scsi_host_ptr, bus, target,0 ); +} + +static int aac_add_safw_device (struct aac_dev *dev,int bus,int target) +{ +if (bus !=CONTAINER_CHANNEL ) + bus =aac_phys_to_logical (bus); + +return scsi_add_device (dev->scsi_host_ptr, bus, target,0 ); +} + +static void aac_put_safw_scsi_device (struct scsi_device *sdev) +{ +if (sdev) +scsi_device_put (sdev); +} + +static void aac_remove_safw_device (struct aac_dev *dev,int bus,int target) +{ +struct scsi_device *sdev; + + sdev =aac_lookup_safw_scsi_device (dev, bus, target); +scsi_remove_device (sdev); +aac_put_safw_scsi_device (sdev); +} +static inline int aac_is_safw_scan_count_equal (struct aac_dev *dev,int bus,int target) {
@@ -1888,33 +1921,37 @@ static int aac_is_safw_target_valid(struct aac_dev *dev, int bus, int target)return aac_is_safw_scan_count_equal (dev, bus, target); } +static int aac_is_safw_device_exposed (struct aac_dev *dev,int bus,int target) +{ +int is_exposed =0 ; +struct scsi_device *sdev; + + sdev =aac_lookup_safw_scsi_device (dev, bus, target); +if (sdev) + is_exposed =1 ; +aac_put_safw_scsi_device (sdev); + +return is_exposed; +} +static void aac_resolve_luns (struct aac_dev *dev) {int i; -int bus, target, channel; -struct scsi_device *sdev; +int bus, target; +int is_exposed =0 ;for (i =0 ; i <AAC_BUS_TARGET_LOOP ; i++) { bus =get_bus_number (i); target =get_target_number (i); -if (bus ==CONTAINER_CHANNEL ) - channel =CONTAINER_CHANNEL ; -else - channel =aac_phys_to_logical (bus); - - sdev =scsi_device_lookup (dev->scsi_host_ptr, channel, - target,0 ); - -if (!sdev &&aac_is_safw_target_valid (dev, bus, target)) -scsi_add_device (dev->scsi_host_ptr, channel, - target,0 ); -else if (sdev &&aac_is_safw_target_valid (dev, bus, target)) -scsi_remove_device (sdev); + is_exposed =aac_is_safw_device_exposed (dev, bus, target); -if (sdev) -scsi_device_put (sdev); +if (aac_is_safw_target_valid (dev, bus, target) && !is_exposed) +aac_add_safw_device (dev, bus, target); +else if (!aac_is_safw_target_valid (dev, bus, target) && + is_exposed) +aac_remove_safw_device (dev, bus, target); } }
Signature · 1 line
2.9.4
PATCH v2 22/30 scsi: aacraid: Merge adapter setup with resolve luns
In reply to Raghava Aditya RenukuntaThe device hotplug events are processed only after retrieving the updated lun information from the fw. Does not make sense to keep them separate.
Merge both the hotplug handling and safw adapter setup code into single function.
---
Changes in V2:
None
drivers/scsi/aacraid/commsup.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/scsi/aacraid/commsup.c +12 -5
@@ -1934,11 +1934,18 @@ static int aac_is_safw_device_exposed(struct aac_dev *dev, int bus, int target)return is_exposed; } -static void aac_resolve_luns (struct aac_dev *dev) +static int aac_update_safw_host_devices (struct aac_dev *dev,int rescan) {int i; -int bus, target; +int bus; +int target;int is_exposed =0 ; +int rcode =0 ; + + rcode =aac_setup_safw_adapter (dev, rescan); +if (unlikely (rcode <0 )) { + goto out; + }for (i =0 ; i <AAC_BUS_TARGET_LOOP ; i++) {
@@ -1953,6 +1960,8 @@ static void aac_resolve_luns(struct aac_dev *dev) is_exposed)aac_remove_safw_device (dev ,bus ,target ); } +out: +return rcode; }/**
@@ -1988,9 +1997,7 @@ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr)case SA_AIF_LDEV_CHANGE :case SA_AIF_BPCFG_CHANGE : -aac_setup_safw_adapter (dev,AAC_RESCAN ); - -aac_resolve_luns (dev); +aac_update_safw_host_devices (dev,AAC_RESCAN );break ;case SA_AIF_BPSTAT_CHANGE :
Signature · 1 line
2.9.4
Re: [PATCH v2 22/30] scsi: aacraid: Merge adapter setup with resolve luns
Quoted 7 lines · Raghava Aditya Renukunta
The device hotplug events are processed only after retrieving the updated lun information from the fw. Does not make sense to keep them separate.
Merge both the hotplug handling and safw adapter setup code into single function.
Signed-off-by Raghava Aditya Renukunta <[email protected]>
According to subsequent commit
[PATCH v2 23/30] scsi: aacraid: Block concurrent hotplug event handling
this commit is racy, because 23/30 adds ->scan_mutex. Shouldn't be these commits squashed?
--
Nikola
RE: [PATCH v2 22/30] scsi: aacraid: Merge adapter setup with resolve luns
Hi Nikola,
Quoted 27 lines
-----Original Message-----
From: Nikola Pajkovsky [mailto:[email protected]]
Sent: Wednesday, January 3, 2018 2:02 AM
To: Raghava Aditya Renukunta <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; Scott Benesh <[email protected]>; Tom White <[email protected]>; dl-esc-Aacraid Linux Driver <[email protected]>; Guilherme G . Piccoli <[email protected]>; Bart Van Assche <[email protected]>
Subject: Re: [PATCH v2 22/30] scsi: aacraid: Merge adapter setup with resolve lunsEXTERNAL EMAIL
Raghava Aditya Renukunta <[email protected]>
Quoted 7 lines · writes:
The device hotplug events are processed only after retrieving the updated lun information from the fw. Does not make sense to keep them separate.
Merge both the hotplug handling and safw adapter setup code into single function.
Signed-off-by Raghava Aditya Renukunta
Quoted 8 lines
According to subsequent commit
[PATCH v2 23/30] scsi: aacraid: Block concurrent hotplug event handling
this commit is racy, because 23/30 adds ->scan_mutex. Shouldn't be these commits squashed?
I tried to make the patches as logically distinct as possible, maybe I got a bit too ambitious and I expected the patches to go thru as a set so I don’t think it would make any difference. What do you think?
Thanks
Raghava Aditya
Quoted 2 lines
--
Nikola
Re: [PATCH v2 22/30] scsi: aacraid: Merge adapter setup with resolve luns
Quoted 33 lines · Raghava Aditya Renukunta
Hi Nikola,
Quoted 31 lines
-----Original Message-----
From: Nikola Pajkovsky [mailto:[email protected]]
Sent: Wednesday, January 3, 2018 2:02 AM
To: Raghava Aditya Renukunta <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; Scott Benesh <[email protected]>; Tom White <[email protected]>; dl-esc-Aacraid Linux Driver <[email protected]>; Guilherme G . Piccoli <[email protected]>; Bart Van Assche <[email protected]>
Subject: Re: [PATCH v2 22/30] scsi: aacraid: Merge adapter setup with resolve lunsEXTERNAL EMAIL
Raghava Aditya Renukunta <[email protected]>
Quoted 7 lines · writes:
The device hotplug events are processed only after retrieving the updated lun information from the fw. Does not make sense to keep them separate.
Merge both the hotplug handling and safw adapter setup code into single function.
Signed-off-by Raghava Aditya RenukuntaAccording to subsequent commit
Quoted 8 lines
Quoted 4 lines
[PATCH v2 23/30] scsi: aacraid: Block concurrent hotplug event handling
this commit is racy, because 23/30 adds ->scan_mutex. Shouldn't be these commits squashed?
I tried to make the patches as logically distinct as possible, maybe I got a bit too ambitious and I expected the patches to go thru as a set so I don’t think it would make any difference. What do you think?
It does make difference, when you start cherry-picking patches to downstream kernel. However, I don't have strong opinion here, so it can stay as is.
Signature · 1 line
Nikola
PATCH v2 23/30 scsi: aacraid: Block concurrent hotplug event handling
In reply to Raghava Aditya RenukuntaCurrently driver will attempt to process hotplug events concurrently based on the FW interrupt.
Protect safw update function with a scan mutex.
---
Changes in V2:
None
drivers/scsi/aacraid/aacraid.h | 1 + drivers/scsi/aacraid/commsup.c | 2 ++ drivers/scsi/aacraid/linit.c | 1 + 3 files changed, 4 insertions(+)
drivers/scsi/aacraid/aacraid.h +1 -0
@@ -1565,6 +1565,7 @@ struct aac_devspinlock_t fib_lock;struct mutex ioctl_mutex; +struct mutex scan_mutex;struct aac_queue_block *queues;/* * The user API will use an IOCTL to register itself to receive
drivers/scsi/aacraid/commsup.c +2 -0
@@ -1997,7 +1997,9 @@ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr)case SA_AIF_LDEV_CHANGE :case SA_AIF_BPCFG_CHANGE : +mutex_lock (&dev->scan_mutex);aac_update_safw_host_devices (dev,AAC_RESCAN ); +mutex_unlock (&dev->scan_mutex);break ;case SA_AIF_BPSTAT_CHANGE :
drivers/scsi/aacraid/linit.c +1 -0
@@ -1683,6 +1683,7 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)spin_lock_init (&aac->fib_lock);mutex_init (&aac->ioctl_mutex); +mutex_init (&aac->scan_mutex);/* * Map in the registers from the adapter. */
Signature · 1 line
2.9.4
PATCH v2 24/30 scsi: aacraid: Use hotplug handling function in place of scsi_scan_host
In reply to Raghava Aditya RenukuntaDriver uses scsi_scan_host to add new devices in the driver init path, which adds all the fw exposed devices. The drivers resorts to queue command checks to block out commands to _hidden_ devices.
Use the hotplug handler code to add new devices during driver init and other areas, this is only for safw. For ARC scsi_scan_host will still apply.
---
Changes in V2:
None
drivers/scsi/aacraid/aachba.c | 4 ---- drivers/scsi/aacraid/aacraid.h | 1 + drivers/scsi/aacraid/commsup.c | 18 +++++++++++++++--- drivers/scsi/aacraid/linit.c | 5 +++-- 4 files changed, 19 insertions(+), 9 deletions(-)
drivers/scsi/aacraid/aachba.c +0 -4
@@ -2150,10 +2150,6 @@ int aac_get_adapter_info(struct aac_dev* dev) dev->maximum_num_channels =le32_to_cpu (bus_info->BusCount); } -if (!dev->sync_mode && dev->sa_firmware && - dev->supplement_adapter_info.virt_device_bus !=0xffff ) - rcode =aac_setup_safw_adapter (dev,AAC_INIT ); -if (!dev->in_reset) {char buffer[16 ]; tmp =le32_to_cpu (dev->adapter_info.kernelrev);
drivers/scsi/aacraid/aacraid.h +1 -0
@@ -2719,6 +2719,7 @@ static inline int aac_supports_2T(struct aac_dev *dev)return (dev->adapter_info.options &AAC_OPT_NEW_COMM_64 ); } +int aac_scan_host (struct aac_dev *dev,int rescan);char *get_container_type (unsigned type);extern int numacb;extern char aac_driver_version[];
drivers/scsi/aacraid/commsup.c +15 -3
@@ -1964,6 +1964,19 @@ static int aac_update_safw_host_devices(struct aac_dev *dev, int rescan)return rcode; } +int aac_scan_host (struct aac_dev *dev,int rescan) +{ +int rcode =0 ; + +mutex_lock (&dev->scan_mutex); +if (dev->sa_firmware) + rcode =aac_update_safw_host_devices (dev, rescan); +else +scsi_scan_host (dev->scsi_host_ptr); +mutex_unlock (&dev->scan_mutex); +return rcode; +} +/** * aac_handle_sa_aif Handle a message from the firmware * @dev: Which adapter this fib is from
@@ -1997,9 +2010,8 @@ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr)case SA_AIF_LDEV_CHANGE :case SA_AIF_BPCFG_CHANGE : -mutex_lock (&dev->scan_mutex); -aac_update_safw_host_devices (dev,AAC_RESCAN ); -mutex_unlock (&dev->scan_mutex); +aac_scan_host (dev,AAC_RESCAN ); +break ;case SA_AIF_BPSTAT_CHANGE :
drivers/scsi/aacraid/linit.c +3 -2
@@ -1787,7 +1787,8 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) error =scsi_add_host (shost, &pdev->dev);if (error) goto out_deinit; -scsi_scan_host (shost); + +aac_scan_host (aac,AAC_INIT );pci_enable_pcie_error_reporting (pdev);pci_save_state (pdev);
@@ -2071,7 +2072,7 @@ static void aac_pci_resume(struct pci_dev *pdev)if (sdev->sdev_state ==SDEV_OFFLINE ) sdev->sdev_state =SDEV_RUNNING ;scsi_unblock_requests (aac->scsi_host_ptr); -scsi_scan_host (aac->scsi_host_ptr); +aac_scan_host (aac,AAC_RESCAN );pci_save_state (pdev);dev_err (&pdev->dev,"aacraid: PCI error - resume\n" );
Signature · 1 line
2.9.4
PATCH v2 25/30 scsi: aacraid: Reschedule host scan in case of failure
In reply to Raghava Aditya RenukuntaIf the driver fails to retrieve information from the fw (could happen when the fw is not fully in its senses), the driver does nothing and change is not processed correctly by the driver
Schedule host rescan in case of failure. This is only for SAFW, since the information retrieval failure will happen on SAFW devices.
---
Changes in V2:
Rename rescan worker to match kernel coding conventions
drivers/scsi/aacraid/aacraid.h | 27 ++++++++++++++++++++++++++- drivers/scsi/aacraid/commsup.c | 14 +++++++++++++- drivers/scsi/aacraid/linit.c | 5 +++++ 3 files changed, 44 insertions(+), 2 deletions(-)
drivers/scsi/aacraid/aacraid.h +26 -1
@@ -1341,6 +1341,8 @@ struct fib {#define AAC_EXPOSE_DISK 0#define AAC_HIDE_DISK 3 +#define AAC_SAFW_RESCAN_DELAY 10 +struct aac_hba_map_info {__le32 rmw_nexus;/* nexus for native HBA devices */ u8 devtype;/* device type */
@@ -1611,6 +1613,7 @@ struct aac_devint maximum_num_channels;struct fsa_dev_info *fsa_dev;struct task_struct *thread; +struct delayed_work safw_rescan_work;int cardtype;/* *This lock will protect the two 32-bit
@@ -2639,12 +2642,35 @@ static inline int aac_adapter_check_health(struct aac_dev *dev)return (dev)->a_ops.adapter_check_health (dev); } + +int aac_scan_host (struct aac_dev *dev,int rescan); + +static inline void aac_schedule_safw_scan_worker (struct aac_dev *dev) +{ +schedule_delayed_work (&dev->safw_rescan_work,AAC_SAFW_RESCAN_DELAY ); +} + +static inline void aac_safw_rescan_worker (struct work_struct *work) +{ +struct aac_dev *dev =container_of (to_delayed_work (work), + struct aac_dev, safw_rescan_work); + +aac_scan_host (dev,AAC_RESCAN ); +} + +static inline void aac_cancel_safw_rescan_worker (struct aac_dev *dev) +{ +if (dev->sa_firmware) +cancel_delayed_work_sync (&dev->safw_rescan_work); +} +/* SCp.phase values */ #define AAC_OWNER_MIDLEVEL 0x101#define AAC_OWNER_LOWLEVEL 0x102#define AAC_OWNER_ERROR_HANDLER 0x103#define AAC_OWNER_FIRMWARE 0x106 +void aac_safw_rescan_worker (struct work_struct *work);int aac_acquire_irq (struct aac_dev *dev);void aac_free_irq (struct aac_dev *dev);int aac_setup_safw_adapter (struct aac_dev *dev,int rescan);
@@ -2719,7 +2745,6 @@ static inline int aac_supports_2T(struct aac_dev *dev)return (dev->adapter_info.options &AAC_OPT_NEW_COMM_64 ); } -int aac_scan_host (struct aac_dev *dev,int rescan);char *get_container_type (unsigned type);extern int numacb;extern char aac_driver_version[];
drivers/scsi/aacraid/commsup.c +13 -1
@@ -1964,16 +1964,28 @@ static int aac_update_safw_host_devices(struct aac_dev *dev, int rescan)return rcode; } +static int aac_scan_safw_host (struct aac_dev *dev,int rescan) +{ +int rcode =0 ; + + rcode =aac_update_safw_host_devices (dev, rescan); +if (rcode) +aac_schedule_safw_scan_worker (dev); + +return rcode; +} +int aac_scan_host (struct aac_dev *dev,int rescan) {int rcode =0 ;mutex_lock (&dev->scan_mutex);if (dev->sa_firmware) - rcode =aac_update_safw_host_devices (dev, rescan); + rcode =aac_scan_safw_host (dev, rescan);else scsi_scan_host (dev->scsi_host_ptr);mutex_unlock (&dev->scan_mutex); +return rcode; }
drivers/scsi/aacraid/linit.c +5 -0
@@ -1684,6 +1684,8 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)mutex_init (&aac->ioctl_mutex);mutex_init (&aac->scan_mutex); + +INIT_DELAYED_WORK (&aac->safw_rescan_work, aac_safw_rescan_worker);/* * Map in the registers from the adapter. */
@@ -1873,6 +1875,7 @@ static int aac_suspend(struct pci_dev *pdev, pm_message_t state)struct aac_dev *aac = (struct aac_dev *)shost->hostdata;scsi_block_requests (shost); +aac_cancel_safw_rescan_worker (aac);aac_send_shutdown (aac);aac_release_resources (aac);
@@ -1931,6 +1934,7 @@ static void aac_remove_one(struct pci_dev *pdev)struct Scsi_Host *shost =pci_get_drvdata (pdev);struct aac_dev *aac = (struct aac_dev *)shost->hostdata; +aac_cancel_safw_rescan_worker (aac);scsi_remove_host (shost);__aac_shutdown (aac);
@@ -1988,6 +1992,7 @@ static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev, aac->handle_pci_error =1 ;scsi_block_requests (aac->scsi_host_ptr); +aac_cancel_safw_rescan_worker (aac);aac_flush_ios (aac);aac_release_resources (aac);
Signature · 1 line
2.9.4
PATCH v2 26/30 scsi: aacraid: Fix hang while scanning in eh recovery
In reply to Raghava Aditya RenukuntaAdd back the ability to scan for hotplug changes while eh was in progress.
Schedule a rescan for a later time in the eh recovery code and wait for eh to complete in the rescan worker.
---
Changes in V2:
None
drivers/scsi/aacraid/aacraid.h | 4 ++++ drivers/scsi/aacraid/commsup.c | 9 +++++++++ 2 files changed, 13 insertions(+)
drivers/scsi/aacraid/aacraid.h +4 -0
@@ -41,6 +41,7 @@#include <linux/interrupt.h> #include <linux/pci.h> +#include <scsi/scsi_host.h> /*------------------------------------------------------------------------------ * D E F I N E S
@@ -2655,6 +2656,9 @@ static inline void aac_safw_rescan_worker(struct work_struct *work)struct aac_dev *dev =container_of (to_delayed_work (work), struct aac_dev, safw_rescan_work); +wait_event (dev->scsi_host_ptr->host_wait, + !scsi_host_in_recovery (dev->scsi_host_ptr)); +aac_scan_host (dev,AAC_RESCAN ); }
drivers/scsi/aacraid/commsup.c +9 -0
@@ -1671,6 +1671,15 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type) aac->in_reset =0 ;scsi_unblock_requests (host); +/* +* Issue bus rescan to catch any configuration that might have +* occurred +*/ +if (!retval) { +dev_info (&aac->pdev->dev,"Scheduling bus rescan\n" ); +aac_schedule_safw_scan_worker (aac); + } +if (jafo) {spin_lock_irq (host->host_lock); }
Signature · 1 line
2.9.4
PATCH v2 27/30 scsi: aacraid: Skip schedule rescan in case of kdump
In reply to Raghava Aditya RenukuntaThere is a chance of the driver to be stuck in kdump if drives start acting up in kdump discovery process and the kernel decides to send eh resets, which would prompt rescan to be scheduled.
Do not perform a rescan in kdump context, since we do not expect a hotplug event during kdump and all the devices are going to go away anyway.
---
Changes in V2:
None
drivers/scsi/aacraid/commsup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/aacraid/commsup.c +2 -1
@@ -33,6 +33,7 @@#include <linux/kernel.h> #include <linux/init.h> +#include <linux/crash_dump.h> #include <linux/types.h> #include <linux/sched.h> #include <linux/pci.h>
@@ -1675,7 +1676,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)* Issue bus rescan to catch any configuration that might have * occurred */ -if (!retval) { +if (!retval && !is_kdump_kernel ()) {dev_info (&aac->pdev->dev,"Scheduling bus rescan\n" );aac_schedule_safw_scan_worker (aac); }
Signature · 1 line
2.9.4
PATCH v2 28/30 scsi: aacraid: Remove unused rescan variable
In reply to Raghava Aditya RenukuntaRemove unused rescan variable.
---
Changes in V2:
None
drivers/scsi/aacraid/aachba.c | 19 +++++++++---------- drivers/scsi/aacraid/aacraid.h | 6 +++--- drivers/scsi/aacraid/commsup.c | 14 +++++++------- drivers/scsi/aacraid/linit.c | 4 ++-- 4 files changed, 21 insertions(+), 22 deletions(-)
drivers/scsi/aacraid/aachba.c +9 -10
@@ -1821,12 +1821,11 @@ static inline void aac_free_safw_ciss_luns(struct aac_dev *dev)/** * aac_get_safw_ciss_luns() Process topology change * @dev: aac_dev structure -* @rescan: Indicates rescan * * Execute a CISS REPORT PHYS LUNS and process the results into * the current hba_map. */ -static int aac_get_safw_ciss_luns (struct aac_dev *dev,int rescan) +static int aac_get_safw_ciss_luns (struct aac_dev *dev) {int rcode = -ENOMEM ;int datasize;
@@ -1932,7 +1931,7 @@ static inline void aac_free_safw_all_identify_resp(struct aac_dev *dev, } } -static int aac_get_safw_attr_all_targets (struct aac_dev *dev,int rescan) +static int aac_get_safw_attr_all_targets (struct aac_dev *dev) {int i;int rcode =0 ;
@@ -1972,7 +1971,7 @@ static int aac_get_safw_attr_all_targets(struct aac_dev *dev, int rescan)* * Update our hba map with the information gathered from the FW */ -static void aac_set_safw_attr_all_targets (struct aac_dev *dev,int rescan) +static void aac_set_safw_attr_all_targets (struct aac_dev *dev) {/* ok and extended reporting */ u32 lun_count, nexus;
@@ -2018,7 +2017,7 @@ static void aac_set_safw_attr_all_targets(struct aac_dev *dev, int rescan) } } -static int aac_setup_safw_targets (struct aac_dev *dev,int rescan) +static int aac_setup_safw_targets (struct aac_dev *dev) {int rcode =0 ;
@@ -2026,15 +2025,15 @@ static int aac_setup_safw_targets(struct aac_dev *dev, int rescan)if (unlikely (rcode <0 )) goto out; - rcode =aac_get_safw_ciss_luns (dev, rescan); + rcode =aac_get_safw_ciss_luns (dev);if (unlikely (rcode <0 )) goto out; - rcode =aac_get_safw_attr_all_targets (dev, rescan); + rcode =aac_get_safw_attr_all_targets (dev);if (unlikely (rcode <0 )) goto free_ciss_luns; -aac_set_safw_attr_all_targets (dev, rescan); +aac_set_safw_attr_all_targets (dev);aac_free_safw_all_identify_resp (dev,-1 ); free_ciss_luns:
@@ -2043,9 +2042,9 @@ static int aac_setup_safw_targets(struct aac_dev *dev, int rescan)return rcode; } -int aac_setup_safw_adapter (struct aac_dev *dev,int rescan) +int aac_setup_safw_adapter (struct aac_dev *dev) { -return aac_setup_safw_targets (dev, rescan); +return aac_setup_safw_targets (dev); }int aac_get_adapter_info (struct aac_dev * dev)
drivers/scsi/aacraid/aacraid.h +3 -3
@@ -2644,7 +2644,7 @@ static inline int aac_adapter_check_health(struct aac_dev *dev) } -int aac_scan_host (struct aac_dev *dev,int rescan); +int aac_scan_host (struct aac_dev *dev);static inline void aac_schedule_safw_scan_worker (struct aac_dev *dev) {
@@ -2659,7 +2659,7 @@ static inline void aac_safw_rescan_worker(struct work_struct *work)wait_event (dev->scsi_host_ptr->host_wait, !scsi_host_in_recovery (dev->scsi_host_ptr)); -aac_scan_host (dev,AAC_RESCAN ); +aac_scan_host (dev); }static inline void aac_cancel_safw_rescan_worker (struct aac_dev *dev)
@@ -2677,7 +2677,7 @@ static inline void aac_cancel_safw_rescan_worker(struct aac_dev *dev)void aac_safw_rescan_worker (struct work_struct *work);int aac_acquire_irq (struct aac_dev *dev);void aac_free_irq (struct aac_dev *dev); -int aac_setup_safw_adapter (struct aac_dev *dev,int rescan); +int aac_setup_safw_adapter (struct aac_dev *dev);const char *aac_driverinfo (struct Scsi_Host *);void aac_fib_vector_assign (struct aac_dev *dev);struct fib *aac_fib_alloc (struct aac_dev *dev);
drivers/scsi/aacraid/commsup.c +7 -7
@@ -1944,7 +1944,7 @@ static int aac_is_safw_device_exposed(struct aac_dev *dev, int bus, int target)return is_exposed; } -static int aac_update_safw_host_devices (struct aac_dev *dev,int rescan) +static int aac_update_safw_host_devices (struct aac_dev *dev) {int i;int bus;
@@ -1952,7 +1952,7 @@ static int aac_update_safw_host_devices(struct aac_dev *dev, int rescan)int is_exposed =0 ;int rcode =0 ; - rcode =aac_setup_safw_adapter (dev, rescan); + rcode =aac_setup_safw_adapter (dev);if (unlikely (rcode <0 )) { goto out; }
@@ -1974,24 +1974,24 @@ static int aac_update_safw_host_devices(struct aac_dev *dev, int rescan)return rcode; } -static int aac_scan_safw_host (struct aac_dev *dev,int rescan) +static int aac_scan_safw_host (struct aac_dev *dev) {int rcode =0 ; - rcode =aac_update_safw_host_devices (dev, rescan); + rcode =aac_update_safw_host_devices (dev);if (rcode)aac_schedule_safw_scan_worker (dev);return rcode; } -int aac_scan_host (struct aac_dev *dev,int rescan) +int aac_scan_host (struct aac_dev *dev) {int rcode =0 ;mutex_lock (&dev->scan_mutex);if (dev->sa_firmware) - rcode =aac_scan_safw_host (dev, rescan); + rcode =aac_scan_safw_host (dev);else scsi_scan_host (dev->scsi_host_ptr);mutex_unlock (&dev->scan_mutex);
@@ -2032,7 +2032,7 @@ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr)case SA_AIF_LDEV_CHANGE :case SA_AIF_BPCFG_CHANGE : -aac_scan_host (dev,AAC_RESCAN ); +aac_scan_host (dev);break ;
drivers/scsi/aacraid/linit.c +2 -2
@@ -1790,7 +1790,7 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)if (error) goto out_deinit; -aac_scan_host (aac,AAC_INIT ); +aac_scan_host (aac);pci_enable_pcie_error_reporting (pdev);pci_save_state (pdev);
@@ -2077,7 +2077,7 @@ static void aac_pci_resume(struct pci_dev *pdev)if (sdev->sdev_state ==SDEV_OFFLINE ) sdev->sdev_state =SDEV_RUNNING ;scsi_unblock_requests (aac->scsi_host_ptr); -aac_scan_host (aac,AAC_RESCAN ); +aac_scan_host (aac);pci_save_state (pdev);dev_err (&pdev->dev,"aacraid: PCI error - resume\n" );
Signature · 1 line
2.9.4
PATCH v2 29/30 scsi: aacraid: Remove AAC_HIDE_DISK check in queue command
In reply to Raghava Aditya RenukuntaEarlier driver would scan throgh all supported buses and targets and add devices that responded. It would add devices that were _hidden_ by the fw. Driver would invalidate commands sent to _hidden_ devices via the AAC_HIDE_DISK check.
Since the driver now adds only the devices that are supposed to be exposed, this code can be removed.
---
Changes in V2:
None
drivers/scsi/aacraid/aachba.c | 10 ---------- drivers/scsi/aacraid/aacraid.h | 3 --- 2 files changed, 13 deletions(-)
drivers/scsi/aacraid/aachba.c +0 -10
@@ -1994,8 +1994,6 @@ static void aac_set_safw_attr_all_targets(struct aac_dev *dev)if (bus >=AAC_MAX_BUSES || target >=AAC_MAX_TARGETS )continue ; - dev->hba_map[bus][target].expose = expose_flag; -if (expose_flag !=0 ) { devtype =AAC_DEVTYPE_RAID_MEMBER ; goto update_devtype;
@@ -2913,14 +2911,6 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) } }else {/* check for physical non-dasd devices */ bus =aac_logical_to_phys (scmd_channel (scsicmd)); -if (bus <AAC_MAX_BUSES && cid <AAC_MAX_TARGETS && - (dev->hba_map[bus][cid].expose - ==AAC_HIDE_DISK )){ -if (scsicmd->cmnd[0 ] ==INQUIRY ) { - scsicmd->result =DID_NO_CONNECT <<16 ; - goto scsi_done_ret; - } - }if (bus <AAC_MAX_BUSES && cid <AAC_MAX_TARGETS && dev->hba_map[bus][cid].devtype
drivers/scsi/aacraid/aacraid.h +0 -3
@@ -1339,8 +1339,6 @@ struct fib {#define AAC_DEVTYPE_RAID_MEMBER 1#define AAC_DEVTYPE_ARC_RAW 2#define AAC_DEVTYPE_NATIVE_RAW 3 -#define AAC_EXPOSE_DISK 0 -#define AAC_HIDE_DISK 3#define AAC_SAFW_RESCAN_DELAY 10
@@ -1350,7 +1348,6 @@ struct aac_hba_map_info {u8 reset_state;/* 0 - no reset, 1..x - */ /* after xth TM LUN reset */ u16 qd_limit; -u8 expose;/*checks if to expose or not*/ u32 scan_counter;struct aac_ciss_identify_pd *safw_identify_resp; };
Signature · 1 line
2.9.4
PATCH v2 30/30 scsi: aacraid: Update driver version to 50877
In reply to Raghava Aditya RenukuntaUpdate driver Version to 50877
--- drivers/scsi/aacraid/aacraid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/aacraid/aacraid.h +1 -1
@@ -98,7 +98,7 @@ enum {#define PMC_GLOBAL_INT_BIT0 0x00000001#ifndef AAC_DRIVER_BUILD -# define AAC_DRIVER_BUILD 50834 +# define AAC_DRIVER_BUILD 50877# define AAC_DRIVER_BRANCH "-custom"#endif #define MAXIMUM_NUM_CONTAINERS 32
Signature · 1 line
2.9.4
Martin K. Petersen
AppliedRaghava,
Quoted 3 lines
This patchset primarily lays the foundation for adding sas transport support to the aacraid driver. Being said these patches are mainly code refactors, bug fixes and improvements.
Applied to 4.16/scsi-queue. Thank you!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering