| 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 | |
| 53 | u_long ts_xtd_fmt; |
| 54 | u_long ts_use_txpd; |
| 55 | u_long ts_csum_off; |
| 56 | u_long ts_send_drop; |
| 57 | u_long ts_recv_drop; |
| 58 | |
| 59 | u_long ts_xpd_intheway;/* xpd mark caused data flow to stop */ |
| 60 | u_long ts_xpdmark_del; /* xpd markers thrown away */ |
| 61 | u_long ts_dt_ooo; /* dt tpdus received out of order */ |
| 62 | u_long ts_dt_niw; /* dt tpdus received & not in window */ |
| 63 | u_long ts_xpd_niw; /* xpd tpdus received & not in window */ |
| 64 | u_long ts_xpd_dup; |
| 65 | u_long ts_dt_dup; /* dt tpdus received & are duplicates */ |
| 66 | |
| 67 | u_long ts_zfcdt; /* # times f credit went down to 0 */ |
| 68 | u_long ts_lcdt_reduced; /* |
| 69 | # times local cdt reduced on an acknowledgement. |
| 70 | */ |
| 71 | |
| 72 | u_long ts_pkt_rcvd; /* from ip */ |
| 73 | u_long ts_tpdu_rcvd; /* accepted as a TPDU in tp_input */ |
| 74 | u_long ts_tpdu_sent; |
| 75 | u_long ts_unused2; |
| 76 | |
| 77 | u_long ts_retrans_cr; |
| 78 | u_long ts_retrans_cc; |
| 79 | u_long ts_retrans_dr; |
| 80 | u_long ts_retrans_dt; |
| 81 | u_long ts_retrans_xpd; |
| 82 | u_long ts_conn_gaveup; |
| 83 | |
| 84 | u_long ts_ER_sent; |
| 85 | u_long ts_DT_sent; |
| 86 | u_long ts_XPD_sent; |
| 87 | u_long ts_AK_sent; |
| 88 | u_long ts_XAK_sent; |
| 89 | u_long ts_DR_sent; |
| 90 | u_long ts_DC_sent; |
| 91 | u_long ts_CR_sent; |
| 92 | u_long ts_CC_sent; |
| 93 | |
| 94 | u_long ts_ER_rcvd; |
| 95 | u_long ts_DT_rcvd; |
| 96 | u_long ts_XPD_rcvd; |
| 97 | u_long ts_AK_rcvd; |
| 98 | u_long ts_XAK_rcvd; |
| 99 | u_long ts_DR_rcvd; |
| 100 | u_long ts_DC_rcvd; |
| 101 | u_long ts_CR_rcvd; |
| 102 | u_long ts_CC_rcvd; |
| 103 | |
| 104 | u_long ts_Eticks; |
| 105 | u_long ts_Eexpired; |
| 106 | u_long ts_Eset; |
| 107 | u_long ts_Ecan_act; |
| 108 | u_long ts_Cticks; |
| 109 | u_long ts_Cexpired; |
| 110 | u_long ts_Cset; |
| 111 | u_long ts_Ccan_act; |
| 112 | u_long ts_Ccan_inact; |
| 113 | |
| 114 | u_long ts_concat_rcvd; |
| 115 | |
| 116 | u_long ts_zdebug; /* zero dref to test timeout on conn estab tp_input.c */ |
| 117 | u_long ts_ydebug; /* throw away pseudo-random pkts tp_input.c */ |
| 118 | u_long ts_unused5; |
| 119 | u_long ts_unused; /* kludged concat to test separation tp_emit.c */ |
| 120 | u_long ts_vdebug; /* kludge to test input size checking tp_emit.c */ |
| 121 | u_long ts_unused4; |
| 122 | u_long ts_ldebug; /* faked a renegging of credit */ |
| 123 | |
| 124 | u_long ts_mb_small; |
| 125 | u_long ts_mb_cluster; |
| 126 | u_long ts_mb_len_distr[17]; |
| 127 | |
| 128 | u_long ts_eot_input; |
| 129 | u_long ts_eot_user; |
| 130 | u_long ts_EOT_sent; |
| 131 | u_long ts_tp0_conn; |
| 132 | u_long ts_tp4_conn; |
| 133 | u_long ts_quench; |
| 134 | u_long ts_rcvdecbit; |
| 135 | |
| 136 | #define NRTT_CATEGORIES 4 |
| 137 | /* The 4 categories are: |
| 138 | * 0 --> tp_flags: ~TPF_PEER_ON_SAMENET | TPF_NL_PDN |
| 139 | * 1 --> tp_flags: ~TPF_PEER_ON_SAMENET | ~TPF_NL_PDN |
| 140 | * 2 --> tp_flags: TPF_PEER_ON_SAMENET | ~TPF_NL_PDN |
| 141 | * 3 --> tp_flags: TPF_PEER_ON_SAMENET | TPF_NL_PDN |
| 142 | */ |
| 143 | struct timeval ts_rtt[NRTT_CATEGORIES]; |
| 144 | struct timeval ts_rtv[NRTT_CATEGORIES]; |
| 145 | |
| 146 | u_long ts_ackreason[_ACK_NUM_REASONS_]; |
| 147 | /* ACK_DONT 0 / ACK_STRAT_EACH 0x1 / ACK_STRAT_FULLWIN 0x4 |
| 148 | * ACK_DUP 0x8 / ACK_EOT 0x10 / ACK_REORDER 0x20 |
| 149 | * ACK_USRRCV ** |
| 150 | * ACK_FCC ** |
| 151 | */ |
| 152 | } tp_stat ; |
| 153 | |
| 154 | #define IncStat(x) tp_stat./**/x/**/++ |
| 155 | |
| 156 | #ifdef TP_PERF_MEAS |
| 157 | |
| 158 | #define PStat(Tpcb, X) (Tpcb)->tp_p_meas->/**/X/**/ |
| 159 | #define IncPStat(Tpcb, X) if((Tpcb)->tp_perf_on) (Tpcb)->tp_p_meas->/**/X/**/++ |
| 160 | |
| 161 | /* BEWARE OF MACROS like this ^^^ must be sure it's surrounded by {} if |
| 162 | * it's used in an if-else statement. |
| 163 | */ |
| 164 | |
| 165 | |
| 166 | /* for perf measurement stuff: maximum window size it can handle */ |
| 167 | #define TP_PM_MAX 0xa /* 10 decimal */ |
| 168 | |
| 169 | struct tp_pmeas { |
| 170 | /* the first few are distributions as a fn of window size |
| 171 | * only keep enough space for normal format plus 1 slot for |
| 172 | * extended format, in case any windows larger than 15 are used |
| 173 | */ |
| 174 | |
| 175 | /* |
| 176 | * tps_npdusent: for each call to tp_sbsend, we inc the |
| 177 | * element representing the number of pdus sent in this call |
| 178 | */ |
| 179 | int tps_win_lim_by_cdt[TP_PM_MAX+1]; |
| 180 | int tps_win_lim_by_data[TP_PM_MAX+1]; |
| 181 | /* |
| 182 | * tps_sendtime: Each call to tp_sbsend() is timed. For |
| 183 | * Each window size, we keep the running average of the time |
| 184 | * taken by tp_sbsend() for each window size. |
| 185 | */ |
| 186 | struct timeval tps_sendtime[TP_PM_MAX+1]; |
| 187 | /* |
| 188 | * n_TMsendack: # times ack sent because timer went off |
| 189 | * n_ack_cuz_eot: # times ack sent due to EOTSDU on incoming packet |
| 190 | * n_ack_cuz_dup: # times ack sent for receiving a duplicate pkt. |
| 191 | * n_ack_cuz_fullwin: # times ack sent for receiving the full window. |
| 192 | * n_ack_cuz_doack: # times ack sent for having just reordered data. |
| 193 | */ |
| 194 | int tps_n_TMsendack; |
| 195 | int tps_n_ack_cuz_eot; |
| 196 | int tps_n_ack_cuz_fullwin; |
| 197 | int tps_n_ack_cuz_reorder; |
| 198 | int tps_n_ack_cuz_dup; |
| 199 | int tps_n_ack_cuz_strat; |
| 200 | /* |
| 201 | * when we send an ack: how much less than the "expected" window |
| 202 | * did we actually ack. For example: if we last sent a credit |
| 203 | * of 10, and we're acking now for whatever reason, and have |
| 204 | * only received 6 since our last credit advertisement, we'll |
| 205 | * keep the difference, 4, in this variable. |
| 206 | */ |
| 207 | int tps_ack_early[TP_PM_MAX+1]; |
| 208 | /* |
| 209 | * when we ack, for the # pkts we actually acked w/ this ack, |
| 210 | * how much cdt are we advertising? |
| 211 | * [ size of window acknowledged ] [ cdt we're giving ] |
| 212 | */ |
| 213 | int tps_cdt_acked[TP_PM_MAX+1][TP_PM_MAX+1]; |
| 214 | |
| 215 | int tps_AK_sent; |
| 216 | int tps_XAK_sent; |
| 217 | int tps_DT_sent; |
| 218 | int tps_XPD_sent; |
| 219 | int tps_AK_rcvd; |
| 220 | int tps_XAK_rcvd; |
| 221 | int tps_DT_rcvd; |
| 222 | int tps_XPD_rcvd; |
| 223 | |
| 224 | int Nb_from_sess; |
| 225 | int Nb_to_sess; |
| 226 | int Nb_to_ll; |
| 227 | int Nb_from_ll; |
| 228 | }; |
| 229 | |
| 230 | #define IFPERF(tpcb) if (tpcb->tp_perf_on &&\ |
| 231 | (tpcb->tp_p_meas != (struct tp_pmeas *)0 )) { |
| 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__ |