/* as node removed - stop further transport calls */ rport_del = none; 
lpfc_nlp_list(struct lpfc_hba * phba, struct lpfc_nodelist * nlp, int list){	enum { none, unmapped, mapped } rport_add = none, rport_del = none;	struct lpfc_sli      *psli;	psli = &phba->sli;	/* Sanity check to ensure we are not moving to / from the same list */	if ((nlp->nlp_flag & NLP_LIST_MASK) == list) {		if (list != NLP_NO_LIST)			return(0);	}	switch(nlp->nlp_flag & NLP_LIST_MASK) {	case NLP_NO_LIST: /* Not on any list */		break;	case NLP_UNUSED_LIST:		phba->fc_unused_cnt--;		list_del(&nlp->nlp_listp);		break;	case NLP_PLOGI_LIST:		phba->fc_plogi_cnt--;		list_del(&nlp->nlp_listp);		break;	case NLP_ADISC_LIST:		phba->fc_adisc_cnt--;		list_del(&nlp->nlp_listp);		break;	case NLP_REGLOGIN_LIST:		phba->fc_reglogin_cnt--;		list_del(&nlp->nlp_listp);		break;	case NLP_PRLI_LIST:		phba->fc_prli_cnt--;		list_del(&nlp->nlp_listp);		break;	case NLP_UNMAPPED_LIST:		phba->fc_unmap_cnt--;		list_del(&nlp->nlp_listp);		spin_lock_irq(phba->host->host_lock);		nlp->nlp_flag &= ~NLP_TGT_NO_SCSIID;		nlp->nlp_type &= ~NLP_FC_NODE;		spin_unlock_irq(phba->host->host_lock);		phba->nport_event_cnt++;		if (nlp->rport)			rport_del = unmapped;		break;	case NLP_MAPPED_LIST:		phba->fc_map_cnt--;		list_del(&nlp->nlp_listp);		phba->nport_event_cnt++;		if (nlp->rport)			rport_del = mapped;		break;	case NLP_NPR_LIST:		phba->fc_npr_cnt--;		list_del(&nlp->nlp_listp);		/* Stop delay tmo if taking node off NPR list */		if ((nlp->nlp_flag & NLP_DELAY_TMO) &&		   (list != NLP_NPR_LIST)) {			spin_lock_irq(phba->host->host_lock);			nlp->nlp_flag &= ~NLP_DELAY_TMO;			spin_unlock_irq(phba->host->host_lock);			del_timer_sync(&nlp->nlp_delayfunc);			if (!list_empty(&nlp->els_retry_evt.evt_listp))				list_del_init(&nlp->els_retry_evt.evt_listp);		}		break;	}	spin_lock_irq(phba->host->host_lock);	nlp->nlp_flag &= ~NLP_LIST_MASK;	spin_unlock_irq(phba->host->host_lock);	/* Add NPort <did> to <num> list */	lpfc_printf_log(phba,			KERN_INFO,			LOG_NODE,			"%d:0904 Add NPort x%x to %d list Data: x%x\n",			phba->brd_no,			nlp->nlp_DID, list, nlp->nlp_flag);	switch(list) {	case NLP_NO_LIST: /* No list, just remove it */		lpfc_nlp_remove(phba, nlp);		break;	case NLP_UNUSED_LIST:		spin_lock_irq(phba->host->host_lock);		nlp->nlp_flag |= list;		spin_unlock_irq(phba->host->host_lock);		/* Put it at the end of the unused list */		list_add_tail(&nlp->nlp_listp, &phba->fc_unused_list);		phba->fc_unused_cnt++;		break;	case NLP_PLOGI_LIST:		spin_lock_irq(phba->host->host_lock);		nlp->nlp_flag |= list;		spin_unlock_irq(phba->host->host_lock);		/* Put it at the end of the plogi list */		list_add_tail(&nlp->nlp_listp, &phba->fc_plogi_list);		phba->fc_plogi_cnt++;		break;	case NLP_ADISC_LIST:		spin_lock_irq(phba->host->host_lock);		nlp->nlp_flag |= list;		spin_unlock_irq(phba->host->host_lock);		/* Put it at the end of the adisc list */		list_add_tail(&nlp->nlp_listp, &phba->fc_adisc_list);		phba->fc_adisc_cnt++;		break;	case NLP_REGLOGIN_LIST:		spin_lock_irq(phba->host->host_lock);		nlp->nlp_flag |= list;		spin_unlock_irq(phba->host->host_lock);		/* Put it at the end of the reglogin list */		list_add_tail(&nlp->nlp_listp, &phba->fc_reglogin_list);		phba->fc_reglogin_cnt++;		break;	case NLP_PRLI_LIST:		spin_lock_irq(phba->host->host_lock);		nlp->nlp_flag |= list;		spin_unlock_irq(phba->host->host_lock);		/* Put it at the end of the prli list */		list_add_tail(&nlp->nlp_listp, &phba->fc_prli_list);		phba->fc_prli_cnt++;		break;	case NLP_UNMAPPED_LIST:		rport_add = unmapped;		/* ensure all vestiges of "mapped" significance are gone */		nlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR);		spin_lock_irq(phba->host->host_lock);		nlp->nlp_flag |= list;		spin_unlock_irq(phba->host->host_lock);		/* Put it at the end of the unmap list */		list_add_tail(&nlp->nlp_listp, &phba->fc_nlpunmap_list);		phba->fc_unmap_cnt++;		phba->nport_event_cnt++;		/* stop nodev tmo if running */		if (nlp->nlp_flag & NLP_NODEV_TMO) {			spin_lock_irq(phba->host->host_lock);			nlp->nlp_flag &= ~NLP_NODEV_TMO;			spin_unlock_irq(phba->host->host_lock);			del_timer_sync(&nlp->nlp_tmofunc);			if (!list_empty(&nlp->nodev_timeout_evt.evt_listp))				list_del_init(&nlp->nodev_timeout_evt.						evt_listp);		}		nlp->nlp_type |= NLP_FC_NODE;		break;	case NLP_MAPPED_LIST:		rport_add = mapped;		spin_lock_irq(phba->host->host_lock);		nlp->nlp_flag |= list;		spin_unlock_irq(phba->host->host_lock);		/* Put it at the end of the map list */		list_add_tail(&nlp->nlp_listp, &phba->fc_nlpmap_list);		phba->fc_map_cnt++;		phba->nport_event_cnt++;		/* stop nodev tmo if running */		if (nlp->nlp_flag & NLP_NODEV_TMO) {			nlp->nlp_flag &= ~NLP_NODEV_TMO;			del_timer_sync(&nlp->nlp_tmofunc);			if (!list_empty(&nlp->nodev_timeout_evt.evt_listp))				list_del_init(&nlp->nodev_timeout_evt.						evt_listp);		}		break;	case NLP_NPR_LIST:		spin_lock_irq(phba->host->host_lock);		nlp->nlp_flag |= list;		spin_unlock_irq(phba->host->host_lock);		/* Put it at the end of the npr list */		list_add_tail(&nlp->nlp_listp, &phba->fc_npr_list);		phba->fc_npr_cnt++;		/*		 * Sanity check for Fabric entity.		 * Set nodev_tmo for NPR state, for Fabric use 1 sec.		 */		if (nlp->nlp_type & NLP_FABRIC) {			mod_timer(&nlp->nlp_tmofunc, jiffies + HZ);		}		else {			mod_timer(&nlp->nlp_tmofunc,			    jiffies + HZ * phba->cfg_nodev_tmo);		}		spin_lock_irq(phba->host->host_lock);		nlp->nlp_flag |= NLP_NODEV_TMO;		nlp->nlp_flag &= ~NLP_RCV_PLOGI;		spin_unlock_irq(phba->host->host_lock);		break;	case NLP_JUST_DQ:		break;	}	/*	 * We make all the calls into the transport after we have	 * moved the node between lists. This so that we don't	 * release the lock while in-between lists.	 */	/* Don't upcall midlayer if we're unloading */	if (!(phba->fc_flag & FC_UNLOADING)) {		/*		 * We revalidate the rport pointer as the "add" function		 * may have removed the remote port.		 */		if ((rport_del != none) && nlp->rport)			fc_remote_port_block(nlp->rport);		if (rport_add != none) {			/*			 * Tell the fc transport about the port, if we haven't			 * already. If we have, and it's a scsi entity, be			 * sure to unblock any attached scsi devices			 */			if (!nlp->rport)				lpfc_register_remote_port(phba, nlp);			else				fc_remote_port_unblock(nlp->rport);			/*			 * if we added to Mapped list, but the remote port			 * registration failed or assigned a target id outside			 * our presentable range - move the node to the			 * Unmapped List			 */			if ((rport_add == mapped) &&			    ((!nlp->rport) ||			     (nlp->rport->scsi_target_id == -1) ||			     (nlp->rport->scsi_target_id >= MAX_FCP_TARGET))) {				nlp->nlp_state = NLP_STE_UNMAPPED_NODE;				spin_lock_irq(phba->host->host_lock);				nlp->nlp_flag |= NLP_TGT_NO_SCSIID;				spin_unlock_irq(phba->host->host_lock);				lpfc_nlp_list(phba, nlp, NLP_UNMAPPED_LIST);			}		}	}	return (0);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/8cbdc5fffa15d5c573e2531c6f533822d08b6b0f/lpfc_hbadisc.c/clean/drivers/scsi/lpfc/lpfc_hbadisc.c