]> git.proxmox.com Git - mirror_ubuntu-kernels.git/blobdiff - drivers/scsi/qla2xxx/qla_os.c
merge by hand (fix up qla_os.c merge error)
[mirror_ubuntu-kernels.git] / drivers / scsi / qla2xxx / qla_os.c
index 3c97aa45772dc4aea2b7c4dbd759e76fa46c1745..e6831264f67ca87002b1b96151795035cebf1af6 100644 (file)
@@ -36,27 +36,12 @@ char qla2x00_version_str[40];
 /*
  * SRB allocation cache
  */
-char srb_cachep_name[16];
-kmem_cache_t *srb_cachep;
-
-/*
- * Stats for all adpaters.
- */
-struct _qla2x00stats qla2x00_stats;
+static kmem_cache_t *srb_cachep;
 
 /*
  * Ioctl related information.
  */
-int num_hosts;
-int apiHBAInstance;
-
-/*
- * Module parameter information and variables
- */
-int ql2xmaxqdepth;
-module_param(ql2xmaxqdepth, int, S_IRUGO|S_IWUSR);
-MODULE_PARM_DESC(ql2xmaxqdepth,
-               "Maximum queue depth to report for target devices.");
+static int num_hosts;
 
 int ql2xlogintimeout = 20;
 module_param(ql2xlogintimeout, int, S_IRUGO|S_IRUSR);
@@ -69,12 +54,6 @@ MODULE_PARM_DESC(qlport_down_retry,
                "Maximum number of command retries to a port that returns"
                "a PORT-DOWN status.");
 
-int ql2xretrycount = 20;
-module_param(ql2xretrycount, int, S_IRUGO|S_IWUSR);
-MODULE_PARM_DESC(ql2xretrycount,
-               "Maximum number of mid-layer retries allowed for a command.  "
-               "Default value is 20, ");
-
 int ql2xplogiabsentdevice;
 module_param(ql2xplogiabsentdevice, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(ql2xplogiabsentdevice,
@@ -95,25 +74,6 @@ MODULE_PARM_DESC(ql2xintrdelaytimer,
                "ZIO: Waiting time for Firmware before it generates an "
                "interrupt to the host to notify completion of request.");
 
-int ConfigRequired;
-module_param(ConfigRequired, int, S_IRUGO|S_IRUSR);
-MODULE_PARM_DESC(ConfigRequired,
-               "If 1, then only configured devices passed in through the"
-               "ql2xopts parameter will be presented to the OS");
-
-int Bind = BIND_BY_PORT_NAME;
-module_param(Bind, int, S_IRUGO|S_IRUSR);
-MODULE_PARM_DESC(Bind,
-               "Target persistent binding method: "
-               "0 by Portname (default); 1 by PortID; 2 by Nodename. ");
-
-int ql2xsuspendcount = SUSPEND_COUNT;
-module_param(ql2xsuspendcount, int, S_IRUGO|S_IWUSR);
-MODULE_PARM_DESC(ql2xsuspendcount,
-               "Number of 6-second suspend iterations to perform while a "
-               "target returns a <NOT READY> status.  Default is 10 "
-               "iterations.");
-
 int ql2xloginretrycount = 0;
 module_param(ql2xloginretrycount, int, S_IRUGO|S_IRUSR);
 MODULE_PARM_DESC(ql2xloginretrycount,
@@ -330,7 +290,6 @@ qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
        sp->fcport = fcport;
        sp->cmd = cmd;
        sp->flags = 0;
-       sp->err_id = 0;
 
        CMD_SP(cmd) = (void *)sp;
        cmd->scsi_done = done;
@@ -474,7 +433,6 @@ qla2x00_wait_for_loop_ready(scsi_qla_host_t *ha)
 
        while ((!atomic_read(&ha->loop_down_timer) &&
            atomic_read(&ha->loop_state) == LOOP_DOWN) ||
-           test_bit(CFG_ACTIVE, &ha->cfg_flags) ||
            atomic_read(&ha->loop_state) != LOOP_READY) {
                msleep(1000);
                if (time_after_eq(jiffies, loop_timeout)) {
@@ -519,7 +477,6 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
        serial = cmd->serial_number;
 
        /* Check active list for command command. */
-       spin_unlock_irq(ha->host->host_lock);
        spin_lock_irqsave(&ha->hardware_lock, flags);
        for (i = 1; i < MAX_OUTSTANDING_COMMANDS; i++) {
                sp = ha->outstanding_cmds[i];
@@ -558,7 +515,6 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
                            "%x.\n", ha->host_no, id, lun, serial, ret);
                }
        }
-       spin_lock_irq(ha->host->host_lock);
 
        qla_printk(KERN_INFO, ha, 
            "scsi(%ld:%d:%d): Abort command issued -- %lx %x.\n", ha->host_no,
@@ -658,12 +614,8 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
        qla_printk(KERN_INFO, ha,
            "scsi(%ld:%d:%d): DEVICE RESET ISSUED.\n", ha->host_no, id, lun);
 
-       spin_unlock_irq(ha->host->host_lock);
-
-       if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) {
-               spin_lock_irq(ha->host->host_lock);
+       if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS)
                goto eh_dev_reset_done;
-       }
 
        if (qla2x00_wait_for_loop_ready(ha) == QLA_SUCCESS) {
                if (qla2x00_device_reset(ha, fcport) == 0)
@@ -714,8 +666,6 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
            "scsi(%ld:%d:%d): DEVICE RESET SUCCEEDED.\n", ha->host_no, id, lun);
 
 eh_dev_reset_done:
-       spin_lock_irq(ha->host->host_lock);
-
        return ret;
 }
 
@@ -805,8 +755,6 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
        qla_printk(KERN_INFO, ha,
            "scsi(%ld:%d:%d): LOOP RESET ISSUED.\n", ha->host_no, id, lun);
 
-       spin_unlock_irq(ha->host->host_lock);
-
        if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) {
                DEBUG2(printk("%s failed:board disabled\n",__func__));
                goto eh_bus_reset_done;
@@ -828,8 +776,6 @@ eh_bus_reset_done:
        qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__,
            (ret == FAILED) ? "failed" : "succeded");
 
-       spin_lock_irq(ha->host->host_lock);
-
        return ret;
 }
 
@@ -871,8 +817,6 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
        qla_printk(KERN_INFO, ha,
            "scsi(%ld:%d:%d): ADAPTER RESET ISSUED.\n", ha->host_no, id, lun);
 
-       spin_unlock_irq(ha->host->host_lock);
-
        if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS)
                goto eh_host_reset_lock;
 
@@ -901,8 +845,6 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
                ret = SUCCESS;
 
 eh_host_reset_lock:
-       spin_lock_irq(ha->host->host_lock);
-
        qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__,
            (ret == FAILED) ? "failed" : "succeded");
 
@@ -1196,34 +1138,24 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
 
        spin_lock_init(&ha->hardware_lock);
 
-       /* 4.23 Initialize /proc/scsi/qla2x00 counters */
-       ha->actthreads = 0;
-       ha->qthreads   = 0;
-       ha->total_isr_cnt = 0;
-       ha->total_isp_aborts = 0;
-       ha->total_lip_cnt = 0;
-       ha->total_dev_errs = 0;
-       ha->total_ios = 0;
-       ha->total_bytes = 0;
-
        ha->prev_topology = 0;
        ha->ports = MAX_BUSES;
 
        if (IS_QLA2100(ha)) {
-               ha->max_targets = MAX_TARGETS_2100;
+               host->max_id = MAX_TARGETS_2100;
                ha->mbx_count = MAILBOX_REGISTER_COUNT_2100;
                ha->request_q_length = REQUEST_ENTRY_CNT_2100;
                ha->response_q_length = RESPONSE_ENTRY_CNT_2100;
                ha->last_loop_id = SNS_LAST_LOOP_ID_2100;
                host->sg_tablesize = 32;
        } else if (IS_QLA2200(ha)) {
-               ha->max_targets = MAX_TARGETS_2200;
+               host->max_id = MAX_TARGETS_2200;
                ha->mbx_count = MAILBOX_REGISTER_COUNT;
                ha->request_q_length = REQUEST_ENTRY_CNT_2200;
                ha->response_q_length = RESPONSE_ENTRY_CNT_2100;
                ha->last_loop_id = SNS_LAST_LOOP_ID_2100;
        } else /*if (IS_QLA2300(ha))*/ {
-               ha->max_targets = MAX_TARGETS_2200;
+               host->max_id = MAX_TARGETS_2200;
                ha->mbx_count = MAILBOX_REGISTER_COUNT;
                ha->request_q_length = REQUEST_ENTRY_CNT_2200;
                ha->response_q_length = RESPONSE_ENTRY_CNT_2300;
@@ -1267,8 +1199,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
        host->unique_id = ha->instance;
        host->max_cmd_len = MAX_CMDSZ;
        host->max_channel = ha->ports - 1;
-       host->max_id = ha->max_targets;
-       host->max_lun = ha->max_luns;
+       host->max_lun = MAX_LUNS;
        host->transportt = qla2xxx_transport_template;
        if (scsi_add_host(host, &pdev->dev))
                goto probe_alloc_failed;
@@ -2338,8 +2269,7 @@ static int __init
 qla2x00_module_init(void)
 {
        /* Allocate cache for SRBs. */
-       sprintf(srb_cachep_name, "qla2xxx_srbs");
-       srb_cachep = kmem_cache_create(srb_cachep_name, sizeof(srb_t), 0,
+       srb_cachep = kmem_cache_create("qla2xxx_srbs", sizeof(srb_t), 0,
            SLAB_HWCACHE_ALIGN, NULL, NULL);
        if (srb_cachep == NULL) {
                printk(KERN_ERR
@@ -2367,16 +2297,7 @@ qla2x00_module_init(void)
 static void __exit
 qla2x00_module_exit(void)
 {
-       /* Free SRBs cache. */
-       if (srb_cachep != NULL) {
-               if (kmem_cache_destroy(srb_cachep) != 0) {
-                       printk(KERN_ERR
-                           "qla2xxx: Unable to free SRB cache...Memory pools "
-                           "still active?\n");
-               }
-               srb_cachep = NULL;
-       }
-
+       kmem_cache_destroy(srb_cachep);
        fc_release_transport(qla2xxx_transport_template);
 }