xref: /original-bsd/sys/netiso/tp_stat.h (revision d272e02a)
1 /***********************************************************
2 		Copyright IBM Corporation 1987
3 
4                       All Rights Reserved
5 
6 Permission to use, copy, modify, and distribute this software and its
7 documentation for any purpose and without fee is hereby granted,
8 provided that the above copyright notice appear in all copies and that
9 both that copyright notice and this permission notice appear in
10 supporting documentation, and that the name of IBM not be
11 used in advertising or publicity pertaining to distribution of the
12 software without specific, written prior permission.
13 
14 IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16 IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20 SOFTWARE.
21 
22 ******************************************************************/
23 
24 /*
25  * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
26  */
27 /*
28  * ARGO TP
29  *
30  * $Header: tp_stat.h,v 5.4 88/11/18 17:28:38 nhall Exp $
31  * $Source: /usr/argo/sys/netiso/RCS/tp_stat.h,v $
32  *
33  * Here are the data structures in which the global
34  * statistics(counters) are gathered.
35  */
36 
37 #ifndef __TP_STAT__
38 #define __TP_STAT__
39 
40 struct tp_stat {
41 	u_long ts_param_ignored;
42 	u_long ts_unused3;
43 	u_long ts_bad_csum;
44 
45 	u_long ts_inv_length;
46 	u_long ts_inv_pcode;
47 	u_long ts_inv_dutype;
48 	u_long ts_negotfailed;
49 	u_long ts_inv_dref;
50 	u_long ts_inv_pval;
51 	u_long ts_inv_sufx;
52 	u_long ts_inv_aclass;
53 
54 	u_long ts_xtd_fmt;
55 	u_long ts_use_txpd;
56 	u_long ts_csum_off;
57 	u_long	ts_send_drop;
58 	u_long	ts_recv_drop;
59 
60 	u_long ts_xpd_intheway;/* xpd mark caused data flow to stop */
61 	u_long ts_xpdmark_del;	/* xpd markers thrown away */
62 	u_long ts_dt_ooo;		/* dt tpdus received out of order */
63 	u_long ts_dt_niw;		/* dt tpdus received & not in window */
64 	u_long ts_xpd_niw;		/* xpd tpdus received & not in window */
65 	u_long ts_xpd_dup;
66 	u_long ts_dt_dup;		/* dt tpdus received & are duplicates */
67 
68 	u_long ts_zfcdt;		/* # times f credit went down to 0 */
69 	u_long ts_lcdt_reduced; /*
70 		# times local cdt reduced on an acknowledgement.
71 		*/
72 
73 	u_long	ts_pkt_rcvd; /* from ip */
74 	u_long	ts_tpdu_rcvd; /* accepted as a TPDU in tp_input */
75 	u_long	ts_tpdu_sent;
76 	u_long	ts_unused2;
77 
78 	u_long	ts_retrans_cr;
79 	u_long	ts_retrans_cc;
80 	u_long	ts_retrans_dr;
81 	u_long	ts_retrans_dt;
82 	u_long	ts_retrans_xpd;
83 	u_long	ts_conn_gaveup;
84 
85 	u_long ts_ER_sent;
86 	u_long	ts_DT_sent;
87 	u_long	ts_XPD_sent;
88 	u_long	ts_AK_sent;
89 	u_long	ts_XAK_sent;
90 	u_long	ts_DR_sent;
91 	u_long	ts_DC_sent;
92 	u_long	ts_CR_sent;
93 	u_long	ts_CC_sent;
94 
95 	u_long ts_ER_rcvd;
96 	u_long	ts_DT_rcvd;
97 	u_long	ts_XPD_rcvd;
98 	u_long	ts_AK_rcvd;
99 	u_long	ts_XAK_rcvd;
100 	u_long	ts_DR_rcvd;
101 	u_long	ts_DC_rcvd;
102 	u_long	ts_CR_rcvd;
103 	u_long	ts_CC_rcvd;
104 
105 	u_long	ts_Eticks;
106 	u_long	ts_Eexpired;
107 	u_long	ts_Eset;
108 	u_long	ts_Ecan_act;
109 	u_long	ts_Cticks;
110 	u_long	ts_Cexpired;
111 	u_long	ts_Cset;
112 	u_long	ts_Ccan_act;
113 	u_long	ts_Ccan_inact;
114 
115 	u_long	ts_concat_rcvd;
116 
117 	u_long	ts_zdebug; /* zero dref to test timeout on conn estab tp_input.c */
118 	u_long ts_ydebug; /* throw away pseudo-random pkts tp_input.c */
119 	u_long ts_unused5;
120 	u_long ts_unused; /* kludged concat to test separation tp_emit.c */
121 	u_long ts_vdebug; /* kludge to test input size checking tp_emit.c */
122 	u_long ts_unused4;
123 	u_long ts_ldebug; /* faked a renegging of credit */
124 
125 	u_long ts_mb_small;
126 	u_long ts_mb_cluster;
127 	u_long ts_mb_len_distr[17];
128 
129 	u_long ts_eot_input;
130 	u_long ts_eot_user;
131 	u_long	ts_EOT_sent;
132 	u_long ts_tp0_conn;
133 	u_long ts_tp4_conn;
134 	u_long ts_quench;
135 	u_long ts_rcvdecbit;
136 
137 #define NRTT_CATEGORIES 4
138 	/*  The 4 categories are:
139 	 * 0 --> tp_flags: ~TPF_PEER_ON_SAMENET |  TPF_NL_PDN
140 	 * 1 --> tp_flags: ~TPF_PEER_ON_SAMENET | ~TPF_NL_PDN
141 	 * 2 --> tp_flags:  TPF_PEER_ON_SAMENET | ~TPF_NL_PDN
142 	 * 3 --> tp_flags:  TPF_PEER_ON_SAMENET |  TPF_NL_PDN
143 	 */
144 	struct timeval ts_rtt[NRTT_CATEGORIES];
145 	struct timeval ts_rtv[NRTT_CATEGORIES];
146 
147 	u_long ts_ackreason[_ACK_NUM_REASONS_];
148 		/*  ACK_DONT 0 / ACK_STRAT_EACH 0x1 / ACK_STRAT_FULLWIN 0x4
149 	  	 *	ACK_DUP 0x8 / ACK_EOT 0x10  / ACK_REORDER 0x20
150 	  	 *	ACK_USRRCV **
151 	  	 *	ACK_FCC **
152 		 */
153 } tp_stat ;
154 
155 #define IncStat(x) tp_stat./**/x/**/++
156 
157 #ifdef TP_PERF_MEAS
158 
159 #define PStat(Tpcb, X) (Tpcb)->tp_p_meas->/**/X/**/
160 #define IncPStat(Tpcb, X) if((Tpcb)->tp_perf_on) (Tpcb)->tp_p_meas->/**/X/**/++
161 
162 /* BEWARE OF MACROS like this ^^^ must be sure it's surrounded by {} if
163  * it's used in an if-else statement.
164  */
165 
166 
167 /* for perf measurement stuff: maximum window size it can handle */
168 #define 	TP_PM_MAX			0xa /* 10 decimal */
169 
170 struct tp_pmeas {
171 		/* the first few are distributions as a fn of window size
172 		 * only keep enough space for normal format plus 1 slot for
173 		 * extended format, in case any windows larger than 15 are used
174 		 */
175 
176 		/*
177 		 * tps_npdusent: for each call to tp_sbsend, we inc the
178 		 * element representing the number of pdus sent in this call
179 		 */
180 		int		tps_win_lim_by_cdt[TP_PM_MAX+1];
181 		int		tps_win_lim_by_data[TP_PM_MAX+1];
182 		/*
183 		 * tps_sendtime: Each call to tp_sbsend() is timed.  For
184 		 * Each window size, we keep the running average of the time
185 		 * taken by tp_sbsend() for each window size.
186 		 */
187 		struct timeval	tps_sendtime[TP_PM_MAX+1];
188 		/*
189 		 * n_TMsendack: # times ack sent because timer went off
190 		 * n_ack_cuz_eot: # times ack sent due to EOTSDU on incoming packet
191 		 * n_ack_cuz_dup: # times ack sent for receiving a duplicate pkt.
192 		 * n_ack_cuz_fullwin: # times ack sent for receiving the full window.
193 		 * n_ack_cuz_doack: # times ack sent for having just reordered data.
194 		 */
195 		int		tps_n_TMsendack;
196 		int		tps_n_ack_cuz_eot;
197 		int		tps_n_ack_cuz_fullwin;
198 		int		tps_n_ack_cuz_reorder;
199 		int		tps_n_ack_cuz_dup;
200 		int		tps_n_ack_cuz_strat;
201 		/*
202 		 * when we send an ack: how much less than the "expected" window
203 		 * did we actually ack.  For example: if we last sent a credit
204 		 * of 10, and we're acking now for whatever reason, and have
205 		 * only received 6 since our last credit advertisement, we'll
206 		 * keep the difference, 4, in this variable.
207 		 */
208 		int		tps_ack_early[TP_PM_MAX+1];
209 		/*
210 		 * when we ack, for the # pkts we actually acked w/ this ack,
211 		 * how much cdt are we advertising?
212 		 * [ size of window acknowledged ] [ cdt we're giving ]
213 		 */
214 		int		tps_cdt_acked[TP_PM_MAX+1][TP_PM_MAX+1];
215 
216 		int 	tps_AK_sent;
217 		int 	tps_XAK_sent;
218 		int 	tps_DT_sent;
219 		int 	tps_XPD_sent;
220 		int 	tps_AK_rcvd;
221 		int 	tps_XAK_rcvd;
222 		int 	tps_DT_rcvd;
223 		int 	tps_XPD_rcvd;
224 
225 		int		Nb_from_sess;
226 		int		Nb_to_sess;
227 		int		Nb_to_ll;
228 		int		Nb_from_ll;
229 };
230 
231 #define  IFPERF(tpcb)  if (tpcb->tp_perf_on && tpcb->tp_p_meas) {
232 #define  ENDPERF }
233 
234 #else
235 
236 #define PStat(tpcb, x)  /* no-op */
237 #define IncPStat(tpcb, x)  /* no-op */
238 
239 #ifndef STAR
240 #define STAR *
241 #endif	STAR
242 #define IFPERF	//*beginning of comment*/STAR
243 #define ENDPERF		 STAR/*end of comment*//
244 
245 #endif TP_PERF_MEAS
246 
247 #endif __TP_STAT__
248