16 #ifndef SRC_VNET_TCP_TCP_DEBUG_H_ 17 #define SRC_VNET_TCP_TCP_DEBUG_H_ 23 #define foreach_tcp_dbg_evt \ 31 _(SYN_SENT, "SYN sent") \ 32 _(FIN_SENT, "FIN sent") \ 33 _(RST_SENT, "RST sent") \ 34 _(SYN_RCVD, "SYN rcvd") \ 35 _(ACK_RCVD, "ACK rcvd") \ 36 _(FIN_RCVD, "FIN rcvd") \ 37 _(RST_RCVD, "RST rcvd") \ 38 _(PKTIZE, "packetize") \ 40 _(TIMER_POP, "timer pop") 44 #define _(sym, str) TCP_DBG_##sym, 49 typedef enum _tcp_dbg_evt
51 #define _(sym, str) TCP_EVT_##sym, 58 #define TRANSPORT_DEBUG (1) 60 #define TCP_DBG(_tc, _evt, _args...) \ 63 _tmp = format(_tmp, "%U", format_tcp_connection_verbose, _tc); \ 64 clib_warning("%s", _tmp); \ 68 #define DECLARE_ETD(_tc, _e, _size) \ 73 ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, \ 74 _e, _tc->c_elog_track) 76 #define TCP_EVT_INIT_HANDLER(_tc, ...) \ 78 _tc->c_elog_track.name = \ 79 (char *) format (0, "%d%c", _tc->c_c_index, 0); \ 80 elog_track_register (&vlib_global_main.elog_main, &_tc->c_elog_track);\ 83 #define TCP_EVT_DEALLOC_HANDLER(_tc, ...) \ 85 vec_free (_tc->c_elog_track.name); \ 88 #define TCP_EVT_OPEN_HANDLER(_tc, ...) \ 90 TCP_EVT_INIT_HANDLER(_tc); \ 91 ELOG_TYPE_DECLARE (_e) = \ 93 .format = "open: index %d", \ 94 .format_args = "i4", \ 96 DECLARE_ETD(_tc, _e, 1); \ 97 ed->data[0] = _tc->c_c_index; \ 100 #define TCP_EVT_CLOSE_HANDLER(_tc, ...) \ 102 ELOG_TYPE_DECLARE (_e) = \ 104 .format = "close: %d", \ 105 .format_args = "i4", \ 107 DECLARE_ETD(_tc, _e, 1); \ 108 ed->data[0] = _tc->c_c_index; \ 111 #define TCP_EVT_BIND_HANDLER(_tc, ...) \ 113 TCP_EVT_INIT_HANDLER(_tc); \ 114 ELOG_TYPE_DECLARE (_e) = \ 116 .format = "bind: listener %d", \ 118 DECLARE_ETD(_tc, _e, 1); \ 119 ed->data[0] = _tc->c_c_index; \ 122 #define TCP_EVT_UNBIND_HANDLER(_tc, ...) \ 124 TCP_EVT_DEALLOC_HANDLER(_tc); \ 125 ELOG_TYPE_DECLARE (_e) = \ 127 .format = "unbind: listener %d", \ 129 DECLARE_ETD(_tc, _e, 1); \ 130 ed->data[0] = _tc->c_c_index; \ 131 TCP_EVT_DEALLOC_HANDLER(_tc); \ 134 #define TCP_EVT_DELETE_HANDLER(_tc, ...) \ 136 ELOG_TYPE_DECLARE (_e) = \ 138 .format = "delete: %d", \ 139 .format_args = "i4", \ 141 DECLARE_ETD(_tc, _e, 0); \ 142 ed->data[0] = _tc->c_c_index; \ 143 TCP_EVT_DEALLOC_HANDLER(_tc); \ 146 #define TCP_EVT_SYN_SENT_HANDLER(_tc, ...) \ 148 ELOG_TYPE_DECLARE (_e) = \ 150 .format = "SYN: iss %d", \ 151 .format_args = "i4", \ 153 DECLARE_ETD(_tc, _e, 1); \ 154 ed->data[0] = _tc->iss; \ 157 #define TCP_EVT_FIN_SENT_HANDLER(_tc, ...) \ 159 ELOG_TYPE_DECLARE (_e) = \ 161 .format = "FIN: snd_nxt %d rcv_nxt %d", \ 162 .format_args = "i4i4", \ 164 DECLARE_ETD(_tc, _e, 2); \ 165 ed->data[0] = _tc->snd_nxt - _tc->iss; \ 166 ed->data[1] = _tc->rcv_nxt - _tc->irs; \ 169 #define TCP_EVT_RST_SENT_HANDLER(_tc, ...) \ 171 ELOG_TYPE_DECLARE (_e) = \ 173 .format = "RST: snd_nxt %d rcv_nxt %d", \ 174 .format_args = "i4i4", \ 176 DECLARE_ETD(_tc, _e, 2); \ 177 ed->data[0] = _tc->snd_nxt - _tc->iss; \ 178 ed->data[1] = _tc->rcv_nxt - _tc->irs; \ 181 #define TCP_EVT_SYN_RCVD_HANDLER(_tc, ...) \ 183 TCP_EVT_INIT_HANDLER(_tc); \ 184 ELOG_TYPE_DECLARE (_e) = \ 186 .format = "SYN rcvd: irs %d", \ 187 .format_args = "i4", \ 189 DECLARE_ETD(_tc, _e, 1); \ 190 ed->data[0] = _tc->irs; \ 193 #define TCP_EVT_FIN_RCVD_HANDLER(_tc, ...) \ 195 ELOG_TYPE_DECLARE (_e) = \ 197 .format = "FIN rcvd: snd_nxt %d rcv_nxt %d", \ 198 .format_args = "i4i4", \ 200 DECLARE_ETD(_tc, _e, 2); \ 201 ed->data[0] = _tc->snd_nxt - _tc->iss; \ 202 ed->data[1] = _tc->rcv_nxt - _tc->irs; \ 205 #define TCP_EVT_RST_RCVD_HANDLER(_tc, ...) \ 207 ELOG_TYPE_DECLARE (_e) = \ 209 .format = "RST rcvd: snd_nxt %d rcv_nxt %d", \ 210 .format_args = "i4i4", \ 212 DECLARE_ETD(_tc, _e, 2); \ 213 ed->data[0] = _tc->snd_nxt - _tc->iss; \ 214 ed->data[1] = _tc->rcv_nxt - _tc->irs; \ 217 #define TCP_EVT_ACK_RCVD_HANDLER(_tc, ...) \ 219 ELOG_TYPE_DECLARE (_e) = \ 221 .format = "ACK: acked %u cwnd %u inflight %u", \ 222 .format_args = "i4i4i4", \ 224 DECLARE_ETD(_tc, _e, 3); \ 225 ed->data[0] = _tc->bytes_acked; \ 226 ed->data[1] = _tc->cwnd; \ 227 ed->data[2] = tcp_flight_size(_tc); \ 230 #define TCP_EVT_PKTIZE_HANDLER(_tc, ...) \ 232 ELOG_TYPE_DECLARE (_e) = \ 234 .format = "pktize: snd_una %u snd_nxt %u una_max %u", \ 235 .format_args = "i4i4i4", \ 237 DECLARE_ETD(_tc, _e, 3); \ 238 ed->data[0] = _tc->snd_una - _tc->iss; \ 239 ed->data[1] = _tc->snd_nxt - _tc->iss; \ 240 ed->data[2] = _tc->snd_una_max - _tc->iss; \ 243 #define TCP_EVT_OUTPUT_HANDLER(_tc, flags, n_bytes,...) \ 245 ELOG_TYPE_DECLARE (_e) = \ 247 .format = "out: flags %x, bytes %u", \ 248 .format_args = "i4i4", \ 250 DECLARE_ETD(_tc, _e, 2); \ 251 ed->data[0] = flags; \ 252 ed->data[1] = n_bytes; \ 255 #define TCP_EVT_INPUT_HANDLER(_tc, n_bytes, ...) \ 257 ELOG_TYPE_DECLARE (_e) = \ 259 .format = "in: bytes %u rcv_nxt %u", \ 260 .format_args = "i4i4", \ 262 DECLARE_ETD(_tc, _e, 2); \ 263 ed->data[0] = n_bytes; \ 264 ed->data[1] = _tc->rcv_nxt - _tc->irs; \ 267 #define TCP_EVT_TIMER_POP_HANDLER(_tc_index, _timer_id, ...) \ 269 tcp_connection_t *_tc; \ 270 if (_timer_id == TCP_TIMER_RETRANSMIT_SYN) \ 272 _tc = tcp_half_open_connection_get (_tc_index); \ 276 u32 _thread_index = os_get_cpu_number (); \ 277 _tc = tcp_connection_get (_tc_index, _thread_index); \ 279 ELOG_TYPE_DECLARE (_e) = \ 281 .format = "TimerPop: %s (%d)", \ 282 .format_args = "t4i4", \ 283 .n_enum_strings = 7, \ 294 DECLARE_ETD(_tc, _e, 2); \ 295 ed->data[0] = _timer_id; \ 296 ed->data[1] = _timer_id; \ 299 #define CONCAT_HELPER(_a, _b) _a##_b 300 #define CC(_a, _b) CONCAT_HELPER(_a, _b) 302 #define TCP_EVT_DBG(_evt, _args...) CC(_evt, _HANDLER)(_args) 305 #define TCP_EVT_DBG(_evt, _args...)
#define foreach_tcp_dbg_evt
enum _tcp_dbg_evt tcp_dbg_evt_e