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