Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[sfrench/cifs-2.6.git] / drivers / scsi / qla2xxx / qla_os.c
index 50286cf02eca046b830b973ca4868c0f02944ec0..46f2d0cf7c0d5db94576545db8e02971927879cb 100644 (file)
@@ -268,6 +268,15 @@ MODULE_PARM_DESC(ql2xautodetectsfp,
                 "Detect SFP range and set appropriate distance.\n"
                 "1 (Default): Enable\n");
 
+int ql2xenablemsix = 1;
+module_param(ql2xenablemsix, int, 0444);
+MODULE_PARM_DESC(ql2xenablemsix,
+                "Set to enable MSI or MSI-X interrupt mechanism.\n"
+                " Default is 1, enable MSI-X interrupt mechanism.\n"
+                " 0 -- enable traditional pin-based mechanism.\n"
+                " 1 -- enable MSI-X interrupt mechanism.\n"
+                " 2 -- enable MSI interrupt mechanism.\n");
+
 /*
  * SCSI host template entry points
  */
@@ -386,7 +395,7 @@ static void qla_init_base_qpair(struct scsi_qla_host *vha, struct req_que *req,
        INIT_LIST_HEAD(&ha->base_qpair->nvme_done_list);
        ha->base_qpair->enable_class_2 = ql2xenableclass2;
        /* init qpair to this cpu. Will adjust at run time. */
-       qla_cpu_update(rsp->qpair, smp_processor_id());
+       qla_cpu_update(rsp->qpair, raw_smp_processor_id());
        ha->base_qpair->pdev = ha->pdev;
 
        if (IS_QLA27XX(ha) || IS_QLA83XX(ha))
@@ -422,7 +431,7 @@ static int qla2x00_alloc_queues(struct qla_hw_data *ha, struct req_que *req,
 
        qla_init_base_qpair(vha, req, rsp);
 
-       if (ql2xmqsupport && ha->max_qpairs) {
+       if ((ql2xmqsupport || ql2xnvmeenable) && ha->max_qpairs) {
                ha->queue_pair_map = kcalloc(ha->max_qpairs, sizeof(struct qla_qpair *),
                        GFP_KERNEL);
                if (!ha->queue_pair_map) {
@@ -1965,7 +1974,8 @@ skip_pio:
        /* Determine queue resources */
        ha->max_req_queues = ha->max_rsp_queues = 1;
        ha->msix_count = QLA_BASE_VECTORS;
-       if (!ql2xmqsupport || (!IS_QLA25XX(ha) && !IS_QLA81XX(ha)))
+       if (!ql2xmqsupport || !ql2xnvmeenable ||
+           (!IS_QLA25XX(ha) && !IS_QLA81XX(ha)))
                goto mqiobase_exit;
 
        ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 3),
@@ -2062,7 +2072,7 @@ qla83xx_iospace_config(struct qla_hw_data *ha)
                 * By default, driver uses at least two msix vectors
                 * (default & rspq)
                 */
-               if (ql2xmqsupport) {
+               if (ql2xmqsupport || ql2xnvmeenable) {
                        /* MB interrupt uses 1 vector */
                        ha->max_req_queues = ha->msix_count - 1;
 
@@ -3080,9 +3090,17 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 
                ql_dbg(ql_dbg_init, base_vha, 0x0192,
                        "blk/scsi-mq enabled, HW queues = %d.\n", host->nr_hw_queues);
-       } else
-               ql_dbg(ql_dbg_init, base_vha, 0x0193,
-                       "blk/scsi-mq disabled.\n");
+       } else {
+               if (ql2xnvmeenable) {
+                       host->nr_hw_queues = ha->max_qpairs;
+                       ql_dbg(ql_dbg_init, base_vha, 0x0194,
+                           "FC-NVMe support is enabled, HW queues=%d\n",
+                           host->nr_hw_queues);
+               } else {
+                       ql_dbg(ql_dbg_init, base_vha, 0x0193,
+                           "blk/scsi-mq disabled.\n");
+               }
+       }
 
        qlt_probe_one_stage1(base_vha, ha);
 
@@ -4743,7 +4761,7 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e)
                if (pla)
                        qlt_plogi_ack_unref(vha, pla);
                else
-                       qla24xx_async_gnl(vha, fcport);
+                       qla24xx_async_gffid(vha, fcport);
        }
 
        if (free_fcport) {
@@ -6292,7 +6310,7 @@ qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
        switch (state) {
        case pci_channel_io_normal:
                ha->flags.eeh_busy = 0;
-               if (ql2xmqsupport) {
+               if (ql2xmqsupport || ql2xnvmeenable) {
                        set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags);
                        qla2xxx_wake_dpc(vha);
                }
@@ -6309,7 +6327,7 @@ qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
                pci_disable_device(pdev);
                /* Return back all IOs */
                qla2x00_abort_all_cmds(vha, DID_RESET << 16);
-               if (ql2xmqsupport) {
+               if (ql2xmqsupport || ql2xnvmeenable) {
                        set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags);
                        qla2xxx_wake_dpc(vha);
                }
@@ -6317,7 +6335,7 @@ qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
        case pci_channel_io_perm_failure:
                ha->flags.pci_channel_io_perm_failure = 1;
                qla2x00_abort_all_cmds(vha, DID_NO_CONNECT << 16);
-               if (ql2xmqsupport) {
+               if (ql2xmqsupport || ql2xnvmeenable) {
                        set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags);
                        qla2xxx_wake_dpc(vha);
                }