]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
scsi: lpfc: Fix NVME io abort failures causing hangs
authorJames Smart <jsmart2021@gmail.com>
Sun, 22 Sep 2019 03:58:50 +0000 (20:58 -0700)
committerSeth Forshee <seth.forshee@canonical.com>
Tue, 7 Apr 2020 15:40:00 +0000 (10:40 -0500)
BugLink: https://bugs.launchpad.net/bugs/1855303
The nvme-fc transport may call to abort an io on controller reset. If the
driver is out of resources to issue an abort command, it just gives up and
does nothing. The transport expects the lldd to always be able to terminate
an io it has issued.  At that point, the controller hangs waiting for
aborted ios to be returned.  Note: flaged by "6136" and "6176" error
messages.

Root issue was the adapter mis-allocated the number resources it allocated
for command entries for the adapter.

Convert the driver to allocate command resources based on the number of
xris supported by the FC port - 1 resource for the original command and 1
resource for the abort request.

Link: https://lore.kernel.org/r/20190922035906.10977-5-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit a5f7337f5a82fc4b13b4481a7e56977656cbe7d1)
Signed-off-by: Vignesh Gunasekaran <vignesh.gunasekaran@broadcom.com>
Signed-off-by: Jeff Lane <jeffrey.lane@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/scsi/lpfc/lpfc.h
drivers/scsi/lpfc/lpfc_attr.c
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_sli.c

index 691acbdcc46dfc4ab941c2668d18bef60cd7347b..291335e168068c13ca750a9402fb1b86e7dfdad7 100644 (file)
@@ -872,7 +872,6 @@ struct lpfc_hba {
        uint32_t cfg_aer_support;
        uint32_t cfg_sriov_nr_virtfn;
        uint32_t cfg_request_firmware_upgrade;
-       uint32_t cfg_iocb_cnt;
        uint32_t cfg_suppress_link_up;
        uint32_t cfg_rrq_xri_bitmap_sz;
        uint32_t cfg_delay_discovery;
index 41cc91d3c77e085e7dca07726f0ee4641d80075c..79a19247975558269d6ab62336125aca42e47ae3 100644 (file)
@@ -3582,9 +3582,6 @@ lpfc_txcmplq_hw_show(struct device *dev, struct device_attribute *attr,
 static DEVICE_ATTR(txcmplq_hw, S_IRUGO,
                         lpfc_txcmplq_hw_show, NULL);
 
-LPFC_ATTR_R(iocb_cnt, 2, 1, 5,
-       "Number of IOCBs alloc for ELS, CT, and ABTS: 1k to 5k IOCBs");
-
 /*
 # lpfc_nodev_tmo: If set, it will hold all I/O errors on devices that disappear
 # until the timer expires. Value range is [0,255]. Default value is 30.
@@ -6073,7 +6070,6 @@ struct device_attribute *lpfc_hba_attrs[] = {
        &dev_attr_lpfc_sriov_nr_virtfn,
        &dev_attr_lpfc_req_fw_upgrade,
        &dev_attr_lpfc_suppress_link_up,
-       &dev_attr_lpfc_iocb_cnt,
        &dev_attr_iocb_hw,
        &dev_attr_txq_hw,
        &dev_attr_txcmplq_hw,
@@ -7212,7 +7208,6 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
        lpfc_sriov_nr_virtfn_init(phba, lpfc_sriov_nr_virtfn);
        lpfc_request_firmware_upgrade_init(phba, lpfc_req_fw_upgrade);
        lpfc_suppress_link_up_init(phba, lpfc_suppress_link_up);
-       lpfc_iocb_cnt_init(phba, lpfc_iocb_cnt);
        lpfc_delay_discovery_init(phba, lpfc_delay_discovery);
        lpfc_sli_mode_init(phba, lpfc_sli_mode);
        phba->cfg_enable_dss = 1;
index e8813d26e59415b1a584900c2ed7772438a74bc3..dc2b8d8c15297368001db3375ed111e54b6a3601 100644 (file)
@@ -7126,7 +7126,7 @@ lpfc_init_iocb_list(struct lpfc_hba *phba, int iocb_count)
                if (iocbq_entry == NULL) {
                        printk(KERN_ERR "%s: only allocated %d iocbs of "
                                "expected %d count. Unloading driver.\n",
-                               __func__, i, LPFC_IOCB_LIST_CNT);
+                               __func__, i, iocb_count);
                        goto out_free_iocbq;
                }
 
@@ -11589,13 +11589,10 @@ fcponly:
        }
 
        /* If the NVME FC4 type is enabled, scale the sg_seg_cnt to
-        * accommodate 512K and 1M IOs in a single nvme buf and supply
-        * enough NVME LS iocb buffers for larger connectivity counts.
+        * accommodate 512K and 1M IOs in a single nvme buf.
         */
-       if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) {
+       if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME)
                phba->cfg_sg_seg_cnt = LPFC_MAX_NVME_SEG_CNT;
-               phba->cfg_iocb_cnt = 5;
-       }
 
        /* Only embed PBDE for if_type 6, PBDE support requires xib be set */
        if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) !=
index 59b0d724cd677ece02dec5db2d9812561d0c89b4..6df2de258bd416cd23912fc697c6f905e65c5943 100644 (file)
@@ -7525,9 +7525,11 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
                }
                phba->sli4_hba.nvmet_xri_cnt = rc;
 
-               cnt = phba->cfg_iocb_cnt * 1024;
-               /* We need 1 iocbq for every SGL, for IO processing */
-               cnt += phba->sli4_hba.nvmet_xri_cnt;
+               /* We allocate an iocbq for every receive context SGL.
+                * The additional allocation is for abort and ls handling.
+                */
+               cnt = phba->sli4_hba.nvmet_xri_cnt +
+                       phba->sli4_hba.max_cfg_param.max_xri;
        } else {
                /* update host common xri-sgl sizes and mappings */
                rc = lpfc_sli4_io_sgl_update(phba);
@@ -7549,14 +7551,17 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
                        rc = -ENODEV;
                        goto out_destroy_queue;
                }
-               cnt = phba->cfg_iocb_cnt * 1024;
+               /* Each lpfc_io_buf job structure has an iocbq element.
+                * This cnt provides for abort, els, ct and ls requests.
+                */
+               cnt = phba->sli4_hba.max_cfg_param.max_xri;
        }
 
        if (!phba->sli.iocbq_lookup) {
                /* Initialize and populate the iocb list per host */
                lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
-                               "2821 initialize iocb list %d total %d\n",
-                               phba->cfg_iocb_cnt, cnt);
+                               "2821 initialize iocb list with %d entries\n",
+                               cnt);
                rc = lpfc_init_iocb_list(phba, cnt);
                if (rc) {
                        lpfc_printf_log(phba, KERN_ERR, LOG_INIT,