}  if (test_and_clear_bit(LOOP_RESET_NEEDED, &ha->dpc_flags)) { DEBUG(printk("scsi(%ld): dpc: sched loop_reset()\n", ha->host_no)); qla2x00_loop_reset(ha); 
qla2x00_do_dpc(void *data){	DECLARE_MUTEX_LOCKED(sem);	scsi_qla_host_t *ha;	fc_port_t	*fcport;	uint8_t		status;	uint16_t	next_loopid;	ha = (scsi_qla_host_t *)data;	lock_kernel();	daemonize("%s_dpc", ha->host_str);	allow_signal(SIGHUP);	ha->dpc_wait = &sem;	set_user_nice(current, -20);	unlock_kernel();	complete(&ha->dpc_inited);	while (1) {		DEBUG3(printk("qla2x00: DPC handler sleeping\n"));		if (down_interruptible(&sem))			break;		if (ha->dpc_should_die)			break;		DEBUG3(printk("qla2x00: DPC handler waking up\n"));		/* Initialization not yet finished. Don't do anything yet. */		if (!ha->flags.init_done || ha->dpc_active)			continue;		DEBUG3(printk("scsi(%ld): DPC handler\n", ha->host_no));		ha->dpc_active = 1;		if (ha->flags.mbox_busy) {			ha->dpc_active = 0;			continue;		}		if (test_and_clear_bit(ISP_ABORT_NEEDED, &ha->dpc_flags)) {			DEBUG(printk("scsi(%ld): dpc: sched "			    "qla2x00_abort_isp ha = %p\n",			    ha->host_no, ha));			if (!(test_and_set_bit(ABORT_ISP_ACTIVE,			    &ha->dpc_flags))) {				if (qla2x00_abort_isp(ha)) {					/* failed. retry later */					set_bit(ISP_ABORT_NEEDED,					    &ha->dpc_flags);				}				clear_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags);			}			DEBUG(printk("scsi(%ld): dpc: qla2x00_abort_isp end\n",			    ha->host_no));		}		if (test_and_clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags) &&		    (!(test_and_set_bit(RESET_ACTIVE, &ha->dpc_flags)))) {			DEBUG(printk("scsi(%ld): qla2x00_reset_marker()\n",			    ha->host_no));			qla2x00_rst_aen(ha);			clear_bit(RESET_ACTIVE, &ha->dpc_flags);		}		/* Retry each device up to login retry count */		if ((test_and_clear_bit(RELOGIN_NEEDED, &ha->dpc_flags)) &&		    !test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) &&		    atomic_read(&ha->loop_state) != LOOP_DOWN) {			DEBUG(printk("scsi(%ld): qla2x00_port_login()\n",			    ha->host_no));			next_loopid = 0;			list_for_each_entry(fcport, &ha->fcports, list) {				if (fcport->port_type != FCT_TARGET)					continue;				/*				 * If the port is not ONLINE then try to login				 * to it if we haven't run out of retries.				 */				if (atomic_read(&fcport->state) != FCS_ONLINE &&				    fcport->login_retry) {					fcport->login_retry--;					if (fcport->flags & FCF_FABRIC_DEVICE) {						if (fcport->flags &						    FCF_TAPE_PRESENT)							ha->isp_ops.fabric_logout(							    ha, fcport->loop_id,							    fcport->d_id.b.domain,							    fcport->d_id.b.area,							    fcport->d_id.b.al_pa);						status = qla2x00_fabric_login(						    ha, fcport, &next_loopid);					} else						status =						    qla2x00_local_device_login(							ha, fcport->loop_id);					if (status == QLA_SUCCESS) {						fcport->old_loop_id = fcport->loop_id;						DEBUG(printk("scsi(%ld): port login OK: logged in ID 0x%x\n",						    ha->host_no, fcport->loop_id));						fcport->port_login_retry_count =						    ha->port_down_retry_count * PORT_RETRY_TIME;						atomic_set(&fcport->state, FCS_ONLINE);						atomic_set(&fcport->port_down_timer,						    ha->port_down_retry_count * PORT_RETRY_TIME);						fcport->login_retry = 0;					} else if (status == 1) {						set_bit(RELOGIN_NEEDED, &ha->dpc_flags);						/* retry the login again */						DEBUG(printk("scsi(%ld): Retrying %d login again loop_id 0x%x\n",						    ha->host_no,						    fcport->login_retry, fcport->loop_id));					} else {						fcport->login_retry = 0;					}				}				if (test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags))					break;			}			DEBUG(printk("scsi(%ld): qla2x00_port_login - end\n",			    ha->host_no));		}		if ((test_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags)) &&		    atomic_read(&ha->loop_state) != LOOP_DOWN) {			clear_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags);			DEBUG(printk("scsi(%ld): qla2x00_login_retry()\n",			    ha->host_no));			set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags);			DEBUG(printk("scsi(%ld): qla2x00_login_retry - end\n",			    ha->host_no));		}		if (test_and_clear_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) {			DEBUG(printk("scsi(%ld): qla2x00_loop_resync()\n",			    ha->host_no));			if (!(test_and_set_bit(LOOP_RESYNC_ACTIVE,			    &ha->dpc_flags))) {				qla2x00_loop_resync(ha);				clear_bit(LOOP_RESYNC_ACTIVE, &ha->dpc_flags);			}			DEBUG(printk("scsi(%ld): qla2x00_loop_resync - end\n",			    ha->host_no));		}		if (test_and_clear_bit(FCPORT_RESCAN_NEEDED, &ha->dpc_flags)) {			DEBUG(printk("scsi(%ld): Rescan flagged fcports...\n",			    ha->host_no));			qla2x00_rescan_fcports(ha);			DEBUG(printk("scsi(%ld): Rescan flagged fcports..."			    "end.\n",			    ha->host_no));		}		if (!ha->interrupts_on)			ha->isp_ops.enable_intrs(ha);		ha->dpc_active = 0;	} /* End of while(1) */	DEBUG(printk("scsi(%ld): DPC handler exiting\n", ha->host_no));	/*	 * Make sure that nobody tries to wake us up again.	 */	ha->dpc_wait = NULL;	ha->dpc_active = 0;	complete_and_exit(&ha->dpc_exited, 0);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/91ca7b01ecc916632202180569a7ddbfccfc3f05/qla_os.c/buggy/drivers/scsi/qla2xxx/qla_os.c