]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/scsi/lpfc/lpfc_attr.c
scsi: lpfc: Fix return value of board_mode store routine in case of online failure
[karo-tx-linux.git] / drivers / scsi / lpfc / lpfc_attr.c
index 4830370bfab14247f567de976787aecc9d6b6d28..8eee39de15f78c729b3c9fe53fde497444ebc8db 100644 (file)
@@ -60,9 +60,9 @@
 #define LPFC_MIN_DEVLOSS_TMO   1
 #define LPFC_MAX_DEVLOSS_TMO   255
 
-#define LPFC_DEF_MRQ_POST      256
-#define LPFC_MIN_MRQ_POST      32
-#define LPFC_MAX_MRQ_POST      512
+#define LPFC_DEF_MRQ_POST      512
+#define LPFC_MIN_MRQ_POST      512
+#define LPFC_MAX_MRQ_POST      2048
 
 /*
  * Write key size should be multiple of 4. If write key is changed
@@ -148,9 +148,9 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
        struct lpfc_hba   *phba = vport->phba;
        struct lpfc_nvmet_tgtport *tgtp;
        struct nvme_fc_local_port *localport;
-       struct lpfc_nvme_lport *lport;
-       struct lpfc_nvme_rport *rport;
+       struct lpfc_nodelist *ndlp;
        struct nvme_fc_remote_port *nrport;
+       uint64_t data1, data2, data3, tot;
        char *statep;
        int len = 0;
 
@@ -205,8 +205,9 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
                                atomic_read(&tgtp->xmt_ls_rsp_error));
 
                len += snprintf(buf+len, PAGE_SIZE-len,
-                               "FCP: Rcv %08x Drop %08x\n",
+                               "FCP: Rcv %08x Release %08x Drop %08x\n",
                                atomic_read(&tgtp->rcv_fcp_cmd_in),
+                               atomic_read(&tgtp->xmt_fcp_release),
                                atomic_read(&tgtp->rcv_fcp_cmd_drop));
 
                if (atomic_read(&tgtp->rcv_fcp_cmd_in) !=
@@ -218,15 +219,12 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
                }
 
                len += snprintf(buf+len, PAGE_SIZE-len,
-                               "FCP Rsp: RD %08x rsp %08x WR %08x rsp %08x\n",
+                               "FCP Rsp: RD %08x rsp %08x WR %08x rsp %08x "
+                               "drop %08x\n",
                                atomic_read(&tgtp->xmt_fcp_read),
                                atomic_read(&tgtp->xmt_fcp_read_rsp),
                                atomic_read(&tgtp->xmt_fcp_write),
-                               atomic_read(&tgtp->xmt_fcp_rsp));
-
-               len += snprintf(buf+len, PAGE_SIZE-len,
-                               "FCP Rsp: abort %08x drop %08x\n",
-                               atomic_read(&tgtp->xmt_fcp_abort),
+                               atomic_read(&tgtp->xmt_fcp_rsp),
                                atomic_read(&tgtp->xmt_fcp_drop));
 
                len += snprintf(buf+len, PAGE_SIZE-len,
@@ -236,10 +234,29 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
                                atomic_read(&tgtp->xmt_fcp_rsp_drop));
 
                len += snprintf(buf+len, PAGE_SIZE-len,
-                               "ABORT: Xmt %08x Err %08x Cmpl %08x",
+                               "ABORT: Xmt %08x Cmpl %08x\n",
+                               atomic_read(&tgtp->xmt_fcp_abort),
+                               atomic_read(&tgtp->xmt_fcp_abort_cmpl));
+
+               len += snprintf(buf + len, PAGE_SIZE - len,
+                               "ABORT: Sol %08x  Usol %08x Err %08x Cmpl %08x",
+                               atomic_read(&tgtp->xmt_abort_sol),
+                               atomic_read(&tgtp->xmt_abort_unsol),
                                atomic_read(&tgtp->xmt_abort_rsp),
-                               atomic_read(&tgtp->xmt_abort_rsp_error),
-                               atomic_read(&tgtp->xmt_abort_cmpl));
+                               atomic_read(&tgtp->xmt_abort_rsp_error));
+
+               spin_lock(&phba->sli4_hba.nvmet_io_lock);
+               tot = phba->sli4_hba.nvmet_xri_cnt -
+                       phba->sli4_hba.nvmet_ctx_cnt;
+               spin_unlock(&phba->sli4_hba.nvmet_io_lock);
+
+               len += snprintf(buf + len, PAGE_SIZE - len,
+                               "IO_CTX: %08x  WAIT: cur %08x tot %08x\n"
+                               "CTX Outstanding %08llx\n",
+                               phba->sli4_hba.nvmet_ctx_cnt,
+                               phba->sli4_hba.nvmet_io_wait_cnt,
+                               phba->sli4_hba.nvmet_io_wait_total,
+                               tot);
 
                len +=  snprintf(buf+len, PAGE_SIZE-len, "\n");
                return len;
@@ -255,7 +272,6 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
        len = snprintf(buf, PAGE_SIZE, "NVME Initiator Enabled\n");
 
        spin_lock_irq(shost->host_lock);
-       lport = (struct lpfc_nvme_lport *)localport->private;
 
        /* Port state is only one of two values for now. */
        if (localport->port_id)
@@ -271,9 +287,12 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
                        wwn_to_u64(vport->fc_nodename.u.wwn),
                        localport->port_id, statep);
 
-       list_for_each_entry(rport, &lport->rport_list, list) {
+       list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
+               if (!ndlp->nrport)
+                       continue;
+
                /* local short-hand pointer. */
-               nrport = rport->remoteport;
+               nrport = ndlp->nrport->remoteport;
 
                /* Port state is only one of two values for now. */
                switch (nrport->port_state) {
@@ -301,25 +320,23 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
                len += snprintf(buf + len, PAGE_SIZE - len, "DID x%06x ",
                                nrport->port_id);
 
-               switch (nrport->port_role) {
-               case FC_PORT_ROLE_NVME_INITIATOR:
+               /* An NVME rport can have multiple roles. */
+               if (nrport->port_role & FC_PORT_ROLE_NVME_INITIATOR)
                        len +=  snprintf(buf + len, PAGE_SIZE - len,
                                         "INITIATOR ");
-                       break;
-               case FC_PORT_ROLE_NVME_TARGET:
+               if (nrport->port_role & FC_PORT_ROLE_NVME_TARGET)
                        len +=  snprintf(buf + len, PAGE_SIZE - len,
                                         "TARGET ");
-                       break;
-               case FC_PORT_ROLE_NVME_DISCOVERY:
+               if (nrport->port_role & FC_PORT_ROLE_NVME_DISCOVERY)
                        len +=  snprintf(buf + len, PAGE_SIZE - len,
-                                        "DISCOVERY ");
-                       break;
-               default:
+                                        "DISCSRVC ");
+               if (nrport->port_role & ~(FC_PORT_ROLE_NVME_INITIATOR |
+                                         FC_PORT_ROLE_NVME_TARGET |
+                                         FC_PORT_ROLE_NVME_DISCOVERY))
                        len +=  snprintf(buf + len, PAGE_SIZE - len,
-                                        "UNKNOWN_ROLE x%x",
+                                        "UNKNOWN ROLE x%x",
                                         nrport->port_role);
-                       break;
-               }
+
                len +=  snprintf(buf + len, PAGE_SIZE - len, "%s  ", statep);
                /* Terminate the string. */
                len +=  snprintf(buf + len, PAGE_SIZE - len, "\n");
@@ -328,19 +345,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;
 }
 
@@ -1332,6 +1351,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)
@@ -3188,9 +3209,12 @@ lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport)
 
        shost = lpfc_shost_from_vport(vport);
        spin_lock_irq(shost->host_lock);
-       list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp)
-               if (NLP_CHK_NODE_ACT(ndlp) && ndlp->rport)
+       list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
+               if (!NLP_CHK_NODE_ACT(ndlp))
+                       continue;
+               if (ndlp->rport)
                        ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo;
+       }
        spin_unlock_irq(shost->host_lock);
 }
 
@@ -3311,14 +3335,6 @@ LPFC_ATTR_R(nvmet_mrq,
            1, 1, 16,
            "Specify number of RQ pairs for processing NVMET cmds");
 
-/*
- * lpfc_nvmet_mrq_post: Specify number buffers to post on every MRQ
- *
- */
-LPFC_ATTR_R(nvmet_mrq_post, LPFC_DEF_MRQ_POST,
-           LPFC_MIN_MRQ_POST, LPFC_MAX_MRQ_POST,
-           "Specify number of buffers to post on every MRQ");
-
 /*
  * lpfc_enable_fc4_type: Defines what FC4 types are supported.
  * Supported Values:  1 - register just FCP
@@ -5154,7 +5170,6 @@ struct device_attribute *lpfc_hba_attrs[] = {
        &dev_attr_lpfc_suppress_rsp,
        &dev_attr_lpfc_nvme_io_channel,
        &dev_attr_lpfc_nvmet_mrq,
-       &dev_attr_lpfc_nvmet_mrq_post,
        &dev_attr_lpfc_nvme_enable_fb,
        &dev_attr_lpfc_nvmet_fb_size,
        &dev_attr_lpfc_enable_bg,
@@ -6194,7 +6209,6 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
 
        lpfc_enable_fc4_type_init(phba, lpfc_enable_fc4_type);
        lpfc_nvmet_mrq_init(phba, lpfc_nvmet_mrq);
-       lpfc_nvmet_mrq_post_init(phba, lpfc_nvmet_mrq_post);
 
        /* Initialize first burst. Target vs Initiator are different. */
        lpfc_nvme_enable_fb_init(phba, lpfc_nvme_enable_fb);
@@ -6291,7 +6305,6 @@ lpfc_nvme_mod_param_dep(struct lpfc_hba *phba)
                /* Not NVME Target mode.  Turn off Target parameters. */
                phba->nvmet_support = 0;
                phba->cfg_nvmet_mrq = 0;
-               phba->cfg_nvmet_mrq_post = 0;
                phba->cfg_nvmet_fb_size = 0;
        }