Lines Matching +full:timeout +full:- +full:lta
4 * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term *
6 * Copyright (C) 2004-2016 Emulex. All rights reserved. *
9 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
17 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *
53 /* AlpaArray for assignment of scsid for scan-down and bind_method */
81 if (ndlp->nlp_fc4_type || in lpfc_valid_xpt_node()
82 ndlp->nlp_type & NLP_FABRIC) in lpfc_valid_xpt_node()
100 return -EINVAL; in lpfc_rport_invalid()
103 rdata = rport->dd_data; in lpfc_rport_invalid()
106 __func__, rport, rport->scsi_target_id); in lpfc_rport_invalid()
107 return -EINVAL; in lpfc_rport_invalid()
110 ndlp = rdata->pnode; in lpfc_rport_invalid()
111 if (!rdata->pnode) { in lpfc_rport_invalid()
113 __func__, rport, rport->scsi_target_id); in lpfc_rport_invalid()
114 return -EINVAL; in lpfc_rport_invalid()
117 if (!ndlp->vport) { in lpfc_rport_invalid()
119 "SID x%x\n", __func__, ndlp, ndlp->nlp_DID, rport, in lpfc_rport_invalid()
120 rport->scsi_target_id); in lpfc_rport_invalid()
121 return -EINVAL; in lpfc_rport_invalid()
136 rdata = rport->dd_data; in lpfc_terminate_rport_io()
137 ndlp = rdata->pnode; in lpfc_terminate_rport_io()
138 vport = ndlp->vport; in lpfc_terminate_rport_io()
141 ndlp->nlp_sid, ndlp->nlp_DID, ndlp->nlp_flag); in lpfc_terminate_rport_io()
143 if (ndlp->nlp_sid != NLP_NO_SID) in lpfc_terminate_rport_io()
144 lpfc_sli_abort_iocb(vport, ndlp->nlp_sid, 0, LPFC_CTX_TGT); in lpfc_terminate_rport_io()
159 ndlp = ((struct lpfc_rport_data *)rport->dd_data)->pnode; in lpfc_dev_loss_tmo_callbk()
163 vport = ndlp->vport; in lpfc_dev_loss_tmo_callbk()
164 phba = vport->phba; in lpfc_dev_loss_tmo_callbk()
168 ndlp->nlp_sid, ndlp->nlp_DID, ndlp->nlp_flag); in lpfc_dev_loss_tmo_callbk()
170 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE, in lpfc_dev_loss_tmo_callbk()
173 ndlp->nlp_DID, ndlp->rport, ndlp->nlp_flag, in lpfc_dev_loss_tmo_callbk()
174 vport->load_flag, kref_read(&ndlp->kref), in lpfc_dev_loss_tmo_callbk()
175 ndlp->nlp_state, ndlp->fc4_xpt_flags); in lpfc_dev_loss_tmo_callbk()
178 if (test_bit(FC_UNLOADING, &vport->load_flag) || in lpfc_dev_loss_tmo_callbk()
179 !test_bit(HBA_SETUP, &phba->hba_flag)) { in lpfc_dev_loss_tmo_callbk()
180 spin_lock_irqsave(&ndlp->lock, iflags); in lpfc_dev_loss_tmo_callbk()
181 ndlp->rport = NULL; in lpfc_dev_loss_tmo_callbk()
187 if (ndlp->fc4_xpt_flags & (NLP_XPT_REGD | SCSI_XPT_REGD)) { in lpfc_dev_loss_tmo_callbk()
188 ndlp->fc4_xpt_flags &= ~SCSI_XPT_REGD; in lpfc_dev_loss_tmo_callbk()
190 /* NVME transport-registered rports need the in lpfc_dev_loss_tmo_callbk()
193 if (!(ndlp->fc4_xpt_flags & NVME_XPT_REGD)) in lpfc_dev_loss_tmo_callbk()
194 ndlp->fc4_xpt_flags &= ~NLP_XPT_REGD; in lpfc_dev_loss_tmo_callbk()
195 spin_unlock_irqrestore(&ndlp->lock, iflags); in lpfc_dev_loss_tmo_callbk()
197 spin_lock_irqsave(&ndlp->lock, iflags); in lpfc_dev_loss_tmo_callbk()
203 if (!(ndlp->fc4_xpt_flags & NVME_XPT_REGD) && in lpfc_dev_loss_tmo_callbk()
204 !(ndlp->nlp_flag & NLP_DROPPED)) { in lpfc_dev_loss_tmo_callbk()
205 ndlp->nlp_flag |= NLP_DROPPED; in lpfc_dev_loss_tmo_callbk()
206 spin_unlock_irqrestore(&ndlp->lock, iflags); in lpfc_dev_loss_tmo_callbk()
211 spin_unlock_irqrestore(&ndlp->lock, iflags); in lpfc_dev_loss_tmo_callbk()
215 if (ndlp->nlp_state == NLP_STE_MAPPED_NODE) in lpfc_dev_loss_tmo_callbk()
219 if (ndlp->nlp_state == NLP_STE_UNMAPPED_NODE && in lpfc_dev_loss_tmo_callbk()
220 ndlp->nlp_DID == Fabric_DID) in lpfc_dev_loss_tmo_callbk()
223 if (rport->port_name != wwn_to_u64(ndlp->nlp_portname.u.wwn)) in lpfc_dev_loss_tmo_callbk()
226 rport->port_name, in lpfc_dev_loss_tmo_callbk()
227 wwn_to_u64(ndlp->nlp_portname.u.wwn)); in lpfc_dev_loss_tmo_callbk()
229 evtp = &ndlp->dev_loss_evt; in lpfc_dev_loss_tmo_callbk()
231 if (!list_empty(&evtp->evt_listp)) { in lpfc_dev_loss_tmo_callbk()
234 rport->port_name); in lpfc_dev_loss_tmo_callbk()
238 spin_lock_irqsave(&ndlp->lock, iflags); in lpfc_dev_loss_tmo_callbk()
239 ndlp->nlp_flag |= NLP_IN_DEV_LOSS; in lpfc_dev_loss_tmo_callbk()
244 if (ndlp->nlp_state != NLP_STE_PLOGI_ISSUE) in lpfc_dev_loss_tmo_callbk()
245 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; in lpfc_dev_loss_tmo_callbk()
251 ndlp->fc4_xpt_flags &= ~SCSI_XPT_REGD; in lpfc_dev_loss_tmo_callbk()
252 ((struct lpfc_rport_data *)rport->dd_data)->pnode = NULL; in lpfc_dev_loss_tmo_callbk()
253 ndlp->rport = NULL; in lpfc_dev_loss_tmo_callbk()
254 spin_unlock_irqrestore(&ndlp->lock, iflags); in lpfc_dev_loss_tmo_callbk()
256 if (phba->worker_thread) { in lpfc_dev_loss_tmo_callbk()
260 evtp->evt_arg1 = lpfc_nlp_get(ndlp); in lpfc_dev_loss_tmo_callbk()
262 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_dev_loss_tmo_callbk()
263 if (evtp->evt_arg1) { in lpfc_dev_loss_tmo_callbk()
264 evtp->evt = LPFC_EVT_DEV_LOSS; in lpfc_dev_loss_tmo_callbk()
265 list_add_tail(&evtp->evt_listp, &phba->work_list); in lpfc_dev_loss_tmo_callbk()
266 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_dev_loss_tmo_callbk()
270 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_dev_loss_tmo_callbk()
272 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE, in lpfc_dev_loss_tmo_callbk()
275 "%d\n", __func__, ndlp->nlp_DID, in lpfc_dev_loss_tmo_callbk()
276 ndlp->rport, ndlp->nlp_flag, in lpfc_dev_loss_tmo_callbk()
277 vport->load_flag, kref_read(&ndlp->kref)); in lpfc_dev_loss_tmo_callbk()
278 if (!(ndlp->fc4_xpt_flags & NVME_XPT_REGD)) { in lpfc_dev_loss_tmo_callbk()
279 spin_lock_irqsave(&ndlp->lock, iflags); in lpfc_dev_loss_tmo_callbk()
281 ndlp->nlp_flag &= ~NLP_IN_DEV_LOSS; in lpfc_dev_loss_tmo_callbk()
282 spin_unlock_irqrestore(&ndlp->lock, iflags); in lpfc_dev_loss_tmo_callbk()
290 * lpfc_check_inactive_vmid_one - VMID inactivity checker for a vport
300 u64 *lta; in lpfc_check_inactive_vmid_one() local
304 write_lock(&vport->vmid_lock); in lpfc_check_inactive_vmid_one()
306 if (!vport->cur_vmid_cnt) in lpfc_check_inactive_vmid_one()
310 hash_for_each(vport->hash_table, bucket, vmp, hnode) { in lpfc_check_inactive_vmid_one()
312 if (vmp->flag & LPFC_VMID_REGISTERED) { in lpfc_check_inactive_vmid_one()
316 /* if last access time is less than timeout */ in lpfc_check_inactive_vmid_one()
317 lta = per_cpu_ptr(vmp->last_io_time, cpu); in lpfc_check_inactive_vmid_one()
318 if (!lta) in lpfc_check_inactive_vmid_one()
320 difftime = (jiffies) - (*lta); in lpfc_check_inactive_vmid_one()
321 if ((vport->vmid_inactivity_timeout * in lpfc_check_inactive_vmid_one()
332 vmp->flag = LPFC_VMID_DE_REGISTER; in lpfc_check_inactive_vmid_one()
333 write_unlock(&vport->vmid_lock); in lpfc_check_inactive_vmid_one()
334 if (vport->vmid_priority_tagging) in lpfc_check_inactive_vmid_one()
343 write_lock(&vport->vmid_lock); in lpfc_check_inactive_vmid_one()
347 vport->cur_vmid_cnt--; in lpfc_check_inactive_vmid_one()
348 ht->flag = LPFC_VMID_SLOT_FREE; in lpfc_check_inactive_vmid_one()
349 free_percpu(ht->last_io_time); in lpfc_check_inactive_vmid_one()
350 ht->last_io_time = NULL; in lpfc_check_inactive_vmid_one()
351 hash_del(&ht->hnode); in lpfc_check_inactive_vmid_one()
357 write_unlock(&vport->vmid_lock); in lpfc_check_inactive_vmid_one()
361 * lpfc_check_inactive_vmid - VMID inactivity checker
380 for (i = 0; i <= phba->max_vports; i++) { in lpfc_check_inactive_vmid()
382 vport = phba->pport; in lpfc_check_inactive_vmid()
394 * lpfc_check_nlp_post_devloss - Check to restore ndlp refcnt after devloss
408 spin_lock_irqsave(&ndlp->lock, iflags); in lpfc_check_nlp_post_devloss()
409 if (ndlp->save_flags & NLP_IN_RECOV_POST_DEV_LOSS) { in lpfc_check_nlp_post_devloss()
410 ndlp->save_flags &= ~NLP_IN_RECOV_POST_DEV_LOSS; in lpfc_check_nlp_post_devloss()
411 spin_unlock_irqrestore(&ndlp->lock, iflags); in lpfc_check_nlp_post_devloss()
414 "8438 Devloss timeout reversed on DID x%x " in lpfc_check_nlp_post_devloss()
417 ndlp->nlp_DID, kref_read(&ndlp->kref), ndlp, in lpfc_check_nlp_post_devloss()
418 ndlp->nlp_flag, vport->port_state); in lpfc_check_nlp_post_devloss()
421 spin_unlock_irqrestore(&ndlp->lock, iflags); in lpfc_check_nlp_post_devloss()
425 * lpfc_dev_loss_tmo_handler - Remote node devloss timeout handler
428 * This function is called from the worker thread when devloss timeout timer
432 * when devloss timeout happened to this @ndlp.
446 vport = ndlp->vport; in lpfc_dev_loss_tmo_handler()
447 name = (uint8_t *)&ndlp->nlp_portname; in lpfc_dev_loss_tmo_handler()
448 phba = vport->phba; in lpfc_dev_loss_tmo_handler()
450 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_dev_loss_tmo_handler()
455 ndlp->nlp_DID, ndlp->nlp_type, ndlp->nlp_sid); in lpfc_dev_loss_tmo_handler()
457 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE, in lpfc_dev_loss_tmo_handler()
459 __func__, ndlp->nlp_DID, ndlp->nlp_flag, in lpfc_dev_loss_tmo_handler()
460 ndlp->fc4_xpt_flags, kref_read(&ndlp->kref)); in lpfc_dev_loss_tmo_handler()
463 if (ndlp->nlp_state == NLP_STE_MAPPED_NODE) { in lpfc_dev_loss_tmo_handler()
465 "0284 Devloss timeout Ignored on " in lpfc_dev_loss_tmo_handler()
470 ndlp->nlp_DID); in lpfc_dev_loss_tmo_handler()
472 spin_lock_irqsave(&ndlp->lock, iflags); in lpfc_dev_loss_tmo_handler()
473 ndlp->nlp_flag &= ~NLP_IN_DEV_LOSS; in lpfc_dev_loss_tmo_handler()
474 spin_unlock_irqrestore(&ndlp->lock, iflags); in lpfc_dev_loss_tmo_handler()
479 if (ndlp->nlp_type & NLP_FABRIC) { in lpfc_dev_loss_tmo_handler()
480 spin_lock_irqsave(&ndlp->lock, iflags); in lpfc_dev_loss_tmo_handler()
486 switch (ndlp->nlp_DID) { in lpfc_dev_loss_tmo_handler()
488 fc_vport = vport->fc_vport; in lpfc_dev_loss_tmo_handler()
491 if (fc_vport->vport_state == in lpfc_dev_loss_tmo_handler()
497 &phba->hba_flag)) in lpfc_dev_loss_tmo_handler()
502 if (ndlp->nlp_flag & NLP_REG_LOGIN_SEND) in lpfc_dev_loss_tmo_handler()
508 if (ndlp->nlp_state >= NLP_STE_PLOGI_ISSUE && in lpfc_dev_loss_tmo_handler()
509 ndlp->nlp_state <= NLP_STE_REG_LOGIN_ISSUE) in lpfc_dev_loss_tmo_handler()
517 if (ndlp->nlp_DID & Fabric_DID_MASK) { in lpfc_dev_loss_tmo_handler()
518 if (ndlp->nlp_state >= NLP_STE_PLOGI_ISSUE && in lpfc_dev_loss_tmo_handler()
519 ndlp->nlp_state <= NLP_STE_REG_LOGIN_ISSUE) in lpfc_dev_loss_tmo_handler()
524 spin_unlock_irqrestore(&ndlp->lock, iflags); in lpfc_dev_loss_tmo_handler()
530 spin_lock_irqsave(&ndlp->lock, iflags); in lpfc_dev_loss_tmo_handler()
531 ndlp->nlp_flag &= ~NLP_IN_DEV_LOSS; in lpfc_dev_loss_tmo_handler()
532 spin_unlock_irqrestore(&ndlp->lock, iflags); in lpfc_dev_loss_tmo_handler()
536 "8436 Devloss timeout marked on " in lpfc_dev_loss_tmo_handler()
539 ndlp->nlp_DID, kref_read(&ndlp->kref), in lpfc_dev_loss_tmo_handler()
540 ndlp, ndlp->nlp_flag, in lpfc_dev_loss_tmo_handler()
541 vport->port_state); in lpfc_dev_loss_tmo_handler()
542 spin_lock_irqsave(&ndlp->lock, iflags); in lpfc_dev_loss_tmo_handler()
543 ndlp->save_flags |= NLP_IN_RECOV_POST_DEV_LOSS; in lpfc_dev_loss_tmo_handler()
544 spin_unlock_irqrestore(&ndlp->lock, iflags); in lpfc_dev_loss_tmo_handler()
546 } else if (ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) { in lpfc_dev_loss_tmo_handler()
553 "8437 Devloss timeout ignored on " in lpfc_dev_loss_tmo_handler()
556 ndlp->nlp_DID, kref_read(&ndlp->kref), in lpfc_dev_loss_tmo_handler()
557 ndlp, ndlp->nlp_flag, in lpfc_dev_loss_tmo_handler()
558 vport->port_state); in lpfc_dev_loss_tmo_handler()
566 if (ndlp->nlp_sid != NLP_NO_SID) { in lpfc_dev_loss_tmo_handler()
568 lpfc_sli_abort_iocb(vport, ndlp->nlp_sid, 0, LPFC_CTX_TGT); in lpfc_dev_loss_tmo_handler()
573 "0203 Devloss timeout on " in lpfc_dev_loss_tmo_handler()
578 ndlp->nlp_DID, ndlp->nlp_flag, in lpfc_dev_loss_tmo_handler()
579 ndlp->nlp_state, ndlp->nlp_rpi, in lpfc_dev_loss_tmo_handler()
580 kref_read(&ndlp->kref)); in lpfc_dev_loss_tmo_handler()
583 "0204 Devloss timeout on " in lpfc_dev_loss_tmo_handler()
588 ndlp->nlp_DID, ndlp->nlp_flag, in lpfc_dev_loss_tmo_handler()
589 ndlp->nlp_state, ndlp->nlp_rpi); in lpfc_dev_loss_tmo_handler()
591 spin_lock_irqsave(&ndlp->lock, iflags); in lpfc_dev_loss_tmo_handler()
592 ndlp->nlp_flag &= ~NLP_IN_DEV_LOSS; in lpfc_dev_loss_tmo_handler()
593 spin_unlock_irqrestore(&ndlp->lock, iflags); in lpfc_dev_loss_tmo_handler()
598 if (ndlp->nlp_state >= NLP_STE_PLOGI_ISSUE && in lpfc_dev_loss_tmo_handler()
599 ndlp->nlp_state <= NLP_STE_PRLI_ISSUE) { in lpfc_dev_loss_tmo_handler()
603 if (!(ndlp->fc4_xpt_flags & NVME_XPT_REGD)) in lpfc_dev_loss_tmo_handler()
619 for (i = 0; i <= phba->max_vports; i++) { in lpfc_check_vmid_qfpa_issue()
621 vport = phba->pport; in lpfc_check_vmid_qfpa_issue()
627 if (vport->vmid_flag & LPFC_VMID_ISSUE_QFPA) { in lpfc_check_vmid_qfpa_issue()
629 vport->vmid_flag &= ~LPFC_VMID_ISSUE_QFPA; in lpfc_check_vmid_qfpa_issue()
636 * lpfc_sli4_post_dev_loss_tmo_handler - SLI4 post devloss timeout handler
638 * @fcf_inuse: SLI4 FCF in-use state reported from devloss timeout handler.
639 * @nlp_did: remote node identifer with devloss timeout.
642 * timeout handler and releasing the reference count for the ndlp with
643 * which the devloss timeout was handled for SLI4 host. For the devloss
644 * timeout of the last remote node which had been in use of FCF, when this
646 * in-use of FCF. When devloss timeout to the last remote using the FCF,
648 * failover process, the in-use FCF shall be unregistered. If the FIP
649 * engine is in FCF discovery process, the devloss timeout state shall
651 * process to unregister the in-use FCF.
657 /* If devloss timeout happened to a remote node when FCF had no in lpfc_sli4_post_dev_loss_tmo_handler()
658 * longer been in-use, do nothing. in lpfc_sli4_post_dev_loss_tmo_handler()
663 if (test_bit(HBA_FIP_SUPPORT, &phba->hba_flag) && in lpfc_sli4_post_dev_loss_tmo_handler()
665 spin_lock_irq(&phba->hbalock); in lpfc_sli4_post_dev_loss_tmo_handler()
666 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_post_dev_loss_tmo_handler()
668 &phba->hba_flag)) { in lpfc_sli4_post_dev_loss_tmo_handler()
669 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_post_dev_loss_tmo_handler()
676 if (phba->fcf.fcf_flag & FCF_REDISC_PROG) { in lpfc_sli4_post_dev_loss_tmo_handler()
677 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_post_dev_loss_tmo_handler()
683 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_post_dev_loss_tmo_handler()
684 if (!test_bit(FCF_TS_INPROG, &phba->hba_flag) && in lpfc_sli4_post_dev_loss_tmo_handler()
685 !test_bit(FCF_RR_INPROG, &phba->hba_flag)) { in lpfc_sli4_post_dev_loss_tmo_handler()
688 "unreg in-use FCF and rescan.\n"); in lpfc_sli4_post_dev_loss_tmo_handler()
689 /* Unregister in-use FCF and rescan */ in lpfc_sli4_post_dev_loss_tmo_handler()
693 if (test_bit(FCF_TS_INPROG, &phba->hba_flag)) in lpfc_sli4_post_dev_loss_tmo_handler()
696 if (test_bit(FCF_RR_INPROG, &phba->hba_flag)) in lpfc_sli4_post_dev_loss_tmo_handler()
705 * lpfc_alloc_fast_evt - Allocates data structure for posting event
719 if (atomic_read(&phba->fast_event_count) > LPFC_MAX_EVT_COUNT) in lpfc_alloc_fast_evt()
725 atomic_inc(&phba->fast_event_count); in lpfc_alloc_fast_evt()
726 INIT_LIST_HEAD(&ret->work_evt.evt_listp); in lpfc_alloc_fast_evt()
727 ret->work_evt.evt = LPFC_EVT_FASTPATH_MGMT_EVT; in lpfc_alloc_fast_evt()
733 * lpfc_free_fast_evt - Frees event data structure
744 atomic_dec(&phba->fast_event_count); in lpfc_free_fast_evt()
749 * lpfc_send_fastpath_evt - Posts events generated from fast path
770 evt_category = (unsigned long) fast_evt_data->un.fabric_evt.event_type; in lpfc_send_fastpath_evt()
771 evt_sub_category = (unsigned long) fast_evt_data->un. in lpfc_send_fastpath_evt()
773 shost = lpfc_shost_from_vport(fast_evt_data->vport); in lpfc_send_fastpath_evt()
776 evt_data = (char *) &fast_evt_data->un.read_check_error; in lpfc_send_fastpath_evt()
777 evt_data_size = sizeof(fast_evt_data->un. in lpfc_send_fastpath_evt()
781 evt_data = (char *) &fast_evt_data->un.fabric_evt; in lpfc_send_fastpath_evt()
782 evt_data_size = sizeof(fast_evt_data->un.fabric_evt); in lpfc_send_fastpath_evt()
791 evt_data = (char *) &fast_evt_data->un.scsi_evt; in lpfc_send_fastpath_evt()
792 evt_data_size = sizeof(fast_evt_data->un.scsi_evt); in lpfc_send_fastpath_evt()
795 evt_data = (char *) &fast_evt_data->un.check_cond_evt; in lpfc_send_fastpath_evt()
796 evt_data_size = sizeof(fast_evt_data->un. in lpfc_send_fastpath_evt()
800 evt_data = (char *) &fast_evt_data->un.queue_depth_evt; in lpfc_send_fastpath_evt()
801 evt_data_size = sizeof(fast_evt_data->un. in lpfc_send_fastpath_evt()
813 if (phba->cfg_enable_fc4_type != LPFC_ENABLE_NVME) in lpfc_send_fastpath_evt()
834 spin_lock_irq(&phba->hbalock); in lpfc_work_list_done()
835 while (!list_empty(&phba->work_list)) { in lpfc_work_list_done()
836 list_remove_head((&phba->work_list), evtp, typeof(*evtp), in lpfc_work_list_done()
838 spin_unlock_irq(&phba->hbalock); in lpfc_work_list_done()
839 hba_pci_err = test_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_work_list_done()
841 switch (evtp->evt) { in lpfc_work_list_done()
843 ndlp = (struct lpfc_nodelist *) (evtp->evt_arg1); in lpfc_work_list_done()
854 ndlp = (struct lpfc_nodelist *)(evtp->evt_arg1); in lpfc_work_list_done()
860 nlp_did = ndlp->nlp_DID; in lpfc_work_list_done()
862 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_work_list_done()
868 ndlp = (struct lpfc_nodelist *)(evtp->evt_arg1); in lpfc_work_list_done()
870 lpfc_sli_abts_recover_port(ndlp->vport, ndlp); in lpfc_work_list_done()
879 if (phba->link_state < LPFC_LINK_DOWN) in lpfc_work_list_done()
880 *(int *) (evtp->evt_arg1) = lpfc_online(phba); in lpfc_work_list_done()
882 *(int *) (evtp->evt_arg1) = 0; in lpfc_work_list_done()
883 complete((struct completion *)(evtp->evt_arg2)); in lpfc_work_list_done()
886 if (phba->link_state >= LPFC_LINK_DOWN) in lpfc_work_list_done()
888 *(int *)(evtp->evt_arg1) = 0; in lpfc_work_list_done()
889 complete((struct completion *)(evtp->evt_arg2)); in lpfc_work_list_done()
894 *(int *)(evtp->evt_arg1) = in lpfc_work_list_done()
897 complete((struct completion *)(evtp->evt_arg2)); in lpfc_work_list_done()
904 *(int *)(evtp->evt_arg1) = in lpfc_work_list_done()
907 complete((struct completion *)(evtp->evt_arg2)); in lpfc_work_list_done()
911 *(int *)(evtp->evt_arg1) in lpfc_work_list_done()
912 = (phba->pport->stopped) in lpfc_work_list_done()
915 complete((struct completion *)(evtp->evt_arg2)); in lpfc_work_list_done()
922 if (!test_bit(FC_UNLOADING, &phba->pport->load_flag)) in lpfc_work_list_done()
928 spin_lock_irq(&phba->hbalock); in lpfc_work_list_done()
930 spin_unlock_irq(&phba->hbalock); in lpfc_work_list_done()
944 hba_pci_err = test_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_work_done()
945 spin_lock_irq(&phba->hbalock); in lpfc_work_done()
946 ha_copy = phba->work_ha; in lpfc_work_done()
947 phba->work_ha = 0; in lpfc_work_done()
948 spin_unlock_irq(&phba->hbalock); in lpfc_work_done()
953 if (phba->pci_dev_grp == LPFC_PCI_DEV_OC && !hba_pci_err) in lpfc_work_done()
960 if (phba->fw_dump_cmpl) { in lpfc_work_done()
961 complete(phba->fw_dump_cmpl); in lpfc_work_done()
962 phba->fw_dump_cmpl = NULL; in lpfc_work_done()
974 if (phba->pport->work_port_events & in lpfc_work_done()
977 phba->pport->work_port_events &= in lpfc_work_done()
980 if (phba->pport->work_port_events & in lpfc_work_done()
983 phba->pport->work_port_events &= in lpfc_work_done()
989 if (phba->pci_dev_grp == LPFC_PCI_DEV_OC) { in lpfc_work_done()
990 if (test_bit(HBA_RRQ_ACTIVE, &phba->hba_flag)) in lpfc_work_done()
992 if (test_bit(ELS_XRI_ABORT_EVENT, &phba->hba_flag)) in lpfc_work_done()
994 if (test_bit(ASYNC_EVENT, &phba->hba_flag)) in lpfc_work_done()
997 &phba->hba_flag)) in lpfc_work_done()
999 if (phba->fcf.fcf_flag & FCF_REDISC_EVT) in lpfc_work_done()
1005 for (i = 0; i <= phba->max_vports; i++) { in lpfc_work_done()
1011 vport = phba->pport; in lpfc_work_done()
1016 spin_lock_irq(&vport->work_port_lock); in lpfc_work_done()
1017 work_port_events = vport->work_port_events; in lpfc_work_done()
1018 vport->work_port_events &= ~work_port_events; in lpfc_work_done()
1019 spin_unlock_irq(&vport->work_port_lock); in lpfc_work_done()
1043 pring->flag & LPFC_DEFERRED_RING_EVENT || in lpfc_work_done()
1044 test_bit(HBA_SP_QUEUE_EVT, &phba->hba_flag))) { in lpfc_work_done()
1045 if (pring->flag & LPFC_STOP_IOCB_EVENT) { in lpfc_work_done()
1046 pring->flag |= LPFC_DEFERRED_RING_EVENT; in lpfc_work_done()
1048 if (!test_bit(HBA_SP_QUEUE_EVT, &phba->hba_flag)) in lpfc_work_done()
1049 set_bit(LPFC_DATA_READY, &phba->data_flags); in lpfc_work_done()
1054 if (phba->link_state >= LPFC_LINK_DOWN || in lpfc_work_done()
1055 phba->link_flag & LS_MDS_LOOPBACK) { in lpfc_work_done()
1056 pring->flag &= ~LPFC_DEFERRED_RING_EVENT; in lpfc_work_done()
1062 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_work_done()
1067 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_work_done()
1068 spin_lock_irq(&phba->hbalock); in lpfc_work_done()
1069 control = readl(phba->HCregaddr); in lpfc_work_done()
1076 writel(control, phba->HCregaddr); in lpfc_work_done()
1077 readl(phba->HCregaddr); /* flush */ in lpfc_work_done()
1083 spin_unlock_irq(&phba->hbalock); in lpfc_work_done()
1096 current->flags |= PF_NOFREEZE; in lpfc_do_work()
1097 phba->data_flags = 0; in lpfc_do_work()
1101 rc = wait_event_interruptible(phba->work_waitq, in lpfc_do_work()
1103 &phba->data_flags) in lpfc_do_work()
1115 phba->worker_thread = NULL; in lpfc_do_work()
1141 evtp->evt_arg1 = arg1; in lpfc_workq_post_event()
1142 evtp->evt_arg2 = arg2; in lpfc_workq_post_event()
1143 evtp->evt = evt; in lpfc_workq_post_event()
1145 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_workq_post_event()
1146 list_add_tail(&evtp->evt_listp, &phba->work_list); in lpfc_workq_post_event()
1147 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_workq_post_event()
1157 struct lpfc_hba *phba = vport->phba; in lpfc_cleanup_rpis()
1160 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_cleanup_rpis()
1161 if ((phba->sli3_options & LPFC_SLI3_VPORT_TEARDOWN) || in lpfc_cleanup_rpis()
1162 ((vport->port_type == LPFC_NPIV_PORT) && in lpfc_cleanup_rpis()
1163 ((ndlp->nlp_DID == NameServer_DID) || in lpfc_cleanup_rpis()
1164 (ndlp->nlp_DID == FDMI_DID) || in lpfc_cleanup_rpis()
1165 (ndlp->nlp_DID == Fabric_Cntl_DID)))) in lpfc_cleanup_rpis()
1169 if ((phba->sli_rev < LPFC_SLI_REV4) && in lpfc_cleanup_rpis()
1170 (!remove && ndlp->nlp_type & NLP_FABRIC)) in lpfc_cleanup_rpis()
1174 if (phba->nvmet_support && in lpfc_cleanup_rpis()
1175 ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) in lpfc_cleanup_rpis()
1183 if (phba->sli3_options & LPFC_SLI3_VPORT_TEARDOWN) { in lpfc_cleanup_rpis()
1184 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_cleanup_rpis()
1187 set_bit(FC_VPORT_NEEDS_REG_VPI, &vport->fc_flag); in lpfc_cleanup_rpis()
1214 struct lpfc_hba *phba = vport->phba; in lpfc_linkdown_port()
1217 if (vport->cfg_enable_fc4_type != LPFC_ENABLE_NVME) in lpfc_linkdown_port()
1223 vport->port_state, vport->fc_ns_retry, vport->fc_flag); in lpfc_linkdown_port()
1228 clear_bit(FC_DISC_DELAYED, &vport->fc_flag); in lpfc_linkdown_port()
1229 del_timer_sync(&vport->delayed_disc_tmo); in lpfc_linkdown_port()
1231 if (phba->sli_rev == LPFC_SLI_REV4 && in lpfc_linkdown_port()
1232 vport->port_type == LPFC_PHYSICAL_PORT && in lpfc_linkdown_port()
1233 phba->sli4_hba.fawwpn_flag & LPFC_FAWWPN_CONFIG) { in lpfc_linkdown_port()
1235 phba->sli4_hba.fawwpn_flag |= LPFC_FAWWPN_FABRIC; in lpfc_linkdown_port()
1242 struct lpfc_vport *vport = phba->pport; in lpfc_linkdown()
1249 if (phba->link_state == LPFC_LINK_DOWN) in lpfc_linkdown()
1254 offline = pci_channel_offline(phba->pcidev); in lpfc_linkdown()
1257 if (phba->defer_flogi_acc.flag) { in lpfc_linkdown()
1258 if (phba->defer_flogi_acc.ndlp) { in lpfc_linkdown()
1259 lpfc_nlp_put(phba->defer_flogi_acc.ndlp); in lpfc_linkdown()
1260 phba->defer_flogi_acc.ndlp = NULL; in lpfc_linkdown()
1263 phba->defer_flogi_acc.flag = false; in lpfc_linkdown()
1266 phba->link_flag &= ~LS_EXTERNAL_LOOPBACK; in lpfc_linkdown()
1268 spin_lock_irq(&phba->hbalock); in lpfc_linkdown()
1269 phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_SCAN_DONE); in lpfc_linkdown()
1270 spin_unlock_irq(&phba->hbalock); in lpfc_linkdown()
1271 if (phba->link_state > LPFC_LINK_DOWN) { in lpfc_linkdown()
1272 phba->link_state = LPFC_LINK_DOWN; in lpfc_linkdown()
1273 if (phba->sli4_hba.conf_trunk) { in lpfc_linkdown()
1274 phba->trunk_link.link0.state = 0; in lpfc_linkdown()
1275 phba->trunk_link.link1.state = 0; in lpfc_linkdown()
1276 phba->trunk_link.link2.state = 0; in lpfc_linkdown()
1277 phba->trunk_link.link3.state = 0; in lpfc_linkdown()
1278 phba->trunk_link.phy_lnk_speed = in lpfc_linkdown()
1280 phba->sli4_hba.link_state.logical_speed = in lpfc_linkdown()
1283 clear_bit(FC_LBIT, &phba->pport->fc_flag); in lpfc_linkdown()
1287 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_linkdown()
1291 vports[i]->fc_myDID = 0; in lpfc_linkdown()
1293 if ((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) || in lpfc_linkdown()
1294 (vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) { in lpfc_linkdown()
1295 if (phba->nvmet_support) in lpfc_linkdown()
1305 if (phba->sli_rev > LPFC_SLI_REV3 || offline) in lpfc_linkdown()
1308 mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_linkdown()
1311 mb->vport = vport; in lpfc_linkdown()
1312 mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; in lpfc_linkdown()
1315 mempool_free(mb, phba->mbox_mem_pool); in lpfc_linkdown()
1321 if (test_bit(FC_PT2PT, &phba->pport->fc_flag)) { in lpfc_linkdown()
1322 mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_linkdown()
1325 mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; in lpfc_linkdown()
1326 mb->vport = vport; in lpfc_linkdown()
1329 mempool_free(mb, phba->mbox_mem_pool); in lpfc_linkdown()
1332 clear_bit(FC_PT2PT, &phba->pport->fc_flag); in lpfc_linkdown()
1333 clear_bit(FC_PT2PT_PLOGI, &phba->pport->fc_flag); in lpfc_linkdown()
1334 spin_lock_irq(shost->host_lock); in lpfc_linkdown()
1335 phba->pport->rcv_flogi_cnt = 0; in lpfc_linkdown()
1336 spin_unlock_irq(shost->host_lock); in lpfc_linkdown()
1346 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_linkup_cleanup_nodes()
1347 ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME); in lpfc_linkup_cleanup_nodes()
1349 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) in lpfc_linkup_cleanup_nodes()
1351 if (ndlp->nlp_type & NLP_FABRIC) { in lpfc_linkup_cleanup_nodes()
1355 if (ndlp->nlp_DID != Fabric_DID) in lpfc_linkup_cleanup_nodes()
1358 } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { in lpfc_linkup_cleanup_nodes()
1371 struct lpfc_hba *phba = vport->phba; in lpfc_linkup_port()
1373 if (test_bit(FC_UNLOADING, &vport->load_flag)) in lpfc_linkup_port()
1378 phba->fc_topology, phba->fc_linkspeed, phba->link_flag); in lpfc_linkup_port()
1381 if (!(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) && in lpfc_linkup_port()
1382 (vport != phba->pport)) in lpfc_linkup_port()
1385 if (phba->defer_flogi_acc.flag) { in lpfc_linkup_port()
1386 clear_bit(FC_ABORT_DISCOVERY, &vport->fc_flag); in lpfc_linkup_port()
1387 clear_bit(FC_RSCN_MODE, &vport->fc_flag); in lpfc_linkup_port()
1388 clear_bit(FC_NLP_MORE, &vport->fc_flag); in lpfc_linkup_port()
1389 clear_bit(FC_RSCN_DISCOVERY, &vport->fc_flag); in lpfc_linkup_port()
1391 clear_bit(FC_PT2PT, &vport->fc_flag); in lpfc_linkup_port()
1392 clear_bit(FC_PT2PT_PLOGI, &vport->fc_flag); in lpfc_linkup_port()
1393 clear_bit(FC_ABORT_DISCOVERY, &vport->fc_flag); in lpfc_linkup_port()
1394 clear_bit(FC_RSCN_MODE, &vport->fc_flag); in lpfc_linkup_port()
1395 clear_bit(FC_NLP_MORE, &vport->fc_flag); in lpfc_linkup_port()
1396 clear_bit(FC_RSCN_DISCOVERY, &vport->fc_flag); in lpfc_linkup_port()
1398 set_bit(FC_NDISC_ACTIVE, &vport->fc_flag); in lpfc_linkup_port()
1400 spin_lock_irq(shost->host_lock); in lpfc_linkup_port()
1401 vport->fc_ns_retry = 0; in lpfc_linkup_port()
1402 spin_unlock_irq(shost->host_lock); in lpfc_linkup_port()
1413 struct Scsi_Host *shost = lpfc_shost_from_vport(phba->pport); in lpfc_linkup()
1415 phba->link_state = LPFC_LINK_UP; in lpfc_linkup()
1418 clear_bit(FABRIC_COMANDS_BLOCKED, &phba->bit_flags); in lpfc_linkup()
1419 del_timer_sync(&phba->fabric_block_timer); in lpfc_linkup()
1423 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_linkup()
1428 * absorbed without an ACQE. No lock here - in worker thread in lpfc_linkup()
1431 spin_lock_irq(shost->host_lock); in lpfc_linkup()
1432 phba->pport->rcv_flogi_cnt = 0; in lpfc_linkup()
1433 spin_unlock_irq(shost->host_lock); in lpfc_linkup()
1436 clear_bit(HBA_FLOGI_ISSUED, &phba->hba_flag); in lpfc_linkup()
1437 clear_bit(HBA_RHBA_CMPL, &phba->hba_flag); in lpfc_linkup()
1451 struct lpfc_vport *vport = pmb->vport; in lpfc_mbx_cmpl_clear_la()
1452 struct lpfc_sli *psli = &phba->sli; in lpfc_mbx_cmpl_clear_la()
1453 MAILBOX_t *mb = &pmb->u.mb; in lpfc_mbx_cmpl_clear_la()
1457 psli->sli3_ring[LPFC_EXTRA_RING].flag &= ~LPFC_STOP_IOCB_EVENT; in lpfc_mbx_cmpl_clear_la()
1458 psli->sli3_ring[LPFC_FCP_RING].flag &= ~LPFC_STOP_IOCB_EVENT; in lpfc_mbx_cmpl_clear_la()
1461 if ((mb->mbxStatus) && (mb->mbxStatus != 0x1601)) { in lpfc_mbx_cmpl_clear_la()
1466 mb->mbxStatus, vport->port_state); in lpfc_mbx_cmpl_clear_la()
1467 phba->link_state = LPFC_HBA_ERROR; in lpfc_mbx_cmpl_clear_la()
1471 if (vport->port_type == LPFC_PHYSICAL_PORT) in lpfc_mbx_cmpl_clear_la()
1472 phba->link_state = LPFC_HBA_READY; in lpfc_mbx_cmpl_clear_la()
1474 spin_lock_irq(&phba->hbalock); in lpfc_mbx_cmpl_clear_la()
1475 psli->sli_flag |= LPFC_PROCESS_LA; in lpfc_mbx_cmpl_clear_la()
1476 control = readl(phba->HCregaddr); in lpfc_mbx_cmpl_clear_la()
1478 writel(control, phba->HCregaddr); in lpfc_mbx_cmpl_clear_la()
1479 readl(phba->HCregaddr); /* flush */ in lpfc_mbx_cmpl_clear_la()
1480 spin_unlock_irq(&phba->hbalock); in lpfc_mbx_cmpl_clear_la()
1481 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_mbx_cmpl_clear_la()
1488 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_mbx_cmpl_clear_la()
1490 clear_bit(FC_ABORT_DISCOVERY, &vport->fc_flag); in lpfc_mbx_cmpl_clear_la()
1496 spin_lock_irq(&phba->hbalock); in lpfc_mbx_cmpl_clear_la()
1497 psli->sli_flag |= LPFC_PROCESS_LA; in lpfc_mbx_cmpl_clear_la()
1498 control = readl(phba->HCregaddr); in lpfc_mbx_cmpl_clear_la()
1500 writel(control, phba->HCregaddr); in lpfc_mbx_cmpl_clear_la()
1501 readl(phba->HCregaddr); /* flush */ in lpfc_mbx_cmpl_clear_la()
1502 spin_unlock_irq(&phba->hbalock); in lpfc_mbx_cmpl_clear_la()
1510 struct lpfc_vport *vport = pmb->vport; in lpfc_mbx_cmpl_local_config_link()
1512 u16 status = pmb->u.mb.mbxStatus; in lpfc_mbx_cmpl_local_config_link()
1515 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_mbx_cmpl_local_config_link()
1521 if ((phba->sli_rev == LPFC_SLI_REV4) && in lpfc_mbx_cmpl_local_config_link()
1522 !test_bit(HBA_FCOE_MODE, &phba->hba_flag) && in lpfc_mbx_cmpl_local_config_link()
1523 (phba->link_flag & LS_LOOPBACK_MODE)) in lpfc_mbx_cmpl_local_config_link()
1526 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP && in lpfc_mbx_cmpl_local_config_link()
1527 test_bit(FC_PUBLIC_LOOP, &vport->fc_flag) && in lpfc_mbx_cmpl_local_config_link()
1528 !test_bit(FC_LBIT, &vport->fc_flag)) { in lpfc_mbx_cmpl_local_config_link()
1529 /* Need to wait for FAN - use discovery timer in lpfc_mbx_cmpl_local_config_link()
1530 * for timeout. port_state is identically in lpfc_mbx_cmpl_local_config_link()
1540 if (vport->port_state != LPFC_FLOGI) { in lpfc_mbx_cmpl_local_config_link()
1542 * bb-credit recovery is in place. in lpfc_mbx_cmpl_local_config_link()
1544 if (phba->bbcredit_support && phba->cfg_enable_bbcr && in lpfc_mbx_cmpl_local_config_link()
1545 !(phba->link_flag & LS_LOOPBACK_MODE)) { in lpfc_mbx_cmpl_local_config_link()
1546 sparam_mb = mempool_alloc(phba->mbox_mem_pool, in lpfc_mbx_cmpl_local_config_link()
1553 mempool_free(sparam_mb, phba->mbox_mem_pool); in lpfc_mbx_cmpl_local_config_link()
1556 sparam_mb->vport = vport; in lpfc_mbx_cmpl_local_config_link()
1557 sparam_mb->mbox_cmpl = lpfc_mbx_cmpl_read_sparam; in lpfc_mbx_cmpl_local_config_link()
1565 set_bit(HBA_DEFER_FLOGI, &phba->hba_flag); in lpfc_mbx_cmpl_local_config_link()
1570 if (test_bit(FC_PT2PT, &vport->fc_flag)) in lpfc_mbx_cmpl_local_config_link()
1578 status, vport->port_state); in lpfc_mbx_cmpl_local_config_link()
1585 vport->port_state); in lpfc_mbx_cmpl_local_config_link()
1604 memset(phba->fcf.fcf_rr_bmask, 0, sizeof(*phba->fcf.fcf_rr_bmask)); in lpfc_sli4_clear_fcf_rr_bmask()
1605 spin_lock_irq(&phba->hbalock); in lpfc_sli4_clear_fcf_rr_bmask()
1607 &phba->fcf.fcf_pri_list, list) { in lpfc_sli4_clear_fcf_rr_bmask()
1608 list_del_init(&fcf_pri->list); in lpfc_sli4_clear_fcf_rr_bmask()
1609 fcf_pri->fcf_rec.flag = 0; in lpfc_sli4_clear_fcf_rr_bmask()
1611 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_clear_fcf_rr_bmask()
1616 struct lpfc_vport *vport = mboxq->vport; in lpfc_mbx_cmpl_reg_fcfi()
1618 if (mboxq->u.mb.mbxStatus) { in lpfc_mbx_cmpl_reg_fcfi()
1621 "HBA state x%x\n", mboxq->u.mb.mbxStatus, in lpfc_mbx_cmpl_reg_fcfi()
1622 vport->port_state); in lpfc_mbx_cmpl_reg_fcfi()
1627 phba->fcf.fcfi = bf_get(lpfc_reg_fcfi_fcfi, &mboxq->u.mqe.un.reg_fcfi); in lpfc_mbx_cmpl_reg_fcfi()
1629 spin_lock_irq(&phba->hbalock); in lpfc_mbx_cmpl_reg_fcfi()
1630 phba->fcf.fcf_flag |= FCF_REGISTERED; in lpfc_mbx_cmpl_reg_fcfi()
1631 spin_unlock_irq(&phba->hbalock); in lpfc_mbx_cmpl_reg_fcfi()
1634 if (!test_bit(FCF_RR_INPROG, &phba->hba_flag) && in lpfc_mbx_cmpl_reg_fcfi()
1639 spin_lock_irq(&phba->hbalock); in lpfc_mbx_cmpl_reg_fcfi()
1640 phba->fcf.fcf_flag |= (FCF_SCAN_DONE | FCF_IN_USE); in lpfc_mbx_cmpl_reg_fcfi()
1641 spin_unlock_irq(&phba->hbalock); in lpfc_mbx_cmpl_reg_fcfi()
1642 clear_bit(FCF_TS_INPROG, &phba->hba_flag); in lpfc_mbx_cmpl_reg_fcfi()
1643 if (vport->port_state != LPFC_FLOGI) { in lpfc_mbx_cmpl_reg_fcfi()
1644 set_bit(FCF_RR_INPROG, &phba->hba_flag); in lpfc_mbx_cmpl_reg_fcfi()
1650 clear_bit(FCF_RR_INPROG, &phba->hba_flag); in lpfc_mbx_cmpl_reg_fcfi()
1652 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_mbx_cmpl_reg_fcfi()
1656 * lpfc_fab_name_match - Check if the fcf fabric name match.
1687 * lpfc_sw_name_match - Check if the fcf switch name match.
1718 * lpfc_mac_addr_match - Check if the fcf mac address match.
1751 * __lpfc_update_fcf_record_pri - update the lpfc_fcf_pri record.
1767 fcf_pri = &phba->fcf.fcf_pri[fcf_index]; in __lpfc_update_fcf_record_pri()
1768 fcf_pri->fcf_rec.fcf_index = fcf_index; in __lpfc_update_fcf_record_pri()
1770 fcf_pri->fcf_rec.priority = new_fcf_record->fip_priority; in __lpfc_update_fcf_record_pri()
1775 * lpfc_copy_fcf_record - Copy fcf information to lpfc_hba.
1787 fcf_rec->fabric_name[0] = in lpfc_copy_fcf_record()
1789 fcf_rec->fabric_name[1] = in lpfc_copy_fcf_record()
1791 fcf_rec->fabric_name[2] = in lpfc_copy_fcf_record()
1793 fcf_rec->fabric_name[3] = in lpfc_copy_fcf_record()
1795 fcf_rec->fabric_name[4] = in lpfc_copy_fcf_record()
1797 fcf_rec->fabric_name[5] = in lpfc_copy_fcf_record()
1799 fcf_rec->fabric_name[6] = in lpfc_copy_fcf_record()
1801 fcf_rec->fabric_name[7] = in lpfc_copy_fcf_record()
1804 fcf_rec->mac_addr[0] = bf_get(lpfc_fcf_record_mac_0, new_fcf_record); in lpfc_copy_fcf_record()
1805 fcf_rec->mac_addr[1] = bf_get(lpfc_fcf_record_mac_1, new_fcf_record); in lpfc_copy_fcf_record()
1806 fcf_rec->mac_addr[2] = bf_get(lpfc_fcf_record_mac_2, new_fcf_record); in lpfc_copy_fcf_record()
1807 fcf_rec->mac_addr[3] = bf_get(lpfc_fcf_record_mac_3, new_fcf_record); in lpfc_copy_fcf_record()
1808 fcf_rec->mac_addr[4] = bf_get(lpfc_fcf_record_mac_4, new_fcf_record); in lpfc_copy_fcf_record()
1809 fcf_rec->mac_addr[5] = bf_get(lpfc_fcf_record_mac_5, new_fcf_record); in lpfc_copy_fcf_record()
1811 fcf_rec->fcf_indx = bf_get(lpfc_fcf_record_fcf_index, new_fcf_record); in lpfc_copy_fcf_record()
1813 fcf_rec->priority = new_fcf_record->fip_priority; in lpfc_copy_fcf_record()
1815 fcf_rec->switch_name[0] = in lpfc_copy_fcf_record()
1817 fcf_rec->switch_name[1] = in lpfc_copy_fcf_record()
1819 fcf_rec->switch_name[2] = in lpfc_copy_fcf_record()
1821 fcf_rec->switch_name[3] = in lpfc_copy_fcf_record()
1823 fcf_rec->switch_name[4] = in lpfc_copy_fcf_record()
1825 fcf_rec->switch_name[5] = in lpfc_copy_fcf_record()
1827 fcf_rec->switch_name[6] = in lpfc_copy_fcf_record()
1829 fcf_rec->switch_name[7] = in lpfc_copy_fcf_record()
1834 * __lpfc_update_fcf_record - Update driver fcf record
1851 lockdep_assert_held(&phba->hbalock); in __lpfc_update_fcf_record()
1856 fcf_rec->addr_mode = addr_mode; in __lpfc_update_fcf_record()
1857 fcf_rec->vlan_id = vlan_id; in __lpfc_update_fcf_record()
1858 fcf_rec->flag |= (flag | RECORD_VALID); in __lpfc_update_fcf_record()
1865 * lpfc_register_fcf - Register the FCF with hba.
1877 spin_lock_irq(&phba->hbalock); in lpfc_register_fcf()
1879 if (!(phba->fcf.fcf_flag & FCF_AVAILABLE)) { in lpfc_register_fcf()
1880 spin_unlock_irq(&phba->hbalock); in lpfc_register_fcf()
1881 clear_bit(FCF_TS_INPROG, &phba->hba_flag); in lpfc_register_fcf()
1882 clear_bit(FCF_RR_INPROG, &phba->hba_flag); in lpfc_register_fcf()
1887 if (phba->fcf.fcf_flag & FCF_REGISTERED) { in lpfc_register_fcf()
1888 phba->fcf.fcf_flag |= (FCF_SCAN_DONE | FCF_IN_USE); in lpfc_register_fcf()
1889 spin_unlock_irq(&phba->hbalock); in lpfc_register_fcf()
1890 clear_bit(FCF_TS_INPROG, &phba->hba_flag); in lpfc_register_fcf()
1891 if (phba->pport->port_state != LPFC_FLOGI && in lpfc_register_fcf()
1892 test_bit(FC_FABRIC, &phba->pport->fc_flag)) { in lpfc_register_fcf()
1893 set_bit(FCF_RR_INPROG, &phba->hba_flag); in lpfc_register_fcf()
1894 lpfc_initial_flogi(phba->pport); in lpfc_register_fcf()
1899 spin_unlock_irq(&phba->hbalock); in lpfc_register_fcf()
1901 fcf_mbxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_register_fcf()
1903 clear_bit(FCF_TS_INPROG, &phba->hba_flag); in lpfc_register_fcf()
1904 clear_bit(FCF_RR_INPROG, &phba->hba_flag); in lpfc_register_fcf()
1909 fcf_mbxq->vport = phba->pport; in lpfc_register_fcf()
1910 fcf_mbxq->mbox_cmpl = lpfc_mbx_cmpl_reg_fcfi; in lpfc_register_fcf()
1913 clear_bit(FCF_TS_INPROG, &phba->hba_flag); in lpfc_register_fcf()
1914 clear_bit(FCF_RR_INPROG, &phba->hba_flag); in lpfc_register_fcf()
1915 mempool_free(fcf_mbxq, phba->mbox_mem_pool); in lpfc_register_fcf()
1922 * lpfc_match_fcf_conn_list - Check if the FCF record can be used for discovery.
1950 if (new_fcf_record->vlan_bitmap[i]) { in lpfc_match_fcf_conn_list()
1953 while (!((new_fcf_record->vlan_bitmap[i] >> j) & 1)) { in lpfc_match_fcf_conn_list()
1967 if (!test_bit(HBA_FIP_SUPPORT, &phba->hba_flag)) { in lpfc_match_fcf_conn_list()
1971 if (phba->valid_vlan) in lpfc_match_fcf_conn_list()
1972 *vlan_id = phba->vlan_id; in lpfc_match_fcf_conn_list()
1982 if (list_empty(&phba->fcf_conn_rec_list)) { in lpfc_match_fcf_conn_list()
1989 * addressing mode - FPMA. in lpfc_match_fcf_conn_list()
2003 &phba->fcf_conn_rec_list, list) { in lpfc_match_fcf_conn_list()
2004 if (!(conn_entry->conn_rec.flags & FCFCNCT_VALID)) in lpfc_match_fcf_conn_list()
2007 if ((conn_entry->conn_rec.flags & FCFCNCT_FBNM_VALID) && in lpfc_match_fcf_conn_list()
2008 !lpfc_fab_name_match(conn_entry->conn_rec.fabric_name, in lpfc_match_fcf_conn_list()
2011 if ((conn_entry->conn_rec.flags & FCFCNCT_SWNM_VALID) && in lpfc_match_fcf_conn_list()
2012 !lpfc_sw_name_match(conn_entry->conn_rec.switch_name, in lpfc_match_fcf_conn_list()
2015 if (conn_entry->conn_rec.flags & FCFCNCT_VLAN_VALID) { in lpfc_match_fcf_conn_list()
2020 if (!(new_fcf_record->vlan_bitmap in lpfc_match_fcf_conn_list()
2021 [conn_entry->conn_rec.vlan_tag / 8] & in lpfc_match_fcf_conn_list()
2022 (1 << (conn_entry->conn_rec.vlan_tag % 8)))) in lpfc_match_fcf_conn_list()
2038 if ((conn_entry->conn_rec.flags & FCFCNCT_AM_VALID) && in lpfc_match_fcf_conn_list()
2039 !(conn_entry->conn_rec.flags & FCFCNCT_AM_PREFERRED)) { in lpfc_match_fcf_conn_list()
2044 if ((conn_entry->conn_rec.flags & FCFCNCT_AM_SPMA) && in lpfc_match_fcf_conn_list()
2052 if (!(conn_entry->conn_rec.flags & FCFCNCT_AM_SPMA) && in lpfc_match_fcf_conn_list()
2061 if (conn_entry->conn_rec.flags & FCFCNCT_BOOT) in lpfc_match_fcf_conn_list()
2077 if ((conn_entry->conn_rec.flags & FCFCNCT_AM_VALID) && in lpfc_match_fcf_conn_list()
2078 (!(conn_entry->conn_rec.flags & FCFCNCT_AM_PREFERRED))) in lpfc_match_fcf_conn_list()
2079 *addr_mode = (conn_entry->conn_rec.flags & in lpfc_match_fcf_conn_list()
2086 else if ((conn_entry->conn_rec.flags & FCFCNCT_AM_VALID) && in lpfc_match_fcf_conn_list()
2087 (conn_entry->conn_rec.flags & FCFCNCT_AM_PREFERRED) && in lpfc_match_fcf_conn_list()
2088 (conn_entry->conn_rec.flags & FCFCNCT_AM_SPMA) && in lpfc_match_fcf_conn_list()
2091 else if ((conn_entry->conn_rec.flags & FCFCNCT_AM_VALID) && in lpfc_match_fcf_conn_list()
2092 (conn_entry->conn_rec.flags & FCFCNCT_AM_PREFERRED) && in lpfc_match_fcf_conn_list()
2093 !(conn_entry->conn_rec.flags & FCFCNCT_AM_SPMA) && in lpfc_match_fcf_conn_list()
2098 if (conn_entry->conn_rec.flags & FCFCNCT_VLAN_VALID) in lpfc_match_fcf_conn_list()
2099 *vlan_id = conn_entry->conn_rec.vlan_tag; in lpfc_match_fcf_conn_list()
2116 * lpfc_check_pending_fcoe_event - Check if there is pending fcoe event.
2118 * @unreg_fcf: Unregister FCF if FCF table need to be re-scaned.
2131 if ((phba->link_state >= LPFC_LINK_UP) && in lpfc_check_pending_fcoe_event()
2132 (phba->fcoe_eventtag == phba->fcoe_eventtag_at_fcf_scan)) in lpfc_check_pending_fcoe_event()
2139 phba->link_state, phba->fcoe_eventtag_at_fcf_scan, in lpfc_check_pending_fcoe_event()
2140 phba->fcoe_eventtag); in lpfc_check_pending_fcoe_event()
2142 spin_lock_irq(&phba->hbalock); in lpfc_check_pending_fcoe_event()
2143 phba->fcf.fcf_flag &= ~FCF_AVAILABLE; in lpfc_check_pending_fcoe_event()
2144 spin_unlock_irq(&phba->hbalock); in lpfc_check_pending_fcoe_event()
2146 if (phba->link_state >= LPFC_LINK_UP) { in lpfc_check_pending_fcoe_event()
2151 phba->fcoe_eventtag_at_fcf_scan, in lpfc_check_pending_fcoe_event()
2152 phba->fcoe_eventtag); in lpfc_check_pending_fcoe_event()
2161 "state change (x%x)\n", phba->link_state); in lpfc_check_pending_fcoe_event()
2162 clear_bit(FCF_TS_INPROG, &phba->hba_flag); in lpfc_check_pending_fcoe_event()
2163 clear_bit(FCF_RR_INPROG, &phba->hba_flag); in lpfc_check_pending_fcoe_event()
2164 spin_lock_irq(&phba->hbalock); in lpfc_check_pending_fcoe_event()
2165 phba->fcf.fcf_flag &= ~(FCF_REDISC_FOV | FCF_DISCOVERY); in lpfc_check_pending_fcoe_event()
2166 spin_unlock_irq(&phba->hbalock); in lpfc_check_pending_fcoe_event()
2171 spin_lock_irq(&phba->hbalock); in lpfc_check_pending_fcoe_event()
2172 phba->fcf.fcf_flag &= ~FCF_REGISTERED; in lpfc_check_pending_fcoe_event()
2173 spin_unlock_irq(&phba->hbalock); in lpfc_check_pending_fcoe_event()
2180 * lpfc_sli4_new_fcf_random_select - Randomly select an eligible new fcf record
2187 * size unit32_t, a 16-bit random number returned from get_random_u16() is
2199 /* Get 16-bit uniform random number */ in lpfc_sli4_new_fcf_random_select()
2210 * lpfc_sli4_fcf_rec_mbox_parse - Parse read_fcf mbox command.
2215 * This routine parses the non-embedded fcf mailbox command by performing the
2216 * necessarily error checking, non-embedded read FCF record mailbox command
2219 * Returns the pointer to the new FCF record in the non-embedded mailbox
2233 /* Get the first SGE entry from the non-embedded DMA memory. This in lpfc_sli4_fcf_rec_mbox_parse()
2237 if (unlikely(!mboxq->sge_array)) { in lpfc_sli4_fcf_rec_mbox_parse()
2239 "2524 Failed to get the non-embedded SGE " in lpfc_sli4_fcf_rec_mbox_parse()
2243 virt_addr = mboxq->sge_array->addr[0]; in lpfc_sli4_fcf_rec_mbox_parse()
2248 shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); in lpfc_sli4_fcf_rec_mbox_parse()
2249 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_fcf_rec_mbox_parse()
2250 shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); in lpfc_sli4_fcf_rec_mbox_parse()
2275 new_fcf_record->word137 = le32_to_cpu(new_fcf_record->word137); in lpfc_sli4_fcf_rec_mbox_parse()
2276 new_fcf_record->word138 = le32_to_cpu(new_fcf_record->word138); in lpfc_sli4_fcf_rec_mbox_parse()
2282 * lpfc_sli4_log_fcf_record_info - Log the information of a fcf record
2314 fcf_record->fip_priority, in lpfc_sli4_log_fcf_record_info()
2343 * lpfc_sli4_fcf_record_match - testing new FCF record for matching existing FCF
2362 if (!lpfc_vlan_id_match(fcf_rec->vlan_id, new_vlan_id)) in lpfc_sli4_fcf_record_match()
2364 if (!lpfc_mac_addr_match(fcf_rec->mac_addr, new_fcf_record)) in lpfc_sli4_fcf_record_match()
2366 if (!lpfc_sw_name_match(fcf_rec->switch_name, new_fcf_record)) in lpfc_sli4_fcf_record_match()
2368 if (!lpfc_fab_name_match(fcf_rec->fabric_name, new_fcf_record)) in lpfc_sli4_fcf_record_match()
2370 if (fcf_rec->priority != new_fcf_record->fip_priority) in lpfc_sli4_fcf_record_match()
2376 * lpfc_sli4_fcf_rr_next_proc - processing next roundrobin fcf
2388 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_fcf_rr_next_proc()
2392 if (test_bit(HBA_DEVLOSS_TMO, &phba->hba_flag)) { in lpfc_sli4_fcf_rr_next_proc()
2395 "FCF, unregister in-use FCF (x%x) " in lpfc_sli4_fcf_rr_next_proc()
2397 phba->fcf.current_rec.fcf_indx); in lpfc_sli4_fcf_rr_next_proc()
2402 clear_bit(FCF_RR_INPROG, &phba->hba_flag); in lpfc_sli4_fcf_rr_next_proc()
2404 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_rr_next_proc()
2405 phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_SCAN_DONE); in lpfc_sli4_fcf_rr_next_proc()
2406 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_rr_next_proc()
2410 phba->pport->port_state, LPFC_VPORT_UNKNOWN); in lpfc_sli4_fcf_rr_next_proc()
2411 phba->pport->port_state = LPFC_VPORT_UNKNOWN; in lpfc_sli4_fcf_rr_next_proc()
2413 if (!phba->fcf.fcf_redisc_attempted) { in lpfc_sli4_fcf_rr_next_proc()
2420 phba->fcf.fcf_redisc_attempted = 1; in lpfc_sli4_fcf_rr_next_proc()
2442 rc, phba->fcf.current_rec.fcf_indx); in lpfc_sli4_fcf_rr_next_proc()
2467 new_fcf_pri = &phba->fcf.fcf_pri[fcf_index]; in lpfc_sli4_fcf_pri_list_del()
2470 fcf_index, new_fcf_pri->fcf_rec.priority, in lpfc_sli4_fcf_pri_list_del()
2471 new_fcf_pri->fcf_rec.flag); in lpfc_sli4_fcf_pri_list_del()
2472 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_pri_list_del()
2473 if (new_fcf_pri->fcf_rec.flag & LPFC_FCF_ON_PRI_LIST) { in lpfc_sli4_fcf_pri_list_del()
2474 if (phba->fcf.current_rec.priority == in lpfc_sli4_fcf_pri_list_del()
2475 new_fcf_pri->fcf_rec.priority) in lpfc_sli4_fcf_pri_list_del()
2476 phba->fcf.eligible_fcf_cnt--; in lpfc_sli4_fcf_pri_list_del()
2477 list_del_init(&new_fcf_pri->list); in lpfc_sli4_fcf_pri_list_del()
2478 new_fcf_pri->fcf_rec.flag &= ~LPFC_FCF_ON_PRI_LIST; in lpfc_sli4_fcf_pri_list_del()
2480 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_pri_list_del()
2490 * If the fcf record is re-read for any reason this flag is cleared brfore
2497 new_fcf_pri = &phba->fcf.fcf_pri[fcf_index]; in lpfc_sli4_set_fcf_flogi_fail()
2498 spin_lock_irq(&phba->hbalock); in lpfc_sli4_set_fcf_flogi_fail()
2499 new_fcf_pri->fcf_rec.flag |= LPFC_FCF_FLOGI_FAILED; in lpfc_sli4_set_fcf_flogi_fail()
2500 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_set_fcf_flogi_fail()
2530 new_fcf_pri = &phba->fcf.fcf_pri[fcf_index]; in lpfc_sli4_fcf_pri_list_add()
2533 fcf_index, new_fcf_record->fip_priority, in lpfc_sli4_fcf_pri_list_add()
2534 new_fcf_pri->fcf_rec.flag); in lpfc_sli4_fcf_pri_list_add()
2535 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_pri_list_add()
2536 if (new_fcf_pri->fcf_rec.flag & LPFC_FCF_ON_PRI_LIST) in lpfc_sli4_fcf_pri_list_add()
2537 list_del_init(&new_fcf_pri->list); in lpfc_sli4_fcf_pri_list_add()
2538 new_fcf_pri->fcf_rec.fcf_index = fcf_index; in lpfc_sli4_fcf_pri_list_add()
2539 new_fcf_pri->fcf_rec.priority = new_fcf_record->fip_priority; in lpfc_sli4_fcf_pri_list_add()
2540 if (list_empty(&phba->fcf.fcf_pri_list)) { in lpfc_sli4_fcf_pri_list_add()
2541 list_add(&new_fcf_pri->list, &phba->fcf.fcf_pri_list); in lpfc_sli4_fcf_pri_list_add()
2543 new_fcf_pri->fcf_rec.fcf_index); in lpfc_sli4_fcf_pri_list_add()
2547 last_index = find_first_bit(phba->fcf.fcf_rr_bmask, in lpfc_sli4_fcf_pri_list_add()
2553 current_fcf_pri = phba->fcf.fcf_pri[last_index].fcf_rec.priority; in lpfc_sli4_fcf_pri_list_add()
2554 if (new_fcf_pri->fcf_rec.priority <= current_fcf_pri) { in lpfc_sli4_fcf_pri_list_add()
2555 list_add(&new_fcf_pri->list, &phba->fcf.fcf_pri_list); in lpfc_sli4_fcf_pri_list_add()
2556 if (new_fcf_pri->fcf_rec.priority < current_fcf_pri) { in lpfc_sli4_fcf_pri_list_add()
2557 memset(phba->fcf.fcf_rr_bmask, 0, in lpfc_sli4_fcf_pri_list_add()
2558 sizeof(*phba->fcf.fcf_rr_bmask)); in lpfc_sli4_fcf_pri_list_add()
2560 phba->fcf.eligible_fcf_cnt = 1; in lpfc_sli4_fcf_pri_list_add()
2563 phba->fcf.eligible_fcf_cnt++; in lpfc_sli4_fcf_pri_list_add()
2565 new_fcf_pri->fcf_rec.fcf_index); in lpfc_sli4_fcf_pri_list_add()
2570 &phba->fcf.fcf_pri_list, list) { in lpfc_sli4_fcf_pri_list_add()
2571 if (new_fcf_pri->fcf_rec.priority <= in lpfc_sli4_fcf_pri_list_add()
2572 fcf_pri->fcf_rec.priority) { in lpfc_sli4_fcf_pri_list_add()
2573 if (fcf_pri->list.prev == &phba->fcf.fcf_pri_list) in lpfc_sli4_fcf_pri_list_add()
2574 list_add(&new_fcf_pri->list, in lpfc_sli4_fcf_pri_list_add()
2575 &phba->fcf.fcf_pri_list); in lpfc_sli4_fcf_pri_list_add()
2577 list_add(&new_fcf_pri->list, in lpfc_sli4_fcf_pri_list_add()
2579 fcf_pri->list.prev)->list); in lpfc_sli4_fcf_pri_list_add()
2582 } else if (fcf_pri->list.next == &phba->fcf.fcf_pri_list in lpfc_sli4_fcf_pri_list_add()
2583 || new_fcf_pri->fcf_rec.priority < in lpfc_sli4_fcf_pri_list_add()
2584 next_fcf_pri->fcf_rec.priority) { in lpfc_sli4_fcf_pri_list_add()
2585 list_add(&new_fcf_pri->list, &fcf_pri->list); in lpfc_sli4_fcf_pri_list_add()
2589 if (new_fcf_pri->fcf_rec.priority > fcf_pri->fcf_rec.priority) in lpfc_sli4_fcf_pri_list_add()
2596 new_fcf_pri->fcf_rec.flag = LPFC_FCF_ON_PRI_LIST; in lpfc_sli4_fcf_pri_list_add()
2597 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_pri_list_add()
2602 * lpfc_mbx_cmpl_fcf_scan_read_fcf_rec - fcf scan read_fcf mbox cmpl handler.
2633 /* Parse the FCF record from the non-embedded mailbox command */ in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2641 clear_bit(FCF_TS_INPROG, &phba->hba_flag); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2674 if ((phba->fcf.fcf_flag & FCF_IN_USE) && in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2675 lpfc_sli4_fcf_record_match(phba, &phba->fcf.current_rec, in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2678 phba->fcf.current_rec.fcf_indx) { in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2682 "of in-use FCF (x%x)\n", in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2685 phba->fcf.current_rec.fcf_indx); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2689 * In case the current in-use FCF record becomes in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2694 if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND) && in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2695 !(phba->fcf.fcf_flag & FCF_REDISC_FOV)) { in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2697 "2835 Invalid in-use FCF " in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2700 phba->fcf.current_rec.fcf_indx); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2701 spin_lock_irq(&phba->hbalock); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2702 phba->fcf.fcf_flag |= FCF_REDISC_FOV; in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2703 spin_unlock_irq(&phba->hbalock); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2722 * matches the in-use FCF record: fabric name, switch name, mac in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2725 spin_lock_irq(&phba->hbalock); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2726 if (phba->fcf.fcf_flag & FCF_IN_USE) { in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2727 if (phba->cfg_fcf_failover_policy == LPFC_FCF_FOV && in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2728 lpfc_sli4_fcf_record_match(phba, &phba->fcf.current_rec, in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2731 phba->fcf.current_rec.fcf_indx) { in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2732 phba->fcf.fcf_flag |= FCF_AVAILABLE; in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2733 if (phba->fcf.fcf_flag & FCF_REDISC_PEND) in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2737 else if (phba->fcf.fcf_flag & FCF_REDISC_FOV) in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2739 phba->fcf.fcf_flag &= ~FCF_REDISC_FOV; in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2740 spin_unlock_irq(&phba->hbalock); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2742 "2836 New FCF matches in-use " in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2745 phba->fcf.current_rec.fcf_indx, in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2746 phba->pport->port_state, in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2747 phba->pport->fc_flag); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2752 "property of in-use FCF (x%x)\n", in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2755 phba->fcf.current_rec.fcf_indx); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2759 * with in-use record only if not during the fast failover in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2764 if (!(phba->fcf.fcf_flag & FCF_REDISC_FOV)) { in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2765 spin_unlock_irq(&phba->hbalock); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2770 * Update on failover FCF record only if it's in FCF fast-failover in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2773 if (phba->fcf.fcf_flag & FCF_REDISC_FOV) in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2774 fcf_rec = &phba->fcf.failover_rec; in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2776 fcf_rec = &phba->fcf.current_rec; in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2778 if (phba->fcf.fcf_flag & FCF_AVAILABLE) { in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2784 if (boot_flag && !(fcf_rec->flag & BOOT_ENABLE)) { in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2789 fcf_rec->fcf_indx, in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2794 spin_unlock_irq(&phba->hbalock); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2802 if (!boot_flag && (fcf_rec->flag & BOOT_ENABLE)) { in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2803 spin_unlock_irq(&phba->hbalock); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2810 if (new_fcf_record->fip_priority < fcf_rec->priority) { in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2815 fcf_rec->fcf_indx, in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2821 phba->fcf.eligible_fcf_cnt = 1; in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2822 } else if (new_fcf_record->fip_priority == fcf_rec->priority) { in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2824 phba->fcf.eligible_fcf_cnt++; in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2826 phba->fcf.eligible_fcf_cnt); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2831 fcf_rec->fcf_indx, in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2840 spin_unlock_irq(&phba->hbalock); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2845 * initial best-fit FCF. in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2856 phba->fcf.fcf_flag |= FCF_AVAILABLE; in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2858 phba->fcf.eligible_fcf_cnt = 1; in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2860 spin_unlock_irq(&phba->hbalock); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2866 if (phba->fcf.fcf_flag & FCF_REDISC_FOV) { in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2875 if (!(phba->fcf.failover_rec.flag & RECORD_VALID)) { in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2879 phba->fcoe_eventtag_at_fcf_scan, in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2883 &phba->hba_flag)) { in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2885 &phba->hba_flag); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2886 /* Unregister in-use FCF and rescan */ in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2890 "unreg in-use FCF and " in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2898 clear_bit(FCF_TS_INPROG, &phba->hba_flag); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2903 * the same as in-use FCF record, unregister the in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2904 * in-use FCF record, replace the in-use FCF record in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2910 /* Unregister the current in-use FCF record */ in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2913 /* Replace in-use record with the new record */ in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2915 "2842 Replace in-use FCF (x%x) " in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2917 phba->fcf.current_rec.fcf_indx, in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2918 phba->fcf.failover_rec.fcf_indx); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2919 memcpy(&phba->fcf.current_rec, in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2920 &phba->fcf.failover_rec, in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2927 spin_lock_irq(&phba->hbalock); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2928 phba->fcf.fcf_flag &= ~FCF_REDISC_FOV; in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2929 spin_unlock_irq(&phba->hbalock); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2937 if ((phba->fcf.fcf_flag & FCF_REDISC_EVT) || in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2938 (phba->fcf.fcf_flag & FCF_REDISC_PEND)) in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2941 if (phba->cfg_fcf_failover_policy == LPFC_FCF_FOV && in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2942 phba->fcf.fcf_flag & FCF_IN_USE) { in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2944 * In case the current in-use FCF record no in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2950 "2841 In-use FCF record (x%x) " in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2953 phba->fcf.current_rec.fcf_indx); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2954 spin_lock_irq(&phba->hbalock); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2955 phba->fcf.fcf_flag |= FCF_REDISC_FOV; in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2956 spin_unlock_irq(&phba->hbalock); in lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
2976 * lpfc_mbx_cmpl_fcf_rr_read_fcf_rec - fcf roundrobin read_fcf mbox cmpl hdler
3001 if (phba->link_state < LPFC_LINK_UP) { in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3002 spin_lock_irq(&phba->hbalock); in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3003 phba->fcf.fcf_flag &= ~FCF_DISCOVERY; in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3004 spin_unlock_irq(&phba->hbalock); in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3005 clear_bit(FCF_RR_INPROG, &phba->hba_flag); in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3009 /* Parse the FCF record from the non-embedded mailbox command */ in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3016 "hba_flg x%lx fcf_flg x%x\n", phba->hba_flag, in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3017 phba->fcf.fcf_flag); in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3039 rc = lpfc_sli4_fcf_rr_next_proc(phba->pport, fcf_index); in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3045 if (fcf_index == phba->fcf.current_rec.fcf_indx) { in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3049 phba->fcf.current_rec.fcf_indx, fcf_index); in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3052 lpfc_issue_init_vfi(phba->pport); in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3059 phba->fcf.failover_rec.fcf_indx, fcf_index); in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3060 spin_lock_irq(&phba->hbalock); in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3061 __lpfc_update_fcf_record(phba, &phba->fcf.failover_rec, in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3064 spin_unlock_irq(&phba->hbalock); in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3066 current_fcf_index = phba->fcf.current_rec.fcf_indx; in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3068 /* Unregister the current in-use FCF record */ in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3071 /* Replace in-use record with the new record */ in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3072 memcpy(&phba->fcf.current_rec, &phba->fcf.failover_rec, in lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
3086 * lpfc_mbx_cmpl_read_fcf_rec - read fcf completion handler.
3106 if (phba->link_state < LPFC_LINK_UP) in lpfc_mbx_cmpl_read_fcf_rec()
3110 if (!(phba->fcf.fcf_flag & FCF_DISCOVERY)) in lpfc_mbx_cmpl_read_fcf_rec()
3113 /* Parse the FCF record from the non-embedded mailbox command */ in lpfc_mbx_cmpl_read_fcf_rec()
3144 * lpfc_init_vfi_cmpl - Completion handler for init_vfi mbox command.
3153 struct lpfc_vport *vport = mboxq->vport; in lpfc_init_vfi_cmpl()
3157 * Also continue if the VFI is in use - just use the same one. in lpfc_init_vfi_cmpl()
3159 if (mboxq->u.mb.mbxStatus && in lpfc_init_vfi_cmpl()
3160 (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) != in lpfc_init_vfi_cmpl()
3162 mboxq->u.mb.mbxStatus != MBX_VFI_IN_USE) { in lpfc_init_vfi_cmpl()
3165 mboxq->u.mb.mbxStatus); in lpfc_init_vfi_cmpl()
3166 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_init_vfi_cmpl()
3172 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_init_vfi_cmpl()
3177 * lpfc_issue_init_vfi - Issue init_vfi mailbox command.
3188 struct lpfc_hba *phba = vport->phba; in lpfc_issue_init_vfi()
3190 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_issue_init_vfi()
3198 mboxq->mbox_cmpl = lpfc_init_vfi_cmpl; in lpfc_issue_init_vfi()
3203 mempool_free(mboxq, vport->phba->mbox_mem_pool); in lpfc_issue_init_vfi()
3208 * lpfc_init_vpi_cmpl - Completion handler for init_vpi mbox command.
3217 struct lpfc_vport *vport = mboxq->vport; in lpfc_init_vpi_cmpl()
3220 if (mboxq->u.mb.mbxStatus) { in lpfc_init_vpi_cmpl()
3223 mboxq->u.mb.mbxStatus); in lpfc_init_vpi_cmpl()
3224 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_init_vpi_cmpl()
3228 clear_bit(FC_VPORT_NEEDS_INIT_VPI, &vport->fc_flag); in lpfc_init_vpi_cmpl()
3231 if ((phba->pport == vport) || (vport->port_state == LPFC_FDISC)) { in lpfc_init_vpi_cmpl()
3240 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_init_vpi_cmpl()
3244 if (phba->link_flag & LS_NPIV_FAB_SUPPORTED) in lpfc_init_vpi_cmpl()
3251 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_init_vpi_cmpl()
3256 * lpfc_issue_init_vpi - Issue init_vpi mailbox command.
3268 if ((vport->port_type != LPFC_PHYSICAL_PORT) && (!vport->vpi)) { in lpfc_issue_init_vpi()
3269 vpi = lpfc_alloc_vpi(vport->phba); in lpfc_issue_init_vpi()
3276 vport->vpi = vpi; in lpfc_issue_init_vpi()
3279 mboxq = mempool_alloc(vport->phba->mbox_mem_pool, GFP_KERNEL); in lpfc_issue_init_vpi()
3286 lpfc_init_vpi(vport->phba, mboxq, vport->vpi); in lpfc_issue_init_vpi()
3287 mboxq->vport = vport; in lpfc_issue_init_vpi()
3288 mboxq->mbox_cmpl = lpfc_init_vpi_cmpl; in lpfc_issue_init_vpi()
3289 rc = lpfc_sli_issue_mbox(vport->phba, mboxq, MBX_NOWAIT); in lpfc_issue_init_vpi()
3293 mempool_free(mboxq, vport->phba->mbox_mem_pool); in lpfc_issue_init_vpi()
3298 * lpfc_start_fdiscs - send fdiscs for each vports on this port.
3312 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_start_fdiscs()
3313 if (vports[i]->port_type == LPFC_PHYSICAL_PORT) in lpfc_start_fdiscs()
3316 if (vports[i]->vpi > phba->max_vpi) { in lpfc_start_fdiscs()
3321 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_start_fdiscs()
3327 &vports[i]->fc_flag)) { in lpfc_start_fdiscs()
3331 if (phba->link_flag & LS_NPIV_FAB_SUPPORTED) in lpfc_start_fdiscs()
3349 struct lpfc_vport *vport = mboxq->vport; in lpfc_mbx_cmpl_reg_vfi()
3356 if (mboxq->u.mb.mbxStatus && in lpfc_mbx_cmpl_reg_vfi()
3357 (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) != in lpfc_mbx_cmpl_reg_vfi()
3359 mboxq->u.mb.mbxStatus != MBX_VFI_IN_USE) { in lpfc_mbx_cmpl_reg_vfi()
3363 mboxq->u.mb.mbxStatus, vport->port_state); in lpfc_mbx_cmpl_reg_vfi()
3364 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_mbx_cmpl_reg_vfi()
3379 if (test_bit(FC_VFI_REGISTERED, &vport->fc_flag)) in lpfc_mbx_cmpl_reg_vfi()
3380 if (!(phba->sli_rev == LPFC_SLI_REV4 && in lpfc_mbx_cmpl_reg_vfi()
3381 test_bit(FC_PT2PT, &vport->fc_flag))) in lpfc_mbx_cmpl_reg_vfi()
3385 set_bit(FC_VFI_REGISTERED, &vport->fc_flag); in lpfc_mbx_cmpl_reg_vfi()
3386 clear_bit(FC_VPORT_NEEDS_REG_VPI, &vport->fc_flag); in lpfc_mbx_cmpl_reg_vfi()
3387 clear_bit(FC_VPORT_NEEDS_INIT_VPI, &vport->fc_flag); in lpfc_mbx_cmpl_reg_vfi()
3388 spin_lock_irq(shost->host_lock); in lpfc_mbx_cmpl_reg_vfi()
3389 vport->vpi_state |= LPFC_VPI_REGISTERED; in lpfc_mbx_cmpl_reg_vfi()
3390 spin_unlock_irq(shost->host_lock); in lpfc_mbx_cmpl_reg_vfi()
3393 if ((phba->sli_rev == LPFC_SLI_REV4) && in lpfc_mbx_cmpl_reg_vfi()
3394 (phba->link_flag & LS_LOOPBACK_MODE)) { in lpfc_mbx_cmpl_reg_vfi()
3395 phba->link_state = LPFC_HBA_READY; in lpfc_mbx_cmpl_reg_vfi()
3402 vport->port_state, vport->fc_flag, vport->fc_myDID, in lpfc_mbx_cmpl_reg_vfi()
3403 vport->phba->alpa_map[0], in lpfc_mbx_cmpl_reg_vfi()
3404 phba->link_state, phba->fc_topology); in lpfc_mbx_cmpl_reg_vfi()
3406 if (vport->port_state == LPFC_FABRIC_CFG_LINK) { in lpfc_mbx_cmpl_reg_vfi()
3411 if (test_bit(FC_PT2PT, &vport->fc_flag) || in lpfc_mbx_cmpl_reg_vfi()
3412 (phba->fc_topology == LPFC_TOPOLOGY_LOOP && in lpfc_mbx_cmpl_reg_vfi()
3413 !test_bit(FC_PUBLIC_LOOP, &vport->fc_flag))) { in lpfc_mbx_cmpl_reg_vfi()
3418 if (test_bit(FC_PT2PT, &vport->fc_flag)) in lpfc_mbx_cmpl_reg_vfi()
3419 vport->port_state = LPFC_VPORT_READY; in lpfc_mbx_cmpl_reg_vfi()
3435 MAILBOX_t *mb = &pmb->u.mb; in lpfc_mbx_cmpl_read_sparam()
3436 struct lpfc_dmabuf *mp = pmb->ctx_buf; in lpfc_mbx_cmpl_read_sparam()
3437 struct lpfc_vport *vport = pmb->vport; in lpfc_mbx_cmpl_read_sparam()
3439 struct serv_parm *sp = &vport->fc_sparam; in lpfc_mbx_cmpl_read_sparam()
3443 if (mb->mbxStatus) { in lpfc_mbx_cmpl_read_sparam()
3448 mb->mbxStatus, vport->port_state); in lpfc_mbx_cmpl_read_sparam()
3453 memcpy((uint8_t *) &vport->fc_sparam, (uint8_t *) mp->virt, in lpfc_mbx_cmpl_read_sparam()
3456 ed_tov = be32_to_cpu(sp->cmn.e_d_tov); in lpfc_mbx_cmpl_read_sparam()
3457 if (sp->cmn.edtovResolution) /* E_D_TOV ticks are in nanoseconds */ in lpfc_mbx_cmpl_read_sparam()
3460 phba->fc_edtov = ed_tov; in lpfc_mbx_cmpl_read_sparam()
3461 phba->fc_ratov = (2 * ed_tov) / 1000; in lpfc_mbx_cmpl_read_sparam()
3462 if (phba->fc_ratov < FF_DEF_RATOV) { in lpfc_mbx_cmpl_read_sparam()
3464 phba->fc_ratov = FF_DEF_RATOV; in lpfc_mbx_cmpl_read_sparam()
3468 fc_host_port_name(shost) = wwn_to_u64(vport->fc_portname.u.wwn); in lpfc_mbx_cmpl_read_sparam()
3469 if (vport->port_type == LPFC_PHYSICAL_PORT) { in lpfc_mbx_cmpl_read_sparam()
3470 memcpy(&phba->wwnn, &vport->fc_nodename, sizeof(phba->wwnn)); in lpfc_mbx_cmpl_read_sparam()
3471 memcpy(&phba->wwpn, &vport->fc_portname, sizeof(phba->wwnn)); in lpfc_mbx_cmpl_read_sparam()
3479 if (test_bit(HBA_DEFER_FLOGI, &phba->hba_flag)) { in lpfc_mbx_cmpl_read_sparam()
3481 clear_bit(HBA_DEFER_FLOGI, &phba->hba_flag); in lpfc_mbx_cmpl_read_sparam()
3493 struct lpfc_vport *vport = phba->pport; in lpfc_mbx_process_link_up()
3500 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_mbx_process_link_up()
3501 phba->fc_linkspeed = bf_get(lpfc_mbx_read_top_link_spd, la); in lpfc_mbx_process_link_up()
3503 if (!test_bit(HBA_FCOE_MODE, &phba->hba_flag)) { in lpfc_mbx_process_link_up()
3517 phba->fc_linkspeed = LPFC_LINK_SPEED_UNKNOWN; in lpfc_mbx_process_link_up()
3522 if (phba->fc_topology && in lpfc_mbx_process_link_up()
3523 phba->fc_topology != bf_get(lpfc_mbx_read_top_topology, la)) { in lpfc_mbx_process_link_up()
3526 phba->fc_topology, in lpfc_mbx_process_link_up()
3528 phba->fc_topology_changed = 1; in lpfc_mbx_process_link_up()
3531 phba->fc_topology = bf_get(lpfc_mbx_read_top_topology, la); in lpfc_mbx_process_link_up()
3532 phba->link_flag &= ~(LS_NPIV_FAB_SUPPORTED | LS_CT_VEN_RPA); in lpfc_mbx_process_link_up()
3534 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_mbx_process_link_up()
3535 phba->sli3_options &= ~LPFC_SLI3_NPIV_ENABLED; in lpfc_mbx_process_link_up()
3540 if (phba->cfg_enable_npiv && phba->max_vpi) in lpfc_mbx_process_link_up()
3546 set_bit(FC_LBIT, &vport->fc_flag); in lpfc_mbx_process_link_up()
3548 vport->fc_myDID = bf_get(lpfc_mbx_read_top_alpa_granted, la); in lpfc_mbx_process_link_up()
3549 i = la->lilpBde64.tus.f.bdeSize; in lpfc_mbx_process_link_up()
3552 phba->alpa_map[0] = 0; in lpfc_mbx_process_link_up()
3554 if (vport->cfg_log_verbose & LOG_LINK_EVENT) { in lpfc_mbx_process_link_up()
3565 numalpa = phba->alpa_map[0]; in lpfc_mbx_process_link_up()
3570 un.pamap[k - 1] = in lpfc_mbx_process_link_up()
3571 phba->alpa_map[j + 1]; in lpfc_mbx_process_link_up()
3589 if (!(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) { in lpfc_mbx_process_link_up()
3590 if (phba->max_vpi && phba->cfg_enable_npiv && in lpfc_mbx_process_link_up()
3591 (phba->sli_rev >= LPFC_SLI_REV3)) in lpfc_mbx_process_link_up()
3592 phba->sli3_options |= LPFC_SLI3_NPIV_ENABLED; in lpfc_mbx_process_link_up()
3594 vport->fc_myDID = phba->fc_pref_DID; in lpfc_mbx_process_link_up()
3595 set_bit(FC_LBIT, &vport->fc_flag); in lpfc_mbx_process_link_up()
3597 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_mbx_process_link_up()
3602 sparam_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_mbx_process_link_up()
3608 mempool_free(sparam_mbox, phba->mbox_mem_pool); in lpfc_mbx_process_link_up()
3611 sparam_mbox->vport = vport; in lpfc_mbx_process_link_up()
3612 sparam_mbox->mbox_cmpl = lpfc_mbx_cmpl_read_sparam; in lpfc_mbx_process_link_up()
3619 if (!test_bit(HBA_FCOE_MODE, &phba->hba_flag)) { in lpfc_mbx_process_link_up()
3620 cfglink_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_mbx_process_link_up()
3623 vport->port_state = LPFC_LOCAL_CFG_LINK; in lpfc_mbx_process_link_up()
3625 cfglink_mbox->vport = vport; in lpfc_mbx_process_link_up()
3626 cfglink_mbox->mbox_cmpl = lpfc_mbx_cmpl_local_config_link; in lpfc_mbx_process_link_up()
3629 mempool_free(cfglink_mbox, phba->mbox_mem_pool); in lpfc_mbx_process_link_up()
3633 vport->port_state = LPFC_VPORT_UNKNOWN; in lpfc_mbx_process_link_up()
3639 if (!test_bit(HBA_FIP_SUPPORT, &phba->hba_flag)) { in lpfc_mbx_process_link_up()
3647 rc = -ENODEV; in lpfc_mbx_process_link_up()
3659 rc = -ENODEV; in lpfc_mbx_process_link_up()
3669 if (test_bit(FCF_TS_INPROG, &phba->hba_flag)) in lpfc_mbx_process_link_up()
3672 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_mbx_process_link_up()
3673 phba->fcf.fcf_flag |= FCF_INIT_DISC; in lpfc_mbx_process_link_up()
3674 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_mbx_process_link_up()
3680 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_mbx_process_link_up()
3681 phba->fcf.fcf_flag &= ~FCF_INIT_DISC; in lpfc_mbx_process_link_up()
3682 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_mbx_process_link_up()
3690 memset(phba->os_host_name, 0, sizeof(phba->os_host_name)); in lpfc_mbx_process_link_up()
3691 scnprintf(phba->os_host_name, sizeof(phba->os_host_name), "%s", in lpfc_mbx_process_link_up()
3692 init_utsname()->nodename); in lpfc_mbx_process_link_up()
3698 vport->port_state, sparam_mbox, cfglink_mbox); in lpfc_mbx_process_link_up()
3707 struct lpfc_sli *psli = &phba->sli; in lpfc_enable_la()
3708 spin_lock_irq(&phba->hbalock); in lpfc_enable_la()
3709 psli->sli_flag |= LPFC_PROCESS_LA; in lpfc_enable_la()
3710 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_enable_la()
3711 control = readl(phba->HCregaddr); in lpfc_enable_la()
3713 writel(control, phba->HCregaddr); in lpfc_enable_la()
3714 readl(phba->HCregaddr); /* flush */ in lpfc_enable_la()
3716 spin_unlock_irq(&phba->hbalock); in lpfc_enable_la()
3725 /* turn on Link Attention interrupts - no CLEAR_LA needed */ in lpfc_mbx_issue_link_down()
3738 struct lpfc_vport *vport = pmb->vport; in lpfc_mbx_cmpl_read_topology()
3741 MAILBOX_t *mb = &pmb->u.mb; in lpfc_mbx_cmpl_read_topology()
3742 struct lpfc_dmabuf *mp = pmb->ctx_buf; in lpfc_mbx_cmpl_read_topology()
3748 pring->flag &= ~LPFC_STOP_IOCB_EVENT; in lpfc_mbx_cmpl_read_topology()
3751 if (mb->mbxStatus) { in lpfc_mbx_cmpl_read_topology()
3754 mb->mbxStatus, vport->port_state); in lpfc_mbx_cmpl_read_topology()
3756 phba->link_state = LPFC_HBA_ERROR; in lpfc_mbx_cmpl_read_topology()
3760 la = (struct lpfc_mbx_read_top *) &pmb->u.mb.un.varReadTop; in lpfc_mbx_cmpl_read_topology()
3763 memcpy(&phba->alpa_map[0], mp->virt, 128); in lpfc_mbx_cmpl_read_topology()
3766 set_bit(FC_BYPASSED_MODE, &vport->fc_flag); in lpfc_mbx_cmpl_read_topology()
3768 clear_bit(FC_BYPASSED_MODE, &vport->fc_flag); in lpfc_mbx_cmpl_read_topology()
3770 if (phba->fc_eventTag <= la->eventTag) { in lpfc_mbx_cmpl_read_topology()
3771 phba->fc_stat.LinkMultiEvent++; in lpfc_mbx_cmpl_read_topology()
3773 if (phba->fc_eventTag != 0) in lpfc_mbx_cmpl_read_topology()
3777 phba->fc_eventTag = la->eventTag; in lpfc_mbx_cmpl_read_topology()
3778 phba->link_events++; in lpfc_mbx_cmpl_read_topology()
3780 phba->fc_stat.LinkUp++; in lpfc_mbx_cmpl_read_topology()
3781 if (phba->link_flag & LS_LOOPBACK_MODE) { in lpfc_mbx_cmpl_read_topology()
3785 la->eventTag, phba->fc_eventTag, in lpfc_mbx_cmpl_read_topology()
3789 phba->alpa_map[0]); in lpfc_mbx_cmpl_read_topology()
3794 la->eventTag, phba->fc_eventTag, in lpfc_mbx_cmpl_read_topology()
3798 phba->alpa_map[0], in lpfc_mbx_cmpl_read_topology()
3803 if (phba->cmf_active_mode != LPFC_CFG_OFF) in lpfc_mbx_cmpl_read_topology()
3806 if (phba->lmt & LMT_64Gb) in lpfc_mbx_cmpl_read_topology()
3811 phba->fc_stat.LinkDown++; in lpfc_mbx_cmpl_read_topology()
3812 if (phba->link_flag & LS_LOOPBACK_MODE) in lpfc_mbx_cmpl_read_topology()
3817 la->eventTag, phba->fc_eventTag, in lpfc_mbx_cmpl_read_topology()
3818 phba->pport->port_state, vport->fc_flag); in lpfc_mbx_cmpl_read_topology()
3823 la->eventTag, phba->fc_eventTag, in lpfc_mbx_cmpl_read_topology()
3824 phba->pport->port_state, vport->fc_flag, in lpfc_mbx_cmpl_read_topology()
3830 la->eventTag, phba->fc_eventTag, in lpfc_mbx_cmpl_read_topology()
3831 phba->pport->port_state, vport->fc_flag, in lpfc_mbx_cmpl_read_topology()
3836 if ((phba->sli_rev < LPFC_SLI_REV4) && in lpfc_mbx_cmpl_read_topology()
3855 struct lpfc_vport *vport = pmb->vport; in lpfc_mbx_cmpl_reg_login()
3856 struct lpfc_dmabuf *mp = pmb->ctx_buf; in lpfc_mbx_cmpl_reg_login()
3857 struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; in lpfc_mbx_cmpl_reg_login()
3863 pmb->ctx_buf = NULL; in lpfc_mbx_cmpl_reg_login()
3864 pmb->ctx_ndlp = NULL; in lpfc_mbx_cmpl_reg_login()
3868 ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, in lpfc_mbx_cmpl_reg_login()
3869 kref_read(&ndlp->kref), in lpfc_mbx_cmpl_reg_login()
3871 if (ndlp->nlp_flag & NLP_REG_LOGIN_SEND) in lpfc_mbx_cmpl_reg_login()
3872 ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; in lpfc_mbx_cmpl_reg_login()
3874 if (ndlp->nlp_flag & NLP_IGNR_REG_CMPL || in lpfc_mbx_cmpl_reg_login()
3875 ndlp->nlp_state != NLP_STE_REG_LOGIN_ISSUE) { in lpfc_mbx_cmpl_reg_login()
3884 spin_lock_irq(&ndlp->lock); in lpfc_mbx_cmpl_reg_login()
3885 ndlp->nlp_flag &= ~NLP_IGNR_REG_CMPL; in lpfc_mbx_cmpl_reg_login()
3886 spin_unlock_irq(&ndlp->lock); in lpfc_mbx_cmpl_reg_login()
3893 ndlp->nlp_flag |= NLP_RPI_REGISTERED; in lpfc_mbx_cmpl_reg_login()
3899 pmb->ctx_buf = mp; in lpfc_mbx_cmpl_reg_login()
3913 MAILBOX_t *mb = &pmb->u.mb; in lpfc_mbx_cmpl_unreg_vpi()
3914 struct lpfc_vport *vport = pmb->vport; in lpfc_mbx_cmpl_unreg_vpi()
3917 switch (mb->mbxStatus) { in lpfc_mbx_cmpl_unreg_vpi()
3922 mb->mbxStatus); in lpfc_mbx_cmpl_unreg_vpi()
3928 vport->vpi, mb->mbxStatus); in lpfc_mbx_cmpl_unreg_vpi()
3929 if (!test_bit(FC_UNLOADING, &phba->pport->load_flag)) in lpfc_mbx_cmpl_unreg_vpi()
3934 set_bit(FC_VPORT_NEEDS_REG_VPI, &vport->fc_flag); in lpfc_mbx_cmpl_unreg_vpi()
3935 spin_lock_irq(shost->host_lock); in lpfc_mbx_cmpl_unreg_vpi()
3936 vport->vpi_state &= ~LPFC_VPI_REGISTERED; in lpfc_mbx_cmpl_unreg_vpi()
3937 spin_unlock_irq(shost->host_lock); in lpfc_mbx_cmpl_unreg_vpi()
3938 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_mbx_cmpl_unreg_vpi()
3944 if (test_bit(FC_UNLOADING, &vport->load_flag) && vport != phba->pport) in lpfc_mbx_cmpl_unreg_vpi()
3951 struct lpfc_hba *phba = vport->phba; in lpfc_mbx_unreg_vpi()
3955 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_mbx_unreg_vpi()
3959 lpfc_unreg_vpi(phba, vport->vpi, mbox); in lpfc_mbx_unreg_vpi()
3960 mbox->vport = vport; in lpfc_mbx_unreg_vpi()
3961 mbox->mbox_cmpl = lpfc_mbx_cmpl_unreg_vpi; in lpfc_mbx_unreg_vpi()
3966 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_mbx_unreg_vpi()
3975 struct lpfc_vport *vport = pmb->vport; in lpfc_mbx_cmpl_reg_vpi()
3977 MAILBOX_t *mb = &pmb->u.mb; in lpfc_mbx_cmpl_reg_vpi()
3979 switch (mb->mbxStatus) { in lpfc_mbx_cmpl_reg_vpi()
3985 mb->mbxStatus); in lpfc_mbx_cmpl_reg_vpi()
3987 clear_bit(FC_FABRIC, &vport->fc_flag); in lpfc_mbx_cmpl_reg_vpi()
3988 clear_bit(FC_PUBLIC_LOOP, &vport->fc_flag); in lpfc_mbx_cmpl_reg_vpi()
3989 vport->fc_myDID = 0; in lpfc_mbx_cmpl_reg_vpi()
3991 if ((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) || in lpfc_mbx_cmpl_reg_vpi()
3992 (vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) { in lpfc_mbx_cmpl_reg_vpi()
3993 if (phba->nvmet_support) in lpfc_mbx_cmpl_reg_vpi()
4001 clear_bit(FC_VPORT_NEEDS_REG_VPI, &vport->fc_flag); in lpfc_mbx_cmpl_reg_vpi()
4002 spin_lock_irq(shost->host_lock); in lpfc_mbx_cmpl_reg_vpi()
4003 vport->vpi_state |= LPFC_VPI_REGISTERED; in lpfc_mbx_cmpl_reg_vpi()
4004 spin_unlock_irq(shost->host_lock); in lpfc_mbx_cmpl_reg_vpi()
4005 vport->num_disc_nodes = 0; in lpfc_mbx_cmpl_reg_vpi()
4007 if (atomic_read(&vport->fc_npr_cnt)) in lpfc_mbx_cmpl_reg_vpi()
4010 if (!vport->num_disc_nodes) { in lpfc_mbx_cmpl_reg_vpi()
4011 clear_bit(FC_NDISC_ACTIVE, &vport->fc_flag); in lpfc_mbx_cmpl_reg_vpi()
4014 vport->port_state = LPFC_VPORT_READY; in lpfc_mbx_cmpl_reg_vpi()
4017 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_mbx_cmpl_reg_vpi()
4022 * lpfc_create_static_vport - Read HBA config region to create static vports.
4045 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_create_static_vport()
4053 mb = &pmb->u.mb; in lpfc_create_static_vport()
4060 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_create_static_vport()
4068 * the dump routine is a single-use construct. in lpfc_create_static_vport()
4070 if (pmb->ctx_buf) { in lpfc_create_static_vport()
4071 mp = pmb->ctx_buf; in lpfc_create_static_vport()
4072 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_create_static_vport()
4074 pmb->ctx_buf = NULL; in lpfc_create_static_vport()
4079 pmb->vport = phba->pport; in lpfc_create_static_vport()
4083 if ((mbx_wait_rc != MBX_SUCCESS) || mb->mbxStatus) { in lpfc_create_static_vport()
4088 mbx_wait_rc, mb->mbxStatus); in lpfc_create_static_vport()
4092 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_create_static_vport()
4093 byte_count = pmb->u.mqe.un.mb_words[5]; in lpfc_create_static_vport()
4094 mp = pmb->ctx_buf; in lpfc_create_static_vport()
4095 if (byte_count > sizeof(struct static_vport_info) - in lpfc_create_static_vport()
4098 - offset; in lpfc_create_static_vport()
4099 memcpy(vport_buff + offset, mp->virt, byte_count); in lpfc_create_static_vport()
4102 if (mb->un.varDmp.word_cnt > in lpfc_create_static_vport()
4103 sizeof(struct static_vport_info) - offset) in lpfc_create_static_vport()
4104 mb->un.varDmp.word_cnt = in lpfc_create_static_vport()
4106 - offset; in lpfc_create_static_vport()
4107 byte_count = mb->un.varDmp.word_cnt; in lpfc_create_static_vport()
4119 if ((le32_to_cpu(vport_info->signature) != VPORT_INFO_SIG) || in lpfc_create_static_vport()
4120 ((le32_to_cpu(vport_info->rev) & VPORT_INFO_REV_MASK) in lpfc_create_static_vport()
4125 le32_to_cpu(vport_info->signature), in lpfc_create_static_vport()
4126 le32_to_cpu(vport_info->rev) & in lpfc_create_static_vport()
4132 shost = lpfc_shost_from_vport(phba->pport); in lpfc_create_static_vport()
4136 vport_id.port_name = wwn_to_u64(vport_info->vport_list[i].wwpn); in lpfc_create_static_vport()
4137 vport_id.node_name = wwn_to_u64(vport_info->vport_list[i].wwnn); in lpfc_create_static_vport()
4153 vport = *(struct lpfc_vport **)new_fc_vport->dd_data; in lpfc_create_static_vport()
4154 vport->vport_flag |= STATIC_VPORT; in lpfc_create_static_vport()
4172 struct lpfc_vport *vport = pmb->vport; in lpfc_mbx_cmpl_fabric_reg_login()
4173 MAILBOX_t *mb = &pmb->u.mb; in lpfc_mbx_cmpl_fabric_reg_login()
4174 struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; in lpfc_mbx_cmpl_fabric_reg_login()
4176 pmb->ctx_ndlp = NULL; in lpfc_mbx_cmpl_fabric_reg_login()
4178 if (mb->mbxStatus) { in lpfc_mbx_cmpl_fabric_reg_login()
4181 mb->mbxStatus); in lpfc_mbx_cmpl_fabric_reg_login()
4183 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_mbx_cmpl_fabric_reg_login()
4204 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_mbx_cmpl_fabric_reg_login()
4205 ndlp->nlp_rpi = mb->un.varWords[0]; in lpfc_mbx_cmpl_fabric_reg_login()
4206 ndlp->nlp_flag |= NLP_RPI_REGISTERED; in lpfc_mbx_cmpl_fabric_reg_login()
4207 ndlp->nlp_type |= NLP_FABRIC; in lpfc_mbx_cmpl_fabric_reg_login()
4210 if (vport->port_state == LPFC_FABRIC_CFG_LINK) { in lpfc_mbx_cmpl_fabric_reg_login()
4213 if (!test_and_clear_bit(FC_LOGO_RCVD_DID_CHNG, &vport->fc_flag)) in lpfc_mbx_cmpl_fabric_reg_login()
4235 if ((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) || in lpfc_issue_gidft()
4236 (vport->cfg_enable_fc4_type == LPFC_ENABLE_FCP)) { in lpfc_issue_gidft()
4249 vport->gidft_inp++; in lpfc_issue_gidft()
4252 if ((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) || in lpfc_issue_gidft()
4253 (vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) { in lpfc_issue_gidft()
4264 vport->gidft_inp); in lpfc_issue_gidft()
4265 if (vport->gidft_inp == 0) in lpfc_issue_gidft()
4268 vport->gidft_inp++; in lpfc_issue_gidft()
4270 return vport->gidft_inp; in lpfc_issue_gidft()
4274 * lpfc_issue_gidpt - issue a GID_PT for all N_Ports
4280 * 0 - Failure to issue a GID_PT
4281 * 1 - GID_PT issued
4298 vport->gidft_inp++; in lpfc_issue_gidpt()
4311 MAILBOX_t *mb = &pmb->u.mb; in lpfc_mbx_cmpl_ns_reg_login()
4312 struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; in lpfc_mbx_cmpl_ns_reg_login()
4313 struct lpfc_vport *vport = pmb->vport; in lpfc_mbx_cmpl_ns_reg_login()
4316 pmb->ctx_ndlp = NULL; in lpfc_mbx_cmpl_ns_reg_login()
4317 vport->gidft_inp = 0; in lpfc_mbx_cmpl_ns_reg_login()
4319 if (mb->mbxStatus) { in lpfc_mbx_cmpl_ns_reg_login()
4322 mb->mbxStatus); in lpfc_mbx_cmpl_ns_reg_login()
4336 if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD))) { in lpfc_mbx_cmpl_ns_reg_login()
4337 spin_lock_irq(&ndlp->lock); in lpfc_mbx_cmpl_ns_reg_login()
4338 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; in lpfc_mbx_cmpl_ns_reg_login()
4339 spin_unlock_irq(&ndlp->lock); in lpfc_mbx_cmpl_ns_reg_login()
4343 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_mbx_cmpl_ns_reg_login()
4358 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_mbx_cmpl_ns_reg_login()
4359 ndlp->nlp_rpi = mb->un.varWords[0]; in lpfc_mbx_cmpl_ns_reg_login()
4360 ndlp->nlp_flag |= NLP_RPI_REGISTERED; in lpfc_mbx_cmpl_ns_reg_login()
4361 ndlp->nlp_type |= NLP_FABRIC; in lpfc_mbx_cmpl_ns_reg_login()
4365 ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, in lpfc_mbx_cmpl_ns_reg_login()
4366 kref_read(&ndlp->kref), in lpfc_mbx_cmpl_ns_reg_login()
4369 if (vport->port_state < LPFC_VPORT_READY) { in lpfc_mbx_cmpl_ns_reg_login()
4376 if ((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) || in lpfc_mbx_cmpl_ns_reg_login()
4377 (vport->cfg_enable_fc4_type == LPFC_ENABLE_FCP)) in lpfc_mbx_cmpl_ns_reg_login()
4380 if ((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) || in lpfc_mbx_cmpl_ns_reg_login()
4381 (vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) in lpfc_mbx_cmpl_ns_reg_login()
4394 if (phba->cmf_active_mode != LPFC_CFG_OFF) { in lpfc_mbx_cmpl_ns_reg_login()
4395 phba->cgn_reg_fpin = phba->cgn_init_reg_fpin; in lpfc_mbx_cmpl_ns_reg_login()
4396 phba->cgn_reg_signal = phba->cgn_init_reg_signal; in lpfc_mbx_cmpl_ns_reg_login()
4401 rc, phba->cgn_init_reg_signal); in lpfc_mbx_cmpl_ns_reg_login()
4402 } else if (phba->lmt & LMT_64Gb) { in lpfc_mbx_cmpl_ns_reg_login()
4410 vport->fc_ns_retry = 0; in lpfc_mbx_cmpl_ns_reg_login()
4434 struct lpfc_vport *vport = pmb->vport; in lpfc_mbx_cmpl_fc_reg_login()
4435 MAILBOX_t *mb = &pmb->u.mb; in lpfc_mbx_cmpl_fc_reg_login()
4436 struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; in lpfc_mbx_cmpl_fc_reg_login()
4438 pmb->ctx_ndlp = NULL; in lpfc_mbx_cmpl_fc_reg_login()
4439 if (mb->mbxStatus) { in lpfc_mbx_cmpl_fc_reg_login()
4442 __func__, mb->mbxStatus); in lpfc_mbx_cmpl_fc_reg_login()
4448 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_mbx_cmpl_fc_reg_login()
4449 ndlp->nlp_rpi = mb->un.varWords[0]; in lpfc_mbx_cmpl_fc_reg_login()
4453 __func__, ndlp->nlp_DID, ndlp->nlp_rpi, in lpfc_mbx_cmpl_fc_reg_login()
4454 ndlp->nlp_state); in lpfc_mbx_cmpl_fc_reg_login()
4456 ndlp->nlp_flag |= NLP_RPI_REGISTERED; in lpfc_mbx_cmpl_fc_reg_login()
4457 ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; in lpfc_mbx_cmpl_fc_reg_login()
4458 ndlp->nlp_type |= NLP_FABRIC; in lpfc_mbx_cmpl_fc_reg_login()
4477 struct lpfc_hba *phba = vport->phba; in lpfc_register_remote_port()
4480 if (vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME) in lpfc_register_remote_port()
4483 /* Remote port has reappeared. Re-register w/ FC transport */ in lpfc_register_remote_port()
4484 rport_ids.node_name = wwn_to_u64(ndlp->nlp_nodename.u.wwn); in lpfc_register_remote_port()
4485 rport_ids.port_name = wwn_to_u64(ndlp->nlp_portname.u.wwn); in lpfc_register_remote_port()
4486 rport_ids.port_id = ndlp->nlp_DID; in lpfc_register_remote_port()
4492 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_type); in lpfc_register_remote_port()
4495 if (test_bit(FC_UNLOADING, &vport->load_flag)) in lpfc_register_remote_port()
4498 ndlp->rport = rport = fc_remote_port_add(shost, 0, &rport_ids); in lpfc_register_remote_port()
4500 dev_printk(KERN_WARNING, &phba->pcidev->dev, in lpfc_register_remote_port()
4506 rport->maxframe_size = ndlp->nlp_maxframe; in lpfc_register_remote_port()
4507 rport->supported_classes = ndlp->nlp_class_sup; in lpfc_register_remote_port()
4508 rdata = rport->dd_data; in lpfc_register_remote_port()
4509 rdata->pnode = lpfc_nlp_get(ndlp); in lpfc_register_remote_port()
4510 if (!rdata->pnode) { in lpfc_register_remote_port()
4511 dev_warn(&phba->pcidev->dev, in lpfc_register_remote_port()
4512 "Warning - node ref failed. Unreg rport\n"); in lpfc_register_remote_port()
4514 ndlp->rport = NULL; in lpfc_register_remote_port()
4518 spin_lock_irqsave(&ndlp->lock, flags); in lpfc_register_remote_port()
4519 ndlp->fc4_xpt_flags |= SCSI_XPT_REGD; in lpfc_register_remote_port()
4520 spin_unlock_irqrestore(&ndlp->lock, flags); in lpfc_register_remote_port()
4522 if (ndlp->nlp_type & NLP_FCP_TARGET) in lpfc_register_remote_port()
4524 if (ndlp->nlp_type & NLP_FCP_INITIATOR) in lpfc_register_remote_port()
4526 if (ndlp->nlp_type & NLP_NVME_INITIATOR) in lpfc_register_remote_port()
4528 if (ndlp->nlp_type & NLP_NVME_TARGET) in lpfc_register_remote_port()
4530 if (ndlp->nlp_type & NLP_NVME_DISCOVERY) in lpfc_register_remote_port()
4536 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE, in lpfc_register_remote_port()
4538 __func__, rport, rport->port_id, rport->roles, in lpfc_register_remote_port()
4539 kref_read(&ndlp->kref)); in lpfc_register_remote_port()
4541 if ((rport->scsi_target_id != -1) && in lpfc_register_remote_port()
4542 (rport->scsi_target_id < LPFC_MAX_TARGET)) { in lpfc_register_remote_port()
4543 ndlp->nlp_sid = rport->scsi_target_id; in lpfc_register_remote_port()
4552 struct fc_rport *rport = ndlp->rport; in lpfc_unregister_remote_port()
4553 struct lpfc_vport *vport = ndlp->vport; in lpfc_unregister_remote_port()
4555 if (vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME) in lpfc_unregister_remote_port()
4560 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_type); in lpfc_unregister_remote_port()
4565 ndlp->nlp_DID, rport, ndlp->fc4_xpt_flags, in lpfc_unregister_remote_port()
4566 kref_read(&ndlp->kref)); in lpfc_unregister_remote_port()
4577 atomic_add(count, &vport->fc_unused_cnt); in lpfc_nlp_counters()
4580 atomic_add(count, &vport->fc_plogi_cnt); in lpfc_nlp_counters()
4583 atomic_add(count, &vport->fc_adisc_cnt); in lpfc_nlp_counters()
4586 atomic_add(count, &vport->fc_reglogin_cnt); in lpfc_nlp_counters()
4589 atomic_add(count, &vport->fc_prli_cnt); in lpfc_nlp_counters()
4592 atomic_add(count, &vport->fc_unmap_cnt); in lpfc_nlp_counters()
4595 atomic_add(count, &vport->fc_map_cnt); in lpfc_nlp_counters()
4598 if (!atomic_read(&vport->fc_npr_cnt) && count == -1) in lpfc_nlp_counters()
4599 atomic_set(&vport->fc_npr_cnt, 0); in lpfc_nlp_counters()
4601 atomic_add(count, &vport->fc_npr_cnt); in lpfc_nlp_counters()
4614 spin_lock_irqsave(&ndlp->lock, iflags); in lpfc_nlp_reg_node()
4615 if (ndlp->fc4_xpt_flags & NLP_XPT_REGD) { in lpfc_nlp_reg_node()
4617 spin_unlock_irqrestore(&ndlp->lock, iflags); in lpfc_nlp_reg_node()
4619 if (ndlp->fc4_xpt_flags & NVME_XPT_REGD && in lpfc_nlp_reg_node()
4620 ndlp->nlp_type & (NLP_NVME_TARGET | NLP_NVME_DISCOVERY)) { in lpfc_nlp_reg_node()
4626 ndlp->fc4_xpt_flags |= NLP_XPT_REGD; in lpfc_nlp_reg_node()
4627 spin_unlock_irqrestore(&ndlp->lock, iflags); in lpfc_nlp_reg_node()
4630 vport->phba->nport_event_cnt++; in lpfc_nlp_reg_node()
4639 if (!(ndlp->nlp_fc4_type & NLP_FC4_NVME)) in lpfc_nlp_reg_node()
4643 if (vport->phba->sli_rev >= LPFC_SLI_REV4 && in lpfc_nlp_reg_node()
4644 ndlp->nlp_fc4_type & NLP_FC4_NVME) { in lpfc_nlp_reg_node()
4645 if (vport->phba->nvmet_support == 0) { in lpfc_nlp_reg_node()
4650 if (ndlp->nlp_type & NLP_NVME_TARGET) { in lpfc_nlp_reg_node()
4651 vport->phba->nport_event_cnt++; in lpfc_nlp_reg_node()
4669 spin_lock_irqsave(&ndlp->lock, iflags); in lpfc_nlp_unreg_node()
4670 if (!(ndlp->fc4_xpt_flags & NLP_XPT_REGD)) { in lpfc_nlp_unreg_node()
4671 spin_unlock_irqrestore(&ndlp->lock, iflags); in lpfc_nlp_unreg_node()
4676 __func__, ndlp, ndlp->rport, ndlp->nlp_DID, in lpfc_nlp_unreg_node()
4677 ndlp->nlp_flag, ndlp->fc4_xpt_flags); in lpfc_nlp_unreg_node()
4681 ndlp->fc4_xpt_flags &= ~NLP_XPT_REGD; in lpfc_nlp_unreg_node()
4682 spin_unlock_irqrestore(&ndlp->lock, iflags); in lpfc_nlp_unreg_node()
4684 if (ndlp->rport && in lpfc_nlp_unreg_node()
4685 ndlp->fc4_xpt_flags & SCSI_XPT_REGD) { in lpfc_nlp_unreg_node()
4686 vport->phba->nport_event_cnt++; in lpfc_nlp_unreg_node()
4688 } else if (!ndlp->rport) { in lpfc_nlp_unreg_node()
4693 __func__, ndlp, ndlp->nlp_DID, ndlp->nlp_flag, in lpfc_nlp_unreg_node()
4694 ndlp->fc4_xpt_flags, in lpfc_nlp_unreg_node()
4695 kref_read(&ndlp->kref)); in lpfc_nlp_unreg_node()
4698 if (ndlp->fc4_xpt_flags & NVME_XPT_REGD) { in lpfc_nlp_unreg_node()
4699 vport->phba->nport_event_cnt++; in lpfc_nlp_unreg_node()
4700 if (vport->phba->nvmet_support == 0) { in lpfc_nlp_unreg_node()
4702 if (ndlp->nlp_type & NLP_NVME_TARGET) in lpfc_nlp_unreg_node()
4733 ndlp->nlp_type |= NLP_FC_NODE; in lpfc_handle_adisc_state()
4736 ndlp->nlp_flag &= ~NLP_NODEV_REMOVE; in lpfc_handle_adisc_state()
4741 * ADISC_ISSUE to non-mapped states in lpfc_handle_adisc_state()
4742 * We are moving from ADISC_ISSUE to a non-mapped state because in lpfc_handle_adisc_state()
4747 ndlp->nlp_flag &= ~NLP_RCV_PLOGI; in lpfc_handle_adisc_state()
4768 ndlp->nlp_flag &= ~NLP_NODEV_REMOVE; in lpfc_nlp_state_cleanup()
4769 ndlp->nlp_type |= NLP_FC_NODE; in lpfc_nlp_state_cleanup()
4772 ndlp->nlp_flag &= ~NLP_NODEV_REMOVE; in lpfc_nlp_state_cleanup()
4774 ndlp->nlp_flag &= ~NLP_RCV_PLOGI; in lpfc_nlp_state_cleanup()
4782 if (!(ndlp->nlp_flag & NLP_NPR_ADISC) || in lpfc_nlp_state_cleanup()
4783 !lpfc_is_link_up(vport->phba)) in lpfc_nlp_state_cleanup()
4794 * id outside the presentable range - move the node to the in lpfc_nlp_state_cleanup()
4798 (ndlp->nlp_type & NLP_FCP_TARGET) && in lpfc_nlp_state_cleanup()
4799 (!ndlp->rport || in lpfc_nlp_state_cleanup()
4800 ndlp->rport->scsi_target_id == -1 || in lpfc_nlp_state_cleanup()
4801 ndlp->rport->scsi_target_id >= LPFC_MAX_TARGET)) { in lpfc_nlp_state_cleanup()
4802 spin_lock_irq(&ndlp->lock); in lpfc_nlp_state_cleanup()
4803 ndlp->nlp_flag |= NLP_TGT_NO_SCSIID; in lpfc_nlp_state_cleanup()
4804 spin_unlock_irq(&ndlp->lock); in lpfc_nlp_state_cleanup()
4835 int old_state = ndlp->nlp_state; in lpfc_nlp_set_state()
4836 int node_dropped = ndlp->nlp_flag & NLP_DROPPED; in lpfc_nlp_set_state()
4841 "0904 NPort state transition x%06x, %s -> %s\n", in lpfc_nlp_set_state()
4842 ndlp->nlp_DID, in lpfc_nlp_set_state()
4848 ndlp->nlp_DID, old_state, state); in lpfc_nlp_set_state()
4852 ndlp->nlp_flag &= ~NLP_DROPPED; in lpfc_nlp_set_state()
4860 ndlp->nlp_flag &= ~NLP_TGT_NO_SCSIID; in lpfc_nlp_set_state()
4861 ndlp->nlp_type &= ~NLP_FC_NODE; in lpfc_nlp_set_state()
4864 if (list_empty(&ndlp->nlp_listp)) { in lpfc_nlp_set_state()
4865 spin_lock_irqsave(&vport->fc_nodes_list_lock, iflags); in lpfc_nlp_set_state()
4866 list_add_tail(&ndlp->nlp_listp, &vport->fc_nodes); in lpfc_nlp_set_state()
4867 spin_unlock_irqrestore(&vport->fc_nodes_list_lock, iflags); in lpfc_nlp_set_state()
4869 lpfc_nlp_counters(vport, old_state, -1); in lpfc_nlp_set_state()
4871 ndlp->nlp_state = state; in lpfc_nlp_set_state()
4881 if (list_empty(&ndlp->nlp_listp)) { in lpfc_enqueue_node()
4882 spin_lock_irqsave(&vport->fc_nodes_list_lock, iflags); in lpfc_enqueue_node()
4883 list_add_tail(&ndlp->nlp_listp, &vport->fc_nodes); in lpfc_enqueue_node()
4884 spin_unlock_irqrestore(&vport->fc_nodes_list_lock, iflags); in lpfc_enqueue_node()
4894 if (ndlp->nlp_state && !list_empty(&ndlp->nlp_listp)) in lpfc_dequeue_node()
4895 lpfc_nlp_counters(vport, ndlp->nlp_state, -1); in lpfc_dequeue_node()
4896 spin_lock_irqsave(&vport->fc_nodes_list_lock, iflags); in lpfc_dequeue_node()
4897 list_del_init(&ndlp->nlp_listp); in lpfc_dequeue_node()
4898 spin_unlock_irqrestore(&vport->fc_nodes_list_lock, iflags); in lpfc_dequeue_node()
4899 lpfc_nlp_state_cleanup(vport, ndlp, ndlp->nlp_state, in lpfc_dequeue_node()
4904 * lpfc_initialize_node - Initialize all fields of node object
4913 * to the life-span of the @ndlp might go beyond the existence of @vport as
4921 INIT_LIST_HEAD(&ndlp->els_retry_evt.evt_listp); in lpfc_initialize_node()
4922 INIT_LIST_HEAD(&ndlp->dev_loss_evt.evt_listp); in lpfc_initialize_node()
4923 timer_setup(&ndlp->nlp_delayfunc, lpfc_els_retry_delay, 0); in lpfc_initialize_node()
4924 INIT_LIST_HEAD(&ndlp->recovery_evt.evt_listp); in lpfc_initialize_node()
4926 ndlp->nlp_DID = did; in lpfc_initialize_node()
4927 ndlp->vport = vport; in lpfc_initialize_node()
4928 ndlp->phba = vport->phba; in lpfc_initialize_node()
4929 ndlp->nlp_sid = NLP_NO_SID; in lpfc_initialize_node()
4930 ndlp->nlp_fc4_type = NLP_FC4_NONE; in lpfc_initialize_node()
4931 kref_init(&ndlp->kref); in lpfc_initialize_node()
4932 atomic_set(&ndlp->cmd_pending, 0); in lpfc_initialize_node()
4933 ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; in lpfc_initialize_node()
4934 ndlp->nlp_defer_did = NLP_EVT_NOTHING_PENDING; in lpfc_initialize_node()
4945 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) in lpfc_drop_node()
4948 if (vport->phba->sli_rev == LPFC_SLI_REV4) { in lpfc_drop_node()
4957 spin_lock_irq(&ndlp->lock); in lpfc_drop_node()
4958 if (!(ndlp->nlp_flag & NLP_DROPPED)) { in lpfc_drop_node()
4959 ndlp->nlp_flag |= NLP_DROPPED; in lpfc_drop_node()
4960 spin_unlock_irq(&ndlp->lock); in lpfc_drop_node()
4964 spin_unlock_irq(&ndlp->lock); in lpfc_drop_node()
4973 struct lpfc_hba *phba = vport->phba; in lpfc_set_disctmo()
4976 if (vport->port_state == LPFC_LOCAL_CFG_LINK) { in lpfc_set_disctmo()
4977 /* For FAN, timeout should be greater than edtov */ in lpfc_set_disctmo()
4978 tmo = (((phba->fc_edtov + 999) / 1000) + 1); in lpfc_set_disctmo()
4980 /* Normal discovery timeout should be > than ELS/CT timeout in lpfc_set_disctmo()
4983 tmo = ((phba->fc_ratov * 3) + 3); in lpfc_set_disctmo()
4987 if (!timer_pending(&vport->fc_disctmo)) { in lpfc_set_disctmo()
4990 tmo, vport->port_state, vport->fc_flag); in lpfc_set_disctmo()
4993 mod_timer(&vport->fc_disctmo, jiffies + msecs_to_jiffies(1000 * tmo)); in lpfc_set_disctmo()
4994 set_bit(FC_DISC_TMO, &vport->fc_flag); in lpfc_set_disctmo()
5000 vport->port_state, tmo, in lpfc_set_disctmo()
5001 (unsigned long)&vport->fc_disctmo, in lpfc_set_disctmo()
5002 atomic_read(&vport->fc_plogi_cnt), in lpfc_set_disctmo()
5003 atomic_read(&vport->fc_adisc_cnt)); in lpfc_set_disctmo()
5018 vport->port_state, vport->fc_ns_retry, vport->fc_flag); in lpfc_can_disctmo()
5021 if (test_bit(FC_DISC_TMO, &vport->fc_flag) || in lpfc_can_disctmo()
5022 timer_pending(&vport->fc_disctmo)) { in lpfc_can_disctmo()
5023 clear_bit(FC_DISC_TMO, &vport->fc_flag); in lpfc_can_disctmo()
5024 del_timer_sync(&vport->fc_disctmo); in lpfc_can_disctmo()
5025 spin_lock_irqsave(&vport->work_port_lock, iflags); in lpfc_can_disctmo()
5026 vport->work_port_events &= ~WORKER_DISC_TMO; in lpfc_can_disctmo()
5027 spin_unlock_irqrestore(&vport->work_port_lock, iflags); in lpfc_can_disctmo()
5034 vport->port_state, vport->fc_flag, in lpfc_can_disctmo()
5035 atomic_read(&vport->fc_plogi_cnt), in lpfc_can_disctmo()
5036 atomic_read(&vport->fc_adisc_cnt)); in lpfc_can_disctmo()
5050 struct lpfc_vport *vport = ndlp->vport; in lpfc_check_sli_ndlp()
5055 if (iocb->vport != vport) in lpfc_check_sli_ndlp()
5062 if (pring->ringno == LPFC_ELS_RING) { in lpfc_check_sli_ndlp()
5065 if (iocb->ndlp == ndlp) in lpfc_check_sli_ndlp()
5069 if (remote_id == ndlp->nlp_DID) in lpfc_check_sli_ndlp()
5073 if (iocb->ndlp == ndlp) in lpfc_check_sli_ndlp()
5076 } else if (pring->ringno == LPFC_FCP_RING) { in lpfc_check_sli_ndlp()
5078 if ((ndlp->nlp_type & NLP_FCP_TARGET) && in lpfc_check_sli_ndlp()
5079 (ndlp->nlp_flag & NLP_DELAY_TMO)) { in lpfc_check_sli_ndlp()
5082 if (ulp_context == ndlp->nlp_rpi) in lpfc_check_sli_ndlp()
5095 list_for_each_entry_safe(iocb, next_iocb, &pring->txq, list) { in __lpfc_dequeue_nport_iocbs()
5099 list_move_tail(&iocb->list, dequeue_list); in __lpfc_dequeue_nport_iocbs()
5107 struct lpfc_sli *psli = &phba->sli; in lpfc_sli3_dequeue_nport_iocbs()
5110 spin_lock_irq(&phba->hbalock); in lpfc_sli3_dequeue_nport_iocbs()
5111 for (i = 0; i < psli->num_rings; i++) in lpfc_sli3_dequeue_nport_iocbs()
5112 __lpfc_dequeue_nport_iocbs(phba, ndlp, &psli->sli3_ring[i], in lpfc_sli3_dequeue_nport_iocbs()
5114 spin_unlock_irq(&phba->hbalock); in lpfc_sli3_dequeue_nport_iocbs()
5124 spin_lock_irq(&phba->hbalock); in lpfc_sli4_dequeue_nport_iocbs()
5125 list_for_each_entry(qp, &phba->sli4_hba.lpfc_wq_list, wq_list) { in lpfc_sli4_dequeue_nport_iocbs()
5126 pring = qp->pring; in lpfc_sli4_dequeue_nport_iocbs()
5129 spin_lock(&pring->ring_lock); in lpfc_sli4_dequeue_nport_iocbs()
5131 spin_unlock(&pring->ring_lock); in lpfc_sli4_dequeue_nport_iocbs()
5133 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_dequeue_nport_iocbs()
5151 if (ndlp->nlp_flag & NLP_RPI_REGISTERED) { in lpfc_no_rpi()
5152 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_no_rpi()
5166 * lpfc_nlp_logo_unreg - Unreg mailbox completion handler before LOGO
5176 struct lpfc_vport *vport = pmb->vport; in lpfc_nlp_logo_unreg()
5179 ndlp = pmb->ctx_ndlp; in lpfc_nlp_logo_unreg()
5185 if ((ndlp->nlp_flag & NLP_UNREG_INP) && in lpfc_nlp_logo_unreg()
5186 (ndlp->nlp_defer_did != NLP_EVT_NOTHING_PENDING)) { in lpfc_nlp_logo_unreg()
5190 ndlp->nlp_rpi, ndlp->nlp_DID, in lpfc_nlp_logo_unreg()
5191 ndlp->nlp_defer_did, ndlp); in lpfc_nlp_logo_unreg()
5193 ndlp->nlp_flag &= ~NLP_UNREG_INP; in lpfc_nlp_logo_unreg()
5194 ndlp->nlp_defer_did = NLP_EVT_NOTHING_PENDING; in lpfc_nlp_logo_unreg()
5195 lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0); in lpfc_nlp_logo_unreg()
5198 if (ndlp->nlp_flag & NLP_RELEASE_RPI) { in lpfc_nlp_logo_unreg()
5199 lpfc_sli4_free_rpi(vport->phba, ndlp->nlp_rpi); in lpfc_nlp_logo_unreg()
5200 spin_lock_irq(&ndlp->lock); in lpfc_nlp_logo_unreg()
5201 ndlp->nlp_flag &= ~NLP_RELEASE_RPI; in lpfc_nlp_logo_unreg()
5202 ndlp->nlp_rpi = LPFC_RPI_ALLOC_ERROR; in lpfc_nlp_logo_unreg()
5203 spin_unlock_irq(&ndlp->lock); in lpfc_nlp_logo_unreg()
5205 spin_lock_irq(&ndlp->lock); in lpfc_nlp_logo_unreg()
5206 ndlp->nlp_flag &= ~NLP_UNREG_INP; in lpfc_nlp_logo_unreg()
5207 spin_unlock_irq(&ndlp->lock); in lpfc_nlp_logo_unreg()
5215 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_nlp_logo_unreg()
5232 mbox->ctx_ndlp = lpfc_nlp_get(ndlp); in lpfc_set_unreg_login_mbx_cmpl()
5233 if (!mbox->ctx_ndlp) in lpfc_set_unreg_login_mbx_cmpl()
5236 if (ndlp->nlp_flag & NLP_ISSUE_LOGO) { in lpfc_set_unreg_login_mbx_cmpl()
5237 mbox->mbox_cmpl = lpfc_nlp_logo_unreg; in lpfc_set_unreg_login_mbx_cmpl()
5239 } else if (phba->sli_rev == LPFC_SLI_REV4 && in lpfc_set_unreg_login_mbx_cmpl()
5240 !test_bit(FC_UNLOADING, &vport->load_flag) && in lpfc_set_unreg_login_mbx_cmpl()
5241 (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= in lpfc_set_unreg_login_mbx_cmpl()
5243 (kref_read(&ndlp->kref) > 0)) { in lpfc_set_unreg_login_mbx_cmpl()
5244 mbox->mbox_cmpl = lpfc_sli4_unreg_rpi_cmpl_clr; in lpfc_set_unreg_login_mbx_cmpl()
5246 if (test_bit(FC_UNLOADING, &vport->load_flag)) { in lpfc_set_unreg_login_mbx_cmpl()
5247 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_set_unreg_login_mbx_cmpl()
5248 spin_lock_irqsave(&ndlp->lock, iflags); in lpfc_set_unreg_login_mbx_cmpl()
5249 ndlp->nlp_flag |= NLP_RELEASE_RPI; in lpfc_set_unreg_login_mbx_cmpl()
5250 spin_unlock_irqrestore(&ndlp->lock, iflags); in lpfc_set_unreg_login_mbx_cmpl()
5253 mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; in lpfc_set_unreg_login_mbx_cmpl()
5269 struct lpfc_hba *phba = vport->phba; in lpfc_unreg_rpi()
5274 if (ndlp->nlp_flag & NLP_RPI_REGISTERED || in lpfc_unreg_rpi()
5275 ndlp->nlp_flag & NLP_REG_LOGIN_SEND) { in lpfc_unreg_rpi()
5276 if (ndlp->nlp_flag & NLP_REG_LOGIN_SEND) in lpfc_unreg_rpi()
5282 ndlp->nlp_rpi, ndlp->nlp_flag, in lpfc_unreg_rpi()
5283 ndlp->nlp_DID); in lpfc_unreg_rpi()
5288 if (ndlp->nlp_flag & NLP_UNREG_INP) { in lpfc_unreg_rpi()
5294 ndlp->nlp_rpi, ndlp->nlp_DID, in lpfc_unreg_rpi()
5295 ndlp->nlp_defer_did, in lpfc_unreg_rpi()
5296 ndlp->nlp_flag, ndlp); in lpfc_unreg_rpi()
5300 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_unreg_rpi()
5303 rpi = ndlp->nlp_rpi; in lpfc_unreg_rpi()
5304 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_unreg_rpi()
5305 rpi = phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]; in lpfc_unreg_rpi()
5307 lpfc_unreg_login(phba, vport->vpi, rpi, mbox); in lpfc_unreg_rpi()
5308 mbox->vport = vport; in lpfc_unreg_rpi()
5310 if (!mbox->ctx_ndlp) { in lpfc_unreg_rpi()
5311 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_unreg_rpi()
5315 if (mbox->mbox_cmpl == lpfc_sli4_unreg_rpi_cmpl_clr) in lpfc_unreg_rpi()
5320 if (((ndlp->nlp_DID & Fabric_DID_MASK) != in lpfc_unreg_rpi()
5322 (!test_bit(FC_OFFLINE_MODE, &vport->fc_flag))) in lpfc_unreg_rpi()
5323 ndlp->nlp_flag |= NLP_UNREG_INP; in lpfc_unreg_rpi()
5330 ndlp->nlp_rpi, ndlp->nlp_DID, in lpfc_unreg_rpi()
5331 ndlp->nlp_flag, ndlp); in lpfc_unreg_rpi()
5335 ndlp->nlp_flag &= ~NLP_UNREG_INP; in lpfc_unreg_rpi()
5336 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_unreg_rpi()
5347 ndlp->nlp_rpi, ndlp->nlp_DID, in lpfc_unreg_rpi()
5348 ndlp->nlp_flag, ndlp); in lpfc_unreg_rpi()
5354 if (!test_bit(FC_UNLOADING, &vport->load_flag)) { in lpfc_unreg_rpi()
5355 ndlp->nlp_flag &= ~NLP_UNREG_INP; in lpfc_unreg_rpi()
5357 ndlp->nlp_prev_state = ndlp->nlp_state; in lpfc_unreg_rpi()
5366 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_unreg_rpi()
5367 ndlp->nlp_rpi = 0; in lpfc_unreg_rpi()
5368 ndlp->nlp_flag &= ~NLP_RPI_REGISTERED; in lpfc_unreg_rpi()
5369 ndlp->nlp_flag &= ~NLP_NPR_ADISC; in lpfc_unreg_rpi()
5371 ndlp->nlp_flag &= ~NLP_LOGO_ACC; in lpfc_unreg_rpi()
5374 ndlp->nlp_flag &= ~NLP_LOGO_ACC; in lpfc_unreg_rpi()
5379 * lpfc_unreg_hba_rpis - Unregister rpis registered to the hba.
5399 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_unreg_hba_rpis()
5400 spin_lock_irqsave(&vports[i]->fc_nodes_list_lock, iflags); in lpfc_unreg_hba_rpis()
5401 list_for_each_entry(ndlp, &vports[i]->fc_nodes, nlp_listp) { in lpfc_unreg_hba_rpis()
5402 if (ndlp->nlp_flag & NLP_RPI_REGISTERED) { in lpfc_unreg_hba_rpis()
5404 spin_unlock_irqrestore(&vports[i]->fc_nodes_list_lock, in lpfc_unreg_hba_rpis()
5407 spin_lock_irqsave(&vports[i]->fc_nodes_list_lock, in lpfc_unreg_hba_rpis()
5411 spin_unlock_irqrestore(&vports[i]->fc_nodes_list_lock, iflags); in lpfc_unreg_hba_rpis()
5419 struct lpfc_hba *phba = vport->phba; in lpfc_unreg_all_rpis()
5423 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_unreg_all_rpis()
5428 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_unreg_all_rpis()
5430 lpfc_unreg_login(phba, vport->vpi, LPFC_UNREG_ALL_RPIS_VPORT, in lpfc_unreg_all_rpis()
5432 mbox->vport = vport; in lpfc_unreg_all_rpis()
5433 mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; in lpfc_unreg_all_rpis()
5434 mbox->ctx_ndlp = NULL; in lpfc_unreg_all_rpis()
5437 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_unreg_all_rpis()
5450 struct lpfc_hba *phba = vport->phba; in lpfc_unreg_default_rpis()
5455 if (phba->sli_rev > LPFC_SLI_REV3) in lpfc_unreg_default_rpis()
5458 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_unreg_default_rpis()
5460 lpfc_unreg_did(phba, vport->vpi, LPFC_UNREG_ALL_DFLT_RPIS, in lpfc_unreg_default_rpis()
5462 mbox->vport = vport; in lpfc_unreg_default_rpis()
5463 mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; in lpfc_unreg_default_rpis()
5464 mbox->ctx_ndlp = NULL; in lpfc_unreg_default_rpis()
5467 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_unreg_default_rpis()
5484 struct lpfc_hba *phba = vport->phba; in lpfc_cleanup_node()
5491 ndlp->nlp_DID, ndlp->nlp_flag, in lpfc_cleanup_node()
5492 ndlp->nlp_state, ndlp->nlp_rpi); in lpfc_cleanup_node()
5498 if ((mb = phba->sli.mbox_active)) { in lpfc_cleanup_node()
5499 if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && in lpfc_cleanup_node()
5500 !(mb->mbox_flag & LPFC_MBX_IMED_UNREG) && in lpfc_cleanup_node()
5501 (ndlp == mb->ctx_ndlp)) { in lpfc_cleanup_node()
5502 mb->ctx_ndlp = NULL; in lpfc_cleanup_node()
5503 mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; in lpfc_cleanup_node()
5507 spin_lock_irq(&phba->hbalock); in lpfc_cleanup_node()
5509 list_for_each_entry(mb, &phba->sli.mboxq_cmpl, list) { in lpfc_cleanup_node()
5510 if ((mb->u.mb.mbxCommand != MBX_REG_LOGIN64) || in lpfc_cleanup_node()
5511 (mb->mbox_flag & LPFC_MBX_IMED_UNREG) || in lpfc_cleanup_node()
5512 (ndlp != mb->ctx_ndlp)) in lpfc_cleanup_node()
5515 mb->ctx_ndlp = NULL; in lpfc_cleanup_node()
5516 mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; in lpfc_cleanup_node()
5519 list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) { in lpfc_cleanup_node()
5520 if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && in lpfc_cleanup_node()
5521 !(mb->mbox_flag & LPFC_MBX_IMED_UNREG) && in lpfc_cleanup_node()
5522 (ndlp == mb->ctx_ndlp)) { in lpfc_cleanup_node()
5523 list_del(&mb->list); in lpfc_cleanup_node()
5531 spin_unlock_irq(&phba->hbalock); in lpfc_cleanup_node()
5535 spin_lock_irq(&ndlp->lock); in lpfc_cleanup_node()
5536 ndlp->nlp_flag &= ~NLP_DELAY_TMO; in lpfc_cleanup_node()
5537 spin_unlock_irq(&ndlp->lock); in lpfc_cleanup_node()
5539 ndlp->nlp_last_elscmd = 0; in lpfc_cleanup_node()
5540 del_timer_sync(&ndlp->nlp_delayfunc); in lpfc_cleanup_node()
5542 list_del_init(&ndlp->els_retry_evt.evt_listp); in lpfc_cleanup_node()
5543 list_del_init(&ndlp->dev_loss_evt.evt_listp); in lpfc_cleanup_node()
5544 list_del_init(&ndlp->recovery_evt.evt_listp); in lpfc_cleanup_node()
5547 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_cleanup_node()
5548 ndlp->nlp_flag |= NLP_RELEASE_RPI; in lpfc_cleanup_node()
5563 if (ndlp->nlp_DID == did) in lpfc_matchdid()
5567 mydid.un.word = vport->fc_myDID; in lpfc_matchdid()
5573 ndlpdid.un.word = ndlp->nlp_DID; in lpfc_matchdid()
5582 * up matching ndlp->nlp_DID 000001 to in lpfc_matchdid()
5588 vport->phba->fc_topology == in lpfc_matchdid()
5595 matchdid.un.word = ndlp->nlp_DID; in lpfc_matchdid()
5615 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in __lpfc_findnode_did()
5617 data1 = (((uint32_t)ndlp->nlp_state << 24) | in __lpfc_findnode_did()
5618 ((uint32_t)ndlp->nlp_xri << 16) | in __lpfc_findnode_did()
5619 ((uint32_t)ndlp->nlp_type << 8) in __lpfc_findnode_did()
5624 ndlp, ndlp->nlp_DID, in __lpfc_findnode_did()
5625 ndlp->nlp_flag, data1, ndlp->nlp_rpi, in __lpfc_findnode_did()
5626 ndlp->active_rrqs_xri_bitmap); in __lpfc_findnode_did()
5644 spin_lock_irqsave(shost->host_lock, iflags); in lpfc_findnode_did()
5646 spin_unlock_irqrestore(shost->host_lock, iflags); in lpfc_findnode_did()
5657 spin_lock_irqsave(&vport->fc_nodes_list_lock, iflags); in lpfc_findnode_mapped()
5659 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_findnode_mapped()
5660 if (ndlp->nlp_state == NLP_STE_UNMAPPED_NODE || in lpfc_findnode_mapped()
5661 ndlp->nlp_state == NLP_STE_MAPPED_NODE) { in lpfc_findnode_mapped()
5662 data1 = (((uint32_t)ndlp->nlp_state << 24) | in lpfc_findnode_mapped()
5663 ((uint32_t)ndlp->nlp_xri << 16) | in lpfc_findnode_mapped()
5664 ((uint32_t)ndlp->nlp_type << 8) | in lpfc_findnode_mapped()
5665 ((uint32_t)ndlp->nlp_rpi & 0xff)); in lpfc_findnode_mapped()
5666 spin_unlock_irqrestore(&vport->fc_nodes_list_lock, in lpfc_findnode_mapped()
5671 ndlp, ndlp->nlp_DID, in lpfc_findnode_mapped()
5672 ndlp->nlp_flag, data1, in lpfc_findnode_mapped()
5673 ndlp->active_rrqs_xri_bitmap); in lpfc_findnode_mapped()
5677 spin_unlock_irqrestore(&vport->fc_nodes_list_lock, iflags); in lpfc_findnode_mapped()
5692 if (vport->phba->nvmet_support) in lpfc_setup_disc_node()
5694 if (test_bit(FC_RSCN_MODE, &vport->fc_flag) && in lpfc_setup_disc_node()
5705 ndlp->nlp_DID, ndlp->nlp_flag, in lpfc_setup_disc_node()
5706 ndlp->nlp_state, vport->fc_flag); in lpfc_setup_disc_node()
5708 spin_lock_irq(&ndlp->lock); in lpfc_setup_disc_node()
5709 ndlp->nlp_flag |= NLP_NPR_2B_DISC; in lpfc_setup_disc_node()
5710 spin_unlock_irq(&ndlp->lock); in lpfc_setup_disc_node()
5718 if (test_bit(FC_RSCN_MODE, &vport->fc_flag) && in lpfc_setup_disc_node()
5719 !test_bit(FC_NDISC_ACTIVE, &vport->fc_flag)) { in lpfc_setup_disc_node()
5723 * delay timeout is not needed. in lpfc_setup_disc_node()
5730 ndlp->nlp_DID, ndlp->nlp_flag, in lpfc_setup_disc_node()
5731 ndlp->nlp_state, vport->fc_flag); in lpfc_setup_disc_node()
5735 * active management - just go to NPR provided the in lpfc_setup_disc_node()
5738 if (vport->phba->nvmet_support) in lpfc_setup_disc_node()
5741 if (ndlp->nlp_state > NLP_STE_UNUSED_NODE && in lpfc_setup_disc_node()
5742 ndlp->nlp_state <= NLP_STE_PRLI_ISSUE) { in lpfc_setup_disc_node()
5747 spin_lock_irq(&ndlp->lock); in lpfc_setup_disc_node()
5748 ndlp->nlp_flag |= NLP_NPR_2B_DISC; in lpfc_setup_disc_node()
5749 spin_unlock_irq(&ndlp->lock); in lpfc_setup_disc_node()
5754 ndlp->nlp_DID, ndlp->nlp_flag, in lpfc_setup_disc_node()
5755 ndlp->nlp_state, vport->fc_flag); in lpfc_setup_disc_node()
5762 ndlp->nlp_DID, ndlp->nlp_flag, in lpfc_setup_disc_node()
5763 ndlp->nlp_state, vport->fc_flag); in lpfc_setup_disc_node()
5769 if (ndlp->nlp_state == NLP_STE_ADISC_ISSUE || in lpfc_setup_disc_node()
5770 ndlp->nlp_state == NLP_STE_PLOGI_ISSUE || in lpfc_setup_disc_node()
5771 (!vport->phba->nvmet_support && in lpfc_setup_disc_node()
5772 ndlp->nlp_flag & NLP_RCV_PLOGI)) in lpfc_setup_disc_node()
5775 if (vport->phba->nvmet_support) in lpfc_setup_disc_node()
5783 spin_lock_irq(&ndlp->lock); in lpfc_setup_disc_node()
5784 ndlp->nlp_flag |= NLP_NPR_2B_DISC; in lpfc_setup_disc_node()
5785 spin_unlock_irq(&ndlp->lock); in lpfc_setup_disc_node()
5794 struct lpfc_hba *phba = vport->phba; in lpfc_disc_list_loopmap()
5801 if (phba->fc_topology != LPFC_TOPOLOGY_LOOP) in lpfc_disc_list_loopmap()
5805 if (phba->alpa_map[0]) { in lpfc_disc_list_loopmap()
5806 for (j = 1; j <= phba->alpa_map[0]; j++) { in lpfc_disc_list_loopmap()
5807 alpa = phba->alpa_map[j]; in lpfc_disc_list_loopmap()
5808 if (((vport->fc_myDID & 0xff) == alpa) || (alpa == 0)) in lpfc_disc_list_loopmap()
5818 if (vport->cfg_scan_down) in lpfc_disc_list_loopmap()
5821 index = FC_MAXLOOP - j - 1; in lpfc_disc_list_loopmap()
5823 if ((vport->fc_myDID & 0xff) == alpa) in lpfc_disc_list_loopmap()
5836 struct lpfc_sli *psli = &phba->sli; in lpfc_issue_clear_la()
5837 struct lpfc_sli_ring *extra_ring = &psli->sli3_ring[LPFC_EXTRA_RING]; in lpfc_issue_clear_la()
5838 struct lpfc_sli_ring *fcp_ring = &psli->sli3_ring[LPFC_FCP_RING]; in lpfc_issue_clear_la()
5845 if ((phba->link_state >= LPFC_CLEAR_LA) || in lpfc_issue_clear_la()
5846 (vport->port_type != LPFC_PHYSICAL_PORT) || in lpfc_issue_clear_la()
5847 (phba->sli_rev == LPFC_SLI_REV4)) in lpfc_issue_clear_la()
5851 if ((mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL)) != NULL) { in lpfc_issue_clear_la()
5852 phba->link_state = LPFC_CLEAR_LA; in lpfc_issue_clear_la()
5854 mbox->mbox_cmpl = lpfc_mbx_cmpl_clear_la; in lpfc_issue_clear_la()
5855 mbox->vport = vport; in lpfc_issue_clear_la()
5858 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_issue_clear_la()
5860 extra_ring->flag &= ~LPFC_STOP_IOCB_EVENT; in lpfc_issue_clear_la()
5861 fcp_ring->flag &= ~LPFC_STOP_IOCB_EVENT; in lpfc_issue_clear_la()
5862 phba->link_state = LPFC_HBA_ERROR; in lpfc_issue_clear_la()
5873 regvpimbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_issue_reg_vpi()
5876 regvpimbox->mbox_cmpl = lpfc_mbx_cmpl_reg_vpi; in lpfc_issue_reg_vpi()
5877 regvpimbox->vport = vport; in lpfc_issue_reg_vpi()
5880 mempool_free(regvpimbox, phba->mbox_mem_pool); in lpfc_issue_reg_vpi()
5889 struct lpfc_hba *phba = vport->phba; in lpfc_disc_start()
5896 phba->link_state); in lpfc_disc_start()
5900 if (phba->link_state == LPFC_CLEAR_LA) in lpfc_disc_start()
5905 if (vport->port_state < LPFC_VPORT_READY) in lpfc_disc_start()
5906 vport->port_state = LPFC_DISC_AUTH; in lpfc_disc_start()
5910 vport->fc_prevDID = vport->fc_myDID; in lpfc_disc_start()
5911 vport->num_disc_nodes = 0; in lpfc_disc_start()
5917 vport->port_state, vport->fc_flag, in lpfc_disc_start()
5918 atomic_read(&vport->fc_plogi_cnt), in lpfc_disc_start()
5919 atomic_read(&vport->fc_adisc_cnt), in lpfc_disc_start()
5920 atomic_read(&vport->fc_npr_cnt)); in lpfc_disc_start()
5922 /* First do ADISCs - if any */ in lpfc_disc_start()
5929 if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) && in lpfc_disc_start()
5930 !test_bit(FC_PT2PT, &vport->fc_flag) && in lpfc_disc_start()
5931 !test_bit(FC_RSCN_MODE, &vport->fc_flag) && in lpfc_disc_start()
5932 (phba->sli_rev < LPFC_SLI_REV4)) { in lpfc_disc_start()
5942 if (vport->port_state < LPFC_VPORT_READY && !clear_la_pending) { in lpfc_disc_start()
5946 if (!test_bit(FC_ABORT_DISCOVERY, &vport->fc_flag)) { in lpfc_disc_start()
5947 vport->num_disc_nodes = 0; in lpfc_disc_start()
5949 if (atomic_read(&vport->fc_npr_cnt)) in lpfc_disc_start()
5952 if (!vport->num_disc_nodes) { in lpfc_disc_start()
5953 clear_bit(FC_NDISC_ACTIVE, &vport->fc_flag); in lpfc_disc_start()
5957 vport->port_state = LPFC_VPORT_READY; in lpfc_disc_start()
5959 /* Next do PLOGIs - if any */ in lpfc_disc_start()
5965 if (test_bit(FC_RSCN_MODE, &vport->fc_flag)) { in lpfc_disc_start()
5969 if (vport->fc_rscn_id_cnt == 0 && in lpfc_disc_start()
5970 !test_bit(FC_RSCN_DISCOVERY, &vport->fc_flag)) { in lpfc_disc_start()
5971 clear_bit(FC_RSCN_MODE, &vport->fc_flag); in lpfc_disc_start()
6000 spin_lock_irq(&phba->hbalock); in lpfc_free_tx()
6001 list_for_each_entry_safe(iocb, next_iocb, &pring->txq, list) { in lpfc_free_tx()
6002 if (iocb->ndlp != ndlp) in lpfc_free_tx()
6010 list_move_tail(&iocb->list, &completions); in lpfc_free_tx()
6015 list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list) { in lpfc_free_tx()
6016 if (iocb->ndlp != ndlp) in lpfc_free_tx()
6026 spin_unlock_irq(&phba->hbalock); in lpfc_free_tx()
6040 struct lpfc_hba *phba = vport->phba; in lpfc_disc_flush_list()
6042 if (atomic_read(&vport->fc_plogi_cnt) || in lpfc_disc_flush_list()
6043 atomic_read(&vport->fc_adisc_cnt)) { in lpfc_disc_flush_list()
6044 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, in lpfc_disc_flush_list()
6046 if (ndlp->nlp_state == NLP_STE_PLOGI_ISSUE || in lpfc_disc_flush_list()
6047 ndlp->nlp_state == NLP_STE_ADISC_ISSUE) { in lpfc_disc_flush_list()
6055 * lpfc_notify_xport_npr - notifies xport of node disappearance
6059 * calls lpfc_nlp_state_cleanup, the ndlp->rport is unregistered
6069 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, in lpfc_notify_xport_npr()
6080 if (pci_channel_offline(vport->phba->pcidev)) in lpfc_cleanup_discovery_resources()
6088 * FUNCTION: Fibre Channel driver discovery timeout routine.
6103 struct lpfc_hba *phba = vport->phba; in lpfc_disc_timeout()
6110 spin_lock_irqsave(&vport->work_port_lock, flags); in lpfc_disc_timeout()
6111 tmo_posted = vport->work_port_events & WORKER_DISC_TMO; in lpfc_disc_timeout()
6113 vport->work_port_events |= WORKER_DISC_TMO; in lpfc_disc_timeout()
6114 spin_unlock_irqrestore(&vport->work_port_lock, flags); in lpfc_disc_timeout()
6124 struct lpfc_hba *phba = vport->phba; in lpfc_disc_timeout_handler()
6125 struct lpfc_sli *psli = &phba->sli; in lpfc_disc_timeout_handler()
6130 if (!test_and_clear_bit(FC_DISC_TMO, &vport->fc_flag)) in lpfc_disc_timeout_handler()
6134 "disc timeout: state:x%x rtry:x%x flg:x%x", in lpfc_disc_timeout_handler()
6135 vport->port_state, vport->fc_ns_retry, vport->fc_flag); in lpfc_disc_timeout_handler()
6137 switch (vport->port_state) { in lpfc_disc_timeout_handler()
6142 * waiting for FAN timeout in lpfc_disc_timeout_handler()
6145 "0221 FAN timeout\n"); in lpfc_disc_timeout_handler()
6148 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, in lpfc_disc_timeout_handler()
6150 if (ndlp->nlp_state != NLP_STE_NPR_NODE) in lpfc_disc_timeout_handler()
6152 if (ndlp->nlp_type & NLP_FABRIC) { in lpfc_disc_timeout_handler()
6156 } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { in lpfc_disc_timeout_handler()
6163 if (vport->port_state != LPFC_FLOGI) { in lpfc_disc_timeout_handler()
6164 if (phba->sli_rev <= LPFC_SLI_REV3) in lpfc_disc_timeout_handler()
6175 /* Initial FLOGI timeout */ in lpfc_disc_timeout_handler()
6178 "0222 Initial %s timeout\n", in lpfc_disc_timeout_handler()
6179 vport->vpi ? "FDISC" : "FLOGI"); in lpfc_disc_timeout_handler()
6197 "0223 Timeout while waiting for " in lpfc_disc_timeout_handler()
6208 /* Check for wait for NameServer Rsp timeout */ in lpfc_disc_timeout_handler()
6211 "0224 NameServer Query timeout " in lpfc_disc_timeout_handler()
6213 vport->fc_ns_retry, LPFC_MAX_NS_RETRY); in lpfc_disc_timeout_handler()
6215 if (vport->fc_ns_retry < LPFC_MAX_NS_RETRY) { in lpfc_disc_timeout_handler()
6217 vport->fc_ns_retry++; in lpfc_disc_timeout_handler()
6218 vport->gidft_inp = 0; in lpfc_disc_timeout_handler()
6223 vport->fc_ns_retry = 0; in lpfc_disc_timeout_handler()
6231 if (phba->sli_rev < LPFC_SLI_REV4) { in lpfc_disc_timeout_handler()
6232 if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) in lpfc_disc_timeout_handler()
6236 vport->port_state = LPFC_VPORT_READY; in lpfc_disc_timeout_handler()
6241 initlinkmbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_disc_timeout_handler()
6247 phba->link_state = LPFC_HBA_ERROR; in lpfc_disc_timeout_handler()
6252 lpfc_init_link(phba, initlinkmbox, phba->cfg_topology, in lpfc_disc_timeout_handler()
6253 phba->cfg_link_speed); in lpfc_disc_timeout_handler()
6254 initlinkmbox->u.mb.un.varInitLnk.lipsr_AL_PA = 0; in lpfc_disc_timeout_handler()
6255 initlinkmbox->vport = vport; in lpfc_disc_timeout_handler()
6256 initlinkmbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; in lpfc_disc_timeout_handler()
6260 mempool_free(initlinkmbox, phba->mbox_mem_pool); in lpfc_disc_timeout_handler()
6265 /* Node Authentication timeout */ in lpfc_disc_timeout_handler()
6268 "0227 Node Authentication timeout\n"); in lpfc_disc_timeout_handler()
6275 if (phba->sli_rev < LPFC_SLI_REV4) { in lpfc_disc_timeout_handler()
6276 if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) in lpfc_disc_timeout_handler()
6280 vport->port_state = LPFC_VPORT_READY; in lpfc_disc_timeout_handler()
6286 if (test_bit(FC_RSCN_MODE, &vport->fc_flag)) { in lpfc_disc_timeout_handler()
6289 "0231 RSCN timeout Data: x%x " in lpfc_disc_timeout_handler()
6291 vport->fc_ns_retry, LPFC_MAX_NS_RETRY, in lpfc_disc_timeout_handler()
6292 vport->port_state, vport->gidft_inp); in lpfc_disc_timeout_handler()
6305 "0273 Unexpected discovery timeout, " in lpfc_disc_timeout_handler()
6306 "vport State x%x\n", vport->port_state); in lpfc_disc_timeout_handler()
6310 switch (phba->link_state) { in lpfc_disc_timeout_handler()
6312 /* CLEAR LA timeout */ in lpfc_disc_timeout_handler()
6315 "0228 CLEAR LA timeout\n"); in lpfc_disc_timeout_handler()
6330 "0230 Unexpected timeout, hba link " in lpfc_disc_timeout_handler()
6331 "state x%x\n", phba->link_state); in lpfc_disc_timeout_handler()
6341 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_disc_timeout_handler()
6342 psli->sli3_ring[(LPFC_EXTRA_RING)].flag &= in lpfc_disc_timeout_handler()
6344 psli->sli3_ring[LPFC_FCP_RING].flag &= in lpfc_disc_timeout_handler()
6347 vport->port_state = LPFC_VPORT_READY; in lpfc_disc_timeout_handler()
6361 MAILBOX_t *mb = &pmb->u.mb; in lpfc_mbx_cmpl_fdmi_reg_login()
6362 struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; in lpfc_mbx_cmpl_fdmi_reg_login()
6363 struct lpfc_vport *vport = pmb->vport; in lpfc_mbx_cmpl_fdmi_reg_login()
6365 pmb->ctx_ndlp = NULL; in lpfc_mbx_cmpl_fdmi_reg_login()
6367 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_mbx_cmpl_fdmi_reg_login()
6368 ndlp->nlp_rpi = mb->un.varWords[0]; in lpfc_mbx_cmpl_fdmi_reg_login()
6369 ndlp->nlp_flag |= NLP_RPI_REGISTERED; in lpfc_mbx_cmpl_fdmi_reg_login()
6370 ndlp->nlp_type |= NLP_FABRIC; in lpfc_mbx_cmpl_fdmi_reg_login()
6374 ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, in lpfc_mbx_cmpl_fdmi_reg_login()
6375 kref_read(&ndlp->kref), in lpfc_mbx_cmpl_fdmi_reg_login()
6378 * Start issuing Fabric-Device Management Interface (FDMI) command to in lpfc_mbx_cmpl_fdmi_reg_login()
6380 * DHBA -> DPRT -> RHBA -> RPA (physical port) in lpfc_mbx_cmpl_fdmi_reg_login()
6381 * DPRT -> RPRT (vports) in lpfc_mbx_cmpl_fdmi_reg_login()
6383 if (vport->port_type == LPFC_PHYSICAL_PORT) { in lpfc_mbx_cmpl_fdmi_reg_login()
6384 phba->link_flag &= ~LS_CT_VEN_RPA; /* For extra Vendor RPA */ in lpfc_mbx_cmpl_fdmi_reg_login()
6404 return ndlp->nlp_rpi == *rpi; in lpfc_filter_by_rpi()
6410 return memcmp(&ndlp->nlp_portname, param, in lpfc_filter_by_wwpn()
6411 sizeof(ndlp->nlp_portname)) == 0; in lpfc_filter_by_wwpn()
6419 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in __lpfc_find_node()
6425 filter, ndlp, ndlp->nlp_DID, in __lpfc_find_node()
6426 ndlp->nlp_flag, ndlp->nlp_state, in __lpfc_find_node()
6427 ndlp->nlp_xri, ndlp->nlp_type, in __lpfc_find_node()
6428 ndlp->nlp_rpi); in __lpfc_find_node()
6457 spin_lock_irq(shost->host_lock); in lpfc_findnode_wwpn()
6459 spin_unlock_irq(shost->host_lock); in lpfc_findnode_wwpn()
6475 spin_lock_irqsave(shost->host_lock, flags); in lpfc_findnode_rpi()
6477 spin_unlock_irqrestore(shost->host_lock, flags); in lpfc_findnode_rpi()
6482 * lpfc_find_vport_by_vpid - Find a vport on a HBA through vport identifier
6491 * NULL - No vport with the matching @vpi found
6492 * Otherwise - Address to the vport with the matching @vpi.
6501 /* The physical ports are always vpi 0 - translate is unnecessary. */ in lpfc_find_vport_by_vpid()
6507 for (i = 0; i <= phba->max_vpi; i++) { in lpfc_find_vport_by_vpid()
6508 if (vpi == phba->vpi_ids[i]) in lpfc_find_vport_by_vpid()
6512 if (i > phba->max_vpi) { in lpfc_find_vport_by_vpid()
6520 spin_lock_irqsave(&phba->port_list_lock, flags); in lpfc_find_vport_by_vpid()
6521 list_for_each_entry(vport, &phba->port_list, listentry) { in lpfc_find_vport_by_vpid()
6522 if (vport->vpi == i) { in lpfc_find_vport_by_vpid()
6523 spin_unlock_irqrestore(&phba->port_list_lock, flags); in lpfc_find_vport_by_vpid()
6527 spin_unlock_irqrestore(&phba->port_list_lock, flags); in lpfc_find_vport_by_vpid()
6537 if (vport->phba->sli_rev == LPFC_SLI_REV4) { in lpfc_nlp_init()
6538 rpi = lpfc_sli4_alloc_rpi(vport->phba); in lpfc_nlp_init()
6543 ndlp = mempool_alloc(vport->phba->nlp_mem_pool, GFP_KERNEL); in lpfc_nlp_init()
6545 if (vport->phba->sli_rev == LPFC_SLI_REV4) in lpfc_nlp_init()
6546 lpfc_sli4_free_rpi(vport->phba, rpi); in lpfc_nlp_init()
6552 spin_lock_init(&ndlp->lock); in lpfc_nlp_init()
6555 INIT_LIST_HEAD(&ndlp->nlp_listp); in lpfc_nlp_init()
6556 if (vport->phba->sli_rev == LPFC_SLI_REV4) { in lpfc_nlp_init()
6557 ndlp->nlp_rpi = rpi; in lpfc_nlp_init()
6561 ndlp, ndlp->nlp_rpi, ndlp->nlp_DID, in lpfc_nlp_init()
6562 ndlp->nlp_flag, kref_read(&ndlp->kref)); in lpfc_nlp_init()
6564 ndlp->active_rrqs_xri_bitmap = in lpfc_nlp_init()
6565 mempool_alloc(vport->phba->active_rrq_pool, in lpfc_nlp_init()
6567 if (ndlp->active_rrqs_xri_bitmap) in lpfc_nlp_init()
6568 memset(ndlp->active_rrqs_xri_bitmap, 0, in lpfc_nlp_init()
6569 ndlp->phba->cfg_rrq_xri_bitmap_sz); in lpfc_nlp_init()
6576 ndlp->nlp_DID, 0, 0); in lpfc_nlp_init()
6589 struct lpfc_vport *vport = ndlp->vport; in lpfc_nlp_release()
6591 lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE, in lpfc_nlp_release()
6593 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_type); in lpfc_nlp_release()
6597 __func__, ndlp, ndlp->nlp_DID, in lpfc_nlp_release()
6598 kref_read(&ndlp->kref), ndlp->nlp_rpi); in lpfc_nlp_release()
6611 if (ndlp->nlp_flag & NLP_RELEASE_RPI) { in lpfc_nlp_release()
6612 if (ndlp->nlp_rpi != LPFC_RPI_ALLOC_ERROR && in lpfc_nlp_release()
6613 !(ndlp->nlp_flag & (NLP_RPI_REGISTERED | NLP_UNREG_INP))) { in lpfc_nlp_release()
6614 lpfc_sli4_free_rpi(vport->phba, ndlp->nlp_rpi); in lpfc_nlp_release()
6615 ndlp->nlp_rpi = LPFC_RPI_ALLOC_ERROR; in lpfc_nlp_release()
6622 ndlp->vport = NULL; in lpfc_nlp_release()
6623 ndlp->nlp_state = NLP_STE_FREED_NODE; in lpfc_nlp_release()
6624 ndlp->nlp_flag = 0; in lpfc_nlp_release()
6625 ndlp->fc4_xpt_flags = 0; in lpfc_nlp_release()
6628 if (ndlp->phba->sli_rev == LPFC_SLI_REV4) in lpfc_nlp_release()
6629 mempool_free(ndlp->active_rrqs_xri_bitmap, in lpfc_nlp_release()
6630 ndlp->phba->active_rrq_pool); in lpfc_nlp_release()
6631 mempool_free(ndlp, ndlp->phba->nlp_mem_pool); in lpfc_nlp_release()
6644 lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE, in lpfc_nlp_get()
6646 ndlp->nlp_DID, ndlp->nlp_flag, in lpfc_nlp_get()
6647 kref_read(&ndlp->kref)); in lpfc_nlp_get()
6653 spin_lock_irqsave(&ndlp->lock, flags); in lpfc_nlp_get()
6654 if (!kref_get_unless_zero(&ndlp->kref)) { in lpfc_nlp_get()
6655 spin_unlock_irqrestore(&ndlp->lock, flags); in lpfc_nlp_get()
6656 lpfc_printf_vlog(ndlp->vport, KERN_WARNING, LOG_NODE, in lpfc_nlp_get()
6658 __func__, (void *)ndlp, kref_read(&ndlp->kref)); in lpfc_nlp_get()
6661 spin_unlock_irqrestore(&ndlp->lock, flags); in lpfc_nlp_get()
6676 lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE, in lpfc_nlp_put()
6678 ndlp->nlp_DID, ndlp->nlp_flag, in lpfc_nlp_put()
6679 kref_read(&ndlp->kref)); in lpfc_nlp_put()
6684 return ndlp ? kref_put(&ndlp->kref, lpfc_nlp_release) : 0; in lpfc_nlp_put()
6688 * lpfc_fcf_inuse - Check if FCF can be unregistered.
6711 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_fcf_inuse()
6718 if (!test_bit(FC_VPORT_CVL_RCVD, &vports[i]->fc_flag)) { in lpfc_fcf_inuse()
6722 spin_lock_irqsave(&vports[i]->fc_nodes_list_lock, iflags); in lpfc_fcf_inuse()
6723 list_for_each_entry(ndlp, &vports[i]->fc_nodes, nlp_listp) { in lpfc_fcf_inuse()
6724 if (ndlp->rport && in lpfc_fcf_inuse()
6725 (ndlp->rport->roles & FC_RPORT_ROLE_FCP_TARGET)) { in lpfc_fcf_inuse()
6727 spin_unlock_irqrestore(&vports[i]->fc_nodes_list_lock, in lpfc_fcf_inuse()
6730 } else if (ndlp->nlp_flag & NLP_RPI_REGISTERED) { in lpfc_fcf_inuse()
6736 ndlp->nlp_rpi, ndlp->nlp_DID, in lpfc_fcf_inuse()
6737 ndlp->nlp_flag); in lpfc_fcf_inuse()
6740 spin_unlock_irqrestore(&vports[i]->fc_nodes_list_lock, iflags); in lpfc_fcf_inuse()
6748 * lpfc_unregister_vfi_cmpl - Completion handler for unreg vfi.
6757 struct lpfc_vport *vport = mboxq->vport; in lpfc_unregister_vfi_cmpl()
6759 if (mboxq->u.mb.mbxStatus) { in lpfc_unregister_vfi_cmpl()
6763 mboxq->u.mb.mbxStatus, vport->port_state); in lpfc_unregister_vfi_cmpl()
6765 clear_bit(FC_VFI_REGISTERED, &phba->pport->fc_flag); in lpfc_unregister_vfi_cmpl()
6766 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_unregister_vfi_cmpl()
6771 * lpfc_unregister_fcfi_cmpl - Completion handler for unreg fcfi.
6780 struct lpfc_vport *vport = mboxq->vport; in lpfc_unregister_fcfi_cmpl()
6782 if (mboxq->u.mb.mbxStatus) { in lpfc_unregister_fcfi_cmpl()
6786 mboxq->u.mb.mbxStatus, vport->port_state); in lpfc_unregister_fcfi_cmpl()
6788 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_unregister_fcfi_cmpl()
6793 * lpfc_unregister_fcf_prep - Unregister fcf record preparation
6813 phba->pport->port_state = LPFC_VPORT_UNKNOWN; in lpfc_unregister_fcf_prep()
6817 if (vports && (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) in lpfc_unregister_fcf_prep()
6818 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_unregister_fcf_prep()
6824 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_unregister_fcf_prep()
6828 spin_lock_irq(shost->host_lock); in lpfc_unregister_fcf_prep()
6829 vports[i]->vpi_state &= ~LPFC_VPI_REGISTERED; in lpfc_unregister_fcf_prep()
6830 spin_unlock_irq(shost->host_lock); in lpfc_unregister_fcf_prep()
6831 set_bit(FC_VPORT_NEEDS_INIT_VPI, &vports[i]->fc_flag); in lpfc_unregister_fcf_prep()
6834 if (i == 0 && (!(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED))) { in lpfc_unregister_fcf_prep()
6835 ndlp = lpfc_findnode_did(phba->pport, Fabric_DID); in lpfc_unregister_fcf_prep()
6837 lpfc_cancel_retry_delay_tmo(phba->pport, ndlp); in lpfc_unregister_fcf_prep()
6838 lpfc_cleanup_pending_mbox(phba->pport); in lpfc_unregister_fcf_prep()
6839 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_unregister_fcf_prep()
6840 lpfc_sli4_unreg_all_rpis(phba->pport); in lpfc_unregister_fcf_prep()
6841 lpfc_mbx_unreg_vpi(phba->pport); in lpfc_unregister_fcf_prep()
6842 shost = lpfc_shost_from_vport(phba->pport); in lpfc_unregister_fcf_prep()
6843 spin_lock_irq(shost->host_lock); in lpfc_unregister_fcf_prep()
6844 phba->pport->vpi_state &= ~LPFC_VPI_REGISTERED; in lpfc_unregister_fcf_prep()
6845 spin_unlock_irq(shost->host_lock); in lpfc_unregister_fcf_prep()
6846 set_bit(FC_VPORT_NEEDS_INIT_VPI, &phba->pport->fc_flag); in lpfc_unregister_fcf_prep()
6853 rc = lpfc_issue_unreg_vfi(phba->pport); in lpfc_unregister_fcf_prep()
6858 * lpfc_sli4_unregister_fcf - Unregister currently registered FCF record
6865 * Return 0 if successfully issued, none-zero otherwise.
6873 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_unregister_fcf()
6877 "HBA state x%x\n", phba->pport->port_state); in lpfc_sli4_unregister_fcf()
6878 return -ENOMEM; in lpfc_sli4_unregister_fcf()
6880 lpfc_unreg_fcfi(mbox, phba->fcf.fcfi); in lpfc_sli4_unregister_fcf()
6881 mbox->vport = phba->pport; in lpfc_sli4_unregister_fcf()
6882 mbox->mbox_cmpl = lpfc_unregister_fcfi_cmpl; in lpfc_sli4_unregister_fcf()
6889 rc, phba->pport->port_state); in lpfc_sli4_unregister_fcf()
6890 return -EINVAL; in lpfc_sli4_unregister_fcf()
6896 * lpfc_unregister_fcf_rescan - Unregister currently registered fcf and rescan
6921 spin_lock_irq(&phba->hbalock); in lpfc_unregister_fcf_rescan()
6922 phba->fcf.fcf_flag = 0; in lpfc_unregister_fcf_rescan()
6923 spin_unlock_irq(&phba->hbalock); in lpfc_unregister_fcf_rescan()
6924 phba->fcf.current_rec.flag = 0; in lpfc_unregister_fcf_rescan()
6930 if (test_bit(FC_UNLOADING, &phba->pport->load_flag) || in lpfc_unregister_fcf_rescan()
6931 phba->link_state < LPFC_LINK_UP) in lpfc_unregister_fcf_rescan()
6935 spin_lock_irq(&phba->hbalock); in lpfc_unregister_fcf_rescan()
6936 phba->fcf.fcf_flag |= FCF_INIT_DISC; in lpfc_unregister_fcf_rescan()
6937 spin_unlock_irq(&phba->hbalock); in lpfc_unregister_fcf_rescan()
6945 spin_lock_irq(&phba->hbalock); in lpfc_unregister_fcf_rescan()
6946 phba->fcf.fcf_flag &= ~FCF_INIT_DISC; in lpfc_unregister_fcf_rescan()
6947 spin_unlock_irq(&phba->hbalock); in lpfc_unregister_fcf_rescan()
6951 phba->pport->port_state); in lpfc_unregister_fcf_rescan()
6956 * lpfc_unregister_fcf - Unregister the currently registered fcf record
6981 spin_lock_irq(&phba->hbalock); in lpfc_unregister_fcf()
6982 phba->fcf.fcf_flag &= ~FCF_REGISTERED; in lpfc_unregister_fcf()
6983 spin_unlock_irq(&phba->hbalock); in lpfc_unregister_fcf()
6987 * lpfc_unregister_unused_fcf - Unregister FCF if all devices are disconnected.
7002 spin_lock_irq(&phba->hbalock); in lpfc_unregister_unused_fcf()
7003 if (!test_bit(HBA_FCOE_MODE, &phba->hba_flag) || in lpfc_unregister_unused_fcf()
7004 !(phba->fcf.fcf_flag & FCF_REGISTERED) || in lpfc_unregister_unused_fcf()
7005 !test_bit(HBA_FIP_SUPPORT, &phba->hba_flag) || in lpfc_unregister_unused_fcf()
7006 (phba->fcf.fcf_flag & FCF_DISCOVERY) || in lpfc_unregister_unused_fcf()
7007 phba->pport->port_state == LPFC_FLOGI) { in lpfc_unregister_unused_fcf()
7008 spin_unlock_irq(&phba->hbalock); in lpfc_unregister_unused_fcf()
7011 spin_unlock_irq(&phba->hbalock); in lpfc_unregister_unused_fcf()
7020 * lpfc_read_fcf_conn_tbl - Create driver FCF connection table.
7039 &phba->fcf_conn_rec_list, list) { in lpfc_read_fcf_conn_tbl()
7040 list_del_init(&conn_entry->list); in lpfc_read_fcf_conn_tbl()
7045 record_count = conn_hdr->length * sizeof(uint32_t)/ in lpfc_read_fcf_conn_tbl()
7063 memcpy(&conn_entry->conn_rec, &conn_rec[i], in lpfc_read_fcf_conn_tbl()
7065 list_add_tail(&conn_entry->list, in lpfc_read_fcf_conn_tbl()
7066 &phba->fcf_conn_rec_list); in lpfc_read_fcf_conn_tbl()
7069 if (!list_empty(&phba->fcf_conn_rec_list)) { in lpfc_read_fcf_conn_tbl()
7071 list_for_each_entry(conn_entry, &phba->fcf_conn_rec_list, in lpfc_read_fcf_conn_tbl()
7073 conn_rec = &conn_entry->conn_rec; in lpfc_read_fcf_conn_tbl()
7081 conn_rec->flags, conn_rec->vlan_tag, in lpfc_read_fcf_conn_tbl()
7082 conn_rec->fabric_name[0], in lpfc_read_fcf_conn_tbl()
7083 conn_rec->fabric_name[1], in lpfc_read_fcf_conn_tbl()
7084 conn_rec->fabric_name[2], in lpfc_read_fcf_conn_tbl()
7085 conn_rec->fabric_name[3], in lpfc_read_fcf_conn_tbl()
7086 conn_rec->fabric_name[4], in lpfc_read_fcf_conn_tbl()
7087 conn_rec->fabric_name[5], in lpfc_read_fcf_conn_tbl()
7088 conn_rec->fabric_name[6], in lpfc_read_fcf_conn_tbl()
7089 conn_rec->fabric_name[7], in lpfc_read_fcf_conn_tbl()
7090 conn_rec->switch_name[0], in lpfc_read_fcf_conn_tbl()
7091 conn_rec->switch_name[1], in lpfc_read_fcf_conn_tbl()
7092 conn_rec->switch_name[2], in lpfc_read_fcf_conn_tbl()
7093 conn_rec->switch_name[3], in lpfc_read_fcf_conn_tbl()
7094 conn_rec->switch_name[4], in lpfc_read_fcf_conn_tbl()
7095 conn_rec->switch_name[5], in lpfc_read_fcf_conn_tbl()
7096 conn_rec->switch_name[6], in lpfc_read_fcf_conn_tbl()
7097 conn_rec->switch_name[7]); in lpfc_read_fcf_conn_tbl()
7103 * lpfc_read_fcoe_param - Read FCoe parameters from conf region..
7122 if ((fcoe_param_hdr->parm_version != FIPP_VERSION) || in lpfc_read_fcoe_param()
7123 (fcoe_param_hdr->length != FCOE_PARAM_LENGTH)) in lpfc_read_fcoe_param()
7126 if (fcoe_param_hdr->parm_flags & FIPP_VLAN_VALID) { in lpfc_read_fcoe_param()
7127 phba->valid_vlan = 1; in lpfc_read_fcoe_param()
7128 phba->vlan_id = le16_to_cpu(fcoe_param->vlan_tag) & in lpfc_read_fcoe_param()
7132 phba->fc_map[0] = fcoe_param->fc_map[0]; in lpfc_read_fcoe_param()
7133 phba->fc_map[1] = fcoe_param->fc_map[1]; in lpfc_read_fcoe_param()
7134 phba->fc_map[2] = fcoe_param->fc_map[2]; in lpfc_read_fcoe_param()
7139 * lpfc_get_rec_conf23 - Get a record type in config region data.
7178 * lpfc_parse_fcoe_conf - Parse FCoE config data read from config region 23.
7220 size - offset, FCOE_PARAM_TYPE); in lpfc_parse_fcoe_conf()
7226 size - offset, FCOE_CONN_TBL_TYPE); in lpfc_parse_fcoe_conf()
7233 * lpfc_error_lost_link - IO failure from link event or FW reset check.
7245 * false - No link or reset error occurred.
7246 * true - A link or reset error occurred.