diff options
author | James Smart <james.smart@emulex.com> | 2010-12-15 17:58:10 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-12-21 13:37:24 -0500 |
commit | 4042629e426da5ff0c793276a61103bd3f6b2183 (patch) | |
tree | 7e7337e1349da7854b45cdf436258dd91b29b59f | |
parent | 2fcee4bf874a8ae72ada68b62728d1fdeb30e3d4 (diff) |
[SCSI] lpfc 8.3.20: Updates to FC discovery commands
Updated commands used for ELS to utilize VPI
Allocate RPI at node creation time and pass in ELS commnads.
Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r-- | drivers/scsi/lpfc/lpfc_bsg.c | 16 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_crtn.h | 2 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_disc.h | 2 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_els.c | 19 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hbadisc.c | 40 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_mbox.c | 12 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_nportdisc.c | 16 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 13 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli4.h | 1 |
9 files changed, 49 insertions, 72 deletions
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c index 3330d7951b42..0dd43bb91618 100644 --- a/drivers/scsi/lpfc/lpfc_bsg.c +++ b/drivers/scsi/lpfc/lpfc_bsg.c | |||
@@ -1619,7 +1619,7 @@ job_error: | |||
1619 | * This function obtains a remote port login id so the diag loopback test | 1619 | * This function obtains a remote port login id so the diag loopback test |
1620 | * can send and receive its own unsolicited CT command. | 1620 | * can send and receive its own unsolicited CT command. |
1621 | **/ | 1621 | **/ |
1622 | static int lpfcdiag_loop_self_reg(struct lpfc_hba *phba, uint16_t * rpi) | 1622 | static int lpfcdiag_loop_self_reg(struct lpfc_hba *phba, uint16_t *rpi) |
1623 | { | 1623 | { |
1624 | LPFC_MBOXQ_t *mbox; | 1624 | LPFC_MBOXQ_t *mbox; |
1625 | struct lpfc_dmabuf *dmabuff; | 1625 | struct lpfc_dmabuf *dmabuff; |
@@ -1629,10 +1629,14 @@ static int lpfcdiag_loop_self_reg(struct lpfc_hba *phba, uint16_t * rpi) | |||
1629 | if (!mbox) | 1629 | if (!mbox) |
1630 | return -ENOMEM; | 1630 | return -ENOMEM; |
1631 | 1631 | ||
1632 | if (phba->sli_rev == LPFC_SLI_REV4) | ||
1633 | *rpi = lpfc_sli4_alloc_rpi(phba); | ||
1632 | status = lpfc_reg_rpi(phba, 0, phba->pport->fc_myDID, | 1634 | status = lpfc_reg_rpi(phba, 0, phba->pport->fc_myDID, |
1633 | (uint8_t *)&phba->pport->fc_sparam, mbox, 0); | 1635 | (uint8_t *)&phba->pport->fc_sparam, mbox, *rpi); |
1634 | if (status) { | 1636 | if (status) { |
1635 | mempool_free(mbox, phba->mbox_mem_pool); | 1637 | mempool_free(mbox, phba->mbox_mem_pool); |
1638 | if (phba->sli_rev == LPFC_SLI_REV4) | ||
1639 | lpfc_sli4_free_rpi(phba, *rpi); | ||
1636 | return -ENOMEM; | 1640 | return -ENOMEM; |
1637 | } | 1641 | } |
1638 | 1642 | ||
@@ -1646,6 +1650,8 @@ static int lpfcdiag_loop_self_reg(struct lpfc_hba *phba, uint16_t * rpi) | |||
1646 | kfree(dmabuff); | 1650 | kfree(dmabuff); |
1647 | if (status != MBX_TIMEOUT) | 1651 | if (status != MBX_TIMEOUT) |
1648 | mempool_free(mbox, phba->mbox_mem_pool); | 1652 | mempool_free(mbox, phba->mbox_mem_pool); |
1653 | if (phba->sli_rev == LPFC_SLI_REV4) | ||
1654 | lpfc_sli4_free_rpi(phba, *rpi); | ||
1649 | return -ENODEV; | 1655 | return -ENODEV; |
1650 | } | 1656 | } |
1651 | 1657 | ||
@@ -1682,8 +1688,9 @@ static int lpfcdiag_loop_self_unreg(struct lpfc_hba *phba, uint16_t rpi) | |||
1682 | mempool_free(mbox, phba->mbox_mem_pool); | 1688 | mempool_free(mbox, phba->mbox_mem_pool); |
1683 | return -EIO; | 1689 | return -EIO; |
1684 | } | 1690 | } |
1685 | |||
1686 | mempool_free(mbox, phba->mbox_mem_pool); | 1691 | mempool_free(mbox, phba->mbox_mem_pool); |
1692 | if (phba->sli_rev == LPFC_SLI_REV4) | ||
1693 | lpfc_sli4_free_rpi(phba, rpi); | ||
1687 | return 0; | 1694 | return 0; |
1688 | } | 1695 | } |
1689 | 1696 | ||
@@ -2080,7 +2087,7 @@ lpfc_bsg_diag_test(struct fc_bsg_job *job) | |||
2080 | uint32_t size; | 2087 | uint32_t size; |
2081 | uint32_t full_size; | 2088 | uint32_t full_size; |
2082 | size_t segment_len = 0, segment_offset = 0, current_offset = 0; | 2089 | size_t segment_len = 0, segment_offset = 0, current_offset = 0; |
2083 | uint16_t rpi; | 2090 | uint16_t rpi = 0; |
2084 | struct lpfc_iocbq *cmdiocbq, *rspiocbq; | 2091 | struct lpfc_iocbq *cmdiocbq, *rspiocbq; |
2085 | IOCB_t *cmd, *rsp; | 2092 | IOCB_t *cmd, *rsp; |
2086 | struct lpfc_sli_ct_request *ctreq; | 2093 | struct lpfc_sli_ct_request *ctreq; |
@@ -2167,7 +2174,6 @@ lpfc_bsg_diag_test(struct fc_bsg_job *job) | |||
2167 | sg_copy_to_buffer(job->request_payload.sg_list, | 2174 | sg_copy_to_buffer(job->request_payload.sg_list, |
2168 | job->request_payload.sg_cnt, | 2175 | job->request_payload.sg_cnt, |
2169 | ptr, size); | 2176 | ptr, size); |
2170 | |||
2171 | rc = lpfcdiag_loop_self_reg(phba, &rpi); | 2177 | rc = lpfcdiag_loop_self_reg(phba, &rpi); |
2172 | if (rc) | 2178 | if (rc) |
2173 | goto loopback_test_exit; | 2179 | goto loopback_test_exit; |
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index 9b95c50ba704..17fde522c84a 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h | |||
@@ -40,7 +40,7 @@ int lpfc_read_sparam(struct lpfc_hba *, LPFC_MBOXQ_t *, int); | |||
40 | void lpfc_read_config(struct lpfc_hba *, LPFC_MBOXQ_t *); | 40 | void lpfc_read_config(struct lpfc_hba *, LPFC_MBOXQ_t *); |
41 | void lpfc_read_lnk_stat(struct lpfc_hba *, LPFC_MBOXQ_t *); | 41 | void lpfc_read_lnk_stat(struct lpfc_hba *, LPFC_MBOXQ_t *); |
42 | int lpfc_reg_rpi(struct lpfc_hba *, uint16_t, uint32_t, uint8_t *, | 42 | int lpfc_reg_rpi(struct lpfc_hba *, uint16_t, uint32_t, uint8_t *, |
43 | LPFC_MBOXQ_t *, uint32_t); | 43 | LPFC_MBOXQ_t *, uint16_t); |
44 | void lpfc_set_var(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t, uint32_t); | 44 | void lpfc_set_var(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t, uint32_t); |
45 | void lpfc_unreg_login(struct lpfc_hba *, uint16_t, uint32_t, LPFC_MBOXQ_t *); | 45 | void lpfc_unreg_login(struct lpfc_hba *, uint16_t, uint32_t, LPFC_MBOXQ_t *); |
46 | void lpfc_unreg_did(struct lpfc_hba *, uint16_t, uint32_t, LPFC_MBOXQ_t *); | 46 | void lpfc_unreg_did(struct lpfc_hba *, uint16_t, uint32_t, LPFC_MBOXQ_t *); |
diff --git a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h index 2f73252d15f0..1d84b63fccad 100644 --- a/drivers/scsi/lpfc/lpfc_disc.h +++ b/drivers/scsi/lpfc/lpfc_disc.h | |||
@@ -153,7 +153,7 @@ struct lpfc_node_rrq { | |||
153 | #define NLP_NODEV_REMOVE 0x08000000 /* Defer removal till discovery ends */ | 153 | #define NLP_NODEV_REMOVE 0x08000000 /* Defer removal till discovery ends */ |
154 | #define NLP_TARGET_REMOVE 0x10000000 /* Target remove in process */ | 154 | #define NLP_TARGET_REMOVE 0x10000000 /* Target remove in process */ |
155 | #define NLP_SC_REQ 0x20000000 /* Target requires authentication */ | 155 | #define NLP_SC_REQ 0x20000000 /* Target requires authentication */ |
156 | #define NLP_RPI_VALID 0x80000000 /* nlp_rpi is valid */ | 156 | #define NLP_RPI_REGISTERED 0x80000000 /* nlp_rpi is valid */ |
157 | 157 | ||
158 | /* ndlp usage management macros */ | 158 | /* ndlp usage management macros */ |
159 | #define NLP_CHK_NODE_ACT(ndlp) (((ndlp)->nlp_usg_map \ | 159 | #define NLP_CHK_NODE_ACT(ndlp) (((ndlp)->nlp_usg_map \ |
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 0705ad86538f..c62d567cc845 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
@@ -375,7 +375,8 @@ lpfc_issue_fabric_reglogin(struct lpfc_vport *vport) | |||
375 | err = 4; | 375 | err = 4; |
376 | goto fail; | 376 | goto fail; |
377 | } | 377 | } |
378 | rc = lpfc_reg_rpi(phba, vport->vpi, Fabric_DID, (uint8_t *)sp, mbox, 0); | 378 | rc = lpfc_reg_rpi(phba, vport->vpi, Fabric_DID, (uint8_t *)sp, mbox, |
379 | ndlp->nlp_rpi); | ||
379 | if (rc) { | 380 | if (rc) { |
380 | err = 5; | 381 | err = 5; |
381 | goto fail_free_mbox; | 382 | goto fail_free_mbox; |
@@ -1023,7 +1024,9 @@ lpfc_issue_els_flogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
1023 | if (sp->cmn.fcphHigh < FC_PH3) | 1024 | if (sp->cmn.fcphHigh < FC_PH3) |
1024 | sp->cmn.fcphHigh = FC_PH3; | 1025 | sp->cmn.fcphHigh = FC_PH3; |
1025 | 1026 | ||
1026 | if (phba->sli_rev == LPFC_SLI_REV4) { | 1027 | if ((phba->sli_rev == LPFC_SLI_REV4) && |
1028 | (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == | ||
1029 | LPFC_SLI_INTF_IF_TYPE_0)) { | ||
1027 | elsiocb->iocb.ulpCt_h = ((SLI4_CT_FCFI >> 1) & 1); | 1030 | elsiocb->iocb.ulpCt_h = ((SLI4_CT_FCFI >> 1) & 1); |
1028 | elsiocb->iocb.ulpCt_l = (SLI4_CT_FCFI & 1); | 1031 | elsiocb->iocb.ulpCt_l = (SLI4_CT_FCFI & 1); |
1029 | /* FLOGI needs to be 3 for WQE FCFI */ | 1032 | /* FLOGI needs to be 3 for WQE FCFI */ |
@@ -3318,14 +3321,6 @@ lpfc_mbx_cmpl_dflt_rpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
3318 | struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) (pmb->context1); | 3321 | struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) (pmb->context1); |
3319 | struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) pmb->context2; | 3322 | struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) pmb->context2; |
3320 | 3323 | ||
3321 | /* | ||
3322 | * This routine is used to register and unregister in previous SLI | ||
3323 | * modes. | ||
3324 | */ | ||
3325 | if ((pmb->u.mb.mbxCommand == MBX_UNREG_LOGIN) && | ||
3326 | (phba->sli_rev == LPFC_SLI_REV4)) | ||
3327 | lpfc_sli4_free_rpi(phba, pmb->u.mb.un.varUnregLogin.rpi); | ||
3328 | |||
3329 | pmb->context1 = NULL; | 3324 | pmb->context1 = NULL; |
3330 | pmb->context2 = NULL; | 3325 | pmb->context2 = NULL; |
3331 | 3326 | ||
@@ -7090,7 +7085,9 @@ lpfc_issue_els_fdisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
7090 | icmd->un.elsreq64.myID = 0; | 7085 | icmd->un.elsreq64.myID = 0; |
7091 | icmd->un.elsreq64.fl = 1; | 7086 | icmd->un.elsreq64.fl = 1; |
7092 | 7087 | ||
7093 | if (phba->sli_rev == LPFC_SLI_REV4) { | 7088 | if ((phba->sli_rev == LPFC_SLI_REV4) && |
7089 | (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == | ||
7090 | LPFC_SLI_INTF_IF_TYPE_0)) { | ||
7094 | /* FDISC needs to be 1 for WQE VPI */ | 7091 | /* FDISC needs to be 1 for WQE VPI */ |
7095 | elsiocb->iocb.ulpCt_h = (SLI4_CT_VPI >> 1) & 1; | 7092 | elsiocb->iocb.ulpCt_h = (SLI4_CT_VPI >> 1) & 1; |
7096 | elsiocb->iocb.ulpCt_l = SLI4_CT_VPI & 1 ; | 7093 | elsiocb->iocb.ulpCt_l = SLI4_CT_VPI & 1 ; |
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 91fa65906173..f9f160ab2ee9 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -3102,8 +3102,8 @@ lpfc_mbx_cmpl_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
3102 | if (ndlp->nlp_flag & NLP_REG_LOGIN_SEND) | 3102 | if (ndlp->nlp_flag & NLP_REG_LOGIN_SEND) |
3103 | ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; | 3103 | ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; |
3104 | 3104 | ||
3105 | if (ndlp->nlp_flag & NLP_IGNR_REG_CMPL || | 3105 | if (ndlp->nlp_flag & NLP_IGNR_REG_CMPL || |
3106 | ndlp->nlp_state != NLP_STE_REG_LOGIN_ISSUE) { | 3106 | ndlp->nlp_state != NLP_STE_REG_LOGIN_ISSUE) { |
3107 | /* We rcvd a rscn after issuing this | 3107 | /* We rcvd a rscn after issuing this |
3108 | * mbox reg login, we may have cycled | 3108 | * mbox reg login, we may have cycled |
3109 | * back through the state and be | 3109 | * back through the state and be |
@@ -3115,10 +3115,6 @@ lpfc_mbx_cmpl_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
3115 | spin_lock_irq(shost->host_lock); | 3115 | spin_lock_irq(shost->host_lock); |
3116 | ndlp->nlp_flag &= ~NLP_IGNR_REG_CMPL; | 3116 | ndlp->nlp_flag &= ~NLP_IGNR_REG_CMPL; |
3117 | spin_unlock_irq(shost->host_lock); | 3117 | spin_unlock_irq(shost->host_lock); |
3118 | if (phba->sli_rev == LPFC_SLI_REV4) | ||
3119 | lpfc_sli4_free_rpi(phba, | ||
3120 | pmb->u.mb.un.varRegLogin.rpi); | ||
3121 | |||
3122 | } else | 3118 | } else |
3123 | /* Good status, call state machine */ | 3119 | /* Good status, call state machine */ |
3124 | lpfc_disc_state_machine(vport, ndlp, pmb, | 3120 | lpfc_disc_state_machine(vport, ndlp, pmb, |
@@ -3428,7 +3424,7 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
3428 | } | 3424 | } |
3429 | 3425 | ||
3430 | ndlp->nlp_rpi = mb->un.varWords[0]; | 3426 | ndlp->nlp_rpi = mb->un.varWords[0]; |
3431 | ndlp->nlp_flag |= NLP_RPI_VALID; | 3427 | ndlp->nlp_flag |= NLP_RPI_REGISTERED; |
3432 | ndlp->nlp_type |= NLP_FABRIC; | 3428 | ndlp->nlp_type |= NLP_FABRIC; |
3433 | lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); | 3429 | lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); |
3434 | 3430 | ||
@@ -3502,7 +3498,7 @@ out: | |||
3502 | } | 3498 | } |
3503 | 3499 | ||
3504 | ndlp->nlp_rpi = mb->un.varWords[0]; | 3500 | ndlp->nlp_rpi = mb->un.varWords[0]; |
3505 | ndlp->nlp_flag |= NLP_RPI_VALID; | 3501 | ndlp->nlp_flag |= NLP_RPI_REGISTERED; |
3506 | ndlp->nlp_type |= NLP_FABRIC; | 3502 | ndlp->nlp_type |= NLP_FABRIC; |
3507 | lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); | 3503 | lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); |
3508 | 3504 | ||
@@ -3835,6 +3831,8 @@ lpfc_initialize_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
3835 | NLP_INT_NODE_ACT(ndlp); | 3831 | NLP_INT_NODE_ACT(ndlp); |
3836 | atomic_set(&ndlp->cmd_pending, 0); | 3832 | atomic_set(&ndlp->cmd_pending, 0); |
3837 | ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; | 3833 | ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; |
3834 | if (vport->phba->sli_rev == LPFC_SLI_REV4) | ||
3835 | ndlp->nlp_rpi = lpfc_sli4_alloc_rpi(vport->phba); | ||
3838 | } | 3836 | } |
3839 | 3837 | ||
3840 | struct lpfc_nodelist * | 3838 | struct lpfc_nodelist * |
@@ -4048,7 +4046,7 @@ lpfc_no_rpi(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) | |||
4048 | * by firmware with a no rpi error. | 4046 | * by firmware with a no rpi error. |
4049 | */ | 4047 | */ |
4050 | psli = &phba->sli; | 4048 | psli = &phba->sli; |
4051 | if (ndlp->nlp_flag & NLP_RPI_VALID) { | 4049 | if (ndlp->nlp_flag & NLP_RPI_REGISTERED) { |
4052 | /* Now process each ring */ | 4050 | /* Now process each ring */ |
4053 | for (i = 0; i < psli->num_rings; i++) { | 4051 | for (i = 0; i < psli->num_rings; i++) { |
4054 | pring = &psli->ring[i]; | 4052 | pring = &psli->ring[i]; |
@@ -4096,7 +4094,7 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) | |||
4096 | LPFC_MBOXQ_t *mbox; | 4094 | LPFC_MBOXQ_t *mbox; |
4097 | int rc; | 4095 | int rc; |
4098 | 4096 | ||
4099 | if (ndlp->nlp_flag & NLP_RPI_VALID) { | 4097 | if (ndlp->nlp_flag & NLP_RPI_REGISTERED) { |
4100 | mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 4098 | mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
4101 | if (mbox) { | 4099 | if (mbox) { |
4102 | lpfc_unreg_login(phba, vport->vpi, ndlp->nlp_rpi, mbox); | 4100 | lpfc_unreg_login(phba, vport->vpi, ndlp->nlp_rpi, mbox); |
@@ -4108,8 +4106,9 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) | |||
4108 | } | 4106 | } |
4109 | lpfc_no_rpi(phba, ndlp); | 4107 | lpfc_no_rpi(phba, ndlp); |
4110 | 4108 | ||
4111 | ndlp->nlp_rpi = 0; | 4109 | if (phba->sli_rev != LPFC_SLI_REV4) |
4112 | ndlp->nlp_flag &= ~NLP_RPI_VALID; | 4110 | ndlp->nlp_rpi = 0; |
4111 | ndlp->nlp_flag &= ~NLP_RPI_REGISTERED; | ||
4113 | ndlp->nlp_flag &= ~NLP_NPR_ADISC; | 4112 | ndlp->nlp_flag &= ~NLP_NPR_ADISC; |
4114 | return 1; | 4113 | return 1; |
4115 | } | 4114 | } |
@@ -4141,7 +4140,7 @@ lpfc_unreg_hba_rpis(struct lpfc_hba *phba) | |||
4141 | shost = lpfc_shost_from_vport(vports[i]); | 4140 | shost = lpfc_shost_from_vport(vports[i]); |
4142 | spin_lock_irq(shost->host_lock); | 4141 | spin_lock_irq(shost->host_lock); |
4143 | list_for_each_entry(ndlp, &vports[i]->fc_nodes, nlp_listp) { | 4142 | list_for_each_entry(ndlp, &vports[i]->fc_nodes, nlp_listp) { |
4144 | if (ndlp->nlp_flag & NLP_RPI_VALID) { | 4143 | if (ndlp->nlp_flag & NLP_RPI_REGISTERED) { |
4145 | /* The mempool_alloc might sleep */ | 4144 | /* The mempool_alloc might sleep */ |
4146 | spin_unlock_irq(shost->host_lock); | 4145 | spin_unlock_irq(shost->host_lock); |
4147 | lpfc_unreg_rpi(vports[i], ndlp); | 4146 | lpfc_unreg_rpi(vports[i], ndlp); |
@@ -4270,9 +4269,6 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) | |||
4270 | kfree(mp); | 4269 | kfree(mp); |
4271 | } | 4270 | } |
4272 | list_del(&mb->list); | 4271 | list_del(&mb->list); |
4273 | if (phba->sli_rev == LPFC_SLI_REV4) | ||
4274 | lpfc_sli4_free_rpi(phba, | ||
4275 | mb->u.mb.un.varRegLogin.rpi); | ||
4276 | mempool_free(mb, phba->mbox_mem_pool); | 4272 | mempool_free(mb, phba->mbox_mem_pool); |
4277 | /* We shall not invoke the lpfc_nlp_put to decrement | 4273 | /* We shall not invoke the lpfc_nlp_put to decrement |
4278 | * the ndlp reference count as we are in the process | 4274 | * the ndlp reference count as we are in the process |
@@ -4314,15 +4310,15 @@ lpfc_nlp_remove(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) | |||
4314 | 4310 | ||
4315 | lpfc_cancel_retry_delay_tmo(vport, ndlp); | 4311 | lpfc_cancel_retry_delay_tmo(vport, ndlp); |
4316 | if ((ndlp->nlp_flag & NLP_DEFER_RM) && | 4312 | if ((ndlp->nlp_flag & NLP_DEFER_RM) && |
4317 | !(ndlp->nlp_flag & NLP_REG_LOGIN_SEND) && | 4313 | !(ndlp->nlp_flag & NLP_REG_LOGIN_SEND) && |
4318 | !(ndlp->nlp_flag & NLP_RPI_VALID)) { | 4314 | !(ndlp->nlp_flag & NLP_RPI_REGISTERED)) { |
4319 | /* For this case we need to cleanup the default rpi | 4315 | /* For this case we need to cleanup the default rpi |
4320 | * allocated by the firmware. | 4316 | * allocated by the firmware. |
4321 | */ | 4317 | */ |
4322 | if ((mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL)) | 4318 | if ((mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL)) |
4323 | != NULL) { | 4319 | != NULL) { |
4324 | rc = lpfc_reg_rpi(phba, vport->vpi, ndlp->nlp_DID, | 4320 | rc = lpfc_reg_rpi(phba, vport->vpi, ndlp->nlp_DID, |
4325 | (uint8_t *) &vport->fc_sparam, mbox, 0); | 4321 | (uint8_t *) &vport->fc_sparam, mbox, ndlp->nlp_rpi); |
4326 | if (rc) { | 4322 | if (rc) { |
4327 | mempool_free(mbox, phba->mbox_mem_pool); | 4323 | mempool_free(mbox, phba->mbox_mem_pool); |
4328 | } | 4324 | } |
@@ -5060,7 +5056,7 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
5060 | pmb->context2 = NULL; | 5056 | pmb->context2 = NULL; |
5061 | 5057 | ||
5062 | ndlp->nlp_rpi = mb->un.varWords[0]; | 5058 | ndlp->nlp_rpi = mb->un.varWords[0]; |
5063 | ndlp->nlp_flag |= NLP_RPI_VALID; | 5059 | ndlp->nlp_flag |= NLP_RPI_REGISTERED; |
5064 | ndlp->nlp_type |= NLP_FABRIC; | 5060 | ndlp->nlp_type |= NLP_FABRIC; |
5065 | lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); | 5061 | lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); |
5066 | 5062 | ||
@@ -5184,6 +5180,8 @@ lpfc_nlp_release(struct kref *kref) | |||
5184 | spin_lock_irqsave(&phba->ndlp_lock, flags); | 5180 | spin_lock_irqsave(&phba->ndlp_lock, flags); |
5185 | NLP_CLR_NODE_ACT(ndlp); | 5181 | NLP_CLR_NODE_ACT(ndlp); |
5186 | spin_unlock_irqrestore(&phba->ndlp_lock, flags); | 5182 | spin_unlock_irqrestore(&phba->ndlp_lock, flags); |
5183 | if (phba->sli_rev == LPFC_SLI_REV4) | ||
5184 | lpfc_sli4_free_rpi(phba, ndlp->nlp_rpi); | ||
5187 | 5185 | ||
5188 | /* free ndlp memory for final ndlp release */ | 5186 | /* free ndlp memory for final ndlp release */ |
5189 | if (NLP_CHK_FREE_REQ(ndlp)) { | 5187 | if (NLP_CHK_FREE_REQ(ndlp)) { |
@@ -5354,7 +5352,7 @@ lpfc_fcf_inuse(struct lpfc_hba *phba) | |||
5354 | "logged in\n", | 5352 | "logged in\n", |
5355 | ndlp->nlp_rpi, ndlp->nlp_DID, | 5353 | ndlp->nlp_rpi, ndlp->nlp_DID, |
5356 | ndlp->nlp_flag); | 5354 | ndlp->nlp_flag); |
5357 | if (ndlp->nlp_flag & NLP_RPI_VALID) | 5355 | if (ndlp->nlp_flag & NLP_RPI_REGISTERED) |
5358 | ret = 1; | 5356 | ret = 1; |
5359 | } | 5357 | } |
5360 | } | 5358 | } |
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c index b1dab92628ee..23403c650207 100644 --- a/drivers/scsi/lpfc/lpfc_mbox.c +++ b/drivers/scsi/lpfc/lpfc_mbox.c | |||
@@ -710,7 +710,7 @@ lpfc_read_lnk_stat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
710 | * @did: remote port identifier. | 710 | * @did: remote port identifier. |
711 | * @param: pointer to memory holding the server parameters. | 711 | * @param: pointer to memory holding the server parameters. |
712 | * @pmb: pointer to the driver internal queue element for mailbox command. | 712 | * @pmb: pointer to the driver internal queue element for mailbox command. |
713 | * @flag: action flag to be passed back for the complete function. | 713 | * @rpi: the rpi to use in the registration (usually only used for SLI4. |
714 | * | 714 | * |
715 | * The registration login mailbox command is used to register an N_Port or | 715 | * The registration login mailbox command is used to register an N_Port or |
716 | * F_Port login. This registration allows the HBA to cache the remote N_Port | 716 | * F_Port login. This registration allows the HBA to cache the remote N_Port |
@@ -729,7 +729,7 @@ lpfc_read_lnk_stat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
729 | **/ | 729 | **/ |
730 | int | 730 | int |
731 | lpfc_reg_rpi(struct lpfc_hba *phba, uint16_t vpi, uint32_t did, | 731 | lpfc_reg_rpi(struct lpfc_hba *phba, uint16_t vpi, uint32_t did, |
732 | uint8_t *param, LPFC_MBOXQ_t *pmb, uint32_t flag) | 732 | uint8_t *param, LPFC_MBOXQ_t *pmb, uint16_t rpi) |
733 | { | 733 | { |
734 | MAILBOX_t *mb = &pmb->u.mb; | 734 | MAILBOX_t *mb = &pmb->u.mb; |
735 | uint8_t *sparam; | 735 | uint8_t *sparam; |
@@ -739,17 +739,13 @@ lpfc_reg_rpi(struct lpfc_hba *phba, uint16_t vpi, uint32_t did, | |||
739 | 739 | ||
740 | mb->un.varRegLogin.rpi = 0; | 740 | mb->un.varRegLogin.rpi = 0; |
741 | if (phba->sli_rev == LPFC_SLI_REV4) { | 741 | if (phba->sli_rev == LPFC_SLI_REV4) { |
742 | mb->un.varRegLogin.rpi = lpfc_sli4_alloc_rpi(phba); | 742 | mb->un.varRegLogin.rpi = rpi; |
743 | if (mb->un.varRegLogin.rpi == LPFC_RPI_ALLOC_ERROR) | 743 | if (mb->un.varRegLogin.rpi == LPFC_RPI_ALLOC_ERROR) |
744 | return 1; | 744 | return 1; |
745 | } | 745 | } |
746 | |||
747 | mb->un.varRegLogin.vpi = vpi + phba->vpi_base; | 746 | mb->un.varRegLogin.vpi = vpi + phba->vpi_base; |
748 | mb->un.varRegLogin.did = did; | 747 | mb->un.varRegLogin.did = did; |
749 | mb->un.varWords[30] = flag; /* Set flag to issue action on cmpl */ | ||
750 | |||
751 | mb->mbxOwner = OWN_HOST; | 748 | mb->mbxOwner = OWN_HOST; |
752 | |||
753 | /* Get a buffer to hold NPorts Service Parameters */ | 749 | /* Get a buffer to hold NPorts Service Parameters */ |
754 | mp = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL); | 750 | mp = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL); |
755 | if (mp) | 751 | if (mp) |
@@ -760,7 +756,7 @@ lpfc_reg_rpi(struct lpfc_hba *phba, uint16_t vpi, uint32_t did, | |||
760 | /* REG_LOGIN: no buffers */ | 756 | /* REG_LOGIN: no buffers */ |
761 | lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, | 757 | lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, |
762 | "0302 REG_LOGIN: no buffers, VPI:%d DID:x%x, " | 758 | "0302 REG_LOGIN: no buffers, VPI:%d DID:x%x, " |
763 | "flag x%x\n", vpi, did, flag); | 759 | "rpi x%x\n", vpi, did, rpi); |
764 | return (1); | 760 | return (1); |
765 | } | 761 | } |
766 | INIT_LIST_HEAD(&mp->list); | 762 | INIT_LIST_HEAD(&mp->list); |
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index bccc9c66fa37..d85a7423a694 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c | |||
@@ -386,7 +386,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
386 | goto out; | 386 | goto out; |
387 | 387 | ||
388 | rc = lpfc_reg_rpi(phba, vport->vpi, icmd->un.rcvels.remoteID, | 388 | rc = lpfc_reg_rpi(phba, vport->vpi, icmd->un.rcvels.remoteID, |
389 | (uint8_t *) sp, mbox, 0); | 389 | (uint8_t *) sp, mbox, ndlp->nlp_rpi); |
390 | if (rc) { | 390 | if (rc) { |
391 | mempool_free(mbox, phba->mbox_mem_pool); | 391 | mempool_free(mbox, phba->mbox_mem_pool); |
392 | goto out; | 392 | goto out; |
@@ -632,7 +632,7 @@ lpfc_disc_set_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) | |||
632 | { | 632 | { |
633 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 633 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
634 | 634 | ||
635 | if (!(ndlp->nlp_flag & NLP_RPI_VALID)) { | 635 | if (!(ndlp->nlp_flag & NLP_RPI_REGISTERED)) { |
636 | ndlp->nlp_flag &= ~NLP_NPR_ADISC; | 636 | ndlp->nlp_flag &= ~NLP_NPR_ADISC; |
637 | return 0; | 637 | return 0; |
638 | } | 638 | } |
@@ -968,7 +968,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport, | |||
968 | lpfc_unreg_rpi(vport, ndlp); | 968 | lpfc_unreg_rpi(vport, ndlp); |
969 | 969 | ||
970 | if (lpfc_reg_rpi(phba, vport->vpi, irsp->un.elsreq64.remoteID, | 970 | if (lpfc_reg_rpi(phba, vport->vpi, irsp->un.elsreq64.remoteID, |
971 | (uint8_t *) sp, mbox, 0) == 0) { | 971 | (uint8_t *) sp, mbox, ndlp->nlp_rpi) == 0) { |
972 | switch (ndlp->nlp_DID) { | 972 | switch (ndlp->nlp_DID) { |
973 | case NameServer_DID: | 973 | case NameServer_DID: |
974 | mbox->mbox_cmpl = lpfc_mbx_cmpl_ns_reg_login; | 974 | mbox->mbox_cmpl = lpfc_mbx_cmpl_ns_reg_login; |
@@ -1338,12 +1338,6 @@ lpfc_rcv_logo_reglogin_issue(struct lpfc_vport *vport, | |||
1338 | list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) { | 1338 | list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) { |
1339 | if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && | 1339 | if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && |
1340 | (ndlp == (struct lpfc_nodelist *) mb->context2)) { | 1340 | (ndlp == (struct lpfc_nodelist *) mb->context2)) { |
1341 | if (phba->sli_rev == LPFC_SLI_REV4) { | ||
1342 | spin_unlock_irq(&phba->hbalock); | ||
1343 | lpfc_sli4_free_rpi(phba, | ||
1344 | mb->u.mb.un.varRegLogin.rpi); | ||
1345 | spin_lock_irq(&phba->hbalock); | ||
1346 | } | ||
1347 | mp = (struct lpfc_dmabuf *) (mb->context1); | 1341 | mp = (struct lpfc_dmabuf *) (mb->context1); |
1348 | if (mp) { | 1342 | if (mp) { |
1349 | __lpfc_mbuf_free(phba, mp->virt, mp->phys); | 1343 | __lpfc_mbuf_free(phba, mp->virt, mp->phys); |
@@ -1426,7 +1420,7 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_vport *vport, | |||
1426 | } | 1420 | } |
1427 | 1421 | ||
1428 | ndlp->nlp_rpi = mb->un.varWords[0]; | 1422 | ndlp->nlp_rpi = mb->un.varWords[0]; |
1429 | ndlp->nlp_flag |= NLP_RPI_VALID; | 1423 | ndlp->nlp_flag |= NLP_RPI_REGISTERED; |
1430 | 1424 | ||
1431 | /* Only if we are not a fabric nport do we issue PRLI */ | 1425 | /* Only if we are not a fabric nport do we issue PRLI */ |
1432 | if (!(ndlp->nlp_type & NLP_FABRIC)) { | 1426 | if (!(ndlp->nlp_type & NLP_FABRIC)) { |
@@ -2027,7 +2021,7 @@ lpfc_cmpl_reglogin_npr_node(struct lpfc_vport *vport, | |||
2027 | 2021 | ||
2028 | if (!mb->mbxStatus) { | 2022 | if (!mb->mbxStatus) { |
2029 | ndlp->nlp_rpi = mb->un.varWords[0]; | 2023 | ndlp->nlp_rpi = mb->un.varWords[0]; |
2030 | ndlp->nlp_flag |= NLP_RPI_VALID; | 2024 | ndlp->nlp_flag |= NLP_RPI_REGISTERED; |
2031 | } else { | 2025 | } else { |
2032 | if (ndlp->nlp_flag & NLP_NODEV_REMOVE) { | 2026 | if (ndlp->nlp_flag & NLP_NODEV_REMOVE) { |
2033 | lpfc_drop_node(vport, ndlp); | 2027 | lpfc_drop_node(vport, ndlp); |
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index d6f3b83f3219..e98e792ab045 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -2116,11 +2116,6 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
2116 | kfree(mp); | 2116 | kfree(mp); |
2117 | } | 2117 | } |
2118 | 2118 | ||
2119 | if ((pmb->u.mb.mbxCommand == MBX_UNREG_LOGIN) && | ||
2120 | (phba->sli_rev == LPFC_SLI_REV4) && | ||
2121 | (pmb->u.mb.un.varUnregLogin.rsvd1 == 0x0)) | ||
2122 | lpfc_sli4_free_rpi(phba, pmb->u.mb.un.varUnregLogin.rpi); | ||
2123 | |||
2124 | /* | 2119 | /* |
2125 | * If a REG_LOGIN succeeded after node is destroyed or node | 2120 | * If a REG_LOGIN succeeded after node is destroyed or node |
2126 | * is in re-discovery driver need to cleanup the RPI. | 2121 | * is in re-discovery driver need to cleanup the RPI. |
@@ -6426,11 +6421,6 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq, | |||
6426 | bf_set(els_req64_vf, &wqe->els_req, 0); | 6421 | bf_set(els_req64_vf, &wqe->els_req, 0); |
6427 | /* And a VFID for word 12 */ | 6422 | /* And a VFID for word 12 */ |
6428 | bf_set(els_req64_vfid, &wqe->els_req, 0); | 6423 | bf_set(els_req64_vfid, &wqe->els_req, 0); |
6429 | /* | ||
6430 | * Set ct field to 3, indicates that the context_tag field | ||
6431 | * contains the FCFI and remote N_Port_ID is | ||
6432 | * in word 5. | ||
6433 | */ | ||
6434 | ct = ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l); | 6424 | ct = ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l); |
6435 | bf_set(wqe_ctxt_tag, &wqe->els_req.wqe_com, | 6425 | bf_set(wqe_ctxt_tag, &wqe->els_req.wqe_com, |
6436 | iocbq->iocb.ulpContext); | 6426 | iocbq->iocb.ulpContext); |
@@ -13372,9 +13362,6 @@ lpfc_cleanup_pending_mbox(struct lpfc_vport *vport) | |||
13372 | while (!list_empty(&mbox_cmd_list)) { | 13362 | while (!list_empty(&mbox_cmd_list)) { |
13373 | list_remove_head(&mbox_cmd_list, mb, LPFC_MBOXQ_t, list); | 13363 | list_remove_head(&mbox_cmd_list, mb, LPFC_MBOXQ_t, list); |
13374 | if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) { | 13364 | if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) { |
13375 | if (phba->sli_rev == LPFC_SLI_REV4) | ||
13376 | __lpfc_sli4_free_rpi(phba, | ||
13377 | mb->u.mb.un.varRegLogin.rpi); | ||
13378 | mp = (struct lpfc_dmabuf *) (mb->context1); | 13365 | mp = (struct lpfc_dmabuf *) (mb->context1); |
13379 | if (mp) { | 13366 | if (mp) { |
13380 | __lpfc_mbuf_free(phba, mp->virt, mp->phys); | 13367 | __lpfc_mbuf_free(phba, mp->virt, mp->phys); |
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h index eb0fedfbf370..c7217d579e0f 100644 --- a/drivers/scsi/lpfc/lpfc_sli4.h +++ b/drivers/scsi/lpfc/lpfc_sli4.h | |||
@@ -551,7 +551,6 @@ int lpfc_sli4_post_all_rpi_hdrs(struct lpfc_hba *); | |||
551 | struct lpfc_rpi_hdr *lpfc_sli4_create_rpi_hdr(struct lpfc_hba *); | 551 | struct lpfc_rpi_hdr *lpfc_sli4_create_rpi_hdr(struct lpfc_hba *); |
552 | void lpfc_sli4_remove_rpi_hdrs(struct lpfc_hba *); | 552 | void lpfc_sli4_remove_rpi_hdrs(struct lpfc_hba *); |
553 | int lpfc_sli4_alloc_rpi(struct lpfc_hba *); | 553 | int lpfc_sli4_alloc_rpi(struct lpfc_hba *); |
554 | void __lpfc_sli4_free_rpi(struct lpfc_hba *, int); | ||
555 | void lpfc_sli4_free_rpi(struct lpfc_hba *, int); | 554 | void lpfc_sli4_free_rpi(struct lpfc_hba *, int); |
556 | void lpfc_sli4_remove_rpis(struct lpfc_hba *); | 555 | void lpfc_sli4_remove_rpis(struct lpfc_hba *); |
557 | void lpfc_sli4_async_event_proc(struct lpfc_hba *); | 556 | void lpfc_sli4_async_event_proc(struct lpfc_hba *); |