aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiridhar Malavali <giridhar.malavali@qlogic.com>2009-03-24 12:07:56 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-04-03 10:22:44 -0400
commita5326f86ebbb153f62b0027a0f367a41f7edc1f6 (patch)
treedb5b818c2301c1c16ee45dbad92dc109cfdaf0d4
parent08029990b25b76b1bc167336358bd21812567f2a (diff)
[SCSI] qla2xxx: Consolidate queuecommand implementations.
Post refactoring/multi-queue additions essentially eliminated the need for separate ISP24XX+ queuecommand as isp_ops contains a function pointer to the associated 'start_scsi()' operation. Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com> Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_mid.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c111
3 files changed, 7 insertions, 108 deletions
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 6de283f8f111..85b689c937b3 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -82,7 +82,7 @@ extern void qla2x00_relogin(struct scsi_qla_host *);
82/* 82/*
83 * Global Functions in qla_mid.c source file. 83 * Global Functions in qla_mid.c source file.
84 */ 84 */
85extern struct scsi_host_template qla24xx_driver_template; 85extern struct scsi_host_template qla2xxx_driver_template;
86extern struct scsi_transport_template *qla2xxx_transport_vport_template; 86extern struct scsi_transport_template *qla2xxx_transport_vport_template;
87extern void qla2x00_timer(scsi_qla_host_t *); 87extern void qla2x00_timer(scsi_qla_host_t *);
88extern void qla2x00_start_timer(scsi_qla_host_t *, void *, unsigned long); 88extern void qla2x00_start_timer(scsi_qla_host_t *, void *, unsigned long);
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
index e2bd36e7e885..51716c7e3008 100644
--- a/drivers/scsi/qla2xxx/qla_mid.c
+++ b/drivers/scsi/qla2xxx/qla_mid.c
@@ -359,7 +359,7 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
359 scsi_qla_host_t *base_vha = shost_priv(fc_vport->shost); 359 scsi_qla_host_t *base_vha = shost_priv(fc_vport->shost);
360 struct qla_hw_data *ha = base_vha->hw; 360 struct qla_hw_data *ha = base_vha->hw;
361 scsi_qla_host_t *vha; 361 scsi_qla_host_t *vha;
362 struct scsi_host_template *sht = &qla24xx_driver_template; 362 struct scsi_host_template *sht = &qla2xxx_driver_template;
363 struct Scsi_Host *host; 363 struct Scsi_Host *host;
364 364
365 vha = qla2x00_create_host(sht, ha); 365 vha = qla2x00_create_host(sht, ha);
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index a6761ff73e24..41ff7d69bd64 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -104,9 +104,7 @@ static int qla2xxx_slave_alloc(struct scsi_device *);
104static int qla2xxx_scan_finished(struct Scsi_Host *, unsigned long time); 104static int qla2xxx_scan_finished(struct Scsi_Host *, unsigned long time);
105static void qla2xxx_scan_start(struct Scsi_Host *); 105static void qla2xxx_scan_start(struct Scsi_Host *);
106static void qla2xxx_slave_destroy(struct scsi_device *); 106static void qla2xxx_slave_destroy(struct scsi_device *);
107static int qla2x00_queuecommand(struct scsi_cmnd *cmd, 107static int qla2xxx_queuecommand(struct scsi_cmnd *cmd,
108 void (*fn)(struct scsi_cmnd *));
109static int qla24xx_queuecommand(struct scsi_cmnd *cmd,
110 void (*fn)(struct scsi_cmnd *)); 108 void (*fn)(struct scsi_cmnd *));
111static int qla2xxx_eh_abort(struct scsi_cmnd *); 109static int qla2xxx_eh_abort(struct scsi_cmnd *);
112static int qla2xxx_eh_device_reset(struct scsi_cmnd *); 110static int qla2xxx_eh_device_reset(struct scsi_cmnd *);
@@ -117,42 +115,10 @@ static int qla2xxx_eh_host_reset(struct scsi_cmnd *);
117static int qla2x00_change_queue_depth(struct scsi_device *, int); 115static int qla2x00_change_queue_depth(struct scsi_device *, int);
118static int qla2x00_change_queue_type(struct scsi_device *, int); 116static int qla2x00_change_queue_type(struct scsi_device *, int);
119 117
120static struct scsi_host_template qla2x00_driver_template = { 118struct scsi_host_template qla2xxx_driver_template = {
121 .module = THIS_MODULE, 119 .module = THIS_MODULE,
122 .name = QLA2XXX_DRIVER_NAME, 120 .name = QLA2XXX_DRIVER_NAME,
123 .queuecommand = qla2x00_queuecommand, 121 .queuecommand = qla2xxx_queuecommand,
124
125 .eh_abort_handler = qla2xxx_eh_abort,
126 .eh_device_reset_handler = qla2xxx_eh_device_reset,
127 .eh_target_reset_handler = qla2xxx_eh_target_reset,
128 .eh_bus_reset_handler = qla2xxx_eh_bus_reset,
129 .eh_host_reset_handler = qla2xxx_eh_host_reset,
130
131 .slave_configure = qla2xxx_slave_configure,
132
133 .slave_alloc = qla2xxx_slave_alloc,
134 .slave_destroy = qla2xxx_slave_destroy,
135 .scan_finished = qla2xxx_scan_finished,
136 .scan_start = qla2xxx_scan_start,
137 .change_queue_depth = qla2x00_change_queue_depth,
138 .change_queue_type = qla2x00_change_queue_type,
139 .this_id = -1,
140 .cmd_per_lun = 3,
141 .use_clustering = ENABLE_CLUSTERING,
142 .sg_tablesize = SG_ALL,
143
144 /*
145 * The RISC allows for each command to transfer (2^32-1) bytes of data,
146 * which equates to 0x800000 sectors.
147 */
148 .max_sectors = 0xFFFF,
149 .shost_attrs = qla2x00_host_attrs,
150};
151
152struct scsi_host_template qla24xx_driver_template = {
153 .module = THIS_MODULE,
154 .name = QLA2XXX_DRIVER_NAME,
155 .queuecommand = qla24xx_queuecommand,
156 122
157 .eh_abort_handler = qla2xxx_eh_abort, 123 .eh_abort_handler = qla2xxx_eh_abort,
158 .eh_device_reset_handler = qla2xxx_eh_device_reset, 124 .eh_device_reset_handler = qla2xxx_eh_device_reset,
@@ -430,73 +396,7 @@ qla2x00_get_new_sp(scsi_qla_host_t *vha, fc_port_t *fcport,
430} 396}
431 397
432static int 398static int
433qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) 399qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
434{
435 scsi_qla_host_t *vha = shost_priv(cmd->device->host);
436 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
437 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device));
438 struct qla_hw_data *ha = vha->hw;
439 srb_t *sp;
440 int rval;
441
442 if (unlikely(pci_channel_offline(ha->pdev))) {
443 cmd->result = DID_REQUEUE << 16;
444 goto qc_fail_command;
445 }
446
447 rval = fc_remote_port_chkready(rport);
448 if (rval) {
449 cmd->result = rval;
450 goto qc_fail_command;
451 }
452
453 /* Close window on fcport/rport state-transitioning. */
454 if (fcport->drport)
455 goto qc_target_busy;
456
457 if (atomic_read(&fcport->state) != FCS_ONLINE) {
458 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
459 atomic_read(&vha->loop_state) == LOOP_DEAD) {
460 cmd->result = DID_NO_CONNECT << 16;
461 goto qc_fail_command;
462 }
463 goto qc_target_busy;
464 }
465
466 spin_unlock_irq(vha->host->host_lock);
467
468 sp = qla2x00_get_new_sp(vha, fcport, cmd, done);
469 if (!sp)
470 goto qc_host_busy_lock;
471
472 rval = ha->isp_ops->start_scsi(sp);
473 if (rval != QLA_SUCCESS)
474 goto qc_host_busy_free_sp;
475
476 spin_lock_irq(vha->host->host_lock);
477
478 return 0;
479
480qc_host_busy_free_sp:
481 qla2x00_sp_free_dma(sp);
482 mempool_free(sp, ha->srb_mempool);
483
484qc_host_busy_lock:
485 spin_lock_irq(vha->host->host_lock);
486 return SCSI_MLQUEUE_HOST_BUSY;
487
488qc_target_busy:
489 return SCSI_MLQUEUE_TARGET_BUSY;
490
491qc_fail_command:
492 done(cmd);
493
494 return 0;
495}
496
497
498static int
499qla24xx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
500{ 400{
501 scsi_qla_host_t *vha = shost_priv(cmd->device->host); 401 scsi_qla_host_t *vha = shost_priv(cmd->device->host);
502 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; 402 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
@@ -1712,7 +1612,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1712 struct rsp_que *rsp = NULL; 1612 struct rsp_que *rsp = NULL;
1713 1613
1714 bars = pci_select_bars(pdev, IORESOURCE_MEM | IORESOURCE_IO); 1614 bars = pci_select_bars(pdev, IORESOURCE_MEM | IORESOURCE_IO);
1715 sht = &qla2x00_driver_template; 1615 sht = &qla2xxx_driver_template;
1716 if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422 || 1616 if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422 ||
1717 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2432 || 1617 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2432 ||
1718 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8432 || 1618 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8432 ||
@@ -1721,7 +1621,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1721 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2532 || 1621 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2532 ||
1722 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8001) { 1622 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8001) {
1723 bars = pci_select_bars(pdev, IORESOURCE_MEM); 1623 bars = pci_select_bars(pdev, IORESOURCE_MEM);
1724 sht = &qla24xx_driver_template;
1725 mem_only = 1; 1624 mem_only = 1;
1726 } 1625 }
1727 1626