]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
lpfc: add support for translating an RSCN rcv into a discovery rescan
authorJames Smart <jsmart2021@gmail.com>
Tue, 14 May 2019 21:58:07 +0000 (14:58 -0700)
committerChristoph Hellwig <hch@lst.de>
Fri, 21 Jun 2019 09:08:38 +0000 (11:08 +0200)
This patch updates RSCN receive processing to check for the remote
port being an NVME port, and if so, invoke the nvme_fc callback to
rescan the remote port.  The rescan will generate a discovery udev
event.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/lpfc/lpfc_crtn.h
drivers/scsi/lpfc/lpfc_els.c
drivers/scsi/lpfc/lpfc_nvme.c

index 4b8eb9107b859208c077afcbfc228c32fde61cc4..866374801140fe6e8e206258bcddf67933e03bae 100644 (file)
@@ -557,6 +557,8 @@ void lpfc_ras_stop_fwlog(struct lpfc_hba *phba);
 int lpfc_check_fwlog_support(struct lpfc_hba *phba);
 
 /* NVME interfaces. */
+void lpfc_nvme_rescan_port(struct lpfc_vport *vport,
+                          struct lpfc_nodelist *ndlp);
 void lpfc_nvme_unregister_port(struct lpfc_vport *vport,
                        struct lpfc_nodelist *ndlp);
 int lpfc_nvme_register_port(struct lpfc_vport *vport,
index 00f5d9d547f9e90d2db135675e8de3c02d968d74..968ed0fd37f7f313db5e2ee2e9ff67a27a63e645 100644 (file)
@@ -6326,6 +6326,8 @@ lpfc_rscn_recovery_check(struct lpfc_vport *vport)
                        continue;
                }
 
+               if (ndlp->nlp_fc4_type & NLP_FC4_NVME)
+                       lpfc_nvme_rescan_port(vport, ndlp);
 
                lpfc_disc_state_machine(vport, ndlp, NULL,
                                        NLP_EVT_DEVICE_RECOVERY);
@@ -6437,6 +6439,9 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
                                 "2024 pt2pt RSCN %08x Data: x%x x%x\n",
                                 *lp, vport->fc_flag, payload_len);
                lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
+
+               if (ndlp->nlp_fc4_type & NLP_FC4_NVME)
+                       lpfc_nvme_rescan_port(vport, ndlp);
                return 0;
        }
 
index 9d99cb91539078e1cde16351a9543789df1fcd38..fdd16d9f55a14619384beb4f16a218e131aff90b 100644 (file)
@@ -2402,6 +2402,50 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
 #endif
 }
 
+/**
+ * lpfc_nvme_rescan_port - Check to see if we should rescan this remoteport
+ *
+ * If the ndlp represents an NVME Target, that we are logged into,
+ * ping the NVME FC Transport layer to initiate a device rescan
+ * on this remote NPort.
+ */
+void
+lpfc_nvme_rescan_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
+{
+#if (IS_ENABLED(CONFIG_NVME_FC))
+       struct lpfc_nvme_rport *rport;
+       struct nvme_fc_remote_port *remoteport;
+
+       rport = ndlp->nrport;
+
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC,
+                        "6170 Rescan NPort DID x%06x type x%x "
+                        "state x%x rport %p\n",
+                        ndlp->nlp_DID, ndlp->nlp_type, ndlp->nlp_state, rport);
+       if (!rport)
+               goto input_err;
+       remoteport = rport->remoteport;
+       if (!remoteport)
+               goto input_err;
+
+       /* Only rescan if we are an NVME target in the MAPPED state */
+       if (remoteport->port_role & FC_PORT_ROLE_NVME_DISCOVERY &&
+           ndlp->nlp_state == NLP_STE_MAPPED_NODE) {
+               nvme_fc_rescan_remoteport(remoteport);
+
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_DISC,
+                                "6172 NVME rescanned DID x%06x "
+                                "port_state x%x\n",
+                                ndlp->nlp_DID, remoteport->port_state);
+       }
+       return;
+input_err:
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_DISC,
+                        "6169 State error: lport %p, rport%p FCID x%06x\n",
+                        vport->localport, ndlp->rport, ndlp->nlp_DID);
+#endif
+}
+
 /* lpfc_nvme_unregister_port - unbind the DID and port_role from this rport.
  *
  * There is no notion of Devloss or rport recovery from the current