aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Smart <jsmart2021@gmail.com>2017-03-04 12:30:33 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2017-03-06 23:04:22 -0500
commit166d721120c1cf768af11706c3e0411324bf138f (patch)
treef9847a2e44ea7f2adbac62b65e8267bf6aa5d11f
parent856984b71cefab1580e9439e5382db1247d689b0 (diff)
scsi: lpfc: Rework lpfc Kconfig for NVME options
Reworked Kconfig so that lfpc only requires the scsi stack. NVME Initiator and NVME Target support can be enabled if the other NVMe subsystems have been enabled. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/Kconfig19
-rw-r--r--drivers/scsi/lpfc/lpfc_nvme.c18
-rw-r--r--drivers/scsi/lpfc/lpfc_nvmet.c10
3 files changed, 41 insertions, 6 deletions
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 230043c1c90f..4bf55b5d78be 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -1241,19 +1241,32 @@ config SCSI_LPFC
1241 tristate "Emulex LightPulse Fibre Channel Support" 1241 tristate "Emulex LightPulse Fibre Channel Support"
1242 depends on PCI && SCSI 1242 depends on PCI && SCSI
1243 depends on SCSI_FC_ATTRS 1243 depends on SCSI_FC_ATTRS
1244 depends on NVME_FC && NVME_TARGET_FC
1245 select CRC_T10DIF 1244 select CRC_T10DIF
1246 help 1245 ---help---
1247 This lpfc driver supports the Emulex LightPulse 1246 This lpfc driver supports the Emulex LightPulse
1248 Family of Fibre Channel PCI host adapters. 1247 Family of Fibre Channel PCI host adapters.
1249 1248
1250config SCSI_LPFC_DEBUG_FS 1249config SCSI_LPFC_DEBUG_FS
1251 bool "Emulex LightPulse Fibre Channel debugfs Support" 1250 bool "Emulex LightPulse Fibre Channel debugfs Support"
1252 depends on SCSI_LPFC && DEBUG_FS 1251 depends on SCSI_LPFC && DEBUG_FS
1253 help 1252 ---help---
1254 This makes debugging information from the lpfc driver 1253 This makes debugging information from the lpfc driver
1255 available via the debugfs filesystem. 1254 available via the debugfs filesystem.
1256 1255
1256config LPFC_NVME_INITIATOR
1257 bool "Emulex LightPulse Fibre Channel NVME Initiator Support"
1258 depends on SCSI_LPFC && NVME_FC
1259 ---help---
1260 This enables NVME Initiator support in the Emulex lpfc driver.
1261
1262config LPFC_NVME_TARGET
1263 bool "Emulex LightPulse Fibre Channel NVME Initiator Support"
1264 depends on SCSI_LPFC && NVME_TARGET_FC
1265 ---help---
1266 This enables NVME Target support in the Emulex lpfc driver.
1267 Target enablement must still be enabled on a per adapter
1268 basis by module parameters.
1269
1257config SCSI_SIM710 1270config SCSI_SIM710
1258 tristate "Simple 53c710 SCSI support (Compaq, NCR machines)" 1271 tristate "Simple 53c710 SCSI support (Compaq, NCR machines)"
1259 depends on (EISA || MCA) && SCSI 1272 depends on (EISA || MCA) && SCSI
diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c
index b9012fee1632..0a4c19081409 100644
--- a/drivers/scsi/lpfc/lpfc_nvme.c
+++ b/drivers/scsi/lpfc/lpfc_nvme.c
@@ -2127,11 +2127,12 @@ lpfc_release_nvme_buf(struct lpfc_hba *phba, struct lpfc_nvme_buf *lpfc_ncmd)
2127int 2127int
2128lpfc_nvme_create_localport(struct lpfc_vport *vport) 2128lpfc_nvme_create_localport(struct lpfc_vport *vport)
2129{ 2129{
2130 int ret = 0;
2130 struct lpfc_hba *phba = vport->phba; 2131 struct lpfc_hba *phba = vport->phba;
2131 struct nvme_fc_port_info nfcp_info; 2132 struct nvme_fc_port_info nfcp_info;
2132 struct nvme_fc_local_port *localport; 2133 struct nvme_fc_local_port *localport;
2133 struct lpfc_nvme_lport *lport; 2134 struct lpfc_nvme_lport *lport;
2134 int len, ret = 0; 2135 int len;
2135 2136
2136 /* Initialize this localport instance. The vport wwn usage ensures 2137 /* Initialize this localport instance. The vport wwn usage ensures
2137 * that NPIV is accounted for. 2138 * that NPIV is accounted for.
@@ -2148,8 +2149,12 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport)
2148 /* localport is allocated from the stack, but the registration 2149 /* localport is allocated from the stack, but the registration
2149 * call allocates heap memory as well as the private area. 2150 * call allocates heap memory as well as the private area.
2150 */ 2151 */
2152#ifdef CONFIG_LPFC_NVME_INITIATOR
2151 ret = nvme_fc_register_localport(&nfcp_info, &lpfc_nvme_template, 2153 ret = nvme_fc_register_localport(&nfcp_info, &lpfc_nvme_template,
2152 &vport->phba->pcidev->dev, &localport); 2154 &vport->phba->pcidev->dev, &localport);
2155#else
2156 ret = -ENOMEM;
2157#endif
2153 if (!ret) { 2158 if (!ret) {
2154 lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME | LOG_NVME_DISC, 2159 lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME | LOG_NVME_DISC,
2155 "6005 Successfully registered local " 2160 "6005 Successfully registered local "
@@ -2185,6 +2190,7 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport)
2185void 2190void
2186lpfc_nvme_destroy_localport(struct lpfc_vport *vport) 2191lpfc_nvme_destroy_localport(struct lpfc_vport *vport)
2187{ 2192{
2193#ifdef CONFIG_LPFC_NVME_INITIATOR
2188 struct nvme_fc_local_port *localport; 2194 struct nvme_fc_local_port *localport;
2189 struct lpfc_nvme_lport *lport; 2195 struct lpfc_nvme_lport *lport;
2190 struct lpfc_nvme_rport *rport = NULL, *rport_next = NULL; 2196 struct lpfc_nvme_rport *rport = NULL, *rport_next = NULL;
@@ -2200,7 +2206,6 @@ lpfc_nvme_destroy_localport(struct lpfc_vport *vport)
2200 lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME, 2206 lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME,
2201 "6011 Destroying NVME localport %p\n", 2207 "6011 Destroying NVME localport %p\n",
2202 localport); 2208 localport);
2203
2204 list_for_each_entry_safe(rport, rport_next, &lport->rport_list, list) { 2209 list_for_each_entry_safe(rport, rport_next, &lport->rport_list, list) {
2205 /* The last node ref has to get released now before the rport 2210 /* The last node ref has to get released now before the rport
2206 * private memory area is released by the transport. 2211 * private memory area is released by the transport.
@@ -2214,6 +2219,7 @@ lpfc_nvme_destroy_localport(struct lpfc_vport *vport)
2214 "6008 rport fail destroy %x\n", ret); 2219 "6008 rport fail destroy %x\n", ret);
2215 wait_for_completion_timeout(&rport->rport_unreg_done, 5); 2220 wait_for_completion_timeout(&rport->rport_unreg_done, 5);
2216 } 2221 }
2222
2217 /* lport's rport list is clear. Unregister 2223 /* lport's rport list is clear. Unregister
2218 * lport and release resources. 2224 * lport and release resources.
2219 */ 2225 */
@@ -2237,6 +2243,7 @@ lpfc_nvme_destroy_localport(struct lpfc_vport *vport)
2237 "Failed, status x%x\n", 2243 "Failed, status x%x\n",
2238 ret); 2244 ret);
2239 } 2245 }
2246#endif
2240} 2247}
2241 2248
2242void 2249void
@@ -2267,6 +2274,7 @@ lpfc_nvme_update_localport(struct lpfc_vport *vport)
2267int 2274int
2268lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) 2275lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
2269{ 2276{
2277#ifdef CONFIG_LPFC_NVME_INITIATOR
2270 int ret = 0; 2278 int ret = 0;
2271 struct nvme_fc_local_port *localport; 2279 struct nvme_fc_local_port *localport;
2272 struct lpfc_nvme_lport *lport; 2280 struct lpfc_nvme_lport *lport;
@@ -2340,7 +2348,6 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
2340 rpinfo.port_role |= FC_PORT_ROLE_NVME_INITIATOR; 2348 rpinfo.port_role |= FC_PORT_ROLE_NVME_INITIATOR;
2341 rpinfo.port_name = wwn_to_u64(ndlp->nlp_portname.u.wwn); 2349 rpinfo.port_name = wwn_to_u64(ndlp->nlp_portname.u.wwn);
2342 rpinfo.node_name = wwn_to_u64(ndlp->nlp_nodename.u.wwn); 2350 rpinfo.node_name = wwn_to_u64(ndlp->nlp_nodename.u.wwn);
2343
2344 ret = nvme_fc_register_remoteport(localport, &rpinfo, 2351 ret = nvme_fc_register_remoteport(localport, &rpinfo,
2345 &remote_port); 2352 &remote_port);
2346 if (!ret) { 2353 if (!ret) {
@@ -2376,6 +2383,9 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
2376 ndlp->nlp_type, ndlp->nlp_DID, ndlp); 2383 ndlp->nlp_type, ndlp->nlp_DID, ndlp);
2377 } 2384 }
2378 return ret; 2385 return ret;
2386#else
2387 return 0;
2388#endif
2379} 2389}
2380 2390
2381/* lpfc_nvme_unregister_port - unbind the DID and port_role from this rport. 2391/* lpfc_nvme_unregister_port - unbind the DID and port_role from this rport.
@@ -2393,6 +2403,7 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
2393void 2403void
2394lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) 2404lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
2395{ 2405{
2406#ifdef CONFIG_LPFC_NVME_INITIATOR
2396 int ret; 2407 int ret;
2397 struct nvme_fc_local_port *localport; 2408 struct nvme_fc_local_port *localport;
2398 struct lpfc_nvme_lport *lport; 2409 struct lpfc_nvme_lport *lport;
@@ -2450,6 +2461,7 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
2450 return; 2461 return;
2451 2462
2452 input_err: 2463 input_err:
2464#endif
2453 lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_DISC, 2465 lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_DISC,
2454 "6168: State error: lport %p, rport%p FCID x%06x\n", 2466 "6168: State error: lport %p, rport%p FCID x%06x\n",
2455 vport->localport, ndlp->rport, ndlp->nlp_DID); 2467 vport->localport, ndlp->rport, ndlp->nlp_DID);
diff --git a/drivers/scsi/lpfc/lpfc_nvmet.c b/drivers/scsi/lpfc/lpfc_nvmet.c
index 48ce9858bc11..a69ca6ea1d6c 100644
--- a/drivers/scsi/lpfc/lpfc_nvmet.c
+++ b/drivers/scsi/lpfc/lpfc_nvmet.c
@@ -671,9 +671,13 @@ lpfc_nvmet_create_targetport(struct lpfc_hba *phba)
671 lpfc_tgttemplate.target_features = NVMET_FCTGTFEAT_READDATA_RSP | 671 lpfc_tgttemplate.target_features = NVMET_FCTGTFEAT_READDATA_RSP |
672 NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED; 672 NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED;
673 673
674#ifdef CONFIG_LPFC_NVME_TARGET
674 error = nvmet_fc_register_targetport(&pinfo, &lpfc_tgttemplate, 675 error = nvmet_fc_register_targetport(&pinfo, &lpfc_tgttemplate,
675 &phba->pcidev->dev, 676 &phba->pcidev->dev,
676 &phba->targetport); 677 &phba->targetport);
678#else
679 error = -ENOMEM;
680#endif
677 if (error) { 681 if (error) {
678 lpfc_printf_log(phba, KERN_ERR, LOG_NVME_DISC, 682 lpfc_printf_log(phba, KERN_ERR, LOG_NVME_DISC,
679 "6025 Cannot register NVME targetport " 683 "6025 Cannot register NVME targetport "
@@ -752,6 +756,7 @@ lpfc_sli4_nvmet_xri_aborted(struct lpfc_hba *phba,
752void 756void
753lpfc_nvmet_destroy_targetport(struct lpfc_hba *phba) 757lpfc_nvmet_destroy_targetport(struct lpfc_hba *phba)
754{ 758{
759#ifdef CONFIG_LPFC_NVME_TARGET
755 struct lpfc_nvmet_tgtport *tgtp; 760 struct lpfc_nvmet_tgtport *tgtp;
756 761
757 if (phba->nvmet_support == 0) 762 if (phba->nvmet_support == 0)
@@ -763,6 +768,7 @@ lpfc_nvmet_destroy_targetport(struct lpfc_hba *phba)
763 wait_for_completion_timeout(&tgtp->tport_unreg_done, 5); 768 wait_for_completion_timeout(&tgtp->tport_unreg_done, 5);
764 } 769 }
765 phba->targetport = NULL; 770 phba->targetport = NULL;
771#endif
766} 772}
767 773
768/** 774/**
@@ -782,6 +788,7 @@ static void
782lpfc_nvmet_unsol_ls_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, 788lpfc_nvmet_unsol_ls_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
783 struct hbq_dmabuf *nvmebuf) 789 struct hbq_dmabuf *nvmebuf)
784{ 790{
791#ifdef CONFIG_LPFC_NVME_TARGET
785 struct lpfc_nvmet_tgtport *tgtp; 792 struct lpfc_nvmet_tgtport *tgtp;
786 struct fc_frame_header *fc_hdr; 793 struct fc_frame_header *fc_hdr;
787 struct lpfc_nvmet_rcv_ctx *ctxp; 794 struct lpfc_nvmet_rcv_ctx *ctxp;
@@ -862,6 +869,7 @@ dropit:
862 869
863 atomic_inc(&tgtp->xmt_ls_abort); 870 atomic_inc(&tgtp->xmt_ls_abort);
864 lpfc_nvmet_unsol_ls_issue_abort(phba, ctxp, sid, oxid); 871 lpfc_nvmet_unsol_ls_issue_abort(phba, ctxp, sid, oxid);
872#endif
865} 873}
866 874
867/** 875/**
@@ -883,6 +891,7 @@ lpfc_nvmet_unsol_fcp_buffer(struct lpfc_hba *phba,
883 struct rqb_dmabuf *nvmebuf, 891 struct rqb_dmabuf *nvmebuf,
884 uint64_t isr_timestamp) 892 uint64_t isr_timestamp)
885{ 893{
894#ifdef CONFIG_LPFC_NVME_TARGET
886 struct lpfc_nvmet_rcv_ctx *ctxp; 895 struct lpfc_nvmet_rcv_ctx *ctxp;
887 struct lpfc_nvmet_tgtport *tgtp; 896 struct lpfc_nvmet_tgtport *tgtp;
888 struct fc_frame_header *fc_hdr; 897 struct fc_frame_header *fc_hdr;
@@ -988,6 +997,7 @@ dropit:
988 /* We assume a rcv'ed cmd ALWAYs fits into 1 buffer */ 997 /* We assume a rcv'ed cmd ALWAYs fits into 1 buffer */
989 lpfc_nvmet_rq_post(phba, NULL, &nvmebuf->hbuf); 998 lpfc_nvmet_rq_post(phba, NULL, &nvmebuf->hbuf);
990 } 999 }
1000#endif
991} 1001}
992 1002
993/** 1003/**