diff options
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) | |||
| 313 | goto error_out; | 313 | goto error_out; |
| 314 | } | 314 | } |
| 315 | 315 | ||
| 316 | /* | ||
| 317 | * In SLI4, the vpi must be activated before it can be used | ||
| 318 | * by the port. | ||
| 319 | */ | ||
| 320 | if (phba->sli_rev == LPFC_SLI_REV4) { | ||
| 321 | rc = lpfc_sli4_init_vpi(phba, vpi); | ||
| 322 | if (rc) { | ||
| 323 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | ||
| 324 | "1838 Failed to INIT_VPI on vpi %d " | ||
| 325 | "status %d\n", vpi, rc); | ||
| 326 | rc = VPORT_NORESOURCES; | ||
| 327 | lpfc_free_vpi(phba, vpi); | ||
| 328 | goto error_out; | ||
| 329 | } | ||
| 330 | } | ||
| 331 | |||
| 332 | /* Assign an unused board number */ | 316 | /* Assign an unused board number */ |
| 333 | if ((instance = lpfc_get_instance()) < 0) { | 317 | if ((instance = lpfc_get_instance()) < 0) { |
| 334 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 318 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, |
| @@ -367,12 +351,8 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
| 367 | goto error_out; | 351 | goto error_out; |
| 368 | } | 352 | } |
| 369 | 353 | ||
| 370 | memcpy(vport->fc_portname.u.wwn, vport->fc_sparam.portName.u.wwn, 8); | 354 | u64_to_wwn(fc_vport->node_name, vport->fc_nodename.u.wwn); |
| 371 | memcpy(vport->fc_nodename.u.wwn, vport->fc_sparam.nodeName.u.wwn, 8); | 355 | u64_to_wwn(fc_vport->port_name, vport->fc_portname.u.wwn); |
| 372 | if (fc_vport->node_name != 0) | ||
| 373 | u64_to_wwn(fc_vport->node_name, vport->fc_nodename.u.wwn); | ||
| 374 | if (fc_vport->port_name != 0) | ||
| 375 | u64_to_wwn(fc_vport->port_name, vport->fc_portname.u.wwn); | ||
| 376 | 356 | ||
| 377 | memcpy(&vport->fc_sparam.portName, vport->fc_portname.u.wwn, 8); | 357 | memcpy(&vport->fc_sparam.portName, vport->fc_portname.u.wwn, 8); |
| 378 | memcpy(&vport->fc_sparam.nodeName, vport->fc_nodename.u.wwn, 8); | 358 | 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) | |||
| 404 | *(struct lpfc_vport **)fc_vport->dd_data = vport; | 384 | *(struct lpfc_vport **)fc_vport->dd_data = vport; |
| 405 | vport->fc_vport = fc_vport; | 385 | vport->fc_vport = fc_vport; |
| 406 | 386 | ||
| 387 | /* | ||
| 388 | * In SLI4, the vpi must be activated before it can be used | ||
| 389 | * by the port. | ||
| 390 | */ | ||
| 391 | if ((phba->sli_rev == LPFC_SLI_REV4) && | ||
| 392 | (pport->vfi_state & LPFC_VFI_REGISTERED)) { | ||
| 393 | rc = lpfc_sli4_init_vpi(phba, vpi); | ||
| 394 | if (rc) { | ||
| 395 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | ||
| 396 | "1838 Failed to INIT_VPI on vpi %d " | ||
| 397 | "status %d\n", vpi, rc); | ||
| 398 | rc = VPORT_NORESOURCES; | ||
| 399 | lpfc_free_vpi(phba, vpi); | ||
| 400 | goto error_out; | ||
| 401 | } | ||
| 402 | } else if (phba->sli_rev == LPFC_SLI_REV4) { | ||
| 403 | /* | ||
| 404 | * Driver cannot INIT_VPI now. Set the flags to | ||
| 405 | * init_vpi when reg_vfi complete. | ||
| 406 | */ | ||
| 407 | vport->fc_flag |= FC_VPORT_NEEDS_INIT_VPI; | ||
| 408 | lpfc_vport_set_state(vport, FC_VPORT_LINKDOWN); | ||
| 409 | rc = VPORT_OK; | ||
| 410 | goto out; | ||
| 411 | } | ||
| 412 | |||
| 407 | if ((phba->link_state < LPFC_LINK_UP) || | 413 | if ((phba->link_state < LPFC_LINK_UP) || |
| 414 | (pport->port_state < LPFC_FABRIC_CFG_LINK) || | ||
| 408 | (phba->fc_topology == TOPOLOGY_LOOP)) { | 415 | (phba->fc_topology == TOPOLOGY_LOOP)) { |
| 409 | lpfc_vport_set_state(vport, FC_VPORT_LINKDOWN); | 416 | lpfc_vport_set_state(vport, FC_VPORT_LINKDOWN); |
| 410 | rc = VPORT_OK; | 417 | rc = VPORT_OK; |
