From 2a615bda97c4c0df44c74d456f5a2e0ade01d257 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Mon, 23 Aug 2004 15:11:44 +0000 Subject: [PATCH] Remove ASR_MEASURE_PERFORMANCE, it doesn't work anyway. Inspired-by: FreeBSD --- sys/conf/options | 5 +- sys/dev/raid/asr/Makefile | 5 +- sys/dev/raid/asr/asr.c | 357 +------------------------------------- 3 files changed, 4 insertions(+), 363 deletions(-) diff --git a/sys/conf/options b/sys/conf/options index 04e4a77b58..a4a72ac1fa 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -1,5 +1,5 @@ # $FreeBSD: src/sys/conf/options,v 1.191.2.53 2003/06/04 17:56:58 sam Exp $ -# $DragonFly: src/sys/conf/options,v 1.22 2004/06/24 08:15:11 dillon Exp $ +# $DragonFly: src/sys/conf/options,v 1.23 2004/08/23 15:11:44 joerg Exp $ # # On the handling of kernel options # @@ -365,9 +365,6 @@ DPT_TIMEOUT_FACTOR opt_dpt.h DPT_LOST_IRQ opt_dpt.h DPT_RESET_HBA opt_dpt.h -# Adaptec ASR and DPT V/VI controller options -ASR_MEASURE_PERFORMANCE opt_asr.h - # Misc debug flags. Most of these should probably be replaced with # 'DEBUG', and then let people recompile just the interesting modules # with 'make CC="cc -DDEBUG"'. diff --git a/sys/dev/raid/asr/Makefile b/sys/dev/raid/asr/Makefile index af19c8c60c..a41cd3593f 100644 --- a/sys/dev/raid/asr/Makefile +++ b/sys/dev/raid/asr/Makefile @@ -1,10 +1,9 @@ # $FreeBSD: src/sys/modules/asr/Makefile,v 1.1.2.1 2000/09/21 20:33:53 msmith Exp $ -# $DragonFly: src/sys/dev/raid/asr/Makefile,v 1.2 2003/06/17 04:28:43 dillon Exp $ +# $DragonFly: src/sys/dev/raid/asr/Makefile,v 1.3 2004/08/23 15:11:44 joerg Exp $ -.PATH: ${.CURDIR}/../../dev/asr KMOD = asr SRCS = asr.c -SRCS += opt_scsi.h opt_cam.h opt_asr.h +SRCS += opt_scsi.h opt_cam.h SRCS += device_if.h bus_if.h pci_if.h .include diff --git a/sys/dev/raid/asr/asr.c b/sys/dev/raid/asr/asr.c index 8311227dac..55c4071fbf 100644 --- a/sys/dev/raid/asr/asr.c +++ b/sys/dev/raid/asr/asr.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/asr/asr.c,v 1.3.2.2 2001/08/23 05:21:29 scottl Exp $ */ -/* $DragonFly: src/sys/dev/raid/asr/asr.c,v 1.15 2004/06/21 15:39:30 dillon Exp $ */ +/* $DragonFly: src/sys/dev/raid/asr/asr.c,v 1.16 2004/08/23 15:11:44 joerg Exp $ */ /* * Copyright (c) 1996-2000 Distributed Processing Technology Corporation * Copyright (c) 2000-2001 Adaptec Corporation @@ -263,8 +263,6 @@ static dpt_sig_S ASR_sig = { #include "i2obscsi.h" #include "i2odpt.h" #include "i2oadptr.h" -#include "opt_asr.h" - #include "sys_info.h" /* Configuration Definitions */ @@ -374,43 +372,6 @@ typedef struct Asr_softc { /* Links into other parents and HBAs */ struct Asr_softc * ha_next; /* HBA list */ - -#ifdef ASR_MEASURE_PERFORMANCE -#define MAX_TIMEQ_SIZE 256 // assumes MAX 256 scsi commands sent - asr_perf_t ha_performance; - u_int32_t ha_submitted_ccbs_count; - - // Queueing macros for a circular queue -#define TIMEQ_FREE_LIST_EMPTY(head, tail) (-1 == (head) && -1 == (tail)) -#define TIMEQ_FREE_LIST_FULL(head, tail) ((((tail) + 1) % MAX_TIMEQ_SIZE) == (head)) -#define ENQ_TIMEQ_FREE_LIST(item, Q, head, tail) \ - if (!TIMEQ_FREE_LIST_FULL((head), (tail))) { \ - if TIMEQ_FREE_LIST_EMPTY((head),(tail)) { \ - (head) = (tail) = 0; \ - } \ - else (tail) = ((tail) + 1) % MAX_TIMEQ_SIZE; \ - Q[(tail)] = (item); \ - } \ - else { \ - debug_asr_printf("asr: Enqueueing when TimeQ Free List is full... This should not happen!\n"); \ - } -#define DEQ_TIMEQ_FREE_LIST(item, Q, head, tail) \ - if (!TIMEQ_FREE_LIST_EMPTY((head), (tail))) { \ - item = Q[(head)]; \ - if ((head) == (tail)) { (head) = (tail) = -1; } \ - else (head) = ((head) + 1) % MAX_TIMEQ_SIZE; \ - } \ - else { \ - (item) = -1; \ - debug_asr_printf("asr: Dequeueing when TimeQ Free List is empty... This should not happen!\n"); \ - } - - // Circular queue of time stamps - struct timeval ha_timeQ[MAX_TIMEQ_SIZE]; - u_int32_t ha_timeQFreeList[MAX_TIMEQ_SIZE]; - int ha_timeQFreeHead; - int ha_timeQFreeTail; -#endif } Asr_softc_t; STATIC Asr_softc_t * Asr_softc; @@ -593,11 +554,6 @@ STATIC struct cdevsw asr_cdevsw = { nopsize /* psize */ }; -#ifdef ASR_MEASURE_PERFORMANCE -STATIC u_int32_t asr_time_delta (IN struct timeval start, - IN struct timeval end); -#endif - /* * Initialize the dynamic cdevsw hooks. */ @@ -1666,32 +1622,6 @@ ASR_queue( I2O_MESSAGE_FRAME_getInitiatorContext64(Message); if ((MessageOffset = ASR_getMessage(sc->ha_Virt)) != EMPTY_QUEUE) { -#ifdef ASR_MEASURE_PERFORMANCE - int startTimeIndex; - - if (ccb) { - ++sc->ha_performance.command_count[ - (int) ccb->csio.cdb_io.cdb_bytes[0]]; - DEQ_TIMEQ_FREE_LIST(startTimeIndex, - sc->ha_timeQFreeList, - sc->ha_timeQFreeHead, - sc->ha_timeQFreeTail); - if (-1 != startTimeIndex) { - microtime(&(sc->ha_timeQ[startTimeIndex])); - } - /* Time stamp the command before we send it out */ - ((PRIVATE_SCSI_SCB_EXECUTE_MESSAGE *) Message)-> - PrivateMessageFrame.TransactionContext - = (I2O_TRANSACTION_CONTEXT) startTimeIndex; - - ++sc->ha_submitted_ccbs_count; - if (sc->ha_performance.max_submit_count - < sc->ha_submitted_ccbs_count) { - sc->ha_performance.max_submit_count - = sc->ha_submitted_ccbs_count; - } - } -#endif bcopy (Message, sc->ha_Fvirt + MessageOffset, I2O_MESSAGE_FRAME_getMessageSize(Message) << 2); if (ccb) { @@ -2860,18 +2790,6 @@ asr_attach (ATTACH_ARGS) */ bzero (sc, sizeof(*sc)); LIST_INIT(&(sc->ha_ccb)); -# ifdef ASR_MEASURE_PERFORMANCE - { - u_int32_t i; - - // initialize free list for timeQ - sc->ha_timeQFreeHead = 0; - sc->ha_timeQFreeTail = MAX_TIMEQ_SIZE - 1; - for (i = 0; i < MAX_TIMEQ_SIZE; i++) { - sc->ha_timeQFreeList[i] = i; - } - } -# endif /* Link us into the HA list */ { Asr_softc_t **ha; @@ -3252,9 +3170,6 @@ asr_action( debug_asr_cmd1_printf (" q"); if (ASR_queue (sc, Message_Ptr) == EMPTY_QUEUE) { -#ifdef ASR_MEASURE_PERFORMANCE - ++sc->ha_performance.command_too_busy; -#endif ccb->ccb_h.status &= ~CAM_STATUS_MASK; ccb->ccb_h.status |= CAM_REQUEUE_REQ; debug_asr_cmd_printf (" E\n"); @@ -3395,60 +3310,6 @@ asr_action( } } /* asr_action */ -#ifdef ASR_MEASURE_PERFORMANCE -#define WRITE_OP 1 -#define READ_OP 2 -#define min_submitR sc->ha_performance.read_by_size_min_time[index] -#define max_submitR sc->ha_performance.read_by_size_max_time[index] -#define min_submitW sc->ha_performance.write_by_size_min_time[index] -#define max_submitW sc->ha_performance.write_by_size_max_time[index] - -STATIC INLINE void -asr_IObySize( - IN Asr_softc_t * sc, - IN u_int32_t submitted_time, - IN int op, - IN int index) -{ - struct timeval submitted_timeval; - - submitted_timeval.tv_sec = 0; - submitted_timeval.tv_usec = submitted_time; - - if ( op == READ_OP ) { - ++sc->ha_performance.read_by_size_count[index]; - - if ( submitted_time != 0xffffffff ) { - timevaladd( - &(sc->ha_performance.read_by_size_total_time[index]), - &submitted_timeval); - if ( (min_submitR == 0) - || (submitted_time < min_submitR) ) { - min_submitR = submitted_time; - } - - if ( submitted_time > max_submitR ) { - max_submitR = submitted_time; - } - } - } else { - ++sc->ha_performance.write_by_size_count[index]; - if ( submitted_time != 0xffffffff ) { - timevaladd( - &(sc->ha_performance.write_by_size_total_time[index]), - &submitted_timeval); - if ( (submitted_time < min_submitW) - || (min_submitW == 0) ) { - min_submitW = submitted_time; - } - - if ( submitted_time > max_submitW ) { - max_submitW = submitted_time; - } - } - } -} /* asr_IObySize */ -#endif /* * Handle processing of current CCB as pointed to by the Status. @@ -3459,13 +3320,6 @@ asr_intr ( { OUT int processed; -#ifdef ASR_MEASURE_PERFORMANCE - struct timeval junk; - - microtime(&junk); - sc->ha_performance.intr_started = junk; -#endif - for (processed = 0; sc->ha_Virt->Status & Mask_InterruptsDisabled; processed = 1) { @@ -3618,154 +3472,6 @@ asr_intr ( Reply); } -#ifdef ASR_MEASURE_PERFORMANCE - { - struct timeval endTime; - u_int32_t submitted_time; - u_int32_t size; - int op_type; - int startTimeIndex; - - --sc->ha_submitted_ccbs_count; - startTimeIndex - = (int)Reply->StdReplyFrame.TransactionContext; - if (-1 != startTimeIndex) { - /* Compute the time spent in device/adapter */ - microtime(&endTime); - submitted_time = asr_time_delta(sc->ha_timeQ[ - startTimeIndex], endTime); - /* put the startTimeIndex back on free list */ - ENQ_TIMEQ_FREE_LIST(startTimeIndex, - sc->ha_timeQFreeList, - sc->ha_timeQFreeHead, - sc->ha_timeQFreeTail); - } else { - submitted_time = 0xffffffff; - } - -#define maxctime sc->ha_performance.max_command_time[ccb->csio.cdb_io.cdb_bytes[0]] -#define minctime sc->ha_performance.min_command_time[ccb->csio.cdb_io.cdb_bytes[0]] - if (submitted_time != 0xffffffff) { - if ( maxctime < submitted_time ) { - maxctime = submitted_time; - } - if ( (minctime == 0) - || (minctime > submitted_time) ) { - minctime = submitted_time; - } - - if ( sc->ha_performance.max_submit_time - < submitted_time ) { - sc->ha_performance.max_submit_time - = submitted_time; - } - if ( sc->ha_performance.min_submit_time == 0 - || sc->ha_performance.min_submit_time - > submitted_time) { - sc->ha_performance.min_submit_time - = submitted_time; - } - - switch ( ccb->csio.cdb_io.cdb_bytes[0] ) { - - case 0xa8: /* 12-byte READ */ - /* FALLTHRU */ - case 0x08: /* 6-byte READ */ - /* FALLTHRU */ - case 0x28: /* 10-byte READ */ - op_type = READ_OP; - break; - - case 0x0a: /* 6-byte WRITE */ - /* FALLTHRU */ - case 0xaa: /* 12-byte WRITE */ - /* FALLTHRU */ - case 0x2a: /* 10-byte WRITE */ - op_type = WRITE_OP; - break; - - default: - op_type = 0; - break; - } - - if ( op_type != 0 ) { - struct scsi_rw_big * cmd; - - cmd = (struct scsi_rw_big *) - &(ccb->csio.cdb_io); - - size = (((u_int32_t) cmd->length2 << 8) - | ((u_int32_t) cmd->length1)) << 9; - - switch ( size ) { - - case 512: - asr_IObySize(sc, - submitted_time, op_type, - SIZE_512); - break; - - case 1024: - asr_IObySize(sc, - submitted_time, op_type, - SIZE_1K); - break; - - case 2048: - asr_IObySize(sc, - submitted_time, op_type, - SIZE_2K); - break; - - case 4096: - asr_IObySize(sc, - submitted_time, op_type, - SIZE_4K); - break; - - case 8192: - asr_IObySize(sc, - submitted_time, op_type, - SIZE_8K); - break; - - case 16384: - asr_IObySize(sc, - submitted_time, op_type, - SIZE_16K); - break; - - case 32768: - asr_IObySize(sc, - submitted_time, op_type, - SIZE_32K); - break; - - case 65536: - asr_IObySize(sc, - submitted_time, op_type, - SIZE_64K); - break; - - default: - if ( size > (1 << 16) ) { - asr_IObySize(sc, - submitted_time, - op_type, - SIZE_BIGGER); - } else { - asr_IObySize(sc, - submitted_time, - op_type, - SIZE_OTHER); - } - break; - } - } - } - } -#endif /* Sense data in reply packet */ if (ccb->ccb_h.status & CAM_AUTOSNS_VALID) { u_int16_t size = I2O_SCSI_ERROR_REPLY_MESSAGE_FRAME_getAutoSenseTransferCount(Reply); @@ -3798,25 +3504,6 @@ asr_intr ( wakeup ((caddr_t)ccb); } } -#ifdef ASR_MEASURE_PERFORMANCE - { - u_int32_t result; - - microtime(&junk); - result = asr_time_delta(sc->ha_performance.intr_started, junk); - - if (result != 0xffffffff) { - if ( sc->ha_performance.max_intr_time < result ) { - sc->ha_performance.max_intr_time = result; - } - - if ( (sc->ha_performance.min_intr_time == 0) - || (sc->ha_performance.min_intr_time > result) ) { - sc->ha_performance.min_intr_time = result; - } - } - } -#endif return (processed); } /* asr_intr */ @@ -4629,14 +4316,6 @@ asr_ioctl( } break; - /* Get performance metrics */ -#ifdef ASR_MEASURE_PERFORMANCE - case DPT_PERF_INFO: - bcopy((caddr_t) &(sc->ha_performance), data, - sizeof(sc->ha_performance)); - return (0); -#endif - /* Send an I2O command */ case I2OUSRCMD: return (ASR_queue_i (sc, *((PI2O_MESSAGE_FRAME *)data))); @@ -4651,37 +4330,3 @@ asr_ioctl( } return (EINVAL); } /* asr_ioctl */ - -#ifdef ASR_MEASURE_PERFORMANCE -/* - * This function subtracts one timeval structure from another, - * Returning the result in usec. - * It assumes that less than 4 billion usecs passed form start to end. - * If times are sensless, 0xffffffff is returned. - */ - -STATIC u_int32_t -asr_time_delta( - IN struct timeval start, - IN struct timeval end) -{ - OUT u_int32_t result; - - if (start.tv_sec > end.tv_sec) { - result = 0xffffffff; - } - else { - if (start.tv_sec == end.tv_sec) { - if (start.tv_usec > end.tv_usec) { - result = 0xffffffff; - } else { - return (end.tv_usec - start.tv_usec); - } - } else { - return (end.tv_sec - start.tv_sec) * 1000000 + - end.tv_usec + (1000000 - start.tv_usec); - } - } - return(result); -} /* asr_time_delta */ -#endif -- 2.35.2