qla2xxx: updates for 2.6.26 [8.02.01-k3].
Subsystems (2)
cover qla2xxx: updates for 2.6.26 [8.02.01-k3].
This patchset contains another round of fixes/updates for 2.6.26.
drivers/scsi/qla2xxx/qla_attr.c | 13 ++++++++++--- drivers/scsi/qla2xxx/qla_def.h | 2 +- drivers/scsi/qla2xxx/qla_gbl.h | 3 +++ drivers/scsi/qla2xxx/qla_inline.h | 4 ++++ drivers/scsi/qla2xxx/qla_isr.c | 27 ++++----------------------- drivers/scsi/qla2xxx/qla_mbx.c | 12 ++++-------- drivers/scsi/qla2xxx/qla_mid.c | 18 +++++++++--------- drivers/scsi/qla2xxx/qla_os.c | 16 +++++++++------- drivers/scsi/qla2xxx/qla_version.h | 2 +- 9 files changed, 45 insertions(+), 52 deletions(-)
here's the commits:
- Return correct port_type to FC-transport for Vports.
- Display driver version at module init-time.
- Correct locking within MSI-X interrupt handlers.
- firmware semaphore to mutex
- Convert vport_sem to a mutex
- Don't depend on mailbox return values while enabling FCE tracing.
- Extend the 'fw_dump' SYSFS node the ability to initiate a firmware dump.
- Disable local-interrupts while polling for RISC status.
- Revert "qla2xxx: Validate mid-layer 'underflow' during check-condition handling."
- Update version number to 8.02.01-k3.
Regards,
Andrew Vasquez
QLogic Corporation
PATCH 1/10 qla2xxx: Return correct port_type to FC-transport for Vports.
From: Shyam Sundar <[email protected]>
For Vports, the port_type should be set to FC_PORTTYPE_NPIV.
--- drivers/scsi/qla2xxx/qla_attr.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +5 -1
@@ -886,9 +886,13 @@ qla2x00_get_host_speed(struct Scsi_Host *shost)static void qla2x00_get_host_port_type (struct Scsi_Host *shost) { -scsi_qla_host_t *ha =to_qla_parent (shost_priv (shost)); +scsi_qla_host_t *ha =shost_priv (shost);uint32_t port_type =FC_PORTTYPE_UNKNOWN ; +if (ha->parent) { +fc_host_port_type (shost) =FC_PORTTYPE_NPIV ; +return ; + }switch (ha->current_topology) {case ISP_CFG_NL : port_type =FC_PORTTYPE_LPORT ;
Signature · 1 line
1.5.5.1.211.g65ea3
PATCH 2/10 qla2xxx: Display driver version at module init-time.
In reply to Andrew Vasquez--- drivers/scsi/qla2xxx/qla_os.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +2 -1
@@ -2864,7 +2864,8 @@ qla2x00_module_init(void)return -ENODEV ; } -printk (KERN_INFO "QLogic Fibre Channel HBA Driver\n" ); +printk (KERN_INFO "QLogic Fibre Channel HBA Driver: %s\n" , + qla2x00_version_str); ret =pci_register_driver (&qla2xxx_pci_driver);if (ret) {kmem_cache_destroy (srb_cachep);
Signature · 1 line
1.5.5.1.211.g65ea3
PATCH 3/10 qla2xxx: Correct locking within MSI-X interrupt handlers.
In reply to Andrew VasquezBoth MSI-X vector handlers attempt to acquire the HA's hardware_lock. This though requires that interrupts be disabled/enabled during acquisition and release of the spinlock.
--- drivers/scsi/qla2xxx/qla_isr.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/qla2xxx/qla_isr.c +4 -4
@@ -1639,12 +1639,12 @@ qla24xx_msix_rsp_q(int irq, void *dev_id) ha = dev_id; reg = &ha->iobase->isp24; -spin_lock (&ha->hardware_lock); +spin_lock_irq (&ha->hardware_lock);qla24xx_process_response_queue (ha);WRT_REG_DWORD (®->hccr,HCCRX_CLR_RISC_INT ); -spin_unlock (&ha->hardware_lock); +spin_unlock_irq (&ha->hardware_lock);return IRQ_HANDLED ; }
@@ -1663,7 +1663,7 @@ qla24xx_msix_default(int irq, void *dev_id) reg = &ha->iobase->isp24; status =0 ; -spin_lock (&ha->hardware_lock); +spin_lock_irq (&ha->hardware_lock); do { stat = RD_REG_DWORD(®->host_status); if (stat & HSRX_RISC_PAUSED) {
@@ -1716,7 +1716,7 @@ qla24xx_msix_default(int irq, void *dev_id) }WRT_REG_DWORD (®->hccr,HCCRX_CLR_RISC_INT ); }while (0 ); -spin_unlock (&ha->hardware_lock); +spin_unlock_irq (&ha->hardware_lock);if (test_bit (MBX_INTR_WAIT , &ha->mbx_cmd_flags) && (status &MBX_INTERRUPT ) && ha->flags.mbox_int) {
Signature · 1 line
1.5.5.1.211.g65ea3
PATCH 4/10 qla2xxx: firmware semaphore to mutex
In reply to Andrew VasquezFrom: Daniel Walker <[email protected]>
--- drivers/scsi/qla2xxx/qla_os.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +6 -5
@@ -10,6 +10,7 @@#include <linux/vmalloc.h> #include <linux/delay.h> #include <linux/kthread.h> +#include <linux/mutex.h> #include <scsi/scsi_tcq.h> #include <scsi/scsicam.h>
@@ -2634,7 +2635,7 @@ qla2x00_timer(scsi_qla_host_t *ha)#define FW_FILE_ISP24XX "ql2400_fw.bin"#define FW_FILE_ISP25XX "ql2500_fw.bin" -static DECLARE_MUTEX (qla_fw_lock); +static DEFINE_MUTEX (qla_fw_lock);static struct fw_blob qla_fw_blobs[FW_BLOBS ] = { { .name =FW_FILE_ISP21XX , .segs = {0x1000 ,0 }, },
@@ -2665,7 +2666,7 @@ qla2x00_request_firmware(scsi_qla_host_t *ha) blob = &qla_fw_blobs[FW_ISP25XX ]; } -down (&qla_fw_lock); +mutex_lock (&qla_fw_lock);if (blob->fw) goto out;
@@ -2678,7 +2679,7 @@ qla2x00_request_firmware(scsi_qla_host_t *ha) } out: -up (&qla_fw_lock); +mutex_unlock (&qla_fw_lock);return blob; }
@@ -2687,11 +2688,11 @@ qla2x00_release_firmware(void) {int idx; -down (&qla_fw_lock); +mutex_lock (&qla_fw_lock);for (idx =0 ; idx <FW_BLOBS ; idx++)if (qla_fw_blobs[idx].fw)release_firmware (qla_fw_blobs[idx].fw); -up (&qla_fw_lock); +mutex_unlock (&qla_fw_lock); } static pci_ers_result_t
Signature · 1 line
1.5.5.1.211.g65ea3
PATCH 5/10 qla2xxx: Convert vport_sem to a mutex
In reply to Andrew VasquezFrom: [email protected] <[email protected]>
The semaphore vport_sem is used as a mutex. Convert it to the mutex API.
--- drivers/scsi/qla2xxx/qla_attr.c | 4 ++-- drivers/scsi/qla2xxx/qla_def.h | 2 +- drivers/scsi/qla2xxx/qla_mbx.c | 4 ++-- drivers/scsi/qla2xxx/qla_mid.c | 18 +++++++++--------- drivers/scsi/qla2xxx/qla_os.c | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +2 -2
@@ -1176,10 +1176,10 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)qla24xx_disable_vp (vha);qla24xx_deallocate_vp_id (vha); -down (&ha->vport_sem); +mutex_lock (&ha->vport_lock); ha->cur_vport_count--;clear_bit (vha->vp_idx, ha->vp_idx_map); -up (&ha->vport_sem); +mutex_unlock (&ha->vport_lock);kfree (vha->node_name);kfree (vha->port_name);
drivers/scsi/qla2xxx/qla_def.h +1 -1
@@ -2457,7 +2457,7 @@ typedef struct scsi_qla_host {#define MBX_INTR_WAIT 2#define MBX_UPDATE_FLASH_ACTIVE 3 -struct semaphore vport_sem;/* Virtual port synchronization */ +struct mutex vport_lock;/* Virtual port synchronization */ struct completion mbx_cmd_comp;/* Serialize mbx access */ struct completion mbx_intr_comp;/* Used for completion notification */
drivers/scsi/qla2xxx/qla_mbx.c +2 -2
@@ -2807,9 +2807,9 @@ qla24xx_control_vp(scsi_qla_host_t *vha, int cmd)*/ map = (vp_index -1 ) /8 ; pos = (vp_index -1 ) &7 ; -down (&ha->vport_sem); +mutex_lock (&ha->vport_lock); vce->vp_idx_map[map] |=1 << pos; -up (&ha->vport_sem); +mutex_unlock (&ha->vport_lock); rval =qla2x00_issue_iocb (ha, vce, vce_dma,0 );if (rval !=QLA_SUCCESS ) {
drivers/scsi/qla2xxx/qla_mid.c +9 -9
@@ -32,12 +32,12 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha)scsi_qla_host_t *ha = vha->parent;/* Find an empty slot and assign an vp_id */ -down (&ha->vport_sem); +mutex_lock (&ha->vport_lock); vp_id =find_first_zero_bit (ha->vp_idx_map, ha->max_npiv_vports +1 );if (vp_id > ha->max_npiv_vports) {DEBUG15 (printk ("vp_id %d is bigger than max-supported %d.\n" , vp_id, ha->max_npiv_vports)); -up (&ha->vport_sem); +mutex_unlock (&ha->vport_lock);return vp_id; }
@@ -45,7 +45,7 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha) ha->num_vhosts++; vha->vp_idx = vp_id;list_add_tail (&vha->vp_list, &ha->vp_list); -up (&ha->vport_sem); +mutex_unlock (&ha->vport_lock);return vp_id; }
@@ -55,12 +55,12 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha)uint16_t vp_id;scsi_qla_host_t *ha = vha->parent; -down (&ha->vport_sem); +mutex_lock (&ha->vport_lock); vp_id = vha->vp_idx; ha->num_vhosts--;clear_bit (vp_id, ha->vp_idx_map);list_del (&vha->vp_list); -up (&ha->vport_sem); +mutex_unlock (&ha->vport_lock); } static scsi_qla_host_t *
@@ -145,9 +145,9 @@ qla24xx_enable_vp(scsi_qla_host_t *vha) }/* Initialize the new vport unless it is a persistent port */ -down (&ha->vport_sem); +mutex_lock (&ha->vport_lock); ret =qla24xx_modify_vp_config (vha); -up (&ha->vport_sem); +mutex_unlock (&ha->vport_lock);if (ret !=QLA_SUCCESS ) {fc_vport_set_state (vha->fc_vport,FC_VPORT_FAILED );
@@ -437,10 +437,10 @@ qla24xx_create_vhost(struct fc_vport *fc_vport) vha->flags.init_done =1 ; num_hosts++; -down (&ha->vport_sem); +mutex_lock (&ha->vport_lock);set_bit (vha->vp_idx, ha->vp_idx_map); ha->cur_vport_count++; -up (&ha->vport_sem); +mutex_unlock (&ha->vport_lock);return vha;
drivers/scsi/qla2xxx/qla_os.c +1 -1
@@ -1632,7 +1632,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)/* load the F/W, read paramaters, and init the H/W */ ha->instance = num_hosts; -init_MUTEX (&ha->vport_sem); +mutex_init (&ha->vport_lock);init_completion (&ha->mbx_cmd_comp);complete (&ha->mbx_cmd_comp);init_completion (&ha->mbx_intr_comp);
Signature · 1 line
1.5.5.1.211.g65ea3
PATCH 6/10 qla2xxx: Don't depend on mailbox return values while enabling FCE tracing.
In reply to Andrew VasquezRecent firmwares no longer return the 'number of buffers' in mailbox6. The original code may result in a potential panic during a FW-dump process due to the driver misinterpreting the size of the allocated buffer.
--- drivers/scsi/qla2xxx/qla_mbx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/qla2xxx/qla_mbx.c +1 -1
@@ -2508,7 +2508,7 @@ qla2x00_enable_fce_trace(scsi_qla_host_t *ha, dma_addr_t fce_dma,if (mb)memcpy (mb, mcp->mb,8 *sizeof (*mb));if (dwords) - *dwords = mcp->mb[6 ]; + *dwords = buffers; }return rval;
Signature · 1 line
1.5.5.1.211.g65ea3
PATCH 7/10 qla2xxx: Extend the 'fw_dump' SYSFS node the ability to initiate a firmware dump.
In reply to Andrew VasquezThe user-initiated dump can be a useful tool in triaging complex ISP and FC issues.
--- drivers/scsi/qla2xxx/qla_attr.c | 3 +++ drivers/scsi/qla2xxx/qla_gbl.h | 3 +++ drivers/scsi/qla2xxx/qla_mbx.c | 6 +----- 3 files changed, 7 insertions(+), 5 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +3 -0
@@ -70,6 +70,9 @@ qla2x00_sysfs_write_fw_dump(struct kobject *kobj,case 2 :qla2x00_alloc_fw_dump (ha);break ; +case 3 : +qla2x00_system_error (ha); +break ; }return (count); }
drivers/scsi/qla2xxx/qla_gbl.h +3 -0
@@ -228,6 +228,9 @@ extern int qla24xx_abort_target(struct fc_port *, unsigned int);extern int qla24xx_lun_reset (struct fc_port *,unsigned int );extern int +qla2x00_system_error (scsi_qla_host_t *); + +extern int qla2x00_set_serdes_params (scsi_qla_host_t *,uint16_t ,uint16_t ,uint16_t ); extern int
drivers/scsi/qla2xxx/qla_mbx.c +1 -5
@@ -2303,8 +2303,6 @@ qla24xx_lun_reset(struct fc_port *fcport, unsigned int l)return __qla24xx_issue_tmf ("Lun" ,TCF_LUN_RESET , fcport, l); } -#if 0 -int qla2x00_system_error (scsi_qla_host_t *ha) {
@@ -2312,7 +2310,7 @@ qla2x00_system_error(scsi_qla_host_t *ha)mbx_cmd_t mc;mbx_cmd_t *mcp = &mc; -if (!IS_FWI2_CAPABLE (ha)) +if (!IS_QLA23XX (ha) && !IS_FWI2_CAPABLE (ha))return QLA_FUNCTION_FAILED ;DEBUG11 (printk ("%s(%ld): entered.\n" , __func__, ha->host_no));
@@ -2334,8 +2332,6 @@ qla2x00_system_error(scsi_qla_host_t *ha)return rval; } -#endif /* 0 */ -/** * qla2x00_set_serdes_params() - * @ha: HA context
Signature · 1 line
1.5.5.1.211.g65ea3
PATCH 8/10 qla2xxx: Disable local-interrupts while polling for RISC status.
In reply to Andrew VasquezMatthew Wilcox <[email protected]> reported the following lockdep warning:
Quoted 17 lines
=================================
[INFO:inconsistentlockstate] 2.6.26-rc1-00115-g0340eda-dirty#60
---------------------------------
inconsistent{hardirq-on-W}->{in-hardirq-W}usage. swapper/1[HC1[1]:SC0[0]:HE0:SE1]takes:
(&ha->hardware_lock){+-..},at:[<c035495d>]qla2300_intr_handler+0x35/0x1f5 {hardirq-on-W}statewasregisteredat:
[<c0139a16>]__lock_acquire+0x459/0xb1d [<c013a091>]__lock_acquire+0xad4/0xb1d [<c013a142>]lock_acquire+0x68/0x82 [<c035495d>]qla2300_intr_handler+0x35/0x1f5 [<c0506da5>]_spin_lock+0x24/0x4d [<c035495d>]qla2300_intr_handler+0x35/0x1f5 [<c035495d>]qla2300_intr_handler+0x35/0x1f5 [<c01391e4>]trace_hardirqs_on+0xe7/0x10e [<c034f0a6>]qla2x00_mailbox_command+0x1c6/0x433
...
Quoted 4 lines
other info that might help us debug this:
no locks held by swapper/1.stack backtrace:
Quoted 12 lines
Pid:1,comm:swapperNottainted2.6.26-rc1-00115-g0340eda-dirty#60 [<c0138121>]print_usage_bug+0x100/0x10a [<c0138d37>]mark_lock+0xaa/0x395 [<c01399af>]__lock_acquire+0x3f2/0xb1d [<c013a091>]__lock_acquire+0xad4/0xb1d [<c013a142>]lock_acquire+0x68/0x82 [<c035495d>]qla2300_intr_handler+0x35/0x1f5 [<c0506da5>]_spin_lock+0x24/0x4d [<c035495d>]qla2300_intr_handler+0x35/0x1f5 [<c035495d>]qla2300_intr_handler+0x35/0x1f5 [<c014a37b>]handle_IRQ_event+0x13/0x3d [<c014b366>]handle_fasteoi_irq+0x76/0xab
Which shows that lockdep is detecting the driver's interrupt-handler is run in both process and interrupt context with irqs-enabled in the former case.
During init-time and error-recovery (after a RISC reset), the driver disables interrupts and 'polls' for completions by calling qla2x00_poll():
static inline void
qla2x00_poll(scsi_qla_host_t *ha)
{
ha->isp_ops->intr_handler(0, ha);
}which in-turn calls the ISP registered interrupt handler. This patch corrects it by disabling local interrupts during polling.
--- drivers/scsi/qla2xxx/qla_inline.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/scsi/qla2xxx/qla_inline.h +4 -0
@@ -34,7 +34,11 @@ qla2x00_debounce_register(volatile uint16_t __iomem *addr)static inline void qla2x00_poll (scsi_qla_host_t *ha) { +unsigned long flags; + +local_irq_save (flags); ha->isp_ops->intr_handler (0 , ha); +local_irq_restore (flags); } static __inline__ scsi_qla_host_t *
Signature · 1 line
1.5.5.1.211.g65ea3
PATCH 9/10 qla2xxx: Revert "qla2xxx: Validate mid-layer 'underflow' during check-condition handling."
In reply to Andrew VasquezThis reverts commit 8084fe168a5252548cdddf2ed181c337fecd0523. The midlayer should be given the oppotunity to interpret the check-condition and based on scsi_cmnd->resid determine if a transfer should be retried or failed.
--- drivers/scsi/qla2xxx/qla_isr.c | 19 ------------------- 1 files changed, 0 insertions(+), 19 deletions(-)
drivers/scsi/qla2xxx/qla_isr.c +0 -19
@@ -1132,25 +1132,6 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)break ;qla2x00_handle_sense (sp, sense_data, sense_len); - -/* -* In case of a Underrun condition, set both the lscsi -* status and the completion status to appropriate -* values. -*/ -if (resid && - ((unsigned )(scsi_bufflen (cp) - resid) < - cp->underflow)) { -DEBUG2 (qla_printk (KERN_INFO , ha, -"scsi(%ld:%d:%d:%d): Mid-layer underflow " -"detected (%x of %x bytes)...returning " -"error status.\n" , ha->host_no, - cp->device->channel, cp->device->id, - cp->device->lun, resid, -scsi_bufflen (cp))); - - cp->result =DID_ERROR <<16 | lscsi_status; - } }else {/* * If RISC reports underrun and target does not report
Signature · 1 line
1.5.5.1.211.g65ea3
PATCH 10/10 qla2xxx: Update version number to 8.02.01-k3.
In reply to Andrew Vasquez--- drivers/scsi/qla2xxx/qla_version.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/qla2xxx/qla_version.h +1 -1
@@ -7,7 +7,7 @@/* * Driver version */ -#define QLA2XXX_VERSION "8.02.01-k2" +#define QLA2XXX_VERSION "8.02.01-k3"#define QLA_DRIVER_MAJOR_VER 8#define QLA_DRIVER_MINOR_VER 2
Signature · 1 line
1.5.5.1.211.g65ea3