diff options
author | Giridhar Malavali <giridhar.malavali@qlogic.com> | 2009-03-24 12:07:56 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-04-03 10:22:44 -0400 |
commit | a5326f86ebbb153f62b0027a0f367a41f7edc1f6 (patch) | |
tree | db5b818c2301c1c16ee45dbad92dc109cfdaf0d4 /drivers/scsi/qla2xxx/qla_os.c | |
parent | 08029990b25b76b1bc167336358bd21812567f2a (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>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_os.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 111 |
1 files changed, 5 insertions, 106 deletions
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 *); | |||
104 | static int qla2xxx_scan_finished(struct Scsi_Host *, unsigned long time); | 104 | static int qla2xxx_scan_finished(struct Scsi_Host *, unsigned long time); |
105 | static void qla2xxx_scan_start(struct Scsi_Host *); | 105 | static void qla2xxx_scan_start(struct Scsi_Host *); |
106 | static void qla2xxx_slave_destroy(struct scsi_device *); | 106 | static void qla2xxx_slave_destroy(struct scsi_device *); |
107 | static int qla2x00_queuecommand(struct scsi_cmnd *cmd, | 107 | static int qla2xxx_queuecommand(struct scsi_cmnd *cmd, |
108 | void (*fn)(struct scsi_cmnd *)); | ||
109 | static int qla24xx_queuecommand(struct scsi_cmnd *cmd, | ||
110 | void (*fn)(struct scsi_cmnd *)); | 108 | void (*fn)(struct scsi_cmnd *)); |
111 | static int qla2xxx_eh_abort(struct scsi_cmnd *); | 109 | static int qla2xxx_eh_abort(struct scsi_cmnd *); |
112 | static int qla2xxx_eh_device_reset(struct scsi_cmnd *); | 110 | static int qla2xxx_eh_device_reset(struct scsi_cmnd *); |
@@ -117,42 +115,10 @@ static int qla2xxx_eh_host_reset(struct scsi_cmnd *); | |||
117 | static int qla2x00_change_queue_depth(struct scsi_device *, int); | 115 | static int qla2x00_change_queue_depth(struct scsi_device *, int); |
118 | static int qla2x00_change_queue_type(struct scsi_device *, int); | 116 | static int qla2x00_change_queue_type(struct scsi_device *, int); |
119 | 117 | ||
120 | static struct scsi_host_template qla2x00_driver_template = { | 118 | struct 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 | |||
152 | struct 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 | ||
432 | static int | 398 | static int |
433 | qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | 399 | qla2xxx_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 | |||
480 | qc_host_busy_free_sp: | ||
481 | qla2x00_sp_free_dma(sp); | ||
482 | mempool_free(sp, ha->srb_mempool); | ||
483 | |||
484 | qc_host_busy_lock: | ||
485 | spin_lock_irq(vha->host->host_lock); | ||
486 | return SCSI_MLQUEUE_HOST_BUSY; | ||
487 | |||
488 | qc_target_busy: | ||
489 | return SCSI_MLQUEUE_TARGET_BUSY; | ||
490 | |||
491 | qc_fail_command: | ||
492 | done(cmd); | ||
493 | |||
494 | return 0; | ||
495 | } | ||
496 | |||
497 | |||
498 | static int | ||
499 | qla24xx_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 | ||