scsi: qla2xxx: Changes to support kdump kernel for NVMe BFS
authorSaurav Kashyap <skashyap@marvell.com>
Tue, 10 Aug 2021 04:37:18 +0000 (21:37 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Oct 2021 13:55:45 +0000 (15:55 +0200)
[ Upstream commit 4a0a542fe5e4273baf9228459ef3f75c29490cba ]

The MSI-X and MSI calls fails in kdump kernel. Because of this
qla2xxx_create_qpair() fails leading to .create_queue callback failure.
The fix is to return existing qpair instead of allocating new one and
allocate a single hw queue.

[   19.975838] qla2xxx [0000:d8:00.1]-00c7:11: MSI-X: Failed to enable support,
giving   up -- 16/-28.
[   19.984885] qla2xxx [0000:d8:00.1]-0037:11: Falling back-to MSI mode --
ret=-28.
[   19.992278] qla2xxx [0000:d8:00.1]-0039:11: Falling back-to INTa mode --
ret=-28.
..
..
..
[   21.141518] qla2xxx [0000:d8:00.0]-2104:2: qla_nvme_alloc_queue: handle
00000000e7ee499d, idx =1, qsize 32
[   21.151166] qla2xxx [0000:d8:00.0]-0181:2: FW/Driver is not multi-queue capable.
[   21.158558] qla2xxx [0000:d8:00.0]-2122:2: Failed to allocate qpair
[   21.164824] nvme nvme0: NVME-FC{0}: reset: Reconnect attempt failed (-22)
[   21.171612] nvme nvme0: NVME-FC{0}: Reconnect attempt in 2 seconds

Link: https://lore.kernel.org/r/20210810043720.1137-13-njavali@marvell.com
Cc: stable@vger.kernel.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/qla2xxx/qla_def.h
drivers/scsi/qla2xxx/qla_isr.c
drivers/scsi/qla2xxx/qla_nvme.c

index 4f0486fe30dd7f7386ff29914be89a03c0b25928..e1fd91a58120240b281842dff166e3f10f3d94b5 100644 (file)
@@ -3913,7 +3913,6 @@ struct qla_hw_data {
                uint32_t        scm_supported_f:1;
                                /* Enabled in Driver */
                uint32_t        scm_enabled:1;
-               uint32_t        max_req_queue_warned:1;
                uint32_t        plogi_template_valid:1;
        } flags;
 
index a24b82de4aab7f7ee808ecd1a686dc73d0f74ed7..5e040b6debc84ef224dbf7e05ffac1dc931eea16 100644 (file)
@@ -4158,6 +4158,8 @@ skip_msi:
                ql_dbg(ql_dbg_init, vha, 0x0125,
                    "INTa mode: Enabled.\n");
                ha->flags.mr_intr_valid = 1;
+               /* Set max_qpair to 0, as MSI-X and MSI in not enabled */
+               ha->max_qpairs = 0;
        }
 
 clear_risc_ints:
index f6c76a063294b217a1832f84d53507718f351c85..5acee3c798d42771e739201f043e9c44ce42dcb6 100644 (file)
@@ -109,19 +109,24 @@ static int qla_nvme_alloc_queue(struct nvme_fc_local_port *lport,
                return -EINVAL;
        }
 
-       if (ha->queue_pair_map[qidx]) {
-               *handle = ha->queue_pair_map[qidx];
-               ql_log(ql_log_info, vha, 0x2121,
-                   "Returning existing qpair of %p for idx=%x\n",
-                   *handle, qidx);
-               return 0;
-       }
+       /* Use base qpair if max_qpairs is 0 */
+       if (!ha->max_qpairs) {
+               qpair = ha->base_qpair;
+       } else {
+               if (ha->queue_pair_map[qidx]) {
+                       *handle = ha->queue_pair_map[qidx];
+                       ql_log(ql_log_info, vha, 0x2121,
+                              "Returning existing qpair of %p for idx=%x\n",
+                              *handle, qidx);
+                       return 0;
+               }
 
-       qpair = qla2xxx_create_qpair(vha, 5, vha->vp_idx, true);
-       if (qpair == NULL) {
-               ql_log(ql_log_warn, vha, 0x2122,
-                   "Failed to allocate qpair\n");
-               return -EINVAL;
+               qpair = qla2xxx_create_qpair(vha, 5, vha->vp_idx, true);
+               if (!qpair) {
+                       ql_log(ql_log_warn, vha, 0x2122,
+                              "Failed to allocate qpair\n");
+                       return -EINVAL;
+               }
        }
        *handle = qpair;
 
@@ -715,18 +720,9 @@ int qla_nvme_register_hba(struct scsi_qla_host *vha)
 
        WARN_ON(vha->nvme_local_port);
 
-       if (ha->max_req_queues < 3) {
-               if (!ha->flags.max_req_queue_warned)
-                       ql_log(ql_log_info, vha, 0x2120,
-                              "%s: Disabling FC-NVME due to lack of free queue pairs (%d).\n",
-                              __func__, ha->max_req_queues);
-               ha->flags.max_req_queue_warned = 1;
-               return ret;
-       }
-
        qla_nvme_fc_transport.max_hw_queues =
            min((uint8_t)(qla_nvme_fc_transport.max_hw_queues),
-               (uint8_t)(ha->max_req_queues - 2));
+               (uint8_t)(ha->max_qpairs ? ha->max_qpairs : 1));
 
        pinfo.node_name = wwn_to_u64(vha->node_name);
        pinfo.port_name = wwn_to_u64(vha->port_name);