2 * QLOGIC LINUX SOFTWARE
4 * QLogic ISP2x00 device driver for Linux 2.6.x
5 * Copyright (C) 2003-2004 QLogic Corporation
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
21 #include <linux/moduleparam.h>
22 #include <linux/vmalloc.h>
23 #include <linux/smp_lock.h>
24 #include <linux/delay.h>
26 #include <scsi/scsi_tcq.h>
27 #include <scsi/scsicam.h>
28 #include <scsi/scsi_transport.h>
29 #include <scsi/scsi_transport_fc.h>
34 char qla2x00_version_str[40];
37 * SRB allocation cache
39 char srb_cachep_name[16];
40 kmem_cache_t *srb_cachep;
43 * Stats for all adpaters.
45 struct _qla2x00stats qla2x00_stats;
48 * Ioctl related information.
54 * Module parameter information and variables
57 module_param(ql2xmaxqdepth, int, S_IRUGO|S_IWUSR);
58 MODULE_PARM_DESC(ql2xmaxqdepth,
59 "Maximum queue depth to report for target devices.");
61 int ql2xlogintimeout = 20;
62 module_param(ql2xlogintimeout, int, S_IRUGO|S_IRUSR);
63 MODULE_PARM_DESC(ql2xlogintimeout,
64 "Login timeout value in seconds.");
66 int qlport_down_retry = 30;
67 module_param(qlport_down_retry, int, S_IRUGO|S_IRUSR);
68 MODULE_PARM_DESC(qlport_down_retry,
69 "Maximum number of command retries to a port that returns"
70 "a PORT-DOWN status.");
72 int ql2xretrycount = 20;
73 module_param(ql2xretrycount, int, S_IRUGO|S_IWUSR);
74 MODULE_PARM_DESC(ql2xretrycount,
75 "Maximum number of mid-layer retries allowed for a command. "
76 "Default value is 20, ");
78 int ql2xplogiabsentdevice;
79 module_param(ql2xplogiabsentdevice, int, S_IRUGO|S_IWUSR);
80 MODULE_PARM_DESC(ql2xplogiabsentdevice,
81 "Option to enable PLOGI to devices that are not present after "
82 "a Fabric scan. This is needed for several broken switches."
83 "Default is 0 - no PLOGI. 1 - perfom PLOGI.");
85 int ql2xenablezio = 0;
86 module_param(ql2xenablezio, int, S_IRUGO|S_IRUSR);
87 MODULE_PARM_DESC(ql2xenablezio,
88 "Option to enable ZIO:If 1 then enable it otherwise"
89 " use the default set in the NVRAM."
90 " Default is 0 : disabled");
92 int ql2xintrdelaytimer = 10;
93 module_param(ql2xintrdelaytimer, int, S_IRUGO|S_IRUSR);
94 MODULE_PARM_DESC(ql2xintrdelaytimer,
95 "ZIO: Waiting time for Firmware before it generates an "
96 "interrupt to the host to notify completion of request.");
99 module_param(ConfigRequired, int, S_IRUGO|S_IRUSR);
100 MODULE_PARM_DESC(ConfigRequired,
101 "If 1, then only configured devices passed in through the"
102 "ql2xopts parameter will be presented to the OS");
104 int Bind = BIND_BY_PORT_NAME;
105 module_param(Bind, int, S_IRUGO|S_IRUSR);
106 MODULE_PARM_DESC(Bind,
107 "Target persistent binding method: "
108 "0 by Portname (default); 1 by PortID; 2 by Nodename. ");
110 int ql2xsuspendcount = SUSPEND_COUNT;
111 module_param(ql2xsuspendcount, int, S_IRUGO|S_IWUSR);
112 MODULE_PARM_DESC(ql2xsuspendcount,
113 "Number of 6-second suspend iterations to perform while a "
114 "target returns a <NOT READY> status. Default is 10 "
117 int ql2xloginretrycount = 0;
118 module_param(ql2xloginretrycount, int, S_IRUGO|S_IRUSR);
119 MODULE_PARM_DESC(ql2xloginretrycount,
120 "Specify an alternate value for the NVRAM login retry count.");
123 * Proc structures and functions
132 static void copy_mem_info(struct info_str *, char *, int);
133 static int copy_info(struct info_str *, char *, ...);
135 static void qla2x00_free_device(scsi_qla_host_t *);
137 static void qla2x00_config_dma_addressing(scsi_qla_host_t *ha);
140 * SCSI host template entry points
142 static int qla2xxx_slave_configure(struct scsi_device * device);
143 static int qla2xxx_slave_alloc(struct scsi_device *);
144 static void qla2xxx_slave_destroy(struct scsi_device *);
145 static int qla2x00_queuecommand(struct scsi_cmnd *cmd,
146 void (*fn)(struct scsi_cmnd *));
147 static int qla2xxx_eh_abort(struct scsi_cmnd *);
148 static int qla2xxx_eh_device_reset(struct scsi_cmnd *);
149 static int qla2xxx_eh_bus_reset(struct scsi_cmnd *);
150 static int qla2xxx_eh_host_reset(struct scsi_cmnd *);
151 static int qla2x00_loop_reset(scsi_qla_host_t *ha);
152 static int qla2x00_device_reset(scsi_qla_host_t *, fc_port_t *);
154 static int qla2x00_proc_info(struct Scsi_Host *, char *, char **,
157 static struct scsi_host_template qla2x00_driver_template = {
158 .module = THIS_MODULE,
160 .proc_name = "qla2xxx",
161 .proc_info = qla2x00_proc_info,
162 .queuecommand = qla2x00_queuecommand,
164 .eh_abort_handler = qla2xxx_eh_abort,
165 .eh_device_reset_handler = qla2xxx_eh_device_reset,
166 .eh_bus_reset_handler = qla2xxx_eh_bus_reset,
167 .eh_host_reset_handler = qla2xxx_eh_host_reset,
169 .slave_configure = qla2xxx_slave_configure,
171 .slave_alloc = qla2xxx_slave_alloc,
172 .slave_destroy = qla2xxx_slave_destroy,
175 .use_clustering = ENABLE_CLUSTERING,
176 .sg_tablesize = SG_ALL,
179 * The RISC allows for each command to transfer (2^32-1) bytes of data,
180 * which equates to 0x800000 sectors.
182 .max_sectors = 0xFFFF,
185 static struct scsi_transport_template *qla2xxx_transport_template = NULL;
187 /* TODO Convert to inlines
191 #define WATCH_INTERVAL 1 /* number of seconds */
193 static void qla2x00_timer(scsi_qla_host_t *);
195 static __inline__ void qla2x00_start_timer(scsi_qla_host_t *,
196 void *, unsigned long);
197 static __inline__ void qla2x00_restart_timer(scsi_qla_host_t *, unsigned long);
198 static __inline__ void qla2x00_stop_timer(scsi_qla_host_t *);
201 qla2x00_start_timer(scsi_qla_host_t *ha, void *func, unsigned long interval)
203 init_timer(&ha->timer);
204 ha->timer.expires = jiffies + interval * HZ;
205 ha->timer.data = (unsigned long)ha;
206 ha->timer.function = (void (*)(unsigned long))func;
207 add_timer(&ha->timer);
208 ha->timer_active = 1;
212 qla2x00_restart_timer(scsi_qla_host_t *ha, unsigned long interval)
214 mod_timer(&ha->timer, jiffies + interval * HZ);
217 static __inline__ void
218 qla2x00_stop_timer(scsi_qla_host_t *ha)
220 del_timer_sync(&ha->timer);
221 ha->timer_active = 0;
224 static int qla2x00_do_dpc(void *data);
226 static void qla2x00_rst_aen(scsi_qla_host_t *);
228 static uint8_t qla2x00_mem_alloc(scsi_qla_host_t *);
229 static void qla2x00_mem_free(scsi_qla_host_t *ha);
230 static int qla2x00_allocate_sp_pool( scsi_qla_host_t *ha);
231 static void qla2x00_free_sp_pool(scsi_qla_host_t *ha);
232 static srb_t *qla2x00_get_new_sp(scsi_qla_host_t *);
233 static void qla2x00_sp_free_dma(scsi_qla_host_t *, srb_t *);
234 void qla2x00_sp_compl(scsi_qla_host_t *ha, srb_t *);
236 /* -------------------------------------------------------------------------- */
239 qla2x00_get_pci_info_str(struct scsi_qla_host *ha, char *str)
241 static char *pci_bus_modes[] = {
242 "33", "66", "100", "133",
247 pci_bus = (ha->pci_attr & (BIT_9 | BIT_10)) >> 9;
250 strcat(str, pci_bus_modes[pci_bus]);
252 pci_bus = (ha->pci_attr & BIT_8) >> 8;
254 strcat(str, pci_bus_modes[pci_bus]);
256 strcat(str, " MHz)");
262 qla2x00_get_fw_version_str(struct scsi_qla_host *ha, char *str)
266 sprintf(str, "%d.%02d.%02d ", ha->fw_major_version,
267 ha->fw_minor_version,
268 ha->fw_subminor_version);
270 if (ha->fw_attributes & BIT_9) {
275 switch (ha->fw_attributes & 0xFF) {
289 sprintf(un_str, "(%x)", ha->fw_attributes);
293 if (ha->fw_attributes & 0x100)
299 /**************************************************************************
300 * qla2x00_queuecommand
303 * Queue a command to the controller.
306 * cmd - pointer to Scsi cmd structure
307 * fn - pointer to Scsi done function
313 * The mid-level driver tries to ensures that queuecommand never gets invoked
314 * concurrently with itself or the interrupt handler (although the
315 * interrupt handler may call this routine as part of request-completion
317 **************************************************************************/
319 qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
321 scsi_qla_host_t *ha = to_qla_host(cmd->device->host);
322 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
327 cmd->result = DID_NO_CONNECT << 16;
328 goto qc_fail_command;
331 if (atomic_read(&fcport->state) != FCS_ONLINE) {
332 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
333 atomic_read(&ha->loop_state) == LOOP_DEAD) {
334 cmd->result = DID_NO_CONNECT << 16;
335 goto qc_fail_command;
340 spin_unlock_irq(ha->host->host_lock);
342 /* Allocate a command packet from the "sp" pool. */
343 if ((sp = qla2x00_get_new_sp(ha)) == NULL) {
344 goto qc_host_busy_lock;
353 CMD_SP(cmd) = (void *)sp;
354 cmd->scsi_done = done;
356 rval = qla2x00_start_scsi(sp);
357 if (rval != QLA_SUCCESS)
358 goto qc_host_busy_free_sp;
360 /* Manage unprocessed RIO/ZIO commands in response queue. */
361 if (ha->flags.online && ha->flags.process_response_queue &&
362 ha->response_ring_ptr->signature != RESPONSE_PROCESSED) {
365 spin_lock_irqsave(&ha->hardware_lock, flags);
366 qla2x00_process_response_queue(ha);
367 spin_unlock_irqrestore(&ha->hardware_lock, flags);
370 spin_lock_irq(ha->host->host_lock);
374 qc_host_busy_free_sp:
375 qla2x00_sp_free_dma(ha, sp);
377 mempool_free(sp, ha->srb_mempool);
380 spin_lock_irq(ha->host->host_lock);
383 return SCSI_MLQUEUE_HOST_BUSY;
392 * qla2x00_eh_wait_on_command
393 * Waits for the command to be returned by the Firmware for some
397 * ha = actual ha whose done queue will contain the command
398 * returned by firmware.
399 * cmd = Scsi Command to wait on.
400 * flag = Abort/Reset(Bus or Device Reset)
407 qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd)
409 #define ABORT_POLLING_PERIOD HZ
410 #define ABORT_WAIT_ITER ((10 * HZ) / (ABORT_POLLING_PERIOD))
411 unsigned long wait_iter = ABORT_WAIT_ITER;
412 int ret = QLA_SUCCESS;
414 while (CMD_SP(cmd)) {
415 set_current_state(TASK_UNINTERRUPTIBLE);
416 schedule_timeout(ABORT_POLLING_PERIOD);
422 ret = QLA_FUNCTION_FAILED;
428 * qla2x00_wait_for_hba_online
429 * Wait till the HBA is online after going through
430 * <= MAX_RETRIES_OF_ISP_ABORT or
431 * finally HBA is disabled ie marked offline
434 * ha - pointer to host adapter structure
437 * Does context switching-Release SPIN_LOCK
438 * (if any) before calling this routine.
441 * Success (Adapter is online) : 0
442 * Failed (Adapter is offline/disabled) : 1
445 qla2x00_wait_for_hba_online(scsi_qla_host_t *ha)
448 unsigned long wait_online;
450 wait_online = jiffies + (MAX_LOOP_TIMEOUT * HZ);
451 while (((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags)) ||
452 test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) ||
453 test_bit(ISP_ABORT_RETRY, &ha->dpc_flags) ||
454 ha->dpc_active) && time_before(jiffies, wait_online)) {
458 if (ha->flags.online)
459 return_status = QLA_SUCCESS;
461 return_status = QLA_FUNCTION_FAILED;
463 DEBUG2(printk("%s return_status=%d\n",__func__,return_status));
465 return (return_status);
469 * qla2x00_wait_for_loop_ready
470 * Wait for MAX_LOOP_TIMEOUT(5 min) value for loop
471 * to be in LOOP_READY state.
473 * ha - pointer to host adapter structure
476 * Does context switching-Release SPIN_LOCK
477 * (if any) before calling this routine.
481 * Success (LOOP_READY) : 0
482 * Failed (LOOP_NOT_READY) : 1
485 qla2x00_wait_for_loop_ready(scsi_qla_host_t *ha)
487 int return_status = QLA_SUCCESS;
488 unsigned long loop_timeout ;
490 /* wait for 5 min at the max for loop to be ready */
491 loop_timeout = jiffies + (MAX_LOOP_TIMEOUT * HZ);
493 while ((!atomic_read(&ha->loop_down_timer) &&
494 atomic_read(&ha->loop_state) == LOOP_DOWN) ||
495 test_bit(CFG_ACTIVE, &ha->cfg_flags) ||
496 atomic_read(&ha->loop_state) != LOOP_READY) {
498 if (time_after_eq(jiffies, loop_timeout)) {
499 return_status = QLA_FUNCTION_FAILED;
503 return (return_status);
506 /**************************************************************************
510 * The abort function will abort the specified command.
513 * cmd = Linux SCSI command packet to be aborted.
516 * Either SUCCESS or FAILED.
519 **************************************************************************/
521 qla2xxx_eh_abort(struct scsi_cmnd *cmd)
523 scsi_qla_host_t *ha = to_qla_host(cmd->device->host);
526 unsigned int id, lun;
527 unsigned long serial;
534 id = cmd->device->id;
535 lun = cmd->device->lun;
536 serial = cmd->serial_number;
538 /* Check active list for command command. */
539 spin_unlock_irq(ha->host->host_lock);
540 spin_lock(&ha->hardware_lock);
541 for (i = 1; i < MAX_OUTSTANDING_COMMANDS; i++) {
542 sp = ha->outstanding_cmds[i];
550 DEBUG2(printk("%s(%ld): aborting sp %p from RISC. pid=%ld "
551 "sp->state=%x\n", __func__, ha->host_no, sp, serial,
553 DEBUG3(qla2x00_print_scsi_cmd(cmd);)
555 spin_unlock(&ha->hardware_lock);
556 if (qla2x00_abort_command(ha, sp)) {
557 DEBUG2(printk("%s(%ld): abort_command "
558 "mbx failed.\n", __func__, ha->host_no));
560 DEBUG3(printk("%s(%ld): abort_command "
561 "mbx success.\n", __func__, ha->host_no));
564 spin_lock(&ha->hardware_lock);
569 /* Wait for the command to be returned. */
570 if (ret == SUCCESS) {
571 spin_unlock(&ha->hardware_lock);
572 if (qla2x00_eh_wait_on_command(ha, cmd) != QLA_SUCCESS) {
573 qla_printk(KERN_ERR, ha,
574 "scsi(%ld:%d:%d): Abort handler timed out -- %lx "
575 "%x.\n", ha->host_no, id, lun, serial, ret);
577 spin_lock(&ha->hardware_lock);
579 spin_lock_irq(ha->host->host_lock);
581 qla_printk(KERN_INFO, ha,
582 "scsi(%ld:%d:%d): Abort command issued -- %lx %x.\n", ha->host_no,
583 id, lun, serial, ret);
588 /**************************************************************************
589 * qla2x00_eh_wait_for_pending_target_commands
592 * Waits for all the commands to come back from the specified target.
595 * ha - pointer to scsi_qla_host structure.
598 * Either SUCCESS or FAILED.
601 **************************************************************************/
603 qla2x00_eh_wait_for_pending_target_commands(scsi_qla_host_t *ha, unsigned int t)
608 struct scsi_cmnd *cmd;
613 * Waiting for all commands for the designated target in the active
616 for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) {
617 spin_lock(&ha->hardware_lock);
618 sp = ha->outstanding_cmds[cnt];
621 spin_unlock(&ha->hardware_lock);
622 if (cmd->device->id == t) {
623 if (!qla2x00_eh_wait_on_command(ha, cmd)) {
629 spin_unlock(&ha->hardware_lock);
636 /**************************************************************************
637 * qla2xxx_eh_device_reset
640 * The device reset function will reset the target and abort any
641 * executing commands.
643 * NOTE: The use of SP is undefined within this context. Do *NOT*
644 * attempt to use this value, even if you determine it is
648 * cmd = Linux SCSI command packet of the command that cause the
652 * SUCCESS/FAILURE (defined as macro in scsi.h).
654 **************************************************************************/
656 qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
658 scsi_qla_host_t *ha = to_qla_host(cmd->device->host);
659 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
662 unsigned int id, lun;
663 unsigned long serial;
667 id = cmd->device->id;
668 lun = cmd->device->lun;
669 serial = cmd->serial_number;
671 sp = (srb_t *) CMD_SP(cmd);
675 qla_printk(KERN_INFO, ha,
676 "scsi(%ld:%d:%d): DEVICE RESET ISSUED.\n", ha->host_no, id, lun);
678 spin_unlock_irq(ha->host->host_lock);
680 if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) {
681 spin_lock_irq(ha->host->host_lock);
682 goto eh_dev_reset_done;
685 if (qla2x00_wait_for_loop_ready(ha) == QLA_SUCCESS) {
686 if (qla2x00_device_reset(ha, fcport) == 0)
689 #if defined(LOGOUT_AFTER_DEVICE_RESET)
690 if (ret == SUCCESS) {
691 if (fcport->flags & FC_FABRIC_DEVICE) {
692 qla2x00_fabric_logout(ha, fcport->loop_id);
693 qla2x00_mark_device_lost(ha, fcport);
698 DEBUG2(printk(KERN_INFO
699 "%s failed: loop not ready\n",__func__);)
703 DEBUG3(printk("%s(%ld): device reset failed\n",
704 __func__, ha->host_no));
705 qla_printk(KERN_INFO, ha, "%s: device reset failed\n",
708 goto eh_dev_reset_done;
712 * If we are coming down the EH path, wait for all commands to
713 * complete for the device.
715 if (cmd->device->host->eh_active) {
716 if (qla2x00_eh_wait_for_pending_target_commands(ha, id))
720 DEBUG3(printk("%s(%ld): failed while waiting for "
721 "commands\n", __func__, ha->host_no));
722 qla_printk(KERN_INFO, ha,
723 "%s: failed while waiting for commands\n",
726 goto eh_dev_reset_done;
730 qla_printk(KERN_INFO, ha,
731 "scsi(%ld:%d:%d): DEVICE RESET SUCCEEDED.\n", ha->host_no, id, lun);
734 spin_lock_irq(ha->host->host_lock);
739 /**************************************************************************
740 * qla2x00_eh_wait_for_pending_commands
743 * Waits for all the commands to come back from the specified host.
746 * ha - pointer to scsi_qla_host structure.
753 **************************************************************************/
755 qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *ha)
760 struct scsi_cmnd *cmd;
765 * Waiting for all commands for the designated target in the active
768 for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) {
769 spin_lock(&ha->hardware_lock);
770 sp = ha->outstanding_cmds[cnt];
773 spin_unlock(&ha->hardware_lock);
774 status = qla2x00_eh_wait_on_command(ha, cmd);
779 spin_unlock(&ha->hardware_lock);
786 /**************************************************************************
787 * qla2xxx_eh_bus_reset
790 * The bus reset function will reset the bus and abort any executing
794 * cmd = Linux SCSI command packet of the command that cause the
798 * SUCCESS/FAILURE (defined as macro in scsi.h).
800 **************************************************************************/
802 qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
804 scsi_qla_host_t *ha = to_qla_host(cmd->device->host);
805 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
808 unsigned int id, lun;
809 unsigned long serial;
813 id = cmd->device->id;
814 lun = cmd->device->lun;
815 serial = cmd->serial_number;
817 sp = (srb_t *) CMD_SP(cmd);
821 qla_printk(KERN_INFO, ha,
822 "scsi(%ld:%d:%d): LOOP RESET ISSUED.\n", ha->host_no, id, lun);
824 spin_unlock_irq(ha->host->host_lock);
826 if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) {
827 DEBUG2(printk("%s failed:board disabled\n",__func__));
828 goto eh_bus_reset_done;
831 if (qla2x00_wait_for_loop_ready(ha) == QLA_SUCCESS) {
832 if (qla2x00_loop_reset(ha) == QLA_SUCCESS)
836 goto eh_bus_reset_done;
838 /* Waiting for our command in done_queue to be returned to OS.*/
839 if (cmd->device->host->eh_active)
840 if (!qla2x00_eh_wait_for_pending_commands(ha))
844 qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__,
845 (ret == FAILED) ? "failed" : "succeded");
847 spin_lock_irq(ha->host->host_lock);
852 /**************************************************************************
853 * qla2xxx_eh_host_reset
856 * The reset function will reset the Adapter.
859 * cmd = Linux SCSI command packet of the command that cause the
863 * Either SUCCESS or FAILED.
866 **************************************************************************/
868 qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
870 scsi_qla_host_t *ha = to_qla_host(cmd->device->host);
871 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
874 unsigned int id, lun;
875 unsigned long serial;
879 id = cmd->device->id;
880 lun = cmd->device->lun;
881 serial = cmd->serial_number;
883 sp = (srb_t *) CMD_SP(cmd);
887 qla_printk(KERN_INFO, ha,
888 "scsi(%ld:%d:%d): ADAPTER RESET ISSUED.\n", ha->host_no, id, lun);
890 spin_unlock_irq(ha->host->host_lock);
892 if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS)
893 goto eh_host_reset_lock;
896 * Fixme-may be dpc thread is active and processing
897 * loop_resync,so wait a while for it to
898 * be completed and then issue big hammer.Otherwise
899 * it may cause I/O failure as big hammer marks the
900 * devices as lost kicking of the port_down_timer
901 * while dpc is stuck for the mailbox to complete.
903 qla2x00_wait_for_loop_ready(ha);
904 set_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags);
905 if (qla2x00_abort_isp(ha)) {
906 clear_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags);
907 /* failed. schedule dpc to try */
908 set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
910 if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS)
911 goto eh_host_reset_lock;
913 clear_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags);
915 /* Waiting for our command in done_queue to be returned to OS.*/
916 if (qla2x00_eh_wait_for_pending_commands(ha))
920 spin_lock_irq(ha->host->host_lock);
922 qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__,
923 (ret == FAILED) ? "failed" : "succeded");
933 * ha = adapter block pointer.
939 qla2x00_loop_reset(scsi_qla_host_t *ha)
941 int status = QLA_SUCCESS;
942 struct fc_port *fcport;
944 if (ha->flags.enable_lip_reset) {
945 status = qla2x00_lip_reset(ha);
948 if (status == QLA_SUCCESS && ha->flags.enable_target_reset) {
949 list_for_each_entry(fcport, &ha->fcports, list) {
950 if (fcport->port_type != FCT_TARGET)
953 status = qla2x00_target_reset(ha, fcport);
954 if (status != QLA_SUCCESS)
959 if (status == QLA_SUCCESS &&
960 ((!ha->flags.enable_target_reset &&
961 !ha->flags.enable_lip_reset) ||
962 ha->flags.enable_lip_full_login)) {
964 status = qla2x00_full_login_lip(ha);
967 /* Issue marker command only when we are going to start the I/O */
968 ha->marker_needed = 1;
972 DEBUG2_3(printk("%s(%ld): **** FAILED ****\n",
977 DEBUG3(printk("%s(%ld): exiting normally.\n",
986 * qla2x00_device_reset
987 * Issue bus device reset message to the target.
990 * ha = adapter block pointer.
992 * TARGET_QUEUE_LOCK must be released.
993 * ADAPTER_STATE_LOCK must be released.
999 qla2x00_device_reset(scsi_qla_host_t *ha, fc_port_t *reset_fcport)
1001 /* Abort Target command will clear Reservation */
1002 return qla2x00_abort_target(reset_fcport);
1006 qla2xxx_slave_alloc(struct scsi_device *sdev)
1008 scsi_qla_host_t *ha = to_qla_host(sdev->host);
1009 struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
1017 list_for_each_entry(fcport, &ha->fcports, list) {
1018 if (rport->port_name ==
1019 be64_to_cpu(*(uint64_t *)fcport->port_name)) {
1028 sdev->hostdata = fcport;
1034 qla2xxx_slave_configure(struct scsi_device *sdev)
1036 scsi_qla_host_t *ha = to_qla_host(sdev->host);
1037 struct fc_rport *rport = starget_to_rport(sdev->sdev_target);
1039 if (sdev->tagged_supported)
1040 scsi_activate_tcq(sdev, 32);
1042 scsi_deactivate_tcq(sdev, 32);
1044 rport->dev_loss_tmo = ha->port_down_retry_count + 5;
1050 qla2xxx_slave_destroy(struct scsi_device *sdev)
1052 sdev->hostdata = NULL;
1056 * qla2x00_config_dma_addressing() - Configure OS DMA addressing method.
1059 * At exit, the @ha's flags.enable_64bit_addressing set to indicated
1060 * supported addressing method.
1063 qla2x00_config_dma_addressing(scsi_qla_host_t *ha)
1065 /* Assume 32bit DMA address */
1066 ha->flags.enable_64bit_addressing = 0;
1067 ha->calc_request_entries = qla2x00_calc_iocbs_32;
1068 ha->build_scsi_iocbs = qla2x00_build_scsi_iocbs_32;
1071 * Given the two variants pci_set_dma_mask(), allow the compiler to
1072 * assist in setting the proper dma mask.
1074 if (sizeof(dma_addr_t) > 4) {
1075 if (pci_set_dma_mask(ha->pdev, DMA_64BIT_MASK) == 0) {
1076 ha->flags.enable_64bit_addressing = 1;
1077 ha->calc_request_entries = qla2x00_calc_iocbs_64;
1078 ha->build_scsi_iocbs = qla2x00_build_scsi_iocbs_64;
1080 if (pci_set_consistent_dma_mask(ha->pdev,
1082 qla_printk(KERN_DEBUG, ha,
1083 "Failed to set 64 bit PCI consistent mask; "
1085 pci_set_consistent_dma_mask(ha->pdev,
1089 qla_printk(KERN_DEBUG, ha,
1090 "Failed to set 64 bit PCI DMA mask, falling back "
1091 "to 32 bit MASK.\n");
1092 pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK);
1095 pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK);
1100 qla2x00_iospace_config(scsi_qla_host_t *ha)
1102 unsigned long pio, pio_len, pio_flags;
1103 unsigned long mmio, mmio_len, mmio_flags;
1105 /* We only need PIO for Flash operations on ISP2312 v2 chips. */
1106 pio = pci_resource_start(ha->pdev, 0);
1107 pio_len = pci_resource_len(ha->pdev, 0);
1108 pio_flags = pci_resource_flags(ha->pdev, 0);
1109 if (pio_flags & IORESOURCE_IO) {
1110 if (pio_len < MIN_IOBASE_LEN) {
1111 qla_printk(KERN_WARNING, ha,
1112 "Invalid PCI I/O region size (%s)...\n",
1113 pci_name(ha->pdev));
1117 qla_printk(KERN_WARNING, ha,
1118 "region #0 not a PIO resource (%s)...\n",
1119 pci_name(ha->pdev));
1123 /* Use MMIO operations for all accesses. */
1124 mmio = pci_resource_start(ha->pdev, 1);
1125 mmio_len = pci_resource_len(ha->pdev, 1);
1126 mmio_flags = pci_resource_flags(ha->pdev, 1);
1128 if (!(mmio_flags & IORESOURCE_MEM)) {
1129 qla_printk(KERN_ERR, ha,
1130 "region #0 not an MMIO resource (%s), aborting\n",
1131 pci_name(ha->pdev));
1132 goto iospace_error_exit;
1134 if (mmio_len < MIN_IOBASE_LEN) {
1135 qla_printk(KERN_ERR, ha,
1136 "Invalid PCI mem region size (%s), aborting\n",
1137 pci_name(ha->pdev));
1138 goto iospace_error_exit;
1141 if (pci_request_regions(ha->pdev, ha->brd_info->drv_name)) {
1142 qla_printk(KERN_WARNING, ha,
1143 "Failed to reserve PIO/MMIO regions (%s)\n",
1144 pci_name(ha->pdev));
1146 goto iospace_error_exit;
1149 ha->pio_address = pio;
1150 ha->pio_length = pio_len;
1151 ha->iobase = ioremap(mmio, MIN_IOBASE_LEN);
1153 qla_printk(KERN_ERR, ha,
1154 "cannot remap MMIO (%s), aborting\n", pci_name(ha->pdev));
1156 goto iospace_error_exit;
1166 * PCI driver interface
1168 int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
1171 device_reg_t __iomem *reg;
1172 struct Scsi_Host *host;
1173 scsi_qla_host_t *ha;
1174 unsigned long flags = 0;
1175 unsigned long wait_switch = 0;
1180 if (pci_enable_device(pdev))
1183 host = scsi_host_alloc(&qla2x00_driver_template,
1184 sizeof(scsi_qla_host_t));
1187 "qla2xxx: Couldn't allocate host from scsi layer!\n");
1188 goto probe_disable_device;
1191 /* Clear our data area */
1192 ha = (scsi_qla_host_t *)host->hostdata;
1193 memset(ha, 0, sizeof(scsi_qla_host_t));
1197 ha->host_no = host->host_no;
1198 ha->brd_info = brd_info;
1199 sprintf(ha->host_str, "%s_%ld", ha->brd_info->drv_name, ha->host_no);
1201 /* Configure PCI I/O space */
1202 ret = qla2x00_iospace_config(ha);
1204 goto probe_alloc_failed;
1207 /* Sanitize the information from PCI BIOS. */
1208 host->irq = pdev->irq;
1210 qla_printk(KERN_INFO, ha,
1211 "Found an %s, irq %d, iobase 0x%p\n", ha->brd_info->isp_name,
1212 host->irq, ha->iobase);
1214 spin_lock_init(&ha->hardware_lock);
1216 /* 4.23 Initialize /proc/scsi/qla2x00 counters */
1219 ha->total_isr_cnt = 0;
1220 ha->total_isp_aborts = 0;
1221 ha->total_lip_cnt = 0;
1222 ha->total_dev_errs = 0;
1224 ha->total_bytes = 0;
1226 ha->prev_topology = 0;
1227 ha->ports = MAX_BUSES;
1229 if (IS_QLA2100(ha)) {
1230 ha->max_targets = MAX_TARGETS_2100;
1231 ha->mbx_count = MAILBOX_REGISTER_COUNT_2100;
1232 ha->request_q_length = REQUEST_ENTRY_CNT_2100;
1233 ha->response_q_length = RESPONSE_ENTRY_CNT_2100;
1234 ha->last_loop_id = SNS_LAST_LOOP_ID_2100;
1235 host->sg_tablesize = 32;
1236 } else if (IS_QLA2200(ha)) {
1237 ha->max_targets = MAX_TARGETS_2200;
1238 ha->mbx_count = MAILBOX_REGISTER_COUNT;
1239 ha->request_q_length = REQUEST_ENTRY_CNT_2200;
1240 ha->response_q_length = RESPONSE_ENTRY_CNT_2100;
1241 ha->last_loop_id = SNS_LAST_LOOP_ID_2100;
1242 } else /*if (IS_QLA2300(ha))*/ {
1243 ha->max_targets = MAX_TARGETS_2200;
1244 ha->mbx_count = MAILBOX_REGISTER_COUNT;
1245 ha->request_q_length = REQUEST_ENTRY_CNT_2200;
1246 ha->response_q_length = RESPONSE_ENTRY_CNT_2300;
1247 ha->last_loop_id = SNS_LAST_LOOP_ID_2300;
1249 host->can_queue = ha->request_q_length + 128;
1251 /* load the F/W, read paramaters, and init the H/W */
1252 ha->instance = num_hosts;
1254 init_MUTEX(&ha->mbx_cmd_sem);
1255 init_MUTEX_LOCKED(&ha->mbx_intr_sem);
1257 INIT_LIST_HEAD(&ha->list);
1258 INIT_LIST_HEAD(&ha->fcports);
1259 INIT_LIST_HEAD(&ha->rscn_fcports);
1262 * These locks are used to prevent more than one CPU
1263 * from modifying the queue at the same time. The
1264 * higher level "host_lock" will reduce most
1265 * contention for these locks.
1267 spin_lock_init(&ha->mbx_reg_lock);
1270 init_completion(&ha->dpc_inited);
1271 init_completion(&ha->dpc_exited);
1273 qla2x00_config_dma_addressing(ha);
1274 if (qla2x00_mem_alloc(ha)) {
1275 qla_printk(KERN_WARNING, ha,
1276 "[ERROR] Failed to allocate memory for adapter\n");
1278 goto probe_alloc_failed;
1281 pci_set_drvdata(pdev, ha);
1282 host->this_id = 255;
1283 host->cmd_per_lun = 3;
1284 host->unique_id = ha->instance;
1285 host->max_cmd_len = MAX_CMDSZ;
1286 host->max_channel = ha->ports - 1;
1287 host->max_id = ha->max_targets;
1288 host->max_lun = ha->max_luns;
1289 host->transportt = qla2xxx_transport_template;
1290 if (scsi_add_host(host, &pdev->dev))
1291 goto probe_alloc_failed;
1293 qla2x00_alloc_sysfs_attr(ha);
1295 if (qla2x00_initialize_adapter(ha) &&
1296 !(ha->device_flags & DFLG_NO_CABLE)) {
1298 qla_printk(KERN_WARNING, ha,
1299 "Failed to initialize adapter\n");
1301 DEBUG2(printk("scsi(%ld): Failed to initialize adapter - "
1302 "Adapter flags %x.\n",
1303 ha->host_no, ha->device_flags));
1308 qla2x00_init_host_attr(ha);
1311 * Startup the kernel thread for this host adapter
1313 ha->dpc_should_die = 0;
1314 ha->dpc_pid = kernel_thread(qla2x00_do_dpc, ha, 0);
1315 if (ha->dpc_pid < 0) {
1316 qla_printk(KERN_WARNING, ha,
1317 "Unable to start DPC thread!\n");
1321 wait_for_completion(&ha->dpc_inited);
1323 if (IS_QLA2100(ha) || IS_QLA2200(ha))
1324 ret = request_irq(host->irq, qla2100_intr_handler,
1325 SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha);
1327 ret = request_irq(host->irq, qla2300_intr_handler,
1328 SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha);
1330 qla_printk(KERN_WARNING, ha,
1331 "Failed to reserve interrupt %d already in use.\n",
1336 /* Initialized the timer */
1337 qla2x00_start_timer(ha, qla2x00_timer, WATCH_INTERVAL);
1339 DEBUG2(printk("DEBUG: detect hba %ld at address = %p\n",
1344 /* Disable ISP interrupts. */
1345 qla2x00_disable_intrs(ha);
1347 /* Ensure mailbox registers are free. */
1348 spin_lock_irqsave(&ha->hardware_lock, flags);
1349 WRT_REG_WORD(®->semaphore, 0);
1350 WRT_REG_WORD(®->hccr, HCCR_CLR_RISC_INT);
1351 WRT_REG_WORD(®->hccr, HCCR_CLR_HOST_INT);
1353 /* Enable proper parity */
1354 if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) {
1357 WRT_REG_WORD(®->hccr, (HCCR_ENABLE_PARITY + 0x1));
1359 /* SRAM, Instruction RAM and GP RAM parity */
1360 WRT_REG_WORD(®->hccr, (HCCR_ENABLE_PARITY + 0x7));
1362 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1364 /* Enable chip interrupts. */
1365 qla2x00_enable_intrs(ha);
1369 * Wait around max loop_reset_delay secs for the devices to come
1370 * on-line. We don't want Linux scanning before we are ready.
1373 for (wait_switch = jiffies + (ha->loop_reset_delay * HZ);
1374 time_before(jiffies,wait_switch) &&
1375 !(ha->device_flags & (DFLG_NO_CABLE | DFLG_FABRIC_DEVICES))
1376 && (ha->device_flags & SWITCH_FOUND) ;) {
1378 qla2x00_check_fabric_devices(ha);
1383 ha->flags.init_done = 1;
1386 qla_printk(KERN_INFO, ha, "\n"
1387 " QLogic Fibre Channel HBA Driver: %s\n"
1389 " %s: %s @ %s hdma%c, host#=%ld, fw=%s\n", qla2x00_version_str,
1390 ha->model_number, ha->model_desc ? ha->model_desc: "",
1391 ha->brd_info->isp_name, qla2x00_get_pci_info_str(ha, pci_info),
1392 pci_name(ha->pdev), ha->flags.enable_64bit_addressing ? '+': '-',
1393 ha->host_no, qla2x00_get_fw_version_str(ha, fw_str));
1395 /* Go with fc_rport registration. */
1396 list_for_each_entry(fcport, &ha->fcports, list)
1397 qla2x00_reg_remote_port(ha, fcport);
1402 fc_remove_host(ha->host);
1404 scsi_remove_host(host);
1407 qla2x00_free_device(ha);
1409 scsi_host_put(host);
1411 probe_disable_device:
1412 pci_disable_device(pdev);
1416 EXPORT_SYMBOL_GPL(qla2x00_probe_one);
1418 void qla2x00_remove_one(struct pci_dev *pdev)
1420 scsi_qla_host_t *ha;
1422 ha = pci_get_drvdata(pdev);
1424 qla2x00_free_sysfs_attr(ha);
1426 fc_remove_host(ha->host);
1428 scsi_remove_host(ha->host);
1430 qla2x00_free_device(ha);
1432 scsi_host_put(ha->host);
1434 pci_set_drvdata(pdev, NULL);
1436 EXPORT_SYMBOL_GPL(qla2x00_remove_one);
1439 qla2x00_free_device(scsi_qla_host_t *ha)
1443 /* Abort any outstanding IO descriptors. */
1444 if (!IS_QLA2100(ha) && !IS_QLA2200(ha))
1445 qla2x00_cancel_io_descriptors(ha);
1447 /* turn-off interrupts on the card */
1448 if (ha->interrupts_on)
1449 qla2x00_disable_intrs(ha);
1452 if (ha->timer_active)
1453 qla2x00_stop_timer(ha);
1455 /* Kill the kernel thread for this host */
1456 if (ha->dpc_pid >= 0) {
1457 ha->dpc_should_die = 1;
1459 ret = kill_proc(ha->dpc_pid, SIGHUP, 1);
1461 qla_printk(KERN_ERR, ha,
1462 "Unable to signal DPC thread -- (%d)\n", ret);
1464 /* TODO: SOMETHING MORE??? */
1466 wait_for_completion(&ha->dpc_exited);
1470 qla2x00_mem_free(ha);
1473 ha->flags.online = 0;
1475 /* Detach interrupts */
1477 free_irq(ha->pdev->irq, ha);
1479 /* release io space registers */
1481 iounmap(ha->iobase);
1482 pci_release_regions(ha->pdev);
1484 pci_disable_device(ha->pdev);
1489 * The following support functions are adopted to handle
1490 * the re-entrant qla2x00_proc_info correctly.
1493 copy_mem_info(struct info_str *info, char *data, int len)
1495 if (info->pos + len > info->offset + info->length)
1496 len = info->offset + info->length - info->pos;
1498 if (info->pos + len < info->offset) {
1503 if (info->pos < info->offset) {
1506 partial = info->offset - info->pos;
1508 info->pos += partial;
1513 memcpy(info->buffer, data, len);
1515 info->buffer += len;
1520 copy_info(struct info_str *info, char *fmt, ...)
1526 va_start(args, fmt);
1527 len = vsprintf(buf, fmt, args);
1530 copy_mem_info(info, buf, len);
1535 /*************************************************************************
1539 * Return information to handle /proc support for the driver.
1541 * inout : decides the direction of the dataflow and the meaning of the
1543 * buffer: If inout==0 data is being written to it else read from it
1544 * (ptr to a page buffer)
1545 * *start: If inout==0 start of the valid data in the buffer
1546 * offset: If inout==0 starting offset from the beginning of all
1547 * possible data to return.
1548 * length: If inout==0 max number of bytes to be written into the buffer
1549 * else number of bytes in "buffer"
1551 * < 0: error. errno value.
1552 * >= 0: sizeof data returned.
1553 *************************************************************************/
1555 qla2x00_proc_info(struct Scsi_Host *shost, char *buffer,
1556 char **start, off_t offset, int length, int inout)
1558 struct info_str info;
1559 int retval = -EINVAL;
1562 uint8_t *loop_state;
1563 scsi_qla_host_t *ha;
1566 DEBUG3(printk(KERN_INFO
1567 "Entering proc_info buff_in=%p, offset=0x%lx, length=0x%x\n",
1568 buffer, offset, length);)
1570 ha = (scsi_qla_host_t *) shost->hostdata;
1573 /* Has data been written to the file? */
1575 "%s: has data been written to the file. \n",
1585 info.buffer = buffer;
1586 info.length = length;
1587 info.offset = offset;
1590 /* start building the print buffer */
1592 "QLogic PCI to Fibre Channel Host Adapter for %s:\n"
1593 " Firmware version %s, ",
1594 ha->model_number, qla2x00_get_fw_version_str(ha, fw_info));
1596 copy_info(&info, "Driver version %s\n", qla2x00_version_str);
1598 tmp_sn = ((ha->serial0 & 0x1f) << 16) | (ha->serial2 << 8) |
1600 copy_info(&info, "ISP: %s, Serial# %c%05d\n",
1601 ha->brd_info->isp_name, ('A' + tmp_sn/100000), (tmp_sn%100000));
1604 "Request Queue = 0x%llx, Response Queue = 0x%llx\n",
1605 (unsigned long long)ha->request_dma,
1606 (unsigned long long)ha->response_dma);
1609 "Request Queue count = %d, Response Queue count = %d\n",
1610 ha->request_q_length, ha->response_q_length);
1613 "Total number of active commands = %ld\n",
1617 "Total number of interrupts = %ld\n",
1618 (long)ha->total_isr_cnt);
1621 " Device queue depth = 0x%x\n",
1622 (ql2xmaxqdepth == 0) ? 16 : ql2xmaxqdepth);
1625 "Number of free request entries = %d\n", ha->req_q_cnt);
1628 "Number of mailbox timeouts = %ld\n", ha->total_mbx_timeout);
1631 "Number of ISP aborts = %ld\n", ha->total_isp_aborts);
1634 "Number of loop resyncs = %ld\n", ha->total_loop_resync);
1637 "Number of retries for empty slots = %ld\n",
1638 qla2x00_stats.outarray_full);
1640 flags = (uint32_t *) &ha->flags;
1642 if (atomic_read(&ha->loop_state) == LOOP_DOWN) {
1643 loop_state = "DOWN";
1644 } else if (atomic_read(&ha->loop_state) == LOOP_UP) {
1646 } else if (atomic_read(&ha->loop_state) == LOOP_READY) {
1647 loop_state = "READY";
1648 } else if (atomic_read(&ha->loop_state) == LOOP_TIMEOUT) {
1649 loop_state = "TIMEOUT";
1650 } else if (atomic_read(&ha->loop_state) == LOOP_UPDATE) {
1651 loop_state = "UPDATE";
1653 loop_state = "UNKNOWN";
1657 "Host adapter:loop state = <%s>, flags = 0x%lx\n",
1658 loop_state , *flags);
1660 copy_info(&info, "Dpc flags = 0x%lx\n", ha->dpc_flags);
1662 copy_info(&info, "MBX flags = 0x%x\n", ha->mbx_flags);
1664 copy_info(&info, "Link down Timeout = %3.3d\n",
1665 ha->link_down_timeout);
1667 copy_info(&info, "Port down retry = %3.3d\n",
1668 ha->port_down_retry_count);
1670 copy_info(&info, "Login retry count = %3.3d\n",
1671 ha->login_retry_count);
1674 "Commands retried with dropped frame(s) = %d\n",
1675 ha->dropped_frame_error_cnt);
1678 "Product ID = %04x %04x %04x %04x\n", ha->product_id[0],
1679 ha->product_id[1], ha->product_id[2], ha->product_id[3]);
1681 copy_info(&info, "\n");
1683 /* 2.25 node/port display to proc */
1684 /* Display the node name for adapter */
1685 copy_info(&info, "\nSCSI Device Information:\n");
1687 "scsi-qla%d-adapter-node="
1688 "%02x%02x%02x%02x%02x%02x%02x%02x;\n",
1690 ha->init_cb->node_name[0],
1691 ha->init_cb->node_name[1],
1692 ha->init_cb->node_name[2],
1693 ha->init_cb->node_name[3],
1694 ha->init_cb->node_name[4],
1695 ha->init_cb->node_name[5],
1696 ha->init_cb->node_name[6],
1697 ha->init_cb->node_name[7]);
1699 /* display the port name for adapter */
1701 "scsi-qla%d-adapter-port="
1702 "%02x%02x%02x%02x%02x%02x%02x%02x;\n",
1704 ha->init_cb->port_name[0],
1705 ha->init_cb->port_name[1],
1706 ha->init_cb->port_name[2],
1707 ha->init_cb->port_name[3],
1708 ha->init_cb->port_name[4],
1709 ha->init_cb->port_name[5],
1710 ha->init_cb->port_name[6],
1711 ha->init_cb->port_name[7]);
1713 retval = info.pos > info.offset ? info.pos - info.offset : 0;
1715 DEBUG3(printk(KERN_INFO
1716 "Exiting proc_info: info.pos=%d, offset=0x%lx, "
1717 "length=0x%x\n", info.pos, offset, length);)
1723 * qla2x00_mark_device_lost Updates fcport state when device goes offline.
1725 * Input: ha = adapter block pointer. fcport = port structure pointer.
1731 void qla2x00_mark_device_lost(scsi_qla_host_t *ha, fc_port_t *fcport,
1734 if (atomic_read(&fcport->state) == FCS_ONLINE && fcport->rport)
1735 fc_remote_port_block(fcport->rport);
1737 * We may need to retry the login, so don't change the state of the
1738 * port but do the retries.
1740 if (atomic_read(&fcport->state) != FCS_DEVICE_DEAD)
1741 atomic_set(&fcport->state, FCS_DEVICE_LOST);
1746 if (fcport->login_retry == 0) {
1747 fcport->login_retry = ha->login_retry_count;
1748 set_bit(RELOGIN_NEEDED, &ha->dpc_flags);
1750 DEBUG(printk("scsi(%ld): Port login retry: "
1751 "%02x%02x%02x%02x%02x%02x%02x%02x, "
1752 "id = 0x%04x retry cnt=%d\n",
1754 fcport->port_name[0],
1755 fcport->port_name[1],
1756 fcport->port_name[2],
1757 fcport->port_name[3],
1758 fcport->port_name[4],
1759 fcport->port_name[5],
1760 fcport->port_name[6],
1761 fcport->port_name[7],
1763 fcport->login_retry));
1768 * qla2x00_mark_all_devices_lost
1769 * Updates fcport state when device goes offline.
1772 * ha = adapter block pointer.
1773 * fcport = port structure pointer.
1781 qla2x00_mark_all_devices_lost(scsi_qla_host_t *ha)
1785 list_for_each_entry(fcport, &ha->fcports, list) {
1786 if (fcport->port_type != FCT_TARGET)
1790 * No point in marking the device as lost, if the device is
1793 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD)
1795 if (atomic_read(&fcport->state) == FCS_ONLINE && fcport->rport)
1796 fc_remote_port_block(fcport->rport);
1797 atomic_set(&fcport->state, FCS_DEVICE_LOST);
1803 * Allocates adapter memory.
1810 qla2x00_mem_alloc(scsi_qla_host_t *ha)
1818 * This will loop only once if everything goes well, else some
1819 * number of retries will be performed to get around a kernel
1820 * bug where available mem is not allocated until after a
1821 * little delay and a retry.
1823 ha->request_ring = dma_alloc_coherent(&ha->pdev->dev,
1824 (ha->request_q_length + 1) * sizeof(request_t),
1825 &ha->request_dma, GFP_KERNEL);
1826 if (ha->request_ring == NULL) {
1827 qla_printk(KERN_WARNING, ha,
1828 "Memory Allocation failed - request_ring\n");
1830 qla2x00_mem_free(ha);
1836 ha->response_ring = dma_alloc_coherent(&ha->pdev->dev,
1837 (ha->response_q_length + 1) * sizeof(response_t),
1838 &ha->response_dma, GFP_KERNEL);
1839 if (ha->response_ring == NULL) {
1840 qla_printk(KERN_WARNING, ha,
1841 "Memory Allocation failed - response_ring\n");
1843 qla2x00_mem_free(ha);
1849 ha->gid_list = dma_alloc_coherent(&ha->pdev->dev, GID_LIST_SIZE,
1850 &ha->gid_list_dma, GFP_KERNEL);
1851 if (ha->gid_list == NULL) {
1852 qla_printk(KERN_WARNING, ha,
1853 "Memory Allocation failed - gid_list\n");
1855 qla2x00_mem_free(ha);
1861 ha->rlc_rsp = dma_alloc_coherent(&ha->pdev->dev,
1862 sizeof(rpt_lun_cmd_rsp_t), &ha->rlc_rsp_dma, GFP_KERNEL);
1863 if (ha->rlc_rsp == NULL) {
1864 qla_printk(KERN_WARNING, ha,
1865 "Memory Allocation failed - rlc");
1867 qla2x00_mem_free(ha);
1873 snprintf(name, sizeof(name), "qla2xxx_%ld", ha->host_no);
1874 ha->s_dma_pool = dma_pool_create(name, &ha->pdev->dev,
1875 DMA_POOL_SIZE, 8, 0);
1876 if (ha->s_dma_pool == NULL) {
1877 qla_printk(KERN_WARNING, ha,
1878 "Memory Allocation failed - s_dma_pool\n");
1880 qla2x00_mem_free(ha);
1886 /* get consistent memory allocated for init control block */
1887 ha->init_cb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL,
1889 if (ha->init_cb == NULL) {
1890 qla_printk(KERN_WARNING, ha,
1891 "Memory Allocation failed - init_cb\n");
1893 qla2x00_mem_free(ha);
1898 memset(ha->init_cb, 0, sizeof(init_cb_t));
1900 /* Get consistent memory allocated for Get Port Database cmd */
1901 ha->iodesc_pd = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL,
1902 &ha->iodesc_pd_dma);
1903 if (ha->iodesc_pd == NULL) {
1905 qla_printk(KERN_WARNING, ha,
1906 "Memory Allocation failed - iodesc_pd\n");
1908 qla2x00_mem_free(ha);
1913 memset(ha->iodesc_pd, 0, PORT_DATABASE_SIZE);
1915 /* Allocate ioctl related memory. */
1916 if (qla2x00_alloc_ioctl_mem(ha)) {
1917 qla_printk(KERN_WARNING, ha,
1918 "Memory Allocation failed - ioctl_mem\n");
1920 qla2x00_mem_free(ha);
1926 if (qla2x00_allocate_sp_pool(ha)) {
1927 qla_printk(KERN_WARNING, ha,
1928 "Memory Allocation failed - "
1929 "qla2x00_allocate_sp_pool()\n");
1931 qla2x00_mem_free(ha);
1937 /* Allocate memory for SNS commands */
1938 if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
1939 /* Get consistent memory allocated for SNS commands */
1940 ha->sns_cmd = dma_alloc_coherent(&ha->pdev->dev,
1941 sizeof(struct sns_cmd_pkt), &ha->sns_cmd_dma,
1943 if (ha->sns_cmd == NULL) {
1945 qla_printk(KERN_WARNING, ha,
1946 "Memory Allocation failed - sns_cmd\n");
1948 qla2x00_mem_free(ha);
1953 memset(ha->sns_cmd, 0, sizeof(struct sns_cmd_pkt));
1955 /* Get consistent memory allocated for MS IOCB */
1956 ha->ms_iocb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL,
1958 if (ha->ms_iocb == NULL) {
1960 qla_printk(KERN_WARNING, ha,
1961 "Memory Allocation failed - ms_iocb\n");
1963 qla2x00_mem_free(ha);
1968 memset(ha->ms_iocb, 0, sizeof(ms_iocb_entry_t));
1971 * Get consistent memory allocated for CT SNS
1974 ha->ct_sns = dma_alloc_coherent(&ha->pdev->dev,
1975 sizeof(struct ct_sns_pkt), &ha->ct_sns_dma,
1977 if (ha->ct_sns == NULL) {
1979 qla_printk(KERN_WARNING, ha,
1980 "Memory Allocation failed - ct_sns\n");
1982 qla2x00_mem_free(ha);
1987 memset(ha->ct_sns, 0, sizeof(struct ct_sns_pkt));
1990 /* Done all allocations without any error. */
1993 } while (retry-- && status != 0);
1997 "%s(): **** FAILED ****\n", __func__);
2005 * Frees all adapter allocated memory.
2008 * ha = adapter block pointer.
2011 qla2x00_mem_free(scsi_qla_host_t *ha)
2013 struct list_head *fcpl, *fcptemp;
2015 unsigned long wtime;/* max wait time if mbx cmd is busy. */
2019 DEBUG2(printk("%s(): ERROR invalid ha pointer.\n", __func__));
2023 /* Make sure all other threads are stopped. */
2025 while (ha->dpc_wait && wtime) {
2026 set_current_state(TASK_INTERRUPTIBLE);
2027 wtime = schedule_timeout(wtime);
2030 /* free ioctl memory */
2031 qla2x00_free_ioctl_mem(ha);
2034 qla2x00_free_sp_pool(ha);
2037 dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt),
2038 ha->sns_cmd, ha->sns_cmd_dma);
2041 dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt),
2042 ha->ct_sns, ha->ct_sns_dma);
2045 dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma);
2048 dma_pool_free(ha->s_dma_pool, ha->iodesc_pd, ha->iodesc_pd_dma);
2051 dma_pool_free(ha->s_dma_pool, ha->init_cb, ha->init_cb_dma);
2054 dma_pool_destroy(ha->s_dma_pool);
2057 dma_free_coherent(&ha->pdev->dev,
2058 sizeof(rpt_lun_cmd_rsp_t), ha->rlc_rsp,
2062 dma_free_coherent(&ha->pdev->dev, GID_LIST_SIZE, ha->gid_list,
2065 if (ha->response_ring)
2066 dma_free_coherent(&ha->pdev->dev,
2067 (ha->response_q_length + 1) * sizeof(response_t),
2068 ha->response_ring, ha->response_dma);
2070 if (ha->request_ring)
2071 dma_free_coherent(&ha->pdev->dev,
2072 (ha->request_q_length + 1) * sizeof(request_t),
2073 ha->request_ring, ha->request_dma);
2076 ha->sns_cmd_dma = 0;
2080 ha->ms_iocb_dma = 0;
2081 ha->iodesc_pd = NULL;
2082 ha->iodesc_pd_dma = 0;
2084 ha->init_cb_dma = 0;
2086 ha->s_dma_pool = NULL;
2089 ha->rlc_rsp_dma = 0;
2090 ha->gid_list = NULL;
2091 ha->gid_list_dma = 0;
2093 ha->response_ring = NULL;
2094 ha->response_dma = 0;
2095 ha->request_ring = NULL;
2096 ha->request_dma = 0;
2098 list_for_each_safe(fcpl, fcptemp, &ha->fcports) {
2099 fcport = list_entry(fcpl, fc_port_t, list);
2102 list_del_init(&fcport->list);
2105 INIT_LIST_HEAD(&ha->fcports);
2108 free_pages((unsigned long)ha->fw_dump, ha->fw_dump_order);
2110 if (ha->fw_dump_buffer)
2111 vfree(ha->fw_dump_buffer);
2114 ha->fw_dump_reading = 0;
2115 ha->fw_dump_buffer = NULL;
2119 * qla2x00_allocate_sp_pool
2120 * This routine is called during initialization to allocate
2121 * memory for local srb_t.
2124 * ha = adapter block pointer.
2129 * Note: Sets the ref_count for non Null sp to one.
2132 qla2x00_allocate_sp_pool(scsi_qla_host_t *ha)
2137 ha->srb_mempool = mempool_create(SRB_MIN_REQ, mempool_alloc_slab,
2138 mempool_free_slab, srb_cachep);
2139 if (ha->srb_mempool == NULL) {
2140 qla_printk(KERN_INFO, ha, "Unable to allocate SRB mempool.\n");
2141 rval = QLA_FUNCTION_FAILED;
2147 * This routine frees all adapter allocated memory.
2151 qla2x00_free_sp_pool( scsi_qla_host_t *ha)
2153 if (ha->srb_mempool) {
2154 mempool_destroy(ha->srb_mempool);
2155 ha->srb_mempool = NULL;
2159 /**************************************************************************
2161 * This kernel thread is a task that is schedule by the interrupt handler
2162 * to perform the background processing for interrupts.
2165 * This task always run in the context of a kernel thread. It
2166 * is kick-off by the driver's detect code and starts up
2167 * up one per adapter. It immediately goes to sleep and waits for
2168 * some fibre event. When either the interrupt handler or
2169 * the timer routine detects a event it will one of the task
2170 * bits then wake us up.
2171 **************************************************************************/
2173 qla2x00_do_dpc(void *data)
2175 DECLARE_MUTEX_LOCKED(sem);
2176 scsi_qla_host_t *ha;
2179 uint16_t next_loopid;
2181 ha = (scsi_qla_host_t *)data;
2185 daemonize("%s_dpc", ha->host_str);
2186 allow_signal(SIGHUP);
2188 ha->dpc_wait = &sem;
2190 set_user_nice(current, -20);
2194 complete(&ha->dpc_inited);
2197 DEBUG3(printk("qla2x00: DPC handler sleeping\n"));
2199 if (down_interruptible(&sem))
2202 if (ha->dpc_should_die)
2205 DEBUG3(printk("qla2x00: DPC handler waking up\n"));
2207 /* Initialization not yet finished. Don't do anything yet. */
2208 if (!ha->flags.init_done || ha->dpc_active)
2211 DEBUG3(printk("scsi(%ld): DPC handler\n", ha->host_no));
2215 if (ha->flags.mbox_busy) {
2220 if (test_and_clear_bit(ISP_ABORT_NEEDED, &ha->dpc_flags)) {
2222 DEBUG(printk("scsi(%ld): dpc: sched "
2223 "qla2x00_abort_isp ha = %p\n",
2225 if (!(test_and_set_bit(ABORT_ISP_ACTIVE,
2228 if (qla2x00_abort_isp(ha)) {
2229 /* failed. retry later */
2230 set_bit(ISP_ABORT_NEEDED,
2233 clear_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags);
2235 DEBUG(printk("scsi(%ld): dpc: qla2x00_abort_isp end\n",
2239 if (test_and_clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags) &&
2240 (!(test_and_set_bit(RESET_ACTIVE, &ha->dpc_flags)))) {
2242 DEBUG(printk("scsi(%ld): qla2x00_reset_marker()\n",
2245 qla2x00_rst_aen(ha);
2246 clear_bit(RESET_ACTIVE, &ha->dpc_flags);
2249 /* Retry each device up to login retry count */
2250 if ((test_and_clear_bit(RELOGIN_NEEDED, &ha->dpc_flags)) &&
2251 !test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) &&
2252 atomic_read(&ha->loop_state) != LOOP_DOWN) {
2254 DEBUG(printk("scsi(%ld): qla2x00_port_login()\n",
2258 list_for_each_entry(fcport, &ha->fcports, list) {
2259 if (fcport->port_type != FCT_TARGET)
2263 * If the port is not ONLINE then try to login
2264 * to it if we haven't run out of retries.
2266 if (atomic_read(&fcport->state) != FCS_ONLINE &&
2267 fcport->login_retry) {
2269 fcport->login_retry--;
2270 if (fcport->flags & FCF_FABRIC_DEVICE) {
2273 qla2x00_fabric_logout(
2276 status = qla2x00_fabric_login(
2277 ha, fcport, &next_loopid);
2280 qla2x00_local_device_login(
2281 ha, fcport->loop_id);
2283 if (status == QLA_SUCCESS) {
2284 fcport->old_loop_id = fcport->loop_id;
2286 DEBUG(printk("scsi(%ld): port login OK: logged in ID 0x%x\n",
2287 ha->host_no, fcport->loop_id));
2289 fcport->port_login_retry_count =
2290 ha->port_down_retry_count * PORT_RETRY_TIME;
2291 atomic_set(&fcport->state, FCS_ONLINE);
2292 atomic_set(&fcport->port_down_timer,
2293 ha->port_down_retry_count * PORT_RETRY_TIME);
2295 fcport->login_retry = 0;
2296 } else if (status == 1) {
2297 set_bit(RELOGIN_NEEDED, &ha->dpc_flags);
2298 /* retry the login again */
2299 DEBUG(printk("scsi(%ld): Retrying %d login again loop_id 0x%x\n",
2301 fcport->login_retry, fcport->loop_id));
2303 fcport->login_retry = 0;
2306 if (test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags))
2309 DEBUG(printk("scsi(%ld): qla2x00_port_login - end\n",
2313 if ((test_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags)) &&
2314 atomic_read(&ha->loop_state) != LOOP_DOWN) {
2316 clear_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags);
2317 DEBUG(printk("scsi(%ld): qla2x00_login_retry()\n",
2320 set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags);
2322 DEBUG(printk("scsi(%ld): qla2x00_login_retry - end\n",
2326 if (test_and_clear_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) {
2328 DEBUG(printk("scsi(%ld): qla2x00_loop_resync()\n",
2331 if (!(test_and_set_bit(LOOP_RESYNC_ACTIVE,
2334 qla2x00_loop_resync(ha);
2336 clear_bit(LOOP_RESYNC_ACTIVE, &ha->dpc_flags);
2339 DEBUG(printk("scsi(%ld): qla2x00_loop_resync - end\n",
2343 if (test_and_clear_bit(FCPORT_RESCAN_NEEDED, &ha->dpc_flags)) {
2345 DEBUG(printk("scsi(%ld): Rescan flagged fcports...\n",
2348 qla2x00_rescan_fcports(ha);
2350 DEBUG(printk("scsi(%ld): Rescan flagged fcports..."
2355 if (!ha->interrupts_on)
2356 qla2x00_enable_intrs(ha);
2359 } /* End of while(1) */
2361 DEBUG(printk("scsi(%ld): DPC handler exiting\n", ha->host_no));
2364 * Make sure that nobody tries to wake us up again.
2366 ha->dpc_wait = NULL;
2369 complete_and_exit(&ha->dpc_exited, 0);
2374 * Processes asynchronous reset.
2377 * ha = adapter block pointer.
2380 qla2x00_rst_aen(scsi_qla_host_t *ha)
2382 if (ha->flags.online && !ha->flags.reset_active &&
2383 !atomic_read(&ha->loop_down_timer) &&
2384 !(test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags))) {
2386 clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags);
2389 * Issue marker command only when we are going to start
2392 ha->marker_needed = 1;
2393 } while (!atomic_read(&ha->loop_down_timer) &&
2394 (test_bit(RESET_MARKER_NEEDED, &ha->dpc_flags)));
2400 * This routine will allocate SP from the free queue
2407 qla2x00_get_new_sp(scsi_qla_host_t *ha)
2411 sp = mempool_alloc(ha->srb_mempool, GFP_ATOMIC);
2413 atomic_set(&sp->ref_count, 1);
2418 qla2x00_sp_free_dma(scsi_qla_host_t *ha, srb_t *sp)
2420 struct scsi_cmnd *cmd = sp->cmd;
2422 if (sp->flags & SRB_DMA_VALID) {
2424 dma_unmap_sg(&ha->pdev->dev, cmd->request_buffer,
2425 cmd->use_sg, cmd->sc_data_direction);
2426 } else if (cmd->request_bufflen) {
2427 dma_unmap_single(&ha->pdev->dev, sp->dma_handle,
2428 cmd->request_bufflen, cmd->sc_data_direction);
2430 sp->flags &= ~SRB_DMA_VALID;
2435 qla2x00_sp_compl(scsi_qla_host_t *ha, srb_t *sp)
2437 struct scsi_cmnd *cmd = sp->cmd;
2439 qla2x00_sp_free_dma(ha, sp);
2442 mempool_free(sp, ha->srb_mempool);
2444 cmd->scsi_done(cmd);
2447 /**************************************************************************
2453 * Context: Interrupt
2454 ***************************************************************************/
2456 qla2x00_timer(scsi_qla_host_t *ha)
2458 unsigned long cpu_flags = 0;
2466 * Ports - Port down timer.
2468 * Whenever, a port is in the LOST state we start decrementing its port
2469 * down timer every second until it reaches zero. Once it reaches zero
2470 * the port it marked DEAD.
2473 list_for_each_entry(fcport, &ha->fcports, list) {
2474 if (fcport->port_type != FCT_TARGET)
2477 if (atomic_read(&fcport->state) == FCS_DEVICE_LOST) {
2479 if (atomic_read(&fcport->port_down_timer) == 0)
2482 if (atomic_dec_and_test(&fcport->port_down_timer) != 0)
2483 atomic_set(&fcport->state, FCS_DEVICE_DEAD);
2485 DEBUG(printk("scsi(%ld): fcport-%d - port retry count: "
2488 t, atomic_read(&fcport->port_down_timer)));
2491 } /* End of for fcport */
2494 /* Loop down handler. */
2495 if (atomic_read(&ha->loop_down_timer) > 0 &&
2496 !(test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags)) && ha->flags.online) {
2498 if (atomic_read(&ha->loop_down_timer) ==
2499 ha->loop_down_abort_time) {
2501 DEBUG(printk("scsi(%ld): Loop Down - aborting the "
2502 "queues before time expire\n",
2505 if (!IS_QLA2100(ha) && ha->link_down_timeout)
2506 atomic_set(&ha->loop_state, LOOP_DEAD);
2508 /* Schedule an ISP abort to return any tape commands. */
2509 spin_lock_irqsave(&ha->hardware_lock, cpu_flags);
2510 for (index = 1; index < MAX_OUTSTANDING_COMMANDS;
2514 sp = ha->outstanding_cmds[index];
2518 if (!(sfcp->flags & FCF_TAPE_PRESENT))
2521 set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
2524 spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
2526 set_bit(ABORT_QUEUES_NEEDED, &ha->dpc_flags);
2530 /* if the loop has been down for 4 minutes, reinit adapter */
2531 if (atomic_dec_and_test(&ha->loop_down_timer) != 0) {
2532 DEBUG(printk("scsi(%ld): Loop down exceed 4 mins - "
2533 "restarting queues.\n",
2536 set_bit(RESTART_QUEUES_NEEDED, &ha->dpc_flags);
2539 if (!(ha->device_flags & DFLG_NO_CABLE)) {
2540 DEBUG(printk("scsi(%ld): Loop down - "
2543 qla_printk(KERN_WARNING, ha,
2544 "Loop down - aborting ISP.\n");
2546 set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
2549 DEBUG3(printk("scsi(%ld): Loop Down - seconds remainning %d\n",
2551 atomic_read(&ha->loop_down_timer)));
2554 /* Schedule the DPC routine if needed */
2555 if ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) ||
2556 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) ||
2558 test_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags) ||
2559 test_bit(RESET_MARKER_NEEDED, &ha->dpc_flags) ||
2560 test_bit(RELOGIN_NEEDED, &ha->dpc_flags)) &&
2561 ha->dpc_wait && !ha->dpc_active) {
2566 qla2x00_restart_timer(ha, WATCH_INTERVAL);
2569 /* XXX(hch): crude hack to emulate a down_timeout() */
2571 qla2x00_down_timeout(struct semaphore *sema, unsigned long timeout)
2573 const unsigned int step = HZ/10;
2576 if (!down_trylock(sema))
2578 set_current_state(TASK_INTERRUPTIBLE);
2579 if (schedule_timeout(step))
2581 } while ((timeout -= step) > 0);
2587 * qla2x00_module_init - Module initialization.
2590 qla2x00_module_init(void)
2592 /* Allocate cache for SRBs. */
2593 sprintf(srb_cachep_name, "qla2xxx_srbs");
2594 srb_cachep = kmem_cache_create(srb_cachep_name, sizeof(srb_t), 0,
2595 SLAB_HWCACHE_ALIGN, NULL, NULL);
2596 if (srb_cachep == NULL) {
2598 "qla2xxx: Unable to allocate SRB cache...Failing load!\n");
2602 /* Derive version string. */
2603 strcpy(qla2x00_version_str, QLA2XXX_VERSION);
2605 strcat(qla2x00_version_str, "-debug");
2607 qla2xxx_transport_template = qla2x00_alloc_transport_tmpl();
2608 if (!qla2xxx_transport_template)
2611 printk(KERN_INFO "QLogic Fibre Channel HBA Driver\n");
2616 * qla2x00_module_exit - Module cleanup.
2619 qla2x00_module_exit(void)
2621 /* Free SRBs cache. */
2622 if (srb_cachep != NULL) {
2623 if (kmem_cache_destroy(srb_cachep) != 0) {
2625 "qla2xxx: Unable to free SRB cache...Memory pools "
2631 fc_release_transport(qla2xxx_transport_template);
2634 module_init(qla2x00_module_init);
2635 module_exit(qla2x00_module_exit);
2637 MODULE_AUTHOR("QLogic Corporation");
2638 MODULE_DESCRIPTION("QLogic Fibre Channel HBA Driver");
2639 MODULE_LICENSE("GPL");
2640 MODULE_VERSION(QLA2XXX_VERSION);