 /* Login and update database */ qla2x00_fabric_dev_login(ha, fcport, &next_loopid); 
qla2x00_configure_fabric(scsi_qla_host_t *ha){	int	rval, rval2;	fc_port_t	*fcport, *fcptemp;	uint16_t	next_loopid;	uint16_t	mb[MAILBOX_REGISTER_COUNT];	LIST_HEAD(new_fcports);	/* If FL port exists, then SNS is present */	rval = qla2x00_get_port_name(ha, SNS_FL_PORT, NULL, 0);	if (rval != QLA_SUCCESS) {		DEBUG2(printk("scsi(%ld): MBC_GET_PORT_NAME Failed, No FL "		    "Port\n", ha->host_no));		ha->device_flags &= ~SWITCH_FOUND;		return (QLA_SUCCESS);	}	/* Mark devices that need re-synchronization. */	rval2 = qla2x00_device_resync(ha);	if (rval2 == QLA_RSCNS_HANDLED) {		/* No point doing the scan, just continue. */		return (QLA_SUCCESS);	}	do {		/* Ensure we are logged into the SNS. */		qla2x00_login_fabric(ha, SIMPLE_NAME_SERVER, 0xff, 0xff, 0xfc,		    mb, BIT_1 | BIT_0);		if (mb[0] != MBS_COMMAND_COMPLETE) {			DEBUG2(qla_printk(KERN_INFO, ha,			    "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x "			    "mb[2]=%x mb[6]=%x mb[7]=%x\n", SIMPLE_NAME_SERVER,			    mb[0], mb[1], mb[2], mb[6], mb[7]));			return (QLA_SUCCESS);		}		if (test_and_clear_bit(REGISTER_FC4_NEEDED, &ha->dpc_flags)) {			if (qla2x00_rft_id(ha)) {				/* EMPTY */				DEBUG2(printk("scsi(%ld): Register FC-4 "				    "TYPE failed.\n", ha->host_no));			}			if (qla2x00_rff_id(ha)) {				/* EMPTY */				DEBUG2(printk("scsi(%ld): Register FC-4 "				    "Features failed.\n", ha->host_no));			}			if (qla2x00_rnn_id(ha)) {				/* EMPTY */				DEBUG2(printk("scsi(%ld): Register Node Name "				    "failed.\n", ha->host_no));			} else if (qla2x00_rsnn_nn(ha)) {				/* EMPTY */				DEBUG2(printk("scsi(%ld): Register Symbolic "				    "Node Name failed.\n", ha->host_no));			}		}		rval = qla2x00_find_all_fabric_devs(ha, &new_fcports);		if (rval != QLA_SUCCESS)			break;		/*		 * Logout all previous fabric devices marked lost, except		 * tape devices.		 */		list_for_each_entry(fcport, &ha->fcports, list) {			if (test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags))				break;			if ((fcport->flags & FCF_FABRIC_DEVICE) == 0)				continue;			if (atomic_read(&fcport->state) == FCS_DEVICE_LOST) {				qla2x00_mark_device_lost(ha, fcport,				    ql2xplogiabsentdevice);				if (fcport->loop_id != FC_NO_LOOP_ID &&				    (fcport->flags & FCF_TAPE_PRESENT) == 0 &&				    fcport->port_type != FCT_INITIATOR &&				    fcport->port_type != FCT_BROADCAST) {					qla2x00_fabric_logout(ha,					    fcport->loop_id);					fcport->loop_id = FC_NO_LOOP_ID;				}			}		}		/* Starting free loop ID. */		next_loopid = ha->min_external_loopid;		/*		 * Scan through our port list and login entries that need to be		 * logged in.		 */		list_for_each_entry(fcport, &ha->fcports, list) {			if (atomic_read(&ha->loop_down_timer) ||			    test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags))				break;			if ((fcport->flags & FCF_FABRIC_DEVICE) == 0 ||			    (fcport->flags & FCF_LOGIN_NEEDED) == 0)				continue;			if (fcport->loop_id == FC_NO_LOOP_ID) {				fcport->loop_id = next_loopid;				rval = qla2x00_find_new_loop_id(ha, fcport);				if (rval != QLA_SUCCESS) {					/* Ran out of IDs to use */					break;				}			}			/* Login and update database */			qla2x00_fabric_dev_login(ha, fcport, &next_loopid);		}		/* Exit if out of loop IDs. */		if (rval != QLA_SUCCESS) {			break;		}		/*		 * Login and add the new devices to our port list.		 */		list_for_each_entry_safe(fcport, fcptemp, &new_fcports, list) {			if (atomic_read(&ha->loop_down_timer) ||			    test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags))				break;			/* Find a new loop ID to use. */			fcport->loop_id = next_loopid;			rval = qla2x00_find_new_loop_id(ha, fcport);			if (rval != QLA_SUCCESS) {				/* Ran out of IDs to use */				break;			}			/* Login and update database */			qla2x00_fabric_dev_login(ha, fcport, &next_loopid);			/* Remove device from the new list and add it to DB */			list_del(&fcport->list);			list_add_tail(&fcport->list, &ha->fcports);		}	} while (0);	/* Free all new device structures not processed. */	list_for_each_entry_safe(fcport, fcptemp, &new_fcports, list) {		list_del(&fcport->list);		kfree(fcport);	}	if (rval) {		DEBUG2(printk("scsi(%ld): Configure fabric error exit: "		    "rval=%d\n", ha->host_no, rval));	}	return (rval);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/bdf796210e01145fd77bbb3ae644d04f982b6c3b/qla_init.c/clean/drivers/scsi/qla2xxx/qla_init.c