aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_sli.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c458
1 files changed, 275 insertions, 183 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index c5614cfcc6e9..22f17087883c 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -95,7 +95,7 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe *wqe)
95 return -ENOMEM; 95 return -ENOMEM;
96 /* set consumption flag every once in a while */ 96 /* set consumption flag every once in a while */
97 if (!((q->host_index + 1) % LPFC_RELEASE_NOTIFICATION_INTERVAL)) 97 if (!((q->host_index + 1) % LPFC_RELEASE_NOTIFICATION_INTERVAL))
98 bf_set(lpfc_wqe_gen_wqec, &wqe->generic, 1); 98 bf_set(wqe_wqec, &wqe->generic.wqe_com, 1);
99 99
100 lpfc_sli_pcimem_bcopy(wqe, temp_wqe, q->entry_size); 100 lpfc_sli_pcimem_bcopy(wqe, temp_wqe, q->entry_size);
101 101
@@ -1735,6 +1735,7 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1735 struct lpfc_vport *vport = pmb->vport; 1735 struct lpfc_vport *vport = pmb->vport;
1736 struct lpfc_dmabuf *mp; 1736 struct lpfc_dmabuf *mp;
1737 struct lpfc_nodelist *ndlp; 1737 struct lpfc_nodelist *ndlp;
1738 struct Scsi_Host *shost;
1738 uint16_t rpi, vpi; 1739 uint16_t rpi, vpi;
1739 int rc; 1740 int rc;
1740 1741
@@ -1746,7 +1747,8 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1746 } 1747 }
1747 1748
1748 if ((pmb->u.mb.mbxCommand == MBX_UNREG_LOGIN) && 1749 if ((pmb->u.mb.mbxCommand == MBX_UNREG_LOGIN) &&
1749 (phba->sli_rev == LPFC_SLI_REV4)) 1750 (phba->sli_rev == LPFC_SLI_REV4) &&
1751 (pmb->u.mb.un.varUnregLogin.rsvd1 == 0x0))
1750 lpfc_sli4_free_rpi(phba, pmb->u.mb.un.varUnregLogin.rpi); 1752 lpfc_sli4_free_rpi(phba, pmb->u.mb.un.varUnregLogin.rpi);
1751 1753
1752 /* 1754 /*
@@ -1765,16 +1767,14 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1765 return; 1767 return;
1766 } 1768 }
1767 1769
1768 /* Unreg VPI, if the REG_VPI succeed after VLink failure */
1769 if ((pmb->u.mb.mbxCommand == MBX_REG_VPI) && 1770 if ((pmb->u.mb.mbxCommand == MBX_REG_VPI) &&
1770 !(phba->pport->load_flag & FC_UNLOADING) && 1771 !(phba->pport->load_flag & FC_UNLOADING) &&
1771 !pmb->u.mb.mbxStatus) { 1772 !pmb->u.mb.mbxStatus) {
1772 lpfc_unreg_vpi(phba, pmb->u.mb.un.varRegVpi.vpi, pmb); 1773 shost = lpfc_shost_from_vport(vport);
1773 pmb->vport = vport; 1774 spin_lock_irq(shost->host_lock);
1774 pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; 1775 vport->vpi_state |= LPFC_VPI_REGISTERED;
1775 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); 1776 vport->fc_flag &= ~FC_VPORT_NEEDS_REG_VPI;
1776 if (rc != MBX_NOT_FINISHED) 1777 spin_unlock_irq(shost->host_lock);
1777 return;
1778 } 1778 }
1779 1779
1780 if (pmb->u.mb.mbxCommand == MBX_REG_LOGIN64) { 1780 if (pmb->u.mb.mbxCommand == MBX_REG_LOGIN64) {
@@ -5921,7 +5921,7 @@ lpfc_sli4_bpl2sgl(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq,
5921 * lpfc_sli4_scmd_to_wqidx_distr - scsi command to SLI4 WQ index distribution 5921 * lpfc_sli4_scmd_to_wqidx_distr - scsi command to SLI4 WQ index distribution
5922 * @phba: Pointer to HBA context object. 5922 * @phba: Pointer to HBA context object.
5923 * 5923 *
5924 * This routine performs a round robin SCSI command to SLI4 FCP WQ index 5924 * This routine performs a roundrobin SCSI command to SLI4 FCP WQ index
5925 * distribution. This is called by __lpfc_sli_issue_iocb_s4() with the hbalock 5925 * distribution. This is called by __lpfc_sli_issue_iocb_s4() with the hbalock
5926 * held. 5926 * held.
5927 * 5927 *
@@ -5965,7 +5965,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
5965 uint16_t abrt_iotag; 5965 uint16_t abrt_iotag;
5966 struct lpfc_iocbq *abrtiocbq; 5966 struct lpfc_iocbq *abrtiocbq;
5967 struct ulp_bde64 *bpl = NULL; 5967 struct ulp_bde64 *bpl = NULL;
5968 uint32_t els_id = ELS_ID_DEFAULT; 5968 uint32_t els_id = LPFC_ELS_ID_DEFAULT;
5969 int numBdes, i; 5969 int numBdes, i;
5970 struct ulp_bde64 bde; 5970 struct ulp_bde64 bde;
5971 5971
@@ -5982,7 +5982,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
5982 memcpy(wqe, &iocbq->iocb, sizeof(union lpfc_wqe)); 5982 memcpy(wqe, &iocbq->iocb, sizeof(union lpfc_wqe));
5983 abort_tag = (uint32_t) iocbq->iotag; 5983 abort_tag = (uint32_t) iocbq->iotag;
5984 xritag = iocbq->sli4_xritag; 5984 xritag = iocbq->sli4_xritag;
5985 wqe->words[7] = 0; /* The ct field has moved so reset */ 5985 wqe->generic.wqe_com.word7 = 0; /* The ct field has moved so reset */
5986 /* words0-2 bpl convert bde */ 5986 /* words0-2 bpl convert bde */
5987 if (iocbq->iocb.un.genreq64.bdl.bdeFlags == BUFF_TYPE_BLP_64) { 5987 if (iocbq->iocb.un.genreq64.bdl.bdeFlags == BUFF_TYPE_BLP_64) {
5988 numBdes = iocbq->iocb.un.genreq64.bdl.bdeSize / 5988 numBdes = iocbq->iocb.un.genreq64.bdl.bdeSize /
@@ -6033,109 +6033,117 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
6033 * contains the FCFI and remote N_Port_ID is 6033 * contains the FCFI and remote N_Port_ID is
6034 * in word 5. 6034 * in word 5.
6035 */ 6035 */
6036
6037 ct = ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l); 6036 ct = ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l);
6038 bf_set(lpfc_wqe_gen_context, &wqe->generic, 6037 bf_set(wqe_ctxt_tag, &wqe->els_req.wqe_com,
6039 iocbq->iocb.ulpContext); 6038 iocbq->iocb.ulpContext);
6040 6039 bf_set(wqe_ct, &wqe->els_req.wqe_com, ct);
6041 bf_set(lpfc_wqe_gen_ct, &wqe->generic, ct); 6040 bf_set(wqe_pu, &wqe->els_req.wqe_com, 0);
6042 bf_set(lpfc_wqe_gen_pu, &wqe->generic, 0);
6043 /* CCP CCPE PV PRI in word10 were set in the memcpy */ 6041 /* CCP CCPE PV PRI in word10 were set in the memcpy */
6044
6045 if (command_type == ELS_COMMAND_FIP) { 6042 if (command_type == ELS_COMMAND_FIP) {
6046 els_id = ((iocbq->iocb_flag & LPFC_FIP_ELS_ID_MASK) 6043 els_id = ((iocbq->iocb_flag & LPFC_FIP_ELS_ID_MASK)
6047 >> LPFC_FIP_ELS_ID_SHIFT); 6044 >> LPFC_FIP_ELS_ID_SHIFT);
6048 } 6045 }
6049 bf_set(lpfc_wqe_gen_els_id, &wqe->generic, els_id); 6046 bf_set(wqe_els_id, &wqe->els_req.wqe_com, els_id);
6050 6047 bf_set(wqe_dbde, &wqe->els_req.wqe_com, 1);
6048 bf_set(wqe_iod, &wqe->els_req.wqe_com, LPFC_WQE_IOD_READ);
6049 bf_set(wqe_qosd, &wqe->els_req.wqe_com, 1);
6050 bf_set(wqe_lenloc, &wqe->els_req.wqe_com, LPFC_WQE_LENLOC_NONE);
6051 bf_set(wqe_ebde_cnt, &wqe->els_req.wqe_com, 0);
6051 break; 6052 break;
6052 case CMD_XMIT_SEQUENCE64_CX: 6053 case CMD_XMIT_SEQUENCE64_CX:
6053 bf_set(lpfc_wqe_gen_context, &wqe->generic, 6054 bf_set(wqe_ctxt_tag, &wqe->xmit_sequence.wqe_com,
6054 iocbq->iocb.un.ulpWord[3]); 6055 iocbq->iocb.un.ulpWord[3]);
6055 wqe->generic.word3 = 0; 6056 bf_set(wqe_rcvoxid, &wqe->xmit_sequence.wqe_com,
6056 bf_set(wqe_rcvoxid, &wqe->generic, iocbq->iocb.ulpContext); 6057 iocbq->iocb.ulpContext);
6057 /* The entire sequence is transmitted for this IOCB */ 6058 /* The entire sequence is transmitted for this IOCB */
6058 xmit_len = total_len; 6059 xmit_len = total_len;
6059 cmnd = CMD_XMIT_SEQUENCE64_CR; 6060 cmnd = CMD_XMIT_SEQUENCE64_CR;
6060 case CMD_XMIT_SEQUENCE64_CR: 6061 case CMD_XMIT_SEQUENCE64_CR:
6061 /* word3 iocb=io_tag32 wqe=payload_offset */ 6062 /* word3 iocb=io_tag32 wqe=reserved */
6062 /* payload offset used for multilpe outstanding 6063 wqe->xmit_sequence.rsvd3 = 0;
6063 * sequences on the same exchange
6064 */
6065 wqe->words[3] = 0;
6066 /* word4 relative_offset memcpy */ 6064 /* word4 relative_offset memcpy */
6067 /* word5 r_ctl/df_ctl memcpy */ 6065 /* word5 r_ctl/df_ctl memcpy */
6068 bf_set(lpfc_wqe_gen_pu, &wqe->generic, 0); 6066 bf_set(wqe_pu, &wqe->xmit_sequence.wqe_com, 0);
6067 bf_set(wqe_dbde, &wqe->xmit_sequence.wqe_com, 1);
6068 bf_set(wqe_iod, &wqe->xmit_sequence.wqe_com,
6069 LPFC_WQE_IOD_WRITE);
6070 bf_set(wqe_lenloc, &wqe->xmit_sequence.wqe_com,
6071 LPFC_WQE_LENLOC_WORD12);
6072 bf_set(wqe_ebde_cnt, &wqe->xmit_sequence.wqe_com, 0);
6069 wqe->xmit_sequence.xmit_len = xmit_len; 6073 wqe->xmit_sequence.xmit_len = xmit_len;
6070 command_type = OTHER_COMMAND; 6074 command_type = OTHER_COMMAND;
6071 break; 6075 break;
6072 case CMD_XMIT_BCAST64_CN: 6076 case CMD_XMIT_BCAST64_CN:
6073 /* word3 iocb=iotag32 wqe=payload_len */ 6077 /* word3 iocb=iotag32 wqe=seq_payload_len */
6074 wqe->words[3] = 0; /* no definition for this in wqe */ 6078 wqe->xmit_bcast64.seq_payload_len = xmit_len;
6075 /* word4 iocb=rsvd wqe=rsvd */ 6079 /* word4 iocb=rsvd wqe=rsvd */
6076 /* word5 iocb=rctl/type/df_ctl wqe=rctl/type/df_ctl memcpy */ 6080 /* word5 iocb=rctl/type/df_ctl wqe=rctl/type/df_ctl memcpy */
6077 /* word6 iocb=ctxt_tag/io_tag wqe=ctxt_tag/xri */ 6081 /* word6 iocb=ctxt_tag/io_tag wqe=ctxt_tag/xri */
6078 bf_set(lpfc_wqe_gen_ct, &wqe->generic, 6082 bf_set(wqe_ct, &wqe->xmit_bcast64.wqe_com,
6079 ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l)); 6083 ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l));
6084 bf_set(wqe_dbde, &wqe->xmit_bcast64.wqe_com, 1);
6085 bf_set(wqe_iod, &wqe->xmit_bcast64.wqe_com, LPFC_WQE_IOD_WRITE);
6086 bf_set(wqe_lenloc, &wqe->xmit_bcast64.wqe_com,
6087 LPFC_WQE_LENLOC_WORD3);
6088 bf_set(wqe_ebde_cnt, &wqe->xmit_bcast64.wqe_com, 0);
6080 break; 6089 break;
6081 case CMD_FCP_IWRITE64_CR: 6090 case CMD_FCP_IWRITE64_CR:
6082 command_type = FCP_COMMAND_DATA_OUT; 6091 command_type = FCP_COMMAND_DATA_OUT;
6083 /* The struct for wqe fcp_iwrite has 3 fields that are somewhat 6092 /* word3 iocb=iotag wqe=payload_offset_len */
6084 * confusing. 6093 /* Add the FCP_CMD and FCP_RSP sizes to get the offset */
6085 * word3 is payload_len: byte offset to the sgl entry for the 6094 wqe->fcp_iwrite.payload_offset_len =
6086 * fcp_command. 6095 xmit_len + sizeof(struct fcp_rsp);
6087 * word4 is total xfer len, same as the IOCB->ulpParameter. 6096 /* word4 iocb=parameter wqe=total_xfer_length memcpy */
6088 * word5 is initial xfer len 0 = wait for xfer-ready 6097 /* word5 iocb=initial_xfer_len wqe=initial_xfer_len memcpy */
6089 */ 6098 bf_set(wqe_erp, &wqe->fcp_iwrite.wqe_com,
6090 6099 iocbq->iocb.ulpFCP2Rcvy);
6091 /* Always wait for xfer-ready before sending data */ 6100 bf_set(wqe_lnk, &wqe->fcp_iwrite.wqe_com, iocbq->iocb.ulpXS);
6092 wqe->fcp_iwrite.initial_xfer_len = 0; 6101 /* Always open the exchange */
6093 /* word 4 (xfer length) should have been set on the memcpy */ 6102 bf_set(wqe_xc, &wqe->fcp_iwrite.wqe_com, 0);
6094 6103 bf_set(wqe_dbde, &wqe->fcp_iwrite.wqe_com, 1);
6095 /* allow write to fall through to read */ 6104 bf_set(wqe_iod, &wqe->fcp_iwrite.wqe_com, LPFC_WQE_IOD_WRITE);
6105 bf_set(wqe_lenloc, &wqe->fcp_iwrite.wqe_com,
6106 LPFC_WQE_LENLOC_WORD4);
6107 bf_set(wqe_ebde_cnt, &wqe->fcp_iwrite.wqe_com, 0);
6108 bf_set(wqe_pu, &wqe->fcp_iwrite.wqe_com, iocbq->iocb.ulpPU);
6109 break;
6096 case CMD_FCP_IREAD64_CR: 6110 case CMD_FCP_IREAD64_CR:
6097 /* FCP_CMD is always the 1st sgl entry */ 6111 /* word3 iocb=iotag wqe=payload_offset_len */
6098 wqe->fcp_iread.payload_len = 6112 /* Add the FCP_CMD and FCP_RSP sizes to get the offset */
6113 wqe->fcp_iread.payload_offset_len =
6099 xmit_len + sizeof(struct fcp_rsp); 6114 xmit_len + sizeof(struct fcp_rsp);
6100 6115 /* word4 iocb=parameter wqe=total_xfer_length memcpy */
6101 /* word 4 (xfer length) should have been set on the memcpy */ 6116 /* word5 iocb=initial_xfer_len wqe=initial_xfer_len memcpy */
6102 6117 bf_set(wqe_erp, &wqe->fcp_iread.wqe_com,
6103 bf_set(lpfc_wqe_gen_erp, &wqe->generic, 6118 iocbq->iocb.ulpFCP2Rcvy);
6104 iocbq->iocb.ulpFCP2Rcvy); 6119 bf_set(wqe_lnk, &wqe->fcp_iread.wqe_com, iocbq->iocb.ulpXS);
6105 bf_set(lpfc_wqe_gen_lnk, &wqe->generic, iocbq->iocb.ulpXS);
6106 /* The XC bit and the XS bit are similar. The driver never
6107 * tracked whether or not the exchange was previouslly open.
6108 * XC = Exchange create, 0 is create. 1 is already open.
6109 * XS = link cmd: 1 do not close the exchange after command.
6110 * XS = 0 close exchange when command completes.
6111 * The only time we would not set the XC bit is when the XS bit
6112 * is set and we are sending our 2nd or greater command on
6113 * this exchange.
6114 */
6115 /* Always open the exchange */ 6120 /* Always open the exchange */
6116 bf_set(wqe_xc, &wqe->fcp_iread.wqe_com, 0); 6121 bf_set(wqe_xc, &wqe->fcp_iread.wqe_com, 0);
6117 6122 bf_set(wqe_dbde, &wqe->fcp_iread.wqe_com, 1);
6118 wqe->words[10] &= 0xffff0000; /* zero out ebde count */ 6123 bf_set(wqe_iod, &wqe->fcp_iread.wqe_com, LPFC_WQE_IOD_READ);
6119 bf_set(lpfc_wqe_gen_pu, &wqe->generic, iocbq->iocb.ulpPU); 6124 bf_set(wqe_lenloc, &wqe->fcp_iread.wqe_com,
6120 break; 6125 LPFC_WQE_LENLOC_WORD4);
6126 bf_set(wqe_ebde_cnt, &wqe->fcp_iread.wqe_com, 0);
6127 bf_set(wqe_pu, &wqe->fcp_iread.wqe_com, iocbq->iocb.ulpPU);
6128 break;
6121 case CMD_FCP_ICMND64_CR: 6129 case CMD_FCP_ICMND64_CR:
6130 /* word3 iocb=IO_TAG wqe=reserved */
6131 wqe->fcp_icmd.rsrvd3 = 0;
6132 bf_set(wqe_pu, &wqe->fcp_icmd.wqe_com, 0);
6122 /* Always open the exchange */ 6133 /* Always open the exchange */
6123 bf_set(wqe_xc, &wqe->fcp_iread.wqe_com, 0); 6134 bf_set(wqe_xc, &wqe->fcp_icmd.wqe_com, 0);
6124 6135 bf_set(wqe_dbde, &wqe->fcp_icmd.wqe_com, 1);
6125 wqe->words[4] = 0; 6136 bf_set(wqe_iod, &wqe->fcp_icmd.wqe_com, LPFC_WQE_IOD_WRITE);
6126 wqe->words[10] &= 0xffff0000; /* zero out ebde count */ 6137 bf_set(wqe_qosd, &wqe->fcp_icmd.wqe_com, 1);
6127 bf_set(lpfc_wqe_gen_pu, &wqe->generic, 0); 6138 bf_set(wqe_lenloc, &wqe->fcp_icmd.wqe_com,
6139 LPFC_WQE_LENLOC_NONE);
6140 bf_set(wqe_ebde_cnt, &wqe->fcp_icmd.wqe_com, 0);
6128 break; 6141 break;
6129 case CMD_GEN_REQUEST64_CR: 6142 case CMD_GEN_REQUEST64_CR:
6130 /* word3 command length is described as byte offset to the 6143 /* word3 iocb=IO_TAG wqe=request_payload_len */
6131 * rsp_data. Would always be 16, sizeof(struct sli4_sge) 6144 wqe->gen_req.request_payload_len = xmit_len;
6132 * sgl[0] = cmnd 6145 /* word4 iocb=parameter wqe=relative_offset memcpy */
6133 * sgl[1] = rsp. 6146 /* word5 [rctl, type, df_ctl, la] copied in memcpy */
6134 *
6135 */
6136 wqe->gen_req.command_len = xmit_len;
6137 /* Word4 parameter copied in the memcpy */
6138 /* Word5 [rctl, type, df_ctl, la] copied in memcpy */
6139 /* word6 context tag copied in memcpy */ 6147 /* word6 context tag copied in memcpy */
6140 if (iocbq->iocb.ulpCt_h || iocbq->iocb.ulpCt_l) { 6148 if (iocbq->iocb.ulpCt_h || iocbq->iocb.ulpCt_l) {
6141 ct = ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l); 6149 ct = ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l);
@@ -6144,31 +6152,39 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
6144 ct, iocbq->iocb.ulpCommand); 6152 ct, iocbq->iocb.ulpCommand);
6145 return IOCB_ERROR; 6153 return IOCB_ERROR;
6146 } 6154 }
6147 bf_set(lpfc_wqe_gen_ct, &wqe->generic, 0); 6155 bf_set(wqe_ct, &wqe->gen_req.wqe_com, 0);
6148 bf_set(wqe_tmo, &wqe->gen_req.wqe_com, 6156 bf_set(wqe_tmo, &wqe->gen_req.wqe_com, iocbq->iocb.ulpTimeout);
6149 iocbq->iocb.ulpTimeout); 6157 bf_set(wqe_pu, &wqe->gen_req.wqe_com, iocbq->iocb.ulpPU);
6150 6158 bf_set(wqe_dbde, &wqe->gen_req.wqe_com, 1);
6151 bf_set(lpfc_wqe_gen_pu, &wqe->generic, iocbq->iocb.ulpPU); 6159 bf_set(wqe_iod, &wqe->gen_req.wqe_com, LPFC_WQE_IOD_READ);
6160 bf_set(wqe_qosd, &wqe->gen_req.wqe_com, 1);
6161 bf_set(wqe_lenloc, &wqe->gen_req.wqe_com, LPFC_WQE_LENLOC_NONE);
6162 bf_set(wqe_ebde_cnt, &wqe->gen_req.wqe_com, 0);
6152 command_type = OTHER_COMMAND; 6163 command_type = OTHER_COMMAND;
6153 break; 6164 break;
6154 case CMD_XMIT_ELS_RSP64_CX: 6165 case CMD_XMIT_ELS_RSP64_CX:
6155 /* words0-2 BDE memcpy */ 6166 /* words0-2 BDE memcpy */
6156 /* word3 iocb=iotag32 wqe=rsvd */ 6167 /* word3 iocb=iotag32 wqe=response_payload_len */
6157 wqe->words[3] = 0; 6168 wqe->xmit_els_rsp.response_payload_len = xmit_len;
6158 /* word4 iocb=did wge=rsvd. */ 6169 /* word4 iocb=did wge=rsvd. */
6159 wqe->words[4] = 0; 6170 wqe->xmit_els_rsp.rsvd4 = 0;
6160 /* word5 iocb=rsvd wge=did */ 6171 /* word5 iocb=rsvd wge=did */
6161 bf_set(wqe_els_did, &wqe->xmit_els_rsp.wqe_dest, 6172 bf_set(wqe_els_did, &wqe->xmit_els_rsp.wqe_dest,
6162 iocbq->iocb.un.elsreq64.remoteID); 6173 iocbq->iocb.un.elsreq64.remoteID);
6163 6174 bf_set(wqe_ct, &wqe->xmit_els_rsp.wqe_com,
6164 bf_set(lpfc_wqe_gen_ct, &wqe->generic, 6175 ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l));
6165 ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l)); 6176 bf_set(wqe_pu, &wqe->xmit_els_rsp.wqe_com, iocbq->iocb.ulpPU);
6166 6177 bf_set(wqe_rcvoxid, &wqe->xmit_els_rsp.wqe_com,
6167 bf_set(lpfc_wqe_gen_pu, &wqe->generic, iocbq->iocb.ulpPU); 6178 iocbq->iocb.ulpContext);
6168 bf_set(wqe_rcvoxid, &wqe->generic, iocbq->iocb.ulpContext);
6169 if (!iocbq->iocb.ulpCt_h && iocbq->iocb.ulpCt_l) 6179 if (!iocbq->iocb.ulpCt_h && iocbq->iocb.ulpCt_l)
6170 bf_set(lpfc_wqe_gen_context, &wqe->generic, 6180 bf_set(wqe_ctxt_tag, &wqe->xmit_els_rsp.wqe_com,
6171 iocbq->vport->vpi + phba->vpi_base); 6181 iocbq->vport->vpi + phba->vpi_base);
6182 bf_set(wqe_dbde, &wqe->xmit_els_rsp.wqe_com, 1);
6183 bf_set(wqe_iod, &wqe->xmit_els_rsp.wqe_com, LPFC_WQE_IOD_WRITE);
6184 bf_set(wqe_qosd, &wqe->xmit_els_rsp.wqe_com, 1);
6185 bf_set(wqe_lenloc, &wqe->xmit_els_rsp.wqe_com,
6186 LPFC_WQE_LENLOC_WORD3);
6187 bf_set(wqe_ebde_cnt, &wqe->xmit_els_rsp.wqe_com, 0);
6172 command_type = OTHER_COMMAND; 6188 command_type = OTHER_COMMAND;
6173 break; 6189 break;
6174 case CMD_CLOSE_XRI_CN: 6190 case CMD_CLOSE_XRI_CN:
@@ -6193,15 +6209,19 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
6193 else 6209 else
6194 bf_set(abort_cmd_ia, &wqe->abort_cmd, 0); 6210 bf_set(abort_cmd_ia, &wqe->abort_cmd, 0);
6195 bf_set(abort_cmd_criteria, &wqe->abort_cmd, T_XRI_TAG); 6211 bf_set(abort_cmd_criteria, &wqe->abort_cmd, T_XRI_TAG);
6196 wqe->words[5] = 0; 6212 /* word5 iocb=CONTEXT_TAG|IO_TAG wqe=reserved */
6197 bf_set(lpfc_wqe_gen_ct, &wqe->generic, 6213 wqe->abort_cmd.rsrvd5 = 0;
6214 bf_set(wqe_ct, &wqe->abort_cmd.wqe_com,
6198 ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l)); 6215 ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l));
6199 abort_tag = iocbq->iocb.un.acxri.abortIoTag; 6216 abort_tag = iocbq->iocb.un.acxri.abortIoTag;
6200 /* 6217 /*
6201 * The abort handler will send us CMD_ABORT_XRI_CN or 6218 * The abort handler will send us CMD_ABORT_XRI_CN or
6202 * CMD_CLOSE_XRI_CN and the fw only accepts CMD_ABORT_XRI_CX 6219 * CMD_CLOSE_XRI_CN and the fw only accepts CMD_ABORT_XRI_CX
6203 */ 6220 */
6204 bf_set(lpfc_wqe_gen_command, &wqe->generic, CMD_ABORT_XRI_CX); 6221 bf_set(wqe_cmnd, &wqe->abort_cmd.wqe_com, CMD_ABORT_XRI_CX);
6222 bf_set(wqe_qosd, &wqe->abort_cmd.wqe_com, 1);
6223 bf_set(wqe_lenloc, &wqe->abort_cmd.wqe_com,
6224 LPFC_WQE_LENLOC_NONE);
6205 cmnd = CMD_ABORT_XRI_CX; 6225 cmnd = CMD_ABORT_XRI_CX;
6206 command_type = OTHER_COMMAND; 6226 command_type = OTHER_COMMAND;
6207 xritag = 0; 6227 xritag = 0;
@@ -6235,18 +6255,14 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
6235 bf_set(wqe_xmit_bls_pt, &wqe->xmit_bls_rsp.wqe_dest, 0x1); 6255 bf_set(wqe_xmit_bls_pt, &wqe->xmit_bls_rsp.wqe_dest, 0x1);
6236 bf_set(wqe_ctxt_tag, &wqe->xmit_bls_rsp.wqe_com, 6256 bf_set(wqe_ctxt_tag, &wqe->xmit_bls_rsp.wqe_com,
6237 iocbq->iocb.ulpContext); 6257 iocbq->iocb.ulpContext);
6258 bf_set(wqe_qosd, &wqe->xmit_bls_rsp.wqe_com, 1);
6259 bf_set(wqe_lenloc, &wqe->xmit_bls_rsp.wqe_com,
6260 LPFC_WQE_LENLOC_NONE);
6238 /* Overwrite the pre-set comnd type with OTHER_COMMAND */ 6261 /* Overwrite the pre-set comnd type with OTHER_COMMAND */
6239 command_type = OTHER_COMMAND; 6262 command_type = OTHER_COMMAND;
6240 break; 6263 break;
6241 case CMD_XRI_ABORTED_CX: 6264 case CMD_XRI_ABORTED_CX:
6242 case CMD_CREATE_XRI_CR: /* Do we expect to use this? */ 6265 case CMD_CREATE_XRI_CR: /* Do we expect to use this? */
6243 /* words0-2 are all 0's no bde */
6244 /* word3 and word4 are rsvrd */
6245 wqe->words[3] = 0;
6246 wqe->words[4] = 0;
6247 /* word5 iocb=rsvd wge=did */
6248 /* There is no remote port id in the IOCB? */
6249 /* Let this fall through and fail */
6250 case CMD_IOCB_FCP_IBIDIR64_CR: /* bidirectional xfer */ 6266 case CMD_IOCB_FCP_IBIDIR64_CR: /* bidirectional xfer */
6251 case CMD_FCP_TSEND64_CX: /* Target mode send xfer-ready */ 6267 case CMD_FCP_TSEND64_CX: /* Target mode send xfer-ready */
6252 case CMD_FCP_TRSP64_CX: /* Target mode rcv */ 6268 case CMD_FCP_TRSP64_CX: /* Target mode rcv */
@@ -6257,16 +6273,14 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
6257 iocbq->iocb.ulpCommand); 6273 iocbq->iocb.ulpCommand);
6258 return IOCB_ERROR; 6274 return IOCB_ERROR;
6259 break; 6275 break;
6260
6261 } 6276 }
6262 bf_set(lpfc_wqe_gen_xri, &wqe->generic, xritag); 6277 bf_set(wqe_xri_tag, &wqe->generic.wqe_com, xritag);
6263 bf_set(lpfc_wqe_gen_request_tag, &wqe->generic, iocbq->iotag); 6278 bf_set(wqe_reqtag, &wqe->generic.wqe_com, iocbq->iotag);
6264 wqe->generic.abort_tag = abort_tag; 6279 wqe->generic.wqe_com.abort_tag = abort_tag;
6265 bf_set(lpfc_wqe_gen_cmd_type, &wqe->generic, command_type); 6280 bf_set(wqe_cmd_type, &wqe->generic.wqe_com, command_type);
6266 bf_set(lpfc_wqe_gen_command, &wqe->generic, cmnd); 6281 bf_set(wqe_cmnd, &wqe->generic.wqe_com, cmnd);
6267 bf_set(lpfc_wqe_gen_class, &wqe->generic, iocbq->iocb.ulpClass); 6282 bf_set(wqe_class, &wqe->generic.wqe_com, iocbq->iocb.ulpClass);
6268 bf_set(lpfc_wqe_gen_cq_id, &wqe->generic, LPFC_WQE_CQ_ID_DEFAULT); 6283 bf_set(wqe_cqid, &wqe->generic.wqe_com, LPFC_WQE_CQ_ID_DEFAULT);
6269
6270 return 0; 6284 return 0;
6271} 6285}
6272 6286
@@ -7257,25 +7271,26 @@ lpfc_ignore_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
7257} 7271}
7258 7272
7259/** 7273/**
7260 * lpfc_sli_issue_abort_iotag - Abort function for a command iocb 7274 * lpfc_sli_abort_iotag_issue - Issue abort for a command iocb
7261 * @phba: Pointer to HBA context object. 7275 * @phba: Pointer to HBA context object.
7262 * @pring: Pointer to driver SLI ring object. 7276 * @pring: Pointer to driver SLI ring object.
7263 * @cmdiocb: Pointer to driver command iocb object. 7277 * @cmdiocb: Pointer to driver command iocb object.
7264 * 7278 *
7265 * This function issues an abort iocb for the provided command 7279 * This function issues an abort iocb for the provided command iocb down to
7266 * iocb. This function is called with hbalock held. 7280 * the port. Other than the case the outstanding command iocb is an abort
7267 * The function returns 0 when it fails due to memory allocation 7281 * request, this function issues abort out unconditionally. This function is
7268 * failure or when the command iocb is an abort request. 7282 * called with hbalock held. The function returns 0 when it fails due to
7283 * memory allocation failure or when the command iocb is an abort request.
7269 **/ 7284 **/
7270int 7285static int
7271lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, 7286lpfc_sli_abort_iotag_issue(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
7272 struct lpfc_iocbq *cmdiocb) 7287 struct lpfc_iocbq *cmdiocb)
7273{ 7288{
7274 struct lpfc_vport *vport = cmdiocb->vport; 7289 struct lpfc_vport *vport = cmdiocb->vport;
7275 struct lpfc_iocbq *abtsiocbp; 7290 struct lpfc_iocbq *abtsiocbp;
7276 IOCB_t *icmd = NULL; 7291 IOCB_t *icmd = NULL;
7277 IOCB_t *iabt = NULL; 7292 IOCB_t *iabt = NULL;
7278 int retval = IOCB_ERROR; 7293 int retval;
7279 7294
7280 /* 7295 /*
7281 * There are certain command types we don't want to abort. And we 7296 * There are certain command types we don't want to abort. And we
@@ -7288,18 +7303,6 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
7288 (cmdiocb->iocb_flag & LPFC_DRIVER_ABORTED) != 0) 7303 (cmdiocb->iocb_flag & LPFC_DRIVER_ABORTED) != 0)
7289 return 0; 7304 return 0;
7290 7305
7291 /* If we're unloading, don't abort iocb on the ELS ring, but change the
7292 * callback so that nothing happens when it finishes.
7293 */
7294 if ((vport->load_flag & FC_UNLOADING) &&
7295 (pring->ringno == LPFC_ELS_RING)) {
7296 if (cmdiocb->iocb_flag & LPFC_IO_FABRIC)
7297 cmdiocb->fabric_iocb_cmpl = lpfc_ignore_els_cmpl;
7298 else
7299 cmdiocb->iocb_cmpl = lpfc_ignore_els_cmpl;
7300 goto abort_iotag_exit;
7301 }
7302
7303 /* issue ABTS for this IOCB based on iotag */ 7306 /* issue ABTS for this IOCB based on iotag */
7304 abtsiocbp = __lpfc_sli_get_iocbq(phba); 7307 abtsiocbp = __lpfc_sli_get_iocbq(phba);
7305 if (abtsiocbp == NULL) 7308 if (abtsiocbp == NULL)
@@ -7344,6 +7347,63 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
7344 7347
7345 if (retval) 7348 if (retval)
7346 __lpfc_sli_release_iocbq(phba, abtsiocbp); 7349 __lpfc_sli_release_iocbq(phba, abtsiocbp);
7350
7351 /*
7352 * Caller to this routine should check for IOCB_ERROR
7353 * and handle it properly. This routine no longer removes
7354 * iocb off txcmplq and call compl in case of IOCB_ERROR.
7355 */
7356 return retval;
7357}
7358
7359/**
7360 * lpfc_sli_issue_abort_iotag - Abort function for a command iocb
7361 * @phba: Pointer to HBA context object.
7362 * @pring: Pointer to driver SLI ring object.
7363 * @cmdiocb: Pointer to driver command iocb object.
7364 *
7365 * This function issues an abort iocb for the provided command iocb. In case
7366 * of unloading, the abort iocb will not be issued to commands on the ELS
7367 * ring. Instead, the callback function shall be changed to those commands
7368 * so that nothing happens when them finishes. This function is called with
7369 * hbalock held. The function returns 0 when the command iocb is an abort
7370 * request.
7371 **/
7372int
7373lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
7374 struct lpfc_iocbq *cmdiocb)
7375{
7376 struct lpfc_vport *vport = cmdiocb->vport;
7377 int retval = IOCB_ERROR;
7378 IOCB_t *icmd = NULL;
7379
7380 /*
7381 * There are certain command types we don't want to abort. And we
7382 * don't want to abort commands that are already in the process of
7383 * being aborted.
7384 */
7385 icmd = &cmdiocb->iocb;
7386 if (icmd->ulpCommand == CMD_ABORT_XRI_CN ||
7387 icmd->ulpCommand == CMD_CLOSE_XRI_CN ||
7388 (cmdiocb->iocb_flag & LPFC_DRIVER_ABORTED) != 0)
7389 return 0;
7390
7391 /*
7392 * If we're unloading, don't abort iocb on the ELS ring, but change
7393 * the callback so that nothing happens when it finishes.
7394 */
7395 if ((vport->load_flag & FC_UNLOADING) &&
7396 (pring->ringno == LPFC_ELS_RING)) {
7397 if (cmdiocb->iocb_flag & LPFC_IO_FABRIC)
7398 cmdiocb->fabric_iocb_cmpl = lpfc_ignore_els_cmpl;
7399 else
7400 cmdiocb->iocb_cmpl = lpfc_ignore_els_cmpl;
7401 goto abort_iotag_exit;
7402 }
7403
7404 /* Now, we try to issue the abort to the cmdiocb out */
7405 retval = lpfc_sli_abort_iotag_issue(phba, pring, cmdiocb);
7406
7347abort_iotag_exit: 7407abort_iotag_exit:
7348 /* 7408 /*
7349 * Caller to this routine should check for IOCB_ERROR 7409 * Caller to this routine should check for IOCB_ERROR
@@ -7354,6 +7414,62 @@ abort_iotag_exit:
7354} 7414}
7355 7415
7356/** 7416/**
7417 * lpfc_sli_iocb_ring_abort - Unconditionally abort all iocbs on an iocb ring
7418 * @phba: Pointer to HBA context object.
7419 * @pring: Pointer to driver SLI ring object.
7420 *
7421 * This function aborts all iocbs in the given ring and frees all the iocb
7422 * objects in txq. This function issues abort iocbs unconditionally for all
7423 * the iocb commands in txcmplq. The iocbs in the txcmplq is not guaranteed
7424 * to complete before the return of this function. The caller is not required
7425 * to hold any locks.
7426 **/
7427static void
7428lpfc_sli_iocb_ring_abort(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
7429{
7430 LIST_HEAD(completions);
7431 struct lpfc_iocbq *iocb, *next_iocb;
7432
7433 if (pring->ringno == LPFC_ELS_RING)
7434 lpfc_fabric_abort_hba(phba);
7435
7436 spin_lock_irq(&phba->hbalock);
7437
7438 /* Take off all the iocbs on txq for cancelling */
7439 list_splice_init(&pring->txq, &completions);
7440 pring->txq_cnt = 0;
7441
7442 /* Next issue ABTS for everything on the txcmplq */
7443 list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list)
7444 lpfc_sli_abort_iotag_issue(phba, pring, iocb);
7445
7446 spin_unlock_irq(&phba->hbalock);
7447
7448 /* Cancel all the IOCBs from the completions list */
7449 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT,
7450 IOERR_SLI_ABORTED);
7451}
7452
7453/**
7454 * lpfc_sli_hba_iocb_abort - Abort all iocbs to an hba.
7455 * @phba: pointer to lpfc HBA data structure.
7456 *
7457 * This routine will abort all pending and outstanding iocbs to an HBA.
7458 **/
7459void
7460lpfc_sli_hba_iocb_abort(struct lpfc_hba *phba)
7461{
7462 struct lpfc_sli *psli = &phba->sli;
7463 struct lpfc_sli_ring *pring;
7464 int i;
7465
7466 for (i = 0; i < psli->num_rings; i++) {
7467 pring = &psli->ring[i];
7468 lpfc_sli_iocb_ring_abort(phba, pring);
7469 }
7470}
7471
7472/**
7357 * lpfc_sli_validate_fcp_iocb - find commands associated with a vport or LUN 7473 * lpfc_sli_validate_fcp_iocb - find commands associated with a vport or LUN
7358 * @iocbq: Pointer to driver iocb object. 7474 * @iocbq: Pointer to driver iocb object.
7359 * @vport: Pointer to driver virtual port object. 7475 * @vport: Pointer to driver virtual port object.
@@ -12242,13 +12358,15 @@ lpfc_sli4_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, uint16_t fcf_index)
12242 /* Issue the mailbox command asynchronously */ 12358 /* Issue the mailbox command asynchronously */
12243 mboxq->vport = phba->pport; 12359 mboxq->vport = phba->pport;
12244 mboxq->mbox_cmpl = lpfc_mbx_cmpl_fcf_scan_read_fcf_rec; 12360 mboxq->mbox_cmpl = lpfc_mbx_cmpl_fcf_scan_read_fcf_rec;
12361
12362 spin_lock_irq(&phba->hbalock);
12363 phba->hba_flag |= FCF_TS_INPROG;
12364 spin_unlock_irq(&phba->hbalock);
12365
12245 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT); 12366 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT);
12246 if (rc == MBX_NOT_FINISHED) 12367 if (rc == MBX_NOT_FINISHED)
12247 error = -EIO; 12368 error = -EIO;
12248 else { 12369 else {
12249 spin_lock_irq(&phba->hbalock);
12250 phba->hba_flag |= FCF_DISC_INPROGRESS;
12251 spin_unlock_irq(&phba->hbalock);
12252 /* Reset eligible FCF count for new scan */ 12370 /* Reset eligible FCF count for new scan */
12253 if (fcf_index == LPFC_FCOE_FCF_GET_FIRST) 12371 if (fcf_index == LPFC_FCOE_FCF_GET_FIRST)
12254 phba->fcf.eligible_fcf_cnt = 0; 12372 phba->fcf.eligible_fcf_cnt = 0;
@@ -12258,21 +12376,21 @@ fail_fcf_scan:
12258 if (error) { 12376 if (error) {
12259 if (mboxq) 12377 if (mboxq)
12260 lpfc_sli4_mbox_cmd_free(phba, mboxq); 12378 lpfc_sli4_mbox_cmd_free(phba, mboxq);
12261 /* FCF scan failed, clear FCF_DISC_INPROGRESS flag */ 12379 /* FCF scan failed, clear FCF_TS_INPROG flag */
12262 spin_lock_irq(&phba->hbalock); 12380 spin_lock_irq(&phba->hbalock);
12263 phba->hba_flag &= ~FCF_DISC_INPROGRESS; 12381 phba->hba_flag &= ~FCF_TS_INPROG;
12264 spin_unlock_irq(&phba->hbalock); 12382 spin_unlock_irq(&phba->hbalock);
12265 } 12383 }
12266 return error; 12384 return error;
12267} 12385}
12268 12386
12269/** 12387/**
12270 * lpfc_sli4_fcf_rr_read_fcf_rec - Read hba fcf record for round robin fcf. 12388 * lpfc_sli4_fcf_rr_read_fcf_rec - Read hba fcf record for roundrobin fcf.
12271 * @phba: pointer to lpfc hba data structure. 12389 * @phba: pointer to lpfc hba data structure.
12272 * @fcf_index: FCF table entry offset. 12390 * @fcf_index: FCF table entry offset.
12273 * 12391 *
12274 * This routine is invoked to read an FCF record indicated by @fcf_index 12392 * This routine is invoked to read an FCF record indicated by @fcf_index
12275 * and to use it for FLOGI round robin FCF failover. 12393 * and to use it for FLOGI roundrobin FCF failover.
12276 * 12394 *
12277 * Return 0 if the mailbox command is submitted sucessfully, none 0 12395 * Return 0 if the mailbox command is submitted sucessfully, none 0
12278 * otherwise. 12396 * otherwise.
@@ -12318,7 +12436,7 @@ fail_fcf_read:
12318 * @fcf_index: FCF table entry offset. 12436 * @fcf_index: FCF table entry offset.
12319 * 12437 *
12320 * This routine is invoked to read an FCF record indicated by @fcf_index to 12438 * This routine is invoked to read an FCF record indicated by @fcf_index to
12321 * determine whether it's eligible for FLOGI round robin failover list. 12439 * determine whether it's eligible for FLOGI roundrobin failover list.
12322 * 12440 *
12323 * Return 0 if the mailbox command is submitted sucessfully, none 0 12441 * Return 0 if the mailbox command is submitted sucessfully, none 0
12324 * otherwise. 12442 * otherwise.
@@ -12364,7 +12482,7 @@ fail_fcf_read:
12364 * 12482 *
12365 * This routine is to get the next eligible FCF record index in a round 12483 * This routine is to get the next eligible FCF record index in a round
12366 * robin fashion. If the next eligible FCF record index equals to the 12484 * robin fashion. If the next eligible FCF record index equals to the
12367 * initial round robin FCF record index, LPFC_FCOE_FCF_NEXT_NONE (0xFFFF) 12485 * initial roundrobin FCF record index, LPFC_FCOE_FCF_NEXT_NONE (0xFFFF)
12368 * shall be returned, otherwise, the next eligible FCF record's index 12486 * shall be returned, otherwise, the next eligible FCF record's index
12369 * shall be returned. 12487 * shall be returned.
12370 **/ 12488 **/
@@ -12392,28 +12510,10 @@ lpfc_sli4_fcf_rr_next_index_get(struct lpfc_hba *phba)
12392 return LPFC_FCOE_FCF_NEXT_NONE; 12510 return LPFC_FCOE_FCF_NEXT_NONE;
12393 } 12511 }
12394 12512
12395 /* Check roundrobin failover index bmask stop condition */
12396 if (next_fcf_index == phba->fcf.fcf_rr_init_indx) {
12397 if (!(phba->fcf.fcf_flag & FCF_REDISC_RRU)) {
12398 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP,
12399 "2847 Round robin failover FCF index "
12400 "search hit stop condition:x%x\n",
12401 next_fcf_index);
12402 return LPFC_FCOE_FCF_NEXT_NONE;
12403 }
12404 /* The roundrobin failover index bmask updated, start over */
12405 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
12406 "2848 Round robin failover FCF index bmask "
12407 "updated, start over\n");
12408 spin_lock_irq(&phba->hbalock);
12409 phba->fcf.fcf_flag &= ~FCF_REDISC_RRU;
12410 spin_unlock_irq(&phba->hbalock);
12411 return phba->fcf.fcf_rr_init_indx;
12412 }
12413
12414 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, 12513 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
12415 "2845 Get next round robin failover " 12514 "2845 Get next roundrobin failover FCF (x%x)\n",
12416 "FCF index x%x\n", next_fcf_index); 12515 next_fcf_index);
12516
12417 return next_fcf_index; 12517 return next_fcf_index;
12418} 12518}
12419 12519
@@ -12422,7 +12522,7 @@ lpfc_sli4_fcf_rr_next_index_get(struct lpfc_hba *phba)
12422 * @phba: pointer to lpfc hba data structure. 12522 * @phba: pointer to lpfc hba data structure.
12423 * 12523 *
12424 * This routine sets the FCF record index in to the eligible bmask for 12524 * This routine sets the FCF record index in to the eligible bmask for
12425 * round robin failover search. It checks to make sure that the index 12525 * roundrobin failover search. It checks to make sure that the index
12426 * does not go beyond the range of the driver allocated bmask dimension 12526 * does not go beyond the range of the driver allocated bmask dimension
12427 * before setting the bit. 12527 * before setting the bit.
12428 * 12528 *
@@ -12434,22 +12534,16 @@ lpfc_sli4_fcf_rr_index_set(struct lpfc_hba *phba, uint16_t fcf_index)
12434{ 12534{
12435 if (fcf_index >= LPFC_SLI4_FCF_TBL_INDX_MAX) { 12535 if (fcf_index >= LPFC_SLI4_FCF_TBL_INDX_MAX) {
12436 lpfc_printf_log(phba, KERN_ERR, LOG_FIP, 12536 lpfc_printf_log(phba, KERN_ERR, LOG_FIP,
12437 "2610 HBA FCF index reached driver's " 12537 "2610 FCF (x%x) reached driver's book "
12438 "book keeping dimension: fcf_index:%d, " 12538 "keeping dimension:x%x\n",
12439 "driver_bmask_max:%d\n",
12440 fcf_index, LPFC_SLI4_FCF_TBL_INDX_MAX); 12539 fcf_index, LPFC_SLI4_FCF_TBL_INDX_MAX);
12441 return -EINVAL; 12540 return -EINVAL;
12442 } 12541 }
12443 /* Set the eligible FCF record index bmask */ 12542 /* Set the eligible FCF record index bmask */
12444 set_bit(fcf_index, phba->fcf.fcf_rr_bmask); 12543 set_bit(fcf_index, phba->fcf.fcf_rr_bmask);
12445 12544
12446 /* Set the roundrobin index bmask updated */
12447 spin_lock_irq(&phba->hbalock);
12448 phba->fcf.fcf_flag |= FCF_REDISC_RRU;
12449 spin_unlock_irq(&phba->hbalock);
12450
12451 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, 12545 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
12452 "2790 Set FCF index x%x to round robin failover " 12546 "2790 Set FCF (x%x) to roundrobin FCF failover "
12453 "bmask\n", fcf_index); 12547 "bmask\n", fcf_index);
12454 12548
12455 return 0; 12549 return 0;
@@ -12460,7 +12554,7 @@ lpfc_sli4_fcf_rr_index_set(struct lpfc_hba *phba, uint16_t fcf_index)
12460 * @phba: pointer to lpfc hba data structure. 12554 * @phba: pointer to lpfc hba data structure.
12461 * 12555 *
12462 * This routine clears the FCF record index from the eligible bmask for 12556 * This routine clears the FCF record index from the eligible bmask for
12463 * round robin failover search. It checks to make sure that the index 12557 * roundrobin failover search. It checks to make sure that the index
12464 * does not go beyond the range of the driver allocated bmask dimension 12558 * does not go beyond the range of the driver allocated bmask dimension
12465 * before clearing the bit. 12559 * before clearing the bit.
12466 **/ 12560 **/
@@ -12469,9 +12563,8 @@ lpfc_sli4_fcf_rr_index_clear(struct lpfc_hba *phba, uint16_t fcf_index)
12469{ 12563{
12470 if (fcf_index >= LPFC_SLI4_FCF_TBL_INDX_MAX) { 12564 if (fcf_index >= LPFC_SLI4_FCF_TBL_INDX_MAX) {
12471 lpfc_printf_log(phba, KERN_ERR, LOG_FIP, 12565 lpfc_printf_log(phba, KERN_ERR, LOG_FIP,
12472 "2762 HBA FCF index goes beyond driver's " 12566 "2762 FCF (x%x) reached driver's book "
12473 "book keeping dimension: fcf_index:%d, " 12567 "keeping dimension:x%x\n",
12474 "driver_bmask_max:%d\n",
12475 fcf_index, LPFC_SLI4_FCF_TBL_INDX_MAX); 12568 fcf_index, LPFC_SLI4_FCF_TBL_INDX_MAX);
12476 return; 12569 return;
12477 } 12570 }
@@ -12479,7 +12572,7 @@ lpfc_sli4_fcf_rr_index_clear(struct lpfc_hba *phba, uint16_t fcf_index)
12479 clear_bit(fcf_index, phba->fcf.fcf_rr_bmask); 12572 clear_bit(fcf_index, phba->fcf.fcf_rr_bmask);
12480 12573
12481 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, 12574 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
12482 "2791 Clear FCF index x%x from round robin failover " 12575 "2791 Clear FCF (x%x) from roundrobin failover "
12483 "bmask\n", fcf_index); 12576 "bmask\n", fcf_index);
12484} 12577}
12485 12578
@@ -12530,8 +12623,7 @@ lpfc_mbx_cmpl_redisc_fcf_table(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox)
12530 } 12623 }
12531 } else { 12624 } else {
12532 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, 12625 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
12533 "2775 Start FCF rediscovery quiescent period " 12626 "2775 Start FCF rediscover quiescent timer\n");
12534 "wait timer before scaning FCF table\n");
12535 /* 12627 /*
12536 * Start FCF rediscovery wait timer for pending FCF 12628 * Start FCF rediscovery wait timer for pending FCF
12537 * before rescan FCF record table. 12629 * before rescan FCF record table.