FreeBSD/sys/cam/ctl/ctl_tpc.c
/*
 * For any sort of check condition, busy, etc., we just retry.  We do not
 * decrement the retry count for unit attention type errors.  These are
 * normal, and we want to save the retry count for "real" errors.  Otherwise,
 * we could end up with situations where a command will succeed in some
 * situations and fail in others, depending on whether a unit attention is
 * pending.  Also, some of our error recovery actions, most notably the
 * LUN reset action, will cause a unit attention.
 *
 * We can add more detail here later if necessary.
 */
For any sort of check condition, busy, etc., we just retry.  We do not
decrement the retry count for unit attention type errors.  These are
normal, and we want to save the retry count for "real" errors.  Otherwise,
we could end up with situations where a command will succeed in some
situations and fail in others, depending on whether a unit attention is
pending.  Also, some of our error recovery actions, most notably the
LUN reset action, will cause a unit attention.

We can add more detail here later if necessary.
For any sort of check condition busy etc . we just retry . We do not decrement the retry count for unit attention type errors . These are normal and we want to save the retry count for " real " errors . Otherwise we could end up with situations where a command will succeed in some situations and fail in others depending on whether a unit attention is pending . Also some of our error recovery actions most notably the LUN reset action will cause a unit attention . We can add more detail here later if necessary .
static tpc_error_action
tpc_checkcond_parse(union ctl_io *io)
{
	tpc_error_action error_action;
	int error_code, sense_key, asc, ascq;
	error_action = TPC_ERR_RETRY;
	scsi_extract_sense_len(&io->scsiio.sense_data,
			       io->scsiio.sense_len,
			       &error_code,
			       &sense_key,
			       &asc,
			       &ascq,
			        1);
	switch (error_code) {
	case SSD_DEFERRED_ERROR:
	case SSD_DESC_DEFERRED_ERROR:
		error_action |= TPC_ERR_NO_DECREMENT;
		break;
	case SSD_CURRENT_ERROR:
	case SSD_DESC_CURRENT_ERROR:
	default:
		switch (sense_key) {
		case SSD_KEY_UNIT_ATTENTION:
			error_action |= TPC_ERR_NO_DECREMENT;
			break;
		case SSD_KEY_HARDWARE_ERROR:
			if ((asc == 0x44) && (ascq == 0x00))
				error_action = TPC_ERR_FAIL;
			break;
		case SSD_KEY_NOT_READY:
			if ((asc == 0x04) && (ascq == 0x02))
				error_action = TPC_ERR_FAIL;
			if ((asc == 0x04) && (ascq == 0x03))
				error_action = TPC_ERR_FAIL;
			break;
		}
	}
	return (error_action);
}
static tpc_error_action tpc_checkcond_parse ( union ctl_io * io ) { tpc_error_action error_action ; int error_code , sense_key , asc , ascq ; error_action = TPC_ERR_RETRY ; scsi_extract_sense_len ( & io -> scsiio . sense_data , io -> scsiio . sense_len , & error_code , & sense_key , & asc , & ascq , 1 ) ; switch ( error_code ) { case SSD_DEFERRED_ERROR : case SSD_DESC_DEFERRED_ERROR : error_action |= TPC_ERR_NO_DECREMENT ; break ; case SSD_CURRENT_ERROR : case SSD_DESC_CURRENT_ERROR : default : switch ( sense_key ) { case SSD_KEY_UNIT_ATTENTION : error_action |= TPC_ERR_NO_DECREMENT ; break ; case SSD_KEY_HARDWARE_ERROR : if ( ( asc == 0x44 ) && ( ascq == 0x00 ) ) error_action = TPC_ERR_FAIL ; break ; case SSD_KEY_NOT_READY : if ( ( asc == 0x04 ) && ( ascq == 0x02 ) ) error_action = TPC_ERR_FAIL ; if ( ( asc == 0x04 ) && ( ascq == 0x03 ) ) error_action = TPC_ERR_FAIL ; break ; } } return ( error_action ) ; }
For any sort of check condition, busy, etc., we just retry.
For any sort of check condition busy etc . we just retry .
/*
	 * Default to retrying the command.
	 */ /*show_errors*/ /*
			 * This is our generic "something bad happened"
			 * error code.  It often isn't recoverable.
			 */ /*
			 * If the LUN is powered down, there likely isn't
			 * much point in retrying right now.
			 */ /*
			 * If the LUN is offline, there probably isn't much
			 * point in retrying, either.
			 */