lpfc_els.c (bf61c8840efe60fd8f91446860b63338fb424158) lpfc_els.c (256ec0d05f8050339a9cc4e92bdc96cec1ce82bd)
1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2012 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com *
7 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
8 * *

--- 470 unchanged lines hidden (view full) ---

479 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
480 if (!mboxq) {
481 rc = -ENOMEM;
482 goto fail_free_coherent;
483 }
484 vport->port_state = LPFC_FABRIC_CFG_LINK;
485 memcpy(dmabuf->virt, &phba->fc_fabparam, sizeof(vport->fc_sparam));
486 lpfc_reg_vfi(mboxq, vport, dmabuf->phys);
1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2012 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com *
7 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
8 * *

--- 470 unchanged lines hidden (view full) ---

479 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
480 if (!mboxq) {
481 rc = -ENOMEM;
482 goto fail_free_coherent;
483 }
484 vport->port_state = LPFC_FABRIC_CFG_LINK;
485 memcpy(dmabuf->virt, &phba->fc_fabparam, sizeof(vport->fc_sparam));
486 lpfc_reg_vfi(mboxq, vport, dmabuf->phys);
487
487 mboxq->mbox_cmpl = lpfc_mbx_cmpl_reg_vfi;
488 mboxq->vport = vport;
489 mboxq->context1 = dmabuf;
490 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT);
491 if (rc == MBX_NOT_FINISHED) {
492 rc = -ENXIO;
493 goto fail_free_mbox;
494 }

--- 200 unchanged lines hidden (view full) ---

695 "1817 Fabric does not support NPIV "
696 "- configuring single port mode.\n");
697 spin_lock_irq(&phba->hbalock);
698 phba->link_flag &= ~LS_NPIV_FAB_SUPPORTED;
699 spin_unlock_irq(&phba->hbalock);
700 }
701 }
702
488 mboxq->mbox_cmpl = lpfc_mbx_cmpl_reg_vfi;
489 mboxq->vport = vport;
490 mboxq->context1 = dmabuf;
491 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT);
492 if (rc == MBX_NOT_FINISHED) {
493 rc = -ENXIO;
494 goto fail_free_mbox;
495 }

--- 200 unchanged lines hidden (view full) ---

696 "1817 Fabric does not support NPIV "
697 "- configuring single port mode.\n");
698 spin_lock_irq(&phba->hbalock);
699 phba->link_flag &= ~LS_NPIV_FAB_SUPPORTED;
700 spin_unlock_irq(&phba->hbalock);
701 }
702 }
703
704 /*
705 * For FC we need to do some special processing because of the SLI
706 * Port's default settings of the Common Service Parameters.
707 */
708 if (phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_FC) {
709 /* If physical FC port changed, unreg VFI and ALL VPIs / RPIs */
710 if ((phba->sli_rev == LPFC_SLI_REV4) && fabric_param_changed)
711 lpfc_unregister_fcf_prep(phba);
712
713 /* This should just update the VFI CSPs*/
714 if (vport->fc_flag & FC_VFI_REGISTERED)
715 lpfc_issue_reg_vfi(vport);
716 }
717
703 if (fabric_param_changed &&
704 !(vport->fc_flag & FC_VPORT_NEEDS_REG_VPI)) {
705
706 /* If our NportID changed, we need to ensure all
707 * remaining NPORTs get unreg_login'ed.
708 */
709 list_for_each_entry_safe(np, next_np,
710 &vport->fc_nodes, nlp_listp) {

--- 5509 unchanged lines hidden (view full) ---

6220 "x%x\n", els_command,
6221 remote_ID, cmd->ulpCommand, cmd->ulpIoTag);
6222 spin_lock_irq(&phba->hbalock);
6223 list_del_init(&piocb->dlist);
6224 lpfc_sli_issue_abort_iotag(phba, pring, piocb);
6225 spin_unlock_irq(&phba->hbalock);
6226 }
6227
718 if (fabric_param_changed &&
719 !(vport->fc_flag & FC_VPORT_NEEDS_REG_VPI)) {
720
721 /* If our NportID changed, we need to ensure all
722 * remaining NPORTs get unreg_login'ed.
723 */
724 list_for_each_entry_safe(np, next_np,
725 &vport->fc_nodes, nlp_listp) {

--- 5509 unchanged lines hidden (view full) ---

6235 "x%x\n", els_command,
6236 remote_ID, cmd->ulpCommand, cmd->ulpIoTag);
6237 spin_lock_irq(&phba->hbalock);
6238 list_del_init(&piocb->dlist);
6239 lpfc_sli_issue_abort_iotag(phba, pring, piocb);
6240 spin_unlock_irq(&phba->hbalock);
6241 }
6242
6228 if (phba->sli.ring[LPFC_ELS_RING].txcmplq_cnt)
6229 mod_timer(&vport->els_tmofunc, jiffies + HZ * timeout);
6243 if (!list_empty(&phba->sli.ring[LPFC_ELS_RING].txcmplq))
6244 mod_timer(&vport->els_tmofunc,
6245 jiffies + msecs_to_jiffies(1000 * timeout));
6230}
6231
6232/**
6233 * lpfc_els_flush_cmd - Clean up the outstanding els commands to a vport
6234 * @vport: pointer to a host virtual N_Port data structure.
6235 *
6236 * This routine is used to clean up all the outstanding ELS commands on a
6237 * @vport. It first aborts the @vport by invoking lpfc_fabric_abort_vport()

--- 36 unchanged lines hidden (view full) ---

6274 cmd->ulpCommand == CMD_CLOSE_XRI_CN ||
6275 cmd->ulpCommand == CMD_ABORT_XRI_CN)
6276 continue;
6277
6278 if (piocb->vport != vport)
6279 continue;
6280
6281 list_move_tail(&piocb->list, &completions);
6246}
6247
6248/**
6249 * lpfc_els_flush_cmd - Clean up the outstanding els commands to a vport
6250 * @vport: pointer to a host virtual N_Port data structure.
6251 *
6252 * This routine is used to clean up all the outstanding ELS commands on a
6253 * @vport. It first aborts the @vport by invoking lpfc_fabric_abort_vport()

--- 36 unchanged lines hidden (view full) ---

6290 cmd->ulpCommand == CMD_CLOSE_XRI_CN ||
6291 cmd->ulpCommand == CMD_ABORT_XRI_CN)
6292 continue;
6293
6294 if (piocb->vport != vport)
6295 continue;
6296
6297 list_move_tail(&piocb->list, &completions);
6282 pring->txq_cnt--;
6283 }
6284
6285 list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) {
6286 if (piocb->iocb_flag & LPFC_IO_LIBDFC) {
6287 continue;
6288 }
6289
6290 if (piocb->vport != vport)

--- 43 unchanged lines hidden (view full) ---

6334 continue;
6335 /* Do not flush out the QUE_RING and ABORT/CLOSE iocbs */
6336 if (cmd->ulpCommand == CMD_QUE_RING_BUF_CN ||
6337 cmd->ulpCommand == CMD_QUE_RING_BUF64_CN ||
6338 cmd->ulpCommand == CMD_CLOSE_XRI_CN ||
6339 cmd->ulpCommand == CMD_ABORT_XRI_CN)
6340 continue;
6341 list_move_tail(&piocb->list, &completions);
6298 }
6299
6300 list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) {
6301 if (piocb->iocb_flag & LPFC_IO_LIBDFC) {
6302 continue;
6303 }
6304
6305 if (piocb->vport != vport)

--- 43 unchanged lines hidden (view full) ---

6349 continue;
6350 /* Do not flush out the QUE_RING and ABORT/CLOSE iocbs */
6351 if (cmd->ulpCommand == CMD_QUE_RING_BUF_CN ||
6352 cmd->ulpCommand == CMD_QUE_RING_BUF64_CN ||
6353 cmd->ulpCommand == CMD_CLOSE_XRI_CN ||
6354 cmd->ulpCommand == CMD_ABORT_XRI_CN)
6355 continue;
6356 list_move_tail(&piocb->list, &completions);
6342 pring->txq_cnt--;
6343 }
6344 list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) {
6345 if (piocb->iocb_flag & LPFC_IO_LIBDFC)
6346 continue;
6347 lpfc_sli_issue_abort_iotag(phba, pring, piocb);
6348 }
6349 spin_unlock_irq(&phba->hbalock);
6350

--- 634 unchanged lines hidden (view full) ---

6985 * If lpfc_delay_discovery parameter is set and the clean address
6986 * bit is cleared and fc fabric parameters chenged, delay FC NPort
6987 * discovery.
6988 */
6989 spin_lock_irq(shost->host_lock);
6990 if (vport->fc_flag & FC_DISC_DELAYED) {
6991 spin_unlock_irq(shost->host_lock);
6992 mod_timer(&vport->delayed_disc_tmo,
6357 }
6358 list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) {
6359 if (piocb->iocb_flag & LPFC_IO_LIBDFC)
6360 continue;
6361 lpfc_sli_issue_abort_iotag(phba, pring, piocb);
6362 }
6363 spin_unlock_irq(&phba->hbalock);
6364

--- 634 unchanged lines hidden (view full) ---

6999 * If lpfc_delay_discovery parameter is set and the clean address
7000 * bit is cleared and fc fabric parameters chenged, delay FC NPort
7001 * discovery.
7002 */
7003 spin_lock_irq(shost->host_lock);
7004 if (vport->fc_flag & FC_DISC_DELAYED) {
7005 spin_unlock_irq(shost->host_lock);
7006 mod_timer(&vport->delayed_disc_tmo,
6993 jiffies + HZ * phba->fc_ratov);
7007 jiffies + msecs_to_jiffies(1000 * phba->fc_ratov));
6994 return;
6995 }
6996 spin_unlock_irq(shost->host_lock);
6997
6998 ndlp = lpfc_findnode_did(vport, NameServer_DID);
6999 if (!ndlp) {
7000 ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL);
7001 if (!ndlp) {

--- 267 unchanged lines hidden (view full) ---

7269 lpfc_cancel_all_vport_retry_delay_timer(phba);
7270
7271 /* If fabric require FLOGI, then re-instantiate physical login */
7272 ndlp = lpfc_findnode_did(phba->pport, Fabric_DID);
7273 if (!ndlp)
7274 return;
7275
7276 shost = lpfc_shost_from_vport(phba->pport);
7008 return;
7009 }
7010 spin_unlock_irq(shost->host_lock);
7011
7012 ndlp = lpfc_findnode_did(vport, NameServer_DID);
7013 if (!ndlp) {
7014 ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL);
7015 if (!ndlp) {

--- 267 unchanged lines hidden (view full) ---

7283 lpfc_cancel_all_vport_retry_delay_timer(phba);
7284
7285 /* If fabric require FLOGI, then re-instantiate physical login */
7286 ndlp = lpfc_findnode_did(phba->pport, Fabric_DID);
7287 if (!ndlp)
7288 return;
7289
7290 shost = lpfc_shost_from_vport(phba->pport);
7277 mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ);
7291 mod_timer(&ndlp->nlp_delayfunc, jiffies + msecs_to_jiffies(1000));
7278 spin_lock_irq(shost->host_lock);
7279 ndlp->nlp_flag |= NLP_DELAY_TMO;
7280 spin_unlock_irq(shost->host_lock);
7281 ndlp->nlp_last_elscmd = ELS_CMD_FLOGI;
7282 phba->pport->port_state = LPFC_FLOGI;
7283 return;
7284}
7285

--- 487 unchanged lines hidden (view full) ---

7773static void
7774lpfc_block_fabric_iocbs(struct lpfc_hba *phba)
7775{
7776 int blocked;
7777
7778 blocked = test_and_set_bit(FABRIC_COMANDS_BLOCKED, &phba->bit_flags);
7779 /* Start a timer to unblock fabric iocbs after 100ms */
7780 if (!blocked)
7292 spin_lock_irq(shost->host_lock);
7293 ndlp->nlp_flag |= NLP_DELAY_TMO;
7294 spin_unlock_irq(shost->host_lock);
7295 ndlp->nlp_last_elscmd = ELS_CMD_FLOGI;
7296 phba->pport->port_state = LPFC_FLOGI;
7297 return;
7298}
7299

--- 487 unchanged lines hidden (view full) ---

7787static void
7788lpfc_block_fabric_iocbs(struct lpfc_hba *phba)
7789{
7790 int blocked;
7791
7792 blocked = test_and_set_bit(FABRIC_COMANDS_BLOCKED, &phba->bit_flags);
7793 /* Start a timer to unblock fabric iocbs after 100ms */
7794 if (!blocked)
7781 mod_timer(&phba->fabric_block_timer, jiffies + HZ/10 );
7795 mod_timer(&phba->fabric_block_timer,
7796 jiffies + msecs_to_jiffies(100));
7782
7783 return;
7784}
7785
7786/**
7787 * lpfc_cmpl_fabric_iocb - Completion callback function for fabric iocb
7788 * @phba: pointer to lpfc hba data structure.
7789 * @cmdiocb: pointer to lpfc command iocb data structure.

--- 270 unchanged lines hidden (view full) ---

8060 sglq_entry->state = SGL_FREED;
8061 spin_unlock(&phba->sli4_hba.abts_sgl_list_lock);
8062 spin_unlock_irqrestore(&phba->hbalock, iflag);
8063 lpfc_set_rrq_active(phba, ndlp,
8064 sglq_entry->sli4_lxritag,
8065 rxid, 1);
8066
8067 /* Check if TXQ queue needs to be serviced */
7797
7798 return;
7799}
7800
7801/**
7802 * lpfc_cmpl_fabric_iocb - Completion callback function for fabric iocb
7803 * @phba: pointer to lpfc hba data structure.
7804 * @cmdiocb: pointer to lpfc command iocb data structure.

--- 270 unchanged lines hidden (view full) ---

8075 sglq_entry->state = SGL_FREED;
8076 spin_unlock(&phba->sli4_hba.abts_sgl_list_lock);
8077 spin_unlock_irqrestore(&phba->hbalock, iflag);
8078 lpfc_set_rrq_active(phba, ndlp,
8079 sglq_entry->sli4_lxritag,
8080 rxid, 1);
8081
8082 /* Check if TXQ queue needs to be serviced */
8068 if (pring->txq_cnt)
8083 if (!(list_empty(&pring->txq)))
8069 lpfc_worker_wake_up(phba);
8070 return;
8071 }
8072 }
8073 spin_unlock(&phba->sli4_hba.abts_sgl_list_lock);
8074 lxri = lpfc_sli4_xri_inrange(phba, xri);
8075 if (lxri == NO_XRI) {
8076 spin_unlock_irqrestore(&phba->hbalock, iflag);

--- 55 unchanged lines hidden ---
8084 lpfc_worker_wake_up(phba);
8085 return;
8086 }
8087 }
8088 spin_unlock(&phba->sli4_hba.abts_sgl_list_lock);
8089 lxri = lpfc_sli4_xri_inrange(phba, xri);
8090 if (lxri == NO_XRI) {
8091 spin_unlock_irqrestore(&phba->hbalock, iflag);

--- 55 unchanged lines hidden ---