⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lpfc_nportdisc.c

📁 linux-2.6.15.6
💻 C
📖 第 1 页 / 共 4 页
字号:
	lpfc_els_rsp_prli_acc(phba, cmdiocb, ndlp);	return (ndlp->nlp_state);}static uint32_tlpfc_rcv_logo_mapped_node(struct lpfc_hba * phba,			  struct lpfc_nodelist * ndlp, void *arg, uint32_t evt){	struct lpfc_iocbq *cmdiocb;	cmdiocb = (struct lpfc_iocbq *) arg;	lpfc_rcv_logo(phba, ndlp, cmdiocb);	return (ndlp->nlp_state);}static uint32_tlpfc_rcv_padisc_mapped_node(struct lpfc_hba * phba,			    struct lpfc_nodelist * ndlp, void *arg,			    uint32_t evt){	struct lpfc_iocbq *cmdiocb;	cmdiocb = (struct lpfc_iocbq *) arg;	lpfc_rcv_padisc(phba, ndlp, cmdiocb);	return (ndlp->nlp_state);}static uint32_tlpfc_rcv_prlo_mapped_node(struct lpfc_hba * phba,			  struct lpfc_nodelist * ndlp, void *arg, uint32_t evt){	struct lpfc_iocbq *cmdiocb;	cmdiocb = (struct lpfc_iocbq *) arg;	/* flush the target */	spin_lock_irq(phba->host->host_lock);	lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring],			       ndlp->nlp_sid, 0, 0, LPFC_CTX_TGT);	spin_unlock_irq(phba->host->host_lock);	/* Treat like rcv logo */	lpfc_rcv_logo(phba, ndlp, cmdiocb);	return (ndlp->nlp_state);}static uint32_tlpfc_device_recov_mapped_node(struct lpfc_hba * phba,			    struct lpfc_nodelist * ndlp, void *arg,			    uint32_t evt){	ndlp->nlp_state = NLP_STE_NPR_NODE;	lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);	spin_lock_irq(phba->host->host_lock);	ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;	spin_unlock_irq(phba->host->host_lock);	lpfc_disc_set_adisc(phba, ndlp);	return (ndlp->nlp_state);}static uint32_tlpfc_rcv_plogi_npr_node(struct lpfc_hba * phba,			    struct lpfc_nodelist * ndlp, void *arg,			    uint32_t evt){	struct lpfc_iocbq *cmdiocb;	cmdiocb = (struct lpfc_iocbq *) arg;	/* Ignore PLOGI if we have an outstanding LOGO */	if (ndlp->nlp_flag & NLP_LOGO_SND) {		return (ndlp->nlp_state);	}	if (lpfc_rcv_plogi(phba, ndlp, cmdiocb)) {		spin_lock_irq(phba->host->host_lock);		ndlp->nlp_flag &= ~(NLP_NPR_ADISC | NLP_NPR_2B_DISC);		spin_unlock_irq(phba->host->host_lock);		return (ndlp->nlp_state);	}	/* send PLOGI immediately, move to PLOGI issue state */	if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) {			ndlp->nlp_state = NLP_STE_PLOGI_ISSUE;			lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);			lpfc_issue_els_plogi(phba, ndlp, 0);	}	return (ndlp->nlp_state);}static uint32_tlpfc_rcv_prli_npr_node(struct lpfc_hba * phba,			    struct lpfc_nodelist * ndlp, void *arg,			    uint32_t evt){	struct lpfc_iocbq     *cmdiocb;	struct ls_rjt          stat;	cmdiocb = (struct lpfc_iocbq *) arg;	memset(&stat, 0, sizeof (struct ls_rjt));	stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC;	stat.un.b.lsRjtRsnCodeExp = LSEXP_NOTHING_MORE;	lpfc_els_rsp_reject(phba, stat.un.lsRjtError, cmdiocb, ndlp);	if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) {		if (ndlp->nlp_flag & NLP_NPR_ADISC) {			ndlp->nlp_state = NLP_STE_ADISC_ISSUE;			lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST);			lpfc_issue_els_adisc(phba, ndlp, 0);		} else {			ndlp->nlp_state = NLP_STE_PLOGI_ISSUE;			lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);			lpfc_issue_els_plogi(phba, ndlp, 0);		}	}	return (ndlp->nlp_state);}static uint32_tlpfc_rcv_logo_npr_node(struct lpfc_hba * phba,			    struct lpfc_nodelist * ndlp, void *arg,			    uint32_t evt){	struct lpfc_iocbq     *cmdiocb;	cmdiocb = (struct lpfc_iocbq *) arg;	lpfc_rcv_logo(phba, ndlp, cmdiocb);	return (ndlp->nlp_state);}static uint32_tlpfc_rcv_padisc_npr_node(struct lpfc_hba * phba,			    struct lpfc_nodelist * ndlp, void *arg,			    uint32_t evt){	struct lpfc_iocbq     *cmdiocb;	cmdiocb = (struct lpfc_iocbq *) arg;	lpfc_rcv_padisc(phba, ndlp, cmdiocb);	if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) {		if (ndlp->nlp_flag & NLP_NPR_ADISC) {			ndlp->nlp_state = NLP_STE_ADISC_ISSUE;			lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST);			lpfc_issue_els_adisc(phba, ndlp, 0);		} else {			ndlp->nlp_state = NLP_STE_PLOGI_ISSUE;			lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);			lpfc_issue_els_plogi(phba, ndlp, 0);		}	}	return (ndlp->nlp_state);}static uint32_tlpfc_rcv_prlo_npr_node(struct lpfc_hba * phba,			    struct lpfc_nodelist * ndlp, void *arg,			    uint32_t evt){	struct lpfc_iocbq     *cmdiocb;	cmdiocb = (struct lpfc_iocbq *) arg;	lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);	if (ndlp->nlp_flag & NLP_DELAY_TMO) {		if (ndlp->nlp_last_elscmd == (unsigned long)ELS_CMD_PLOGI) {			return (ndlp->nlp_state);		} else {			spin_lock_irq(phba->host->host_lock);			ndlp->nlp_flag &= ~NLP_DELAY_TMO;			spin_unlock_irq(phba->host->host_lock);			del_timer_sync(&ndlp->nlp_delayfunc);			if (!list_empty(&ndlp->els_retry_evt.evt_listp))				list_del_init(&ndlp->els_retry_evt.evt_listp);		}	}	ndlp->nlp_state = NLP_STE_PLOGI_ISSUE;	lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);	lpfc_issue_els_plogi(phba, ndlp, 0);	return (ndlp->nlp_state);}static uint32_tlpfc_cmpl_logo_npr_node(struct lpfc_hba * phba,		struct lpfc_nodelist * ndlp, void *arg, uint32_t evt){	lpfc_unreg_rpi(phba, ndlp);	/* This routine does nothing, just return the current state */	return (ndlp->nlp_state);}static uint32_tlpfc_cmpl_reglogin_npr_node(struct lpfc_hba * phba,			    struct lpfc_nodelist * ndlp, void *arg,			    uint32_t evt){	LPFC_MBOXQ_t *pmb;	MAILBOX_t *mb;	pmb = (LPFC_MBOXQ_t *) arg;	mb = &pmb->mb;	ndlp->nlp_rpi = mb->un.varWords[0];	return (ndlp->nlp_state);}static uint32_tlpfc_device_rm_npr_node(struct lpfc_hba * phba,			    struct lpfc_nodelist * ndlp, void *arg,			    uint32_t evt){	lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);	return (NLP_STE_FREED_NODE);}static uint32_tlpfc_device_recov_npr_node(struct lpfc_hba * phba,			    struct lpfc_nodelist * ndlp, void *arg,			    uint32_t evt){	spin_lock_irq(phba->host->host_lock);	ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;	spin_unlock_irq(phba->host->host_lock);	return (ndlp->nlp_state);}/* This next section defines the NPort Discovery State Machine *//* There are 4 different double linked lists nodelist entries can reside on. * The plogi list and adisc list are used when Link Up discovery or RSCN * processing is needed. Each list holds the nodes that we will send PLOGI * or ADISC on. These lists will keep track of what nodes will be effected * by an RSCN, or a Link Up (Typically, all nodes are effected on Link Up). * The unmapped_list will contain all nodes that we have successfully logged * into at the Fibre Channel level. The mapped_list will contain all nodes * that are mapped FCP targets. *//* * The bind list is a list of undiscovered (potentially non-existent) nodes * that we have saved binding information on. This information is used when * nodes transition from the unmapped to the mapped list. *//* For UNUSED_NODE state, the node has just been allocated . * For PLOGI_ISSUE and REG_LOGIN_ISSUE, the node is on * the PLOGI list. For REG_LOGIN_COMPL, the node is taken off the PLOGI list * and put on the unmapped list. For ADISC processing, the node is taken off * the ADISC list and placed on either the mapped or unmapped list (depending * on its previous state). Once on the unmapped list, a PRLI is issued and the * state changed to PRLI_ISSUE. When the PRLI completion occurs, the state is * changed to UNMAPPED_NODE. If the completion indicates a mapped * node, the node is taken off the unmapped list. The binding list is checked * for a valid binding, or a binding is automatically assigned. If binding * assignment is unsuccessful, the node is left on the unmapped list. If * binding assignment is successful, the associated binding list entry (if * any) is removed, and the node is placed on the mapped list. *//* * For a Link Down, all nodes on the ADISC, PLOGI, unmapped or mapped * lists will receive a DEVICE_RECOVERY event. If the linkdown or nodev timers * expire, all effected nodes will receive a DEVICE_RM event. *//* * For a Link Up or RSCN, all nodes will move from the mapped / unmapped lists * to either the ADISC or PLOGI list.  After a Nameserver query or ALPA loopmap * check, additional nodes may be added or removed (via DEVICE_RM) to / from * the PLOGI or ADISC lists. Once the PLOGI and ADISC lists are populated, * we will first process the ADISC list.  32 entries are processed initially and * ADISC is initited for each one.  Completions / Events for each node are * funnelled thru the state machine.  As each node finishes ADISC processing, it * starts ADISC for any nodes waiting for ADISC processing. If no nodes are * waiting, and the ADISC list count is identically 0, then we are done. For * Link Up discovery, since all nodes on the PLOGI list are UNREG_LOGIN'ed, we * can issue a CLEAR_LA and reenable Link Events. Next we will process the PLOGI * list.  32 entries are processed initially and PLOGI is initited for each one. * Completions / Events for each node are funnelled thru the state machine.  As * each node finishes PLOGI processing, it starts PLOGI for any nodes waiting * for PLOGI processing. If no nodes are waiting, and the PLOGI list count is * indentically 0, then we are done. We have now completed discovery / RSCN * handling. Upon completion, ALL nodes should be on either the mapped or * unmapped lists. */static uint32_t (*lpfc_disc_action[NLP_STE_MAX_STATE * NLP_EVT_MAX_EVENT])     (struct lpfc_hba *, struct lpfc_nodelist *, void *, uint32_t) = {	/* Action routine                  Event       Current State  */	lpfc_rcv_plogi_unused_node,	/* RCV_PLOGI   UNUSED_NODE    */	lpfc_rcv_els_unused_node,	/* RCV_PRLI        */	lpfc_rcv_logo_unused_node,	/* RCV_LOGO        */	lpfc_rcv_els_unused_node,	/* RCV_ADISC       */	lpfc_rcv_els_unused_node,	/* RCV_PDISC       */	lpfc_rcv_els_unused_node,	/* RCV_PRLO        */	lpfc_disc_illegal,		/* CMPL_PLOGI      */	lpfc_disc_illegal,		/* CMPL_PRLI       */	lpfc_cmpl_logo_unused_node,	/* CMPL_LOGO       */	lpfc_disc_illegal,		/* CMPL_ADISC      */	lpfc_disc_illegal,		/* CMPL_REG_LOGIN  */	lpfc_device_rm_unused_node,	/* DEVICE_RM       */	lpfc_disc_illegal,		/* DEVICE_RECOVERY */	lpfc_rcv_plogi_plogi_issue,	/* RCV_PLOGI   PLOGI_ISSUE    */	lpfc_rcv_els_plogi_issue,	/* RCV_PRLI        */	lpfc_rcv_els_plogi_issue,	/* RCV_LOGO        */	lpfc_rcv_els_plogi_issue,	/* RCV_ADISC       */	lpfc_rcv_els_plogi_issue,	/* RCV_PDISC       */	lpfc_rcv_els_plogi_issue,	/* RCV_PRLO        */	lpfc_cmpl_plogi_plogi_issue,	/* CMPL_PLOGI      */	lpfc_disc_illegal,		/* CMPL_PRLI       */	lpfc_disc_illegal,		/* CMPL_LOGO       */	lpfc_disc_illegal,		/* CMPL_ADISC      */	lpfc_disc_illegal,		/* CMPL_REG_LOGIN  */	lpfc_device_rm_plogi_issue,	/* DEVICE_RM       */	lpfc_device_recov_plogi_issue,	/* DEVICE_RECOVERY */	lpfc_rcv_plogi_adisc_issue,	/* RCV_PLOGI   ADISC_ISSUE    */	lpfc_rcv_prli_adisc_issue,	/* RCV_PRLI        */	lpfc_rcv_logo_adisc_issue,	/* RCV_LOGO        */	lpfc_rcv_padisc_adisc_issue,	/* RCV_ADISC       */	lpfc_rcv_padisc_adisc_issue,	/* RCV_PDISC       */	lpfc_rcv_prlo_adisc_issue,	/* RCV_PRLO        */	lpfc_disc_illegal,		/* CMPL_PLOGI      */	lpfc_disc_illegal,		/* CMPL_PRLI       */	lpfc_disc_illegal,		/* CMPL_LOGO       */	lpfc_cmpl_adisc_adisc_issue,	/* CMPL_ADISC      */	lpfc_disc_illegal,		/* CMPL_REG_LOGIN  */	lpfc_device_rm_adisc_issue,	/* DEVICE_RM       */	lpfc_device_recov_adisc_issue,	/* DEVICE_RECOVERY */	lpfc_rcv_plogi_reglogin_issue,	/* RCV_PLOGI  REG_LOGIN_ISSUE */	lpfc_rcv_prli_reglogin_issue,	/* RCV_PLOGI       */	lpfc_rcv_logo_reglogin_issue,	/* RCV_LOGO        */	lpfc_rcv_padisc_reglogin_issue,	/* RCV_ADISC       */	lpfc_rcv_padisc_reglogin_issue,	/* RCV_PDISC       */	lpfc_rcv_prlo_reglogin_issue,	/* RCV_PRLO        */	lpfc_disc_illegal,		/* CMPL_PLOGI      */	lpfc_disc_illegal,		/* CMPL_PRLI       */	lpfc_disc_illegal,		/* CMPL_LOGO       */	lpfc_disc_illegal,		/* CMPL_ADISC      */	lpfc_cmpl_reglogin_reglogin_issue,/* CMPL_REG_LOGIN  */	lpfc_device_rm_reglogin_issue,	/* DEVICE_RM       */	lpfc_device_recov_reglogin_issue,/* DEVICE_RECOVERY */	lpfc_rcv_plogi_prli_issue,	/* RCV_PLOGI   PRLI_ISSUE     */	lpfc_rcv_prli_prli_issue,	/* RCV_PRLI        */	lpfc_rcv_logo_prli_issue,	/* RCV_LOGO        */	lpfc_rcv_padisc_prli_issue,	/* RCV_ADISC       */	lpfc_rcv_padisc_prli_issue,	/* RCV_PDISC       */	lpfc_rcv_prlo_prli_issue,	/* RCV_PRLO        */	lpfc_disc_illegal,		/* CMPL_PLOGI      */	lpfc_cmpl_prli_prli_issue,	/* CMPL_PRLI       */	lpfc_disc_illegal,		/* CMPL_LOGO       */	lpfc_disc_illegal,		/* CMPL_ADISC      */	lpfc_disc_illegal,		/* CMPL_REG_LOGIN  */	lpfc_device_rm_prli_issue,	/* DEVICE_RM       */	lpfc_device_recov_prli_issue,	/* DEVICE_RECOVERY */	lpfc_rcv_plogi_unmap_node,	/* RCV_PLOGI   UNMAPPED_NODE  */	lpfc_rcv_prli_unmap_node,	/* RCV_PRLI        */	lpfc_rcv_logo_unmap_node,	/* RCV_LOGO        */	lpfc_rcv_padisc_unmap_node,	/* RCV_ADISC       */	lpfc_rcv_padisc_unmap_node,	/* RCV_PDISC       */	lpfc_rcv_prlo_unmap_node,	/* RCV_PRLO        */	lpfc_disc_illegal,		/* CMPL_PLOGI      */	lpfc_disc_illegal,		/* CMPL_PRLI       */	lpfc_disc_illegal,		/* CMPL_LOGO       */	lpfc_disc_illegal,		/* CMPL_ADISC      */	lpfc_disc_illegal,		/* CMPL_REG_LOGIN  */	lpfc_disc_illegal,		/* DEVICE_RM       */	lpfc_device_recov_unmap_node,	/* DEVICE_RECOVERY */	lpfc_rcv_plogi_mapped_node,	/* RCV_PLOGI   MAPPED_NODE    */	lpfc_rcv_prli_mapped_node,	/* RCV_PRLI        */	lpfc_rcv_logo_mapped_node,	/* RCV_LOGO        */	lpfc_rcv_padisc_mapped_node,	/* RCV_ADISC       */	lpfc_rcv_padisc_mapped_node,	/* RCV_PDISC       */	lpfc_rcv_prlo_mapped_node,	/* RCV_PRLO        */	lpfc_disc_illegal,		/* CMPL_PLOGI      */	lpfc_disc_illegal,		/* CMPL_PRLI       */	lpfc_disc_illegal,		/* CMPL_LOGO       */	lpfc_disc_illegal,		/* CMPL_ADISC      */	lpfc_disc_illegal,		/* CMPL_REG_LOGIN  */	lpfc_disc_illegal,		/* DEVICE_RM       */	lpfc_device_recov_mapped_node,	/* DEVICE_RECOVERY */	lpfc_rcv_plogi_npr_node,        /* RCV_PLOGI   NPR_NODE    */	lpfc_rcv_prli_npr_node,         /* RCV_PRLI        */	lpfc_rcv_logo_npr_node,         /* RCV_LOGO        */	lpfc_rcv_padisc_npr_node,       /* RCV_ADISC       */	lpfc_rcv_padisc_npr_node,       /* RCV_PDISC       */	lpfc_rcv_prlo_npr_node,         /* RCV_PRLO        */	lpfc_disc_noop,			/* CMPL_PLOGI      */	lpfc_disc_noop,			/* CMPL_PRLI       */	lpfc_cmpl_logo_npr_node,        /* CMPL_LOGO       */	lpfc_disc_noop,			/* CMPL_ADISC      */	lpfc_cmpl_reglogin_npr_node,    /* CMPL_REG_LOGIN  */	lpfc_device_rm_npr_node,        /* DEVICE_RM       */	lpfc_device_recov_npr_node,     /* DEVICE_RECOVERY */};intlpfc_disc_state_machine(struct lpfc_hba * phba,			struct lpfc_nodelist * ndlp, void *arg, uint32_t evt){	uint32_t cur_state, rc;	uint32_t(*func) (struct lpfc_hba *, struct lpfc_nodelist *, void *,			 uint32_t);	ndlp->nlp_disc_refcnt++;	cur_state = ndlp->nlp_state;	/* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */	lpfc_printf_log(phba,			KERN_INFO,			LOG_DISCOVERY,			"%d:0211 DSM in event x%x on NPort x%x in state %d "			"Data: x%x\n",			phba->brd_no,			evt, ndlp->nlp_DID, cur_state, ndlp->nlp_flag);	func = lpfc_disc_action[(cur_state * NLP_EVT_MAX_EVENT) + evt];	rc = (func) (phba, ndlp, arg, evt);	/* DSM out state <rc> on NPort <nlp_DID> */	lpfc_printf_log(phba,		       KERN_INFO,		       LOG_DISCOVERY,		       "%d:0212 DSM out state %d on NPort x%x Data: x%x\n",		       phba->brd_no,		       rc, ndlp->nlp_DID, ndlp->nlp_flag);	ndlp->nlp_disc_refcnt--;	/* Check to see if ndlp removal is deferred */	if ((ndlp->nlp_disc_refcnt == 0)	    && (ndlp->nlp_flag & NLP_DELAY_REMOVE)) {		spin_lock_irq(phba->host->host_lock);		ndlp->nlp_flag &= ~NLP_DELAY_REMOVE;		spin_unlock_irq(phba->host->host_lock);		lpfc_nlp_remove(phba, ndlp);		return (NLP_STE_FREED_NODE);	}	if (rc == NLP_STE_FREED_NODE)		return (NLP_STE_FREED_NODE);	ndlp->nlp_state = rc;	return (rc);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -