]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/scsi/lpfc/lpfc_attr.c
scsi: lpfc: Break up IO ctx list into a separate get and put list
[karo-tx-linux.git] / drivers / scsi / lpfc / lpfc_attr.c
index 200a614bb540d9dc0e297fc2e1fbc62e65afe4b9..4ed48ed38e79316f02ca1e299e56f66eea84ba8e 100644 (file)
@@ -150,6 +150,7 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
        struct nvme_fc_local_port *localport;
        struct lpfc_nodelist *ndlp;
        struct nvme_fc_remote_port *nrport;
+       uint64_t data1, data2, data3, tot;
        char *statep;
        int len = 0;
 
@@ -170,7 +171,7 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
                else
                        statep = "INIT";
                len += snprintf(buf + len, PAGE_SIZE - len,
-                               "NVME Target: Enabled  State %s\n",
+                               "NVME Target Enabled  State %s\n",
                                statep);
                len += snprintf(buf + len, PAGE_SIZE - len,
                                "%s%d WWPN x%llx WWNN x%llx DID x%06x\n",
@@ -244,11 +245,21 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
                                atomic_read(&tgtp->xmt_abort_rsp),
                                atomic_read(&tgtp->xmt_abort_rsp_error));
 
+               spin_lock(&phba->sli4_hba.nvmet_ctx_get_lock);
+               spin_lock(&phba->sli4_hba.nvmet_ctx_put_lock);
+               tot = phba->sli4_hba.nvmet_xri_cnt -
+                       (phba->sli4_hba.nvmet_ctx_get_cnt +
+                       phba->sli4_hba.nvmet_ctx_put_cnt);
+               spin_unlock(&phba->sli4_hba.nvmet_ctx_put_lock);
+               spin_unlock(&phba->sli4_hba.nvmet_ctx_get_lock);
+
                len += snprintf(buf + len, PAGE_SIZE - len,
-                               "IO_CTX: %08x outstanding %08x total %x",
-                               phba->sli4_hba.nvmet_ctx_cnt,
+                               "IO_CTX: %08x  WAIT: cur %08x tot %08x\n"
+                               "CTX Outstanding %08llx\n",
+                               phba->sli4_hba.nvmet_xri_cnt,
                                phba->sli4_hba.nvmet_io_wait_cnt,
-                               phba->sli4_hba.nvmet_io_wait_total);
+                               phba->sli4_hba.nvmet_io_wait_total,
+                               tot);
 
                len +=  snprintf(buf+len, PAGE_SIZE-len, "\n");
                return len;
@@ -337,19 +348,21 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
 
        len += snprintf(buf + len, PAGE_SIZE - len, "\nNVME Statistics\n");
        len += snprintf(buf+len, PAGE_SIZE-len,
-                       "LS: Xmt %016llx Cmpl %016llx\n",
-                       phba->fc4NvmeLsRequests,
-                       phba->fc4NvmeLsCmpls);
-
+                       "LS: Xmt %016x Cmpl %016x\n",
+                       atomic_read(&phba->fc4NvmeLsRequests),
+                       atomic_read(&phba->fc4NvmeLsCmpls));
+
+       tot = atomic_read(&phba->fc4NvmeIoCmpls);
+       data1 = atomic_read(&phba->fc4NvmeInputRequests);
+       data2 = atomic_read(&phba->fc4NvmeOutputRequests);
+       data3 = atomic_read(&phba->fc4NvmeControlRequests);
        len += snprintf(buf+len, PAGE_SIZE-len,
                        "FCP: Rd %016llx Wr %016llx IO %016llx\n",
-                       phba->fc4NvmeInputRequests,
-                       phba->fc4NvmeOutputRequests,
-                       phba->fc4NvmeControlRequests);
+                       data1, data2, data3);
 
        len += snprintf(buf+len, PAGE_SIZE-len,
-                       "    Cmpl %016llx\n", phba->fc4NvmeIoCmpls);
-
+                       "    Cmpl %016llx Outstanding %016llx\n",
+                       tot, (data1 + data2 + data3) - tot);
        return len;
 }
 
@@ -1341,6 +1354,8 @@ lpfc_board_mode_store(struct device *dev, struct device_attribute *attr,
                        goto board_mode_out;
                }
                wait_for_completion(&online_compl);
+               if (status)
+                       status = -EIO;
        } else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0)
                status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE);
        else if (strncmp(buf, "warm", sizeof("warm") - 1) == 0)
@@ -4469,9 +4484,11 @@ lpfc_fcp_imax_store(struct device *dev, struct device_attribute *attr,
                return -EINVAL;
 
        phba->cfg_fcp_imax = (uint32_t)val;
+       phba->initial_imax = phba->cfg_fcp_imax;
 
        for (i = 0; i < phba->io_channel_irqs; i += LPFC_MAX_EQ_DELAY_EQID_CNT)
-               lpfc_modify_hba_eq_delay(phba, i);
+               lpfc_modify_hba_eq_delay(phba, i, LPFC_MAX_EQ_DELAY_EQID_CNT,
+                                        val);
 
        return strlen(buf);
 }
@@ -4526,6 +4543,16 @@ lpfc_fcp_imax_init(struct lpfc_hba *phba, int val)
 static DEVICE_ATTR(lpfc_fcp_imax, S_IRUGO | S_IWUSR,
                   lpfc_fcp_imax_show, lpfc_fcp_imax_store);
 
+/*
+ * lpfc_auto_imax: Controls Auto-interrupt coalescing values support.
+ *       0       No auto_imax support
+ *       1       auto imax on
+ * Auto imax will change the value of fcp_imax on a per EQ basis, using
+ * the EQ Delay Multiplier, depending on the activity for that EQ.
+ * Value range [0,1]. Default value is 1.
+ */
+LPFC_ATTR_RW(auto_imax, 1, 0, 1, "Enable Auto imax");
+
 /**
  * lpfc_state_show - Display current driver CPU affinity
  * @dev: class converted to a Scsi_host structure.
@@ -5152,6 +5179,7 @@ struct device_attribute *lpfc_hba_attrs[] = {
        &dev_attr_lpfc_task_mgmt_tmo,
        &dev_attr_lpfc_use_msi,
        &dev_attr_lpfc_nvme_oas,
+       &dev_attr_lpfc_auto_imax,
        &dev_attr_lpfc_fcp_imax,
        &dev_attr_lpfc_fcp_cpu_map,
        &dev_attr_lpfc_fcp_io_channel,
@@ -6170,6 +6198,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
        lpfc_enable_SmartSAN_init(phba, lpfc_enable_SmartSAN);
        lpfc_use_msi_init(phba, lpfc_use_msi);
        lpfc_nvme_oas_init(phba, lpfc_nvme_oas);
+       lpfc_auto_imax_init(phba, lpfc_auto_imax);
        lpfc_fcp_imax_init(phba, lpfc_fcp_imax);
        lpfc_fcp_cpu_map_init(phba, lpfc_fcp_cpu_map);
        lpfc_enable_hba_reset_init(phba, lpfc_enable_hba_reset);
@@ -6214,6 +6243,10 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
                        phba->cfg_enable_fc4_type |= LPFC_ENABLE_FCP;
        }
 
+       if (phba->cfg_auto_imax && !phba->cfg_fcp_imax)
+               phba->cfg_auto_imax = 0;
+       phba->initial_imax = phba->cfg_fcp_imax;
+
        /* A value of 0 means use the number of CPUs found in the system */
        if (phba->cfg_fcp_io_channel == 0)
                phba->cfg_fcp_io_channel = phba->sli4_hba.num_present_cpu;