1 /*	$OpenBSD: nfsrtt.h,v 1.6 2003/06/02 23:28:20 millert Exp $	*/
2 /*	$NetBSD: nfsrtt.h,v 1.4 1996/02/18 11:54:07 fvdl Exp $	*/
3 
4 /*
5  * Copyright (c) 1992, 1993
6  *	The Regents of the University of California.  All rights reserved.
7  *
8  * This code is derived from software contributed to Berkeley by
9  * Rick Macklem at The University of Guelph.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  * 3. Neither the name of the University nor the names of its contributors
20  *    may be used to endorse or promote products derived from this software
21  *    without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  *
35  *	@(#)nfsrtt.h	8.2 (Berkeley) 3/30/95
36  */
37 
38 
39 #ifndef _NFS_NFSRTT_H_
40 #define _NFS_NFSRTT_H_
41 
42 /*
43  * Definitions for performance monitor.
44  * The client and server logging are turned on by setting the global
45  * constant "nfsrtton" to 1.
46  */
47 #define	NFSRTTLOGSIZ	128
48 
49 /*
50  * Circular log of client side rpc activity. Each log entry is for one
51  * rpc filled in upon completion. (ie. in order of completion)
52  * The "pos" is the table index for the "next" entry, therefore the
53  * list goes from nfsrtt.rttl[pos] --> nfsrtt.rttl[pos - 1] in
54  * chronological order of completion.
55  */
56 struct nfsrtt {
57 	int pos;			/* Position in array for next entry */
58 	struct rttl {
59 		int	proc;		/* NFS procedure number */
60 		int	rtt;		/* Measured round trip time */
61 		int	rto;		/* Round Trip Timeout */
62 		int	sent;		/* # rpcs in progress */
63 		int	cwnd;		/* Send window */
64 		int	srtt;		/* Ave Round Trip Time */
65 		int	sdrtt;		/* Ave mean deviation of RTT */
66 		fsid_t	fsid;		/* Fsid for mount point */
67 		struct timeval tstamp;	/* Timestamp of log entry */
68 	} rttl[NFSRTTLOGSIZ];
69 };
70 
71 /*
72  * And definitions for server side performance monitor.
73  * The log organization is the same as above except it is filled in at the
74  * time the server sends the rpc reply.
75  */
76 
77 /*
78  * Bits for the flags field.
79  */
80 #define	DRT_TCP		0x02	/* Client used TCP transport */
81 #define	DRT_CACHEREPLY	0x04	/* Reply was from recent request cache */
82 #define	DRT_CACHEDROP	0x08	/* Rpc request dropped, due to recent reply */
83 #define DRT_NFSV3	0x10	/* Rpc used NFS Version 3 */
84 
85 /*
86  * Server log structure
87  * NB: ipadr == INADDR_ANY indicates a client using a non IP protocol.
88  *	(ISO perhaps?)
89  */
90 struct nfsdrt {
91 	int pos;			/* Position of next log entry */
92 	struct drt {
93 		int       flag;		/* Bits as defined above */
94 		int       proc;		/* NFS procedure number */
95 		u_int32_t ipadr;		/* IP address of client */
96 		int       resptime;	/* Response time (usec) */
97 		struct timeval tstamp;	/* Timestamp of log entry */
98 	} drt[NFSRTTLOGSIZ];
99 };
100 
101 #endif
102