Pass more information down to the protocol-specific socket dispatch function
[dragonfly.git] / sys / netinet / tcp_stats.h
1 /*
2  * Copyright (c) 2003-2004
3  *      Hiten Pandya <hmp@backplane.com>.  All rights reserved.
4  *
5  * Copyright (c) 1982, 1986, 1993, 1994, 1995
6  *      The Regents of the University of California.  All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. All advertising materials mentioning features or use of this software
17  *    must display the following acknowledgement:
18  *      This product includes software developed by the University of
19  *      California, Berkeley and its contributors.
20  * 4. Neither the name of the University nor the names of its contributors
21  *    may be used to endorse or promote products derived from this software
22  *    without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34  * SUCH DAMAGE.
35  *
36  * $DragonFly: src/sys/netinet/Attic/tcp_stats.h,v 1.1 2004/04/07 20:56:15 dillon Exp $
37  */
38
39 #ifndef _NETINET_TCP_STATS_H_
40 #define _NETINET_TCP_STATS_H_
41
42 #ifdef _KERNEL
43 #ifdef SMP
44 /* 
45  * Uglyness, but it allows us to safely redefine in a critical path
46  * function, so a cached globaldata pointer can be accessed.  HMP.
47  */
48 #define _GD     mycpu
49 #define tcpstat tcpstats_ary[_GD->gd_cpuid]
50 #else /* !SMP */
51 #define tcpstat tcpstats_ary[0] /* only one CPU */
52 #endif
53
54 struct tcp_stats;
55 extern struct tcp_stats         tcpstats_ary[MAXCPU];
56 #endif
57
58 /*
59  * TCP statistics.
60  *
61  * Many of these should be kept per connection,
62  * but that's inconvenient at the moment.
63  */
64 struct tcp_stats {
65         u_long  tcps_connattempt;       /* connections initiated */
66         u_long  tcps_accepts;           /* connections accepted */
67         u_long  tcps_connects;          /* connections established */
68         u_long  tcps_drops;             /* connections dropped */
69         u_long  tcps_conndrops;         /* embryonic connections dropped */
70         u_long  tcps_closed;            /* conn. closed (includes drops) */
71         u_long  tcps_segstimed;         /* segs where we tried to get rtt */
72         u_long  tcps_rttupdated;        /* times we succeeded */
73         u_long  tcps_delack;            /* delayed acks sent */
74         u_long  tcps_timeoutdrop;       /* conn. dropped in rxmt timeout */
75         u_long  tcps_rexmttimeo;        /* retransmit timeouts */
76         u_long  tcps_persisttimeo;      /* persist timeouts */
77         u_long  tcps_keeptimeo;         /* keepalive timeouts */
78         u_long  tcps_keepprobe;         /* keepalive probes sent */
79         u_long  tcps_keepdrops;         /* connections dropped in keepalive */
80
81         u_long  tcps_sndtotal;          /* total packets sent */
82         u_long  tcps_sndpack;           /* data packets sent */
83         u_long  tcps_sndbyte;           /* data bytes sent */
84         u_long  tcps_sndrexmitpack;     /* data packets retransmitted */
85         u_long  tcps_sndrexmitbyte;     /* data bytes retransmitted */
86         u_long  tcps_sndfastrexmit;     /* Fast Retransmissions */
87         u_long  tcps_sndearlyrexmit;    /* early Fast Retransmissions */
88         u_long  tcps_sndlimited;        /* Limited Transmit packets */
89         u_long  tcps_sndrtobad;         /* spurious RTO retransmissions */
90         u_long  tcps_sndfastrexmitbad;  /* spurious Fast Retransmissions */
91         u_long  tcps_sndearlyrexmitbad; /* spurious early Fast Retransmissions,
92                                            a subset of tcps_sndfastrexmitbad */
93         u_long  tcps_eifeldetected;     /* Eifel-detected spurious rexmits */
94         u_long  tcps_rttcantdetect;     /* Eifel but not 1/2 RTT-detectable */
95         u_long  tcps_rttdetected;       /* RTT-detected spurious RTO rexmits */
96         u_long  tcps_sndacks;           /* ack-only packets sent */
97         u_long  tcps_sndprobe;          /* window probes sent */
98         u_long  tcps_sndurg;            /* packets sent with URG only */
99         u_long  tcps_sndwinup;          /* window update-only packets sent */
100         u_long  tcps_sndctrl;           /* control (SYN|FIN|RST) packets sent */
101
102         u_long  tcps_rcvtotal;          /* total packets received */
103         u_long  tcps_rcvpack;           /* packets received in sequence */
104         u_long  tcps_rcvbyte;           /* bytes received in sequence */
105         u_long  tcps_rcvbadsum;         /* packets received with ccksum errs */
106         u_long  tcps_rcvbadoff;         /* packets received with bad offset */
107         u_long  tcps_rcvmemdrop;        /* packets dropped for lack of memory */
108         u_long  tcps_rcvshort;          /* packets received too short */
109         u_long  tcps_rcvduppack;        /* duplicate-only packets received */
110         u_long  tcps_rcvdupbyte;        /* duplicate-only bytes received */
111         u_long  tcps_rcvpartduppack;    /* packets with some duplicate data */
112         u_long  tcps_rcvpartdupbyte;    /* dup. bytes in part-dup. packets */
113         u_long  tcps_rcvoopack;         /* out-of-order packets received */
114         u_long  tcps_rcvoobyte;         /* out-of-order bytes received */
115         u_long  tcps_rcvpackafterwin;   /* packets with data after window */
116         u_long  tcps_rcvbyteafterwin;   /* bytes rcvd after window */
117         u_long  tcps_rcvafterclose;     /* packets rcvd after "close" */
118         u_long  tcps_rcvwinprobe;       /* rcvd window probe packets */
119         u_long  tcps_rcvdupack;         /* rcvd duplicate acks */
120         u_long  tcps_rcvacktoomuch;     /* rcvd acks for unsent data */
121         u_long  tcps_rcvackpack;        /* rcvd ack packets */
122         u_long  tcps_rcvackbyte;        /* bytes acked by rcvd acks */
123         u_long  tcps_rcvwinupd;         /* rcvd window update packets */
124         u_long  tcps_pawsdrop;          /* segments dropped due to PAWS */
125         u_long  tcps_predack;           /* times hdr predict ok for acks */
126         u_long  tcps_preddat;           /* times hdr predict ok for data pkts */
127         u_long  tcps_pcbcachemiss;
128         u_long  tcps_cachedrtt;         /* times cached RTT in route updated */
129         u_long  tcps_cachedrttvar;      /* times cached rttvar updated */
130         u_long  tcps_cachedssthresh;    /* times cached ssthresh updated */
131         u_long  tcps_usedrtt;           /* times RTT initialized from route */
132         u_long  tcps_usedrttvar;        /* times RTTVAR initialized from rt */
133         u_long  tcps_usedssthresh;      /* times ssthresh initialized from rt*/
134         u_long  tcps_persistdrop;       /* timeout in persist state */
135         u_long  tcps_badsyn;            /* bogus SYN, e.g. premature ACK */
136         u_long  tcps_mturesent;         /* resends due to MTU discovery */
137         u_long  tcps_listendrop;        /* listen queue overflows */
138
139         u_long  tcps_sc_added;          /* entry added to syncache */
140         u_long  tcps_sc_retransmitted;  /* syncache entry was retransmitted */
141         u_long  tcps_sc_dupsyn;         /* duplicate SYN packet */
142         u_long  tcps_sc_dropped;        /* could not reply to packet */
143         u_long  tcps_sc_completed;      /* successful extraction of entry */
144         u_long  tcps_sc_bucketoverflow; /* syncache per-bucket limit hit */
145         u_long  tcps_sc_cacheoverflow;  /* syncache cache limit hit */
146         u_long  tcps_sc_reset;          /* RST removed entry from syncache */
147         u_long  tcps_sc_stale;          /* timed out or listen socket gone */
148         u_long  tcps_sc_aborted;        /* syncache entry aborted */
149         u_long  tcps_sc_badack;         /* removed due to bad ACK */
150         u_long  tcps_sc_unreach;        /* ICMP unreachable received */
151         u_long  tcps_sc_zonefail;       /* zalloc() failed */
152         u_long  tcps_sc_sendcookie;     /* SYN cookie sent */
153         u_long  tcps_sc_recvcookie;     /* SYN cookie received */
154 };
155
156 #endif /* _NETINET_TCP_STATS_H_ */