1 /*- 2 * Copyright (c) 1991 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)tp_stat.h 7.5 (Berkeley) 06/27/91 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 124 u_long ts_concat_rcvd; 125 126 u_long ts_zdebug; /* zero dref to test timeout on conn estab tp_input.c */ 127 u_long ts_ydebug; /* throw away pseudo-random pkts tp_input.c */ 128 u_long ts_unused5; 129 u_long ts_unused; /* kludged concat to test separation tp_emit.c */ 130 u_long ts_vdebug; /* kludge to test input size checking tp_emit.c */ 131 u_long ts_unused4; 132 u_long ts_ldebug; /* faked a renegging of credit */ 133 134 u_long ts_mb_small; 135 u_long ts_mb_cluster; 136 u_long ts_mb_len_distr[17]; 137 138 u_long ts_eot_input; 139 u_long ts_eot_user; 140 u_long ts_EOT_sent; 141 u_long ts_tp0_conn; 142 u_long ts_tp4_conn; 143 u_long ts_quench; 144 u_long ts_rcvdecbit; 145 146 #define NRTT_CATEGORIES 4 147 /* The 4 categories are: 148 * 0 --> tp_flags: ~TPF_PEER_ON_SAMENET | TPF_NL_PDN 149 * 1 --> tp_flags: ~TPF_PEER_ON_SAMENET | ~TPF_NL_PDN 150 * 2 --> tp_flags: TPF_PEER_ON_SAMENET | ~TPF_NL_PDN 151 * 3 --> tp_flags: TPF_PEER_ON_SAMENET | TPF_NL_PDN 152 */ 153 struct timeval ts_rtt[NRTT_CATEGORIES]; 154 struct timeval ts_rtv[NRTT_CATEGORIES]; 155 156 u_long ts_ackreason[_ACK_NUM_REASONS_]; 157 /* ACK_DONT 0 / ACK_STRAT_EACH 0x1 / ACK_STRAT_FULLWIN 0x4 158 * ACK_DUP 0x8 / ACK_EOT 0x10 / ACK_REORDER 0x20 159 * ACK_USRRCV ** 160 * ACK_FCC ** 161 */ 162 } tp_stat ; 163 #define TP_PM_MAX 0xa /* 10 decimal */ 164 165 #define IncStat(x) tp_stat./**/x/**/++ 166 167 #ifdef TP_PERF_MEAS 168 169 #define PStat(Tpcb, X) (Tpcb)->tp_p_meas->/**/X/**/ 170 #define IncPStat(Tpcb, X) if((Tpcb)->tp_perf_on) (Tpcb)->tp_p_meas->/**/X/**/++ 171 172 /* BEWARE OF MACROS like this ^^^ must be sure it's surrounded by {} if 173 * it's used in an if-else statement. 174 */ 175 176 177 /* for perf measurement stuff: maximum window size it can handle */ 178 179 struct tp_pmeas { 180 /* the first few are distributions as a fn of window size 181 * only keep enough space for normal format plus 1 slot for 182 * extended format, in case any windows larger than 15 are used 183 */ 184 185 /* 186 * tps_npdusent: for each call to tp_sbsend, we inc the 187 * element representing the number of pdus sent in this call 188 */ 189 int tps_win_lim_by_cdt[TP_PM_MAX+1]; 190 int tps_win_lim_by_data[TP_PM_MAX+1]; 191 /* 192 * tps_sendtime: Each call to tp_sbsend() is timed. For 193 * Each window size, we keep the running average of the time 194 * taken by tp_sbsend() for each window size. 195 */ 196 struct timeval tps_sendtime[TP_PM_MAX+1]; 197 /* 198 * n_TMsendack: # times ack sent because timer went off 199 * n_ack_cuz_eot: # times ack sent due to EOTSDU on incoming packet 200 * n_ack_cuz_dup: # times ack sent for receiving a duplicate pkt. 201 * n_ack_cuz_fullwin: # times ack sent for receiving the full window. 202 * n_ack_cuz_doack: # times ack sent for having just reordered data. 203 */ 204 int tps_n_TMsendack; 205 int tps_n_ack_cuz_eot; 206 int tps_n_ack_cuz_fullwin; 207 int tps_n_ack_cuz_reorder; 208 int tps_n_ack_cuz_dup; 209 int tps_n_ack_cuz_strat; 210 /* 211 * when we send an ack: how much less than the "expected" window 212 * did we actually ack. For example: if we last sent a credit 213 * of 10, and we're acking now for whatever reason, and have 214 * only received 6 since our last credit advertisement, we'll 215 * keep the difference, 4, in this variable. 216 */ 217 int tps_ack_early[TP_PM_MAX+1]; 218 /* 219 * when we ack, for the # pkts we actually acked w/ this ack, 220 * how much cdt are we advertising? 221 * [ size of window acknowledged ] [ cdt we're giving ] 222 */ 223 int tps_cdt_acked[TP_PM_MAX+1][TP_PM_MAX+1]; 224 225 int tps_AK_sent; 226 int tps_XAK_sent; 227 int tps_DT_sent; 228 int tps_XPD_sent; 229 int tps_AK_rcvd; 230 int tps_XAK_rcvd; 231 int tps_DT_rcvd; 232 int tps_XPD_rcvd; 233 234 int Nb_from_sess; 235 int Nb_to_sess; 236 int Nb_to_ll; 237 int Nb_from_ll; 238 }; 239 240 #define IFPERF(tpcb) if (tpcb->tp_perf_on && tpcb->tp_p_meas) { 241 #define ENDPERF } 242 243 #else 244 245 int PStat_Junk; 246 #define PStat(tpcb, x) PStat_Junk 247 #define IncPStat(tpcb, x) /* no-op */ 248 #define tpmeas(a,b,c,d,e,f) 0 249 250 #define IFPERF(x) if (0) { 251 #define ENDPERF } 252 253 #endif TP_PERF_MEAS 254 255 #endif __TP_STAT__ 256