FreeBSD/sys/dev/isp/isp_target.c
/*
 * Synthesize a message from the task management flags in a FCP_CMND_IU.
 */
Synthesize a message from the task management flags in a FCP_CMND_IU.
Synthesize a message from the task management flags in a FCP_CMND_IU .
static void
isp_got_msg_fc(ispsoftc_t *isp, in_fcentry_t *inp)
{
	isp_notify_t notify;
	static const char f1[] = "%s from N-port handle 0x%x lun %x seq 0x%x";
	static const char f2[] = "unknown %s 0x%x lun %x N-Port handle 0x%x task flags 0x%x seq 0x%x\n";
	uint16_t seqid, nphdl;
	ISP_MEMZERO(&notify, sizeof (isp_notify_t));
	notify.nt_hba = isp;
	notify.nt_wwn = INI_ANY;
	if (ISP_CAP_2KLOGIN(isp)) {
		notify.nt_nphdl = ((in_fcentry_e_t *)inp)->in_iid;
		nphdl = ((in_fcentry_e_t *)inp)->in_iid;
		seqid = ((in_fcentry_e_t *)inp)->in_seqid;
	} else {
		notify.nt_nphdl = inp->in_iid;
		nphdl = inp->in_iid;
		seqid = inp->in_seqid;
	}
	notify.nt_sid = PORT_ANY;
	notify.nt_did = PORT_ANY;
	if (ISP_CAP_SCCFW(isp)) {
		notify.nt_lun = inp->in_scclun;
#if __FreeBSD_version < 1000700
		notify.nt_lun &= 0x3fff;
#endif
	} else {
		notify.nt_lun = inp->in_lun;
	}
	notify.nt_tagval = seqid;
	notify.nt_tagval |= (((uint64_t)(isp->isp_serno++)) << 32);
	notify.nt_need_ack = 1;
	notify.nt_lreserved = inp;
	if (inp->in_status != IN_MSG_RECEIVED) {
		isp_prt(isp, ISP_LOGINFO, f2, "immediate notify status", inp->in_status, notify.nt_lun, nphdl, inp->in_task_flags, inp->in_seqid);
		isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inp);
		return;
	}
	if (inp->in_task_flags & TASK_FLAGS_ABORT_TASK_SET) {
		isp_prt(isp, ISP_LOGINFO, f1, "ABORT TASK SET", nphdl, notify.nt_lun, inp->in_seqid);
		notify.nt_ncode = NT_ABORT_TASK_SET;
	} else if (inp->in_task_flags & TASK_FLAGS_CLEAR_TASK_SET) {
		isp_prt(isp, ISP_LOGINFO, f1, "CLEAR TASK SET", nphdl, notify.nt_lun, inp->in_seqid);
		notify.nt_ncode = NT_CLEAR_TASK_SET;
	} else if (inp->in_task_flags & TASK_FLAGS_LUN_RESET) {
		isp_prt(isp, ISP_LOGINFO, f1, "LUN RESET", nphdl, notify.nt_lun, inp->in_seqid);
		notify.nt_ncode = NT_LUN_RESET;
	} else if (inp->in_task_flags & TASK_FLAGS_TARGET_RESET) {
		isp_prt(isp, ISP_LOGINFO, f1, "TARGET RESET", nphdl, notify.nt_lun, inp->in_seqid);
		notify.nt_ncode = NT_TARGET_RESET;
	} else if (inp->in_task_flags & TASK_FLAGS_CLEAR_ACA) {
		isp_prt(isp, ISP_LOGINFO, f1, "CLEAR ACA", nphdl, notify.nt_lun, inp->in_seqid);
		notify.nt_ncode = NT_CLEAR_ACA;
	} else {
		isp_prt(isp, ISP_LOGWARN, f2, "task flag", inp->in_status, notify.nt_lun, nphdl, inp->in_task_flags,  inp->in_seqid);
		isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inp);
		return;
	}
	isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
}
static void isp_got_msg_fc ( ispsoftc_t * isp , in_fcentry_t * inp ) { isp_notify_t notify ; static const char f1 [ ] = " " ; static const char f2 [ ] = " \n " ; uint16_t seqid , nphdl ; ISP_MEMZERO ( & notify , sizeof ( isp_notify_t ) ) ; notify . nt_hba = isp ; notify . nt_wwn = INI_ANY ; if ( ISP_CAP_2KLOGIN ( isp ) ) { notify . nt_nphdl = ( ( in_fcentry_e_t * ) inp ) -> in_iid ; nphdl = ( ( in_fcentry_e_t * ) inp ) -> in_iid ; seqid = ( ( in_fcentry_e_t * ) inp ) -> in_seqid ; } else { notify . nt_nphdl = inp -> in_iid ; nphdl = inp -> in_iid ; seqid = inp -> in_seqid ; } notify . nt_sid = PORT_ANY ; notify . nt_did = PORT_ANY ; if ( ISP_CAP_SCCFW ( isp ) ) { notify . nt_lun = inp -> in_scclun ; #if __FreeBSD_version < 1000700 notify . nt_lun &= 0x3fff ; #endif } else { notify . nt_lun = inp -> in_lun ; } notify . nt_tagval = seqid ; notify . nt_tagval |= ( ( ( uint64_t ) ( isp -> isp_serno ++ ) ) << 32 ) ; notify . nt_need_ack = 1 ; notify . nt_lreserved = inp ; if ( inp -> in_status != IN_MSG_RECEIVED ) { isp_prt ( isp , ISP_LOGINFO , f2 , " " , inp -> in_status , notify . nt_lun , nphdl , inp -> in_task_flags , inp -> in_seqid ) ; isp_async ( isp , ISPASYNC_TARGET_NOTIFY_ACK , inp ) ; return ; } if ( inp -> in_task_flags & TASK_FLAGS_ABORT_TASK_SET ) { isp_prt ( isp , ISP_LOGINFO , f1 , " " , nphdl , notify . nt_lun , inp -> in_seqid ) ; notify . nt_ncode = NT_ABORT_TASK_SET ; } else if ( inp -> in_task_flags & TASK_FLAGS_CLEAR_TASK_SET ) { isp_prt ( isp , ISP_LOGINFO , f1 , " " , nphdl , notify . nt_lun , inp -> in_seqid ) ; notify . nt_ncode = NT_CLEAR_TASK_SET ; } else if ( inp -> in_task_flags & TASK_FLAGS_LUN_RESET ) { isp_prt ( isp , ISP_LOGINFO , f1 , " " , nphdl , notify . nt_lun , inp -> in_seqid ) ; notify . nt_ncode = NT_LUN_RESET ; } else if ( inp -> in_task_flags & TASK_FLAGS_TARGET_RESET ) { isp_prt ( isp , ISP_LOGINFO , f1 , " " , nphdl , notify . nt_lun , inp -> in_seqid ) ; notify . nt_ncode = NT_TARGET_RESET ; } else if ( inp -> in_task_flags & TASK_FLAGS_CLEAR_ACA ) { isp_prt ( isp , ISP_LOGINFO , f1 , " " , nphdl , notify . nt_lun , inp -> in_seqid ) ; notify . nt_ncode = NT_CLEAR_ACA ; } else { isp_prt ( isp , ISP_LOGWARN , f2 , " " , inp -> in_status , notify . nt_lun , nphdl , inp -> in_task_flags , inp -> in_seqid ) ; isp_async ( isp , ISPASYNC_TARGET_NOTIFY_ACK , inp ) ; return ; } isp_async ( isp , ISPASYNC_TARGET_NOTIFY , & notify ) ; }
Synthesize a message from the task management flags in a FCP_CMND_IU.
Synthesize a message from the task management flags in a FCP_CMND_IU .
/* nt_tgt set in outer layers */