diff options
author | James Smart <James.Smart@Emulex.Com> | 2009-07-19 16:01:26 +0200 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-08-23 00:51:58 +0200 |
commit | 1c6834a7e85715a4ac07c1cac25a1950040decb0 (patch) | |
tree | 66e859591d7bb25b26c10999ee861ac86701cfbc /drivers/scsi/lpfc/lpfc_vport.c | |
parent | [SCSI] lpfc 8.3.4: Fix a pair of FCoE issues (diff) | |
download | linux-1c6834a7e85715a4ac07c1cac25a1950040decb0.tar.xz linux-1c6834a7e85715a4ac07c1cac25a1950040decb0.zip |
[SCSI] lpfc 8.3.4: NPIV vport fixes
NPIV vport fixes
- Fixed static vport creation on SLI4 HBAs
- Fixed vport create sending init_vpi before REG_VFI
- Fix unable to create vports on SLI4 HBA's Port2
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_vport.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_vport.c | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c index e0b49922193e..9ba2a01c0e38 100644 --- a/drivers/scsi/lpfc/lpfc_vport.c +++ b/drivers/scsi/lpfc/lpfc_vport.c @@ -313,22 +313,6 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) goto error_out; } - /* - * In SLI4, the vpi must be activated before it can be used - * by the port. - */ - if (phba->sli_rev == LPFC_SLI_REV4) { - rc = lpfc_sli4_init_vpi(phba, vpi); - if (rc) { - lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, - "1838 Failed to INIT_VPI on vpi %d " - "status %d\n", vpi, rc); - rc = VPORT_NORESOURCES; - lpfc_free_vpi(phba, vpi); - goto error_out; - } - } - /* Assign an unused board number */ if ((instance = lpfc_get_instance()) < 0) { lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, @@ -367,12 +351,8 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) goto error_out; } - memcpy(vport->fc_portname.u.wwn, vport->fc_sparam.portName.u.wwn, 8); - memcpy(vport->fc_nodename.u.wwn, vport->fc_sparam.nodeName.u.wwn, 8); - if (fc_vport->node_name != 0) - u64_to_wwn(fc_vport->node_name, vport->fc_nodename.u.wwn); - if (fc_vport->port_name != 0) - u64_to_wwn(fc_vport->port_name, vport->fc_portname.u.wwn); + u64_to_wwn(fc_vport->node_name, vport->fc_nodename.u.wwn); + u64_to_wwn(fc_vport->port_name, vport->fc_portname.u.wwn); memcpy(&vport->fc_sparam.portName, vport->fc_portname.u.wwn, 8); memcpy(&vport->fc_sparam.nodeName, vport->fc_nodename.u.wwn, 8); @@ -404,7 +384,34 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) *(struct lpfc_vport **)fc_vport->dd_data = vport; vport->fc_vport = fc_vport; + /* + * In SLI4, the vpi must be activated before it can be used + * by the port. + */ + if ((phba->sli_rev == LPFC_SLI_REV4) && + (pport->vfi_state & LPFC_VFI_REGISTERED)) { + rc = lpfc_sli4_init_vpi(phba, vpi); + if (rc) { + lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, + "1838 Failed to INIT_VPI on vpi %d " + "status %d\n", vpi, rc); + rc = VPORT_NORESOURCES; + lpfc_free_vpi(phba, vpi); + goto error_out; + } + } else if (phba->sli_rev == LPFC_SLI_REV4) { + /* + * Driver cannot INIT_VPI now. Set the flags to + * init_vpi when reg_vfi complete. + */ + vport->fc_flag |= FC_VPORT_NEEDS_INIT_VPI; + lpfc_vport_set_state(vport, FC_VPORT_LINKDOWN); + rc = VPORT_OK; + goto out; + } + if ((phba->link_state < LPFC_LINK_UP) || + (pport->port_state < LPFC_FABRIC_CFG_LINK) || (phba->fc_topology == TOPOLOGY_LOOP)) { lpfc_vport_set_state(vport, FC_VPORT_LINKDOWN); rc = VPORT_OK; |