blob: b4497a3b8d8739a7e9fcef2c44427d10ab4452f1 [file] [log] [blame]
Florin Corase69f4952017-03-07 10:06:24 -08001/*
2 * Copyright (c) 2017 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef SRC_VNET_TCP_TCP_DEBUG_H_
17#define SRC_VNET_TCP_TCP_DEBUG_H_
18
19#include <vlib/vlib.h>
20
21#define TCP_DEBUG (1)
Florin Coras6792ec02017-03-13 03:49:51 -070022#define TCP_DEBUG_CC (1)
23#define TCP_DEBUG_VERBOSE (0)
Florin Corase69f4952017-03-07 10:06:24 -080024
25#define foreach_tcp_dbg_evt \
26 _(INIT, "") \
27 _(DEALLOC, "") \
28 _(OPEN, "open") \
29 _(CLOSE, "close") \
30 _(BIND, "bind") \
31 _(UNBIND, "unbind") \
32 _(DELETE, "delete") \
33 _(SYN_SENT, "SYN sent") \
Florin Coras3e350af2017-03-30 02:54:28 -070034 _(SYN_RTX, "SYN retransmit") \
Florin Corase69f4952017-03-07 10:06:24 -080035 _(FIN_SENT, "FIN sent") \
Florin Coras6792ec02017-03-13 03:49:51 -070036 _(ACK_SENT, "ACK sent") \
37 _(DUPACK_SENT, "DUPACK sent") \
Florin Corase69f4952017-03-07 10:06:24 -080038 _(RST_SENT, "RST sent") \
39 _(SYN_RCVD, "SYN rcvd") \
40 _(ACK_RCVD, "ACK rcvd") \
Florin Coras6792ec02017-03-13 03:49:51 -070041 _(DUPACK_RCVD, "DUPACK rcvd") \
Florin Corase69f4952017-03-07 10:06:24 -080042 _(FIN_RCVD, "FIN rcvd") \
43 _(RST_RCVD, "RST rcvd") \
44 _(PKTIZE, "packetize") \
45 _(INPUT, "in") \
Florin Coras6792ec02017-03-13 03:49:51 -070046 _(SND_WND, "snd_wnd update") \
47 _(OUTPUT, "output") \
48 _(TIMER_POP, "timer pop") \
49 _(CC_RTX, "retransmit") \
50 _(CC_EVT, "cc event") \
51 _(CC_PACK, "cc partial ack") \
52 _(SEG_INVALID, "invalid segment") \
Florin Corasc28764f2017-04-26 00:08:42 -070053 _(PAWS_FAIL, "failed paws check") \
Florin Coras6792ec02017-03-13 03:49:51 -070054 _(ACK_RCV_ERR, "invalid ack") \
Florin Coras3e350af2017-03-30 02:54:28 -070055 _(RCV_WND_SHRUNK, "shrunk rcv_wnd") \
Florin Corase69f4952017-03-07 10:06:24 -080056
57typedef enum _tcp_dbg
58{
59#define _(sym, str) TCP_DBG_##sym,
60 foreach_tcp_dbg_evt
61#undef _
62} tcp_dbg_e;
63
64typedef enum _tcp_dbg_evt
65{
66#define _(sym, str) TCP_EVT_##sym,
67 foreach_tcp_dbg_evt
68#undef _
69} tcp_dbg_evt_e;
70
71#if TCP_DEBUG
72
73#define TRANSPORT_DEBUG (1)
74
75#define TCP_DBG(_tc, _evt, _args...) \
76{ \
77 u8 *_tmp = 0; \
78 _tmp = format(_tmp, "%U", format_tcp_connection_verbose, _tc); \
79 clib_warning("%s", _tmp); \
80 vec_free(_tmp); \
81}
82
83#define DECLARE_ETD(_tc, _e, _size) \
84 struct \
85 { \
86 u32 data[_size]; \
87 } * ed; \
88 ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, \
89 _e, _tc->c_elog_track)
90
Florin Coras6792ec02017-03-13 03:49:51 -070091#define TCP_EVT_INIT_HANDLER(_tc, _fmt, ...) \
Florin Corase69f4952017-03-07 10:06:24 -080092{ \
93 _tc->c_elog_track.name = \
Florin Coras6792ec02017-03-13 03:49:51 -070094 (char *) format (0, _fmt, _tc->c_c_index, 0); \
Florin Corase69f4952017-03-07 10:06:24 -080095 elog_track_register (&vlib_global_main.elog_main, &_tc->c_elog_track);\
96}
97
98#define TCP_EVT_DEALLOC_HANDLER(_tc, ...) \
99{ \
100 vec_free (_tc->c_elog_track.name); \
101}
102
103#define TCP_EVT_OPEN_HANDLER(_tc, ...) \
104{ \
Florin Coras6792ec02017-03-13 03:49:51 -0700105 TCP_EVT_INIT_HANDLER(_tc, "s%d%c"); \
Florin Corase69f4952017-03-07 10:06:24 -0800106 ELOG_TYPE_DECLARE (_e) = \
107 { \
108 .format = "open: index %d", \
109 .format_args = "i4", \
110 }; \
111 DECLARE_ETD(_tc, _e, 1); \
112 ed->data[0] = _tc->c_c_index; \
113}
114
115#define TCP_EVT_CLOSE_HANDLER(_tc, ...) \
116{ \
117 ELOG_TYPE_DECLARE (_e) = \
118 { \
119 .format = "close: %d", \
120 .format_args = "i4", \
121 }; \
122 DECLARE_ETD(_tc, _e, 1); \
123 ed->data[0] = _tc->c_c_index; \
124}
125
126#define TCP_EVT_BIND_HANDLER(_tc, ...) \
127{ \
Florin Coras6792ec02017-03-13 03:49:51 -0700128 TCP_EVT_INIT_HANDLER(_tc, "l%d%c"); \
Florin Corase69f4952017-03-07 10:06:24 -0800129 ELOG_TYPE_DECLARE (_e) = \
130 { \
131 .format = "bind: listener %d", \
132 }; \
133 DECLARE_ETD(_tc, _e, 1); \
134 ed->data[0] = _tc->c_c_index; \
135}
136
137#define TCP_EVT_UNBIND_HANDLER(_tc, ...) \
138{ \
139 TCP_EVT_DEALLOC_HANDLER(_tc); \
140 ELOG_TYPE_DECLARE (_e) = \
141 { \
142 .format = "unbind: listener %d", \
143 }; \
144 DECLARE_ETD(_tc, _e, 1); \
145 ed->data[0] = _tc->c_c_index; \
146 TCP_EVT_DEALLOC_HANDLER(_tc); \
147}
148
149#define TCP_EVT_DELETE_HANDLER(_tc, ...) \
150{ \
151 ELOG_TYPE_DECLARE (_e) = \
152 { \
153 .format = "delete: %d", \
154 .format_args = "i4", \
155 }; \
Florin Coras6792ec02017-03-13 03:49:51 -0700156 DECLARE_ETD(_tc, _e, 1); \
Florin Corase69f4952017-03-07 10:06:24 -0800157 ed->data[0] = _tc->c_c_index; \
158 TCP_EVT_DEALLOC_HANDLER(_tc); \
159}
160
Florin Coras6792ec02017-03-13 03:49:51 -0700161#define TCP_EVT_ACK_SENT_HANDLER(_tc, ...) \
162{ \
163 ELOG_TYPE_DECLARE (_e) = \
164 { \
Florin Coras3e350af2017-03-30 02:54:28 -0700165 .format = "ack_tx: acked %u rcv_nxt %u rcv_wnd %u snd_nxt %u snd_wnd %u",\
166 .format_args = "i4i4i4i4i4", \
Florin Coras6792ec02017-03-13 03:49:51 -0700167 }; \
Florin Coras3e350af2017-03-30 02:54:28 -0700168 DECLARE_ETD(_tc, _e, 5); \
Florin Coras6792ec02017-03-13 03:49:51 -0700169 ed->data[0] = _tc->rcv_nxt - _tc->rcv_las; \
170 ed->data[1] = _tc->rcv_nxt - _tc->irs; \
171 ed->data[2] = _tc->rcv_wnd; \
172 ed->data[3] = _tc->snd_nxt - _tc->iss; \
Florin Coras3e350af2017-03-30 02:54:28 -0700173 ed->data[4] = _tc->snd_wnd; \
Florin Coras6792ec02017-03-13 03:49:51 -0700174}
175
176#define TCP_EVT_DUPACK_SENT_HANDLER(_tc, ...) \
177{ \
178 ELOG_TYPE_DECLARE (_e) = \
179 { \
Florin Coras3e350af2017-03-30 02:54:28 -0700180 .format = "dack_tx: rcv_nxt %u rcv_wnd %u snd_nxt %u av_wnd %u snd_wnd %u",\
181 .format_args = "i4i4i4i4i4", \
Florin Coras6792ec02017-03-13 03:49:51 -0700182 }; \
Florin Coras3e350af2017-03-30 02:54:28 -0700183 DECLARE_ETD(_tc, _e, 5); \
Florin Coras6792ec02017-03-13 03:49:51 -0700184 ed->data[0] = _tc->rcv_nxt - _tc->irs; \
185 ed->data[1] = _tc->rcv_wnd; \
186 ed->data[2] = _tc->snd_nxt - _tc->iss; \
187 ed->data[3] = tcp_available_wnd(_tc); \
Florin Coras3e350af2017-03-30 02:54:28 -0700188 ed->data[4] = _tc->snd_wnd; \
Florin Coras6792ec02017-03-13 03:49:51 -0700189}
190
Florin Corase69f4952017-03-07 10:06:24 -0800191#define TCP_EVT_SYN_SENT_HANDLER(_tc, ...) \
192{ \
193 ELOG_TYPE_DECLARE (_e) = \
194 { \
Florin Coras3e350af2017-03-30 02:54:28 -0700195 .format = "SYNtx: iss %u", \
196 .format_args = "i4", \
197 }; \
198 DECLARE_ETD(_tc, _e, 1); \
199 ed->data[0] = _tc->iss; \
200}
201
202#define TCP_EVT_SYN_RTX_HANDLER(_tc, ...) \
203{ \
204 ELOG_TYPE_DECLARE (_e) = \
205 { \
206 .format = "SYNrtx: iss %u", \
Florin Corase69f4952017-03-07 10:06:24 -0800207 .format_args = "i4", \
208 }; \
209 DECLARE_ETD(_tc, _e, 1); \
210 ed->data[0] = _tc->iss; \
211}
212
213#define TCP_EVT_FIN_SENT_HANDLER(_tc, ...) \
214{ \
215 ELOG_TYPE_DECLARE (_e) = \
216 { \
Florin Coras6792ec02017-03-13 03:49:51 -0700217 .format = "FINtx: snd_nxt %d rcv_nxt %d", \
Florin Corase69f4952017-03-07 10:06:24 -0800218 .format_args = "i4i4", \
219 }; \
220 DECLARE_ETD(_tc, _e, 2); \
221 ed->data[0] = _tc->snd_nxt - _tc->iss; \
222 ed->data[1] = _tc->rcv_nxt - _tc->irs; \
223}
224
225#define TCP_EVT_RST_SENT_HANDLER(_tc, ...) \
226{ \
227 ELOG_TYPE_DECLARE (_e) = \
228 { \
Florin Coras6792ec02017-03-13 03:49:51 -0700229 .format = "RSTtx: snd_nxt %d rcv_nxt %d", \
Florin Corase69f4952017-03-07 10:06:24 -0800230 .format_args = "i4i4", \
231 }; \
232 DECLARE_ETD(_tc, _e, 2); \
233 ed->data[0] = _tc->snd_nxt - _tc->iss; \
234 ed->data[1] = _tc->rcv_nxt - _tc->irs; \
235}
236
237#define TCP_EVT_SYN_RCVD_HANDLER(_tc, ...) \
238{ \
Florin Coras6792ec02017-03-13 03:49:51 -0700239 TCP_EVT_INIT_HANDLER(_tc, "s%d%c"); \
Florin Corase69f4952017-03-07 10:06:24 -0800240 ELOG_TYPE_DECLARE (_e) = \
241 { \
Florin Coras6792ec02017-03-13 03:49:51 -0700242 .format = "SYNrx: irs %u", \
Florin Corase69f4952017-03-07 10:06:24 -0800243 .format_args = "i4", \
244 }; \
245 DECLARE_ETD(_tc, _e, 1); \
246 ed->data[0] = _tc->irs; \
247}
248
249#define TCP_EVT_FIN_RCVD_HANDLER(_tc, ...) \
250{ \
251 ELOG_TYPE_DECLARE (_e) = \
252 { \
Florin Coras6792ec02017-03-13 03:49:51 -0700253 .format = "FINrx: snd_nxt %d rcv_nxt %d", \
Florin Corase69f4952017-03-07 10:06:24 -0800254 .format_args = "i4i4", \
255 }; \
256 DECLARE_ETD(_tc, _e, 2); \
257 ed->data[0] = _tc->snd_nxt - _tc->iss; \
258 ed->data[1] = _tc->rcv_nxt - _tc->irs; \
259}
260
261#define TCP_EVT_RST_RCVD_HANDLER(_tc, ...) \
262{ \
263 ELOG_TYPE_DECLARE (_e) = \
264 { \
Florin Coras6792ec02017-03-13 03:49:51 -0700265 .format = "RSTrx: snd_nxt %d rcv_nxt %d", \
Florin Corase69f4952017-03-07 10:06:24 -0800266 .format_args = "i4i4", \
267 }; \
268 DECLARE_ETD(_tc, _e, 2); \
269 ed->data[0] = _tc->snd_nxt - _tc->iss; \
270 ed->data[1] = _tc->rcv_nxt - _tc->irs; \
271}
272
Florin Coras3e350af2017-03-30 02:54:28 -0700273#define TCP_EVT_ACK_RCVD_HANDLER(_tc, ...) \
Florin Corase69f4952017-03-07 10:06:24 -0800274{ \
275 ELOG_TYPE_DECLARE (_e) = \
276 { \
Florin Coras3e350af2017-03-30 02:54:28 -0700277 .format = "acked: %u snd_una %u snd_wnd %u cwnd %u inflight %u", \
Florin Coras6792ec02017-03-13 03:49:51 -0700278 .format_args = "i4i4i4i4i4", \
Florin Corase69f4952017-03-07 10:06:24 -0800279 }; \
Florin Coras6792ec02017-03-13 03:49:51 -0700280 DECLARE_ETD(_tc, _e, 5); \
Florin Corase69f4952017-03-07 10:06:24 -0800281 ed->data[0] = _tc->bytes_acked; \
Florin Coras6792ec02017-03-13 03:49:51 -0700282 ed->data[1] = _tc->snd_una - _tc->iss; \
Florin Coras3e350af2017-03-30 02:54:28 -0700283 ed->data[2] = _tc->snd_wnd; \
Florin Coras6792ec02017-03-13 03:49:51 -0700284 ed->data[3] = _tc->cwnd; \
285 ed->data[4] = tcp_flight_size(_tc); \
286}
287
288#define TCP_EVT_DUPACK_RCVD_HANDLER(_tc, ...) \
289{ \
290 ELOG_TYPE_DECLARE (_e) = \
291 { \
Florin Coras3e350af2017-03-30 02:54:28 -0700292 .format = "dack_rx: snd_una %u cwnd %u snd_wnd %u flight %u rcv_wnd %u",\
293 .format_args = "i4i4i4i4i4", \
Florin Coras6792ec02017-03-13 03:49:51 -0700294 }; \
Florin Coras3e350af2017-03-30 02:54:28 -0700295 DECLARE_ETD(_tc, _e, 5); \
Florin Coras6792ec02017-03-13 03:49:51 -0700296 ed->data[0] = _tc->snd_una - _tc->iss; \
Florin Corase69f4952017-03-07 10:06:24 -0800297 ed->data[1] = _tc->cwnd; \
Florin Coras6792ec02017-03-13 03:49:51 -0700298 ed->data[2] = _tc->snd_wnd; \
299 ed->data[3] = tcp_flight_size(_tc); \
Florin Coras3e350af2017-03-30 02:54:28 -0700300 ed->data[4] = _tc->rcv_wnd; \
Florin Corase69f4952017-03-07 10:06:24 -0800301}
302
303#define TCP_EVT_PKTIZE_HANDLER(_tc, ...) \
304{ \
305 ELOG_TYPE_DECLARE (_e) = \
306 { \
Florin Coras6792ec02017-03-13 03:49:51 -0700307 .format = "pktize: una %u snd_nxt %u space %u flight %u rcv_wnd %u",\
308 .format_args = "i4i4i4i4i4", \
Florin Corase69f4952017-03-07 10:06:24 -0800309 }; \
Florin Coras6792ec02017-03-13 03:49:51 -0700310 DECLARE_ETD(_tc, _e, 5); \
Florin Corase69f4952017-03-07 10:06:24 -0800311 ed->data[0] = _tc->snd_una - _tc->iss; \
312 ed->data[1] = _tc->snd_nxt - _tc->iss; \
Florin Coras6792ec02017-03-13 03:49:51 -0700313 ed->data[2] = tcp_available_snd_space (_tc); \
314 ed->data[3] = tcp_flight_size (_tc); \
315 ed->data[4] = _tc->rcv_wnd; \
Florin Corase69f4952017-03-07 10:06:24 -0800316}
317
Florin Coras6792ec02017-03-13 03:49:51 -0700318#define TCP_EVT_INPUT_HANDLER(_tc, _type, _len, _written, ...) \
Florin Corase69f4952017-03-07 10:06:24 -0800319{ \
320 ELOG_TYPE_DECLARE (_e) = \
321 { \
Florin Coras3e350af2017-03-30 02:54:28 -0700322 .format = "in: %s len %u written %d rcv_nxt %u rcv_wnd(o) %d", \
Florin Coras6792ec02017-03-13 03:49:51 -0700323 .format_args = "t4i4i4i4i4", \
324 .n_enum_strings = 2, \
325 .enum_strings = { \
326 "order", \
327 "ooo", \
328 }, \
Florin Corase69f4952017-03-07 10:06:24 -0800329 }; \
Florin Coras6792ec02017-03-13 03:49:51 -0700330 DECLARE_ETD(_tc, _e, 5); \
331 ed->data[0] = _type; \
332 ed->data[1] = _len; \
333 ed->data[2] = _written; \
334 ed->data[3] = (_tc->rcv_nxt - _tc->irs) + _written; \
335 ed->data[4] = _tc->rcv_wnd - (_tc->rcv_nxt - _tc->rcv_las); \
Florin Corase69f4952017-03-07 10:06:24 -0800336}
337
338#define TCP_EVT_TIMER_POP_HANDLER(_tc_index, _timer_id, ...) \
339{ \
340 tcp_connection_t *_tc; \
flyingeagle23e8146b02017-04-26 20:06:52 +0800341 if (_timer_id == TCP_TIMER_RETRANSMIT_SYN \
342 || _timer_id == TCP_TIMER_ESTABLISH) \
Florin Corase69f4952017-03-07 10:06:24 -0800343 { \
344 _tc = tcp_half_open_connection_get (_tc_index); \
345 } \
346 else \
347 { \
Damjan Marion586afd72017-04-05 19:18:20 +0200348 u32 _thread_index = vlib_get_thread_index (); \
Florin Corase69f4952017-03-07 10:06:24 -0800349 _tc = tcp_connection_get (_tc_index, _thread_index); \
350 } \
351 ELOG_TYPE_DECLARE (_e) = \
352 { \
353 .format = "TimerPop: %s (%d)", \
354 .format_args = "t4i4", \
355 .n_enum_strings = 7, \
356 .enum_strings = { \
357 "retransmit", \
358 "delack", \
Florin Coras3e350af2017-03-30 02:54:28 -0700359 "persist", \
Florin Corase69f4952017-03-07 10:06:24 -0800360 "keep", \
361 "waitclose", \
362 "retransmit syn", \
363 "establish", \
364 }, \
365 }; \
366 DECLARE_ETD(_tc, _e, 2); \
367 ed->data[0] = _timer_id; \
368 ed->data[1] = _timer_id; \
369}
370
Florin Coras6792ec02017-03-13 03:49:51 -0700371#define TCP_EVT_SEG_INVALID_HANDLER(_tc, _seq, _end, ...) \
372{ \
373 ELOG_TYPE_DECLARE (_e) = \
374 { \
Florin Coras3e350af2017-03-30 02:54:28 -0700375 .format = "seg-inv: seq %u end %u rcv_las %u rcv_nxt %u rcv_wnd %u",\
Florin Coras6792ec02017-03-13 03:49:51 -0700376 .format_args = "i4i4i4i4i4", \
377 }; \
378 DECLARE_ETD(_tc, _e, 5); \
379 ed->data[0] = _seq - _tc->irs; \
380 ed->data[1] = _end - _tc->irs; \
381 ed->data[2] = _tc->rcv_las - _tc->irs; \
382 ed->data[3] = _tc->rcv_nxt - _tc->irs; \
383 ed->data[4] = _tc->rcv_wnd; \
384}
385
Florin Corasc28764f2017-04-26 00:08:42 -0700386#define TCP_EVT_PAWS_FAIL_HANDLER(_tc, _seq, _end, ...) \
387{ \
388 ELOG_TYPE_DECLARE (_e) = \
389 { \
390 .format = "paws fail: seq %u end %u tsval %u tsval_recent %u", \
391 .format_args = "i4i4i4i4", \
392 }; \
393 DECLARE_ETD(_tc, _e, 4); \
394 ed->data[0] = _seq - _tc->irs; \
395 ed->data[1] = _end - _tc->irs; \
396 ed->data[2] = _tc->opt.tsval; \
397 ed->data[3] = _tc->tsval_recent; \
398}
399
Florin Coras6792ec02017-03-13 03:49:51 -0700400#define TCP_EVT_ACK_RCV_ERR_HANDLER(_tc, _type, _ack, ...) \
401{ \
402 ELOG_TYPE_DECLARE (_e) = \
403 { \
404 .format = "ack-err: %s ack %u snd_una %u snd_nxt %u una_max %u", \
405 .format_args = "t4i4i4i4i4", \
406 .n_enum_strings = 3, \
407 .enum_strings = { \
408 "invalid", \
409 "old", \
410 "future", \
411 }, \
412 }; \
413 DECLARE_ETD(_tc, _e, 5); \
414 ed->data[0] = _type; \
415 ed->data[1] = _ack - _tc->iss; \
416 ed->data[2] = _tc->snd_una - _tc->iss; \
417 ed->data[3] = _tc->snd_nxt - _tc->iss; \
418 ed->data[4] = _tc->snd_una_max - _tc->iss; \
419}
420
421/*
422 * Congestion Control
423 */
424
425#if TCP_DEBUG_CC
426#define TCP_EVT_CC_RTX_HANDLER(_tc, offset, n_bytes, ...) \
427{ \
428 ELOG_TYPE_DECLARE (_e) = \
429 { \
430 .format = "rtx: snd_nxt %u offset %u snd %u rtx %u", \
431 .format_args = "i4i4i4i4", \
432 }; \
433 DECLARE_ETD(_tc, _e, 4); \
434 ed->data[0] = _tc->snd_nxt - _tc->iss; \
435 ed->data[1] = offset; \
436 ed->data[2] = n_bytes; \
437 ed->data[3] = _tc->rtx_bytes; \
438}
439
440#define TCP_EVT_CC_EVT_HANDLER(_tc, _sub_evt, ...) \
441{ \
442 ELOG_TYPE_DECLARE (_e) = \
443 { \
444 .format = "cc: %s wnd %u snd_cong %u rtx_bytes %u", \
445 .format_args = "t4i4i4i4", \
446 .n_enum_strings = 5, \
447 .enum_strings = { \
448 "fast-rtx", \
449 "rtx-timeout", \
450 "first-rtx", \
451 "recovered", \
452 "congestion", \
453 }, \
454 }; \
455 DECLARE_ETD(_tc, _e, 4); \
456 ed->data[0] = _sub_evt; \
457 ed->data[1] = tcp_available_snd_space (_tc); \
458 ed->data[2] = _tc->snd_congestion - _tc->iss; \
459 ed->data[3] = _tc->rtx_bytes; \
460}
461
462#define TCP_EVT_CC_PACK_HANDLER(_tc, ...) \
463{ \
464 ELOG_TYPE_DECLARE (_e) = \
465 { \
466 .format = "pack: snd_una %u snd_una_max %u", \
467 .format_args = "i4i4", \
468 }; \
469 DECLARE_ETD(_tc, _e, 2); \
470 ed->data[0] = _tc->snd_una - _tc->iss; \
471 ed->data[1] = _tc->snd_una_max - _tc->iss; \
472}
473
474#else
475#define TCP_EVT_CC_RTX_HANDLER(_tc, offset, n_bytes, ...)
476#define TCP_EVT_CC_EVT_HANDLER(_tc, _sub_evt, _snd_space, ...)
477#define TCP_EVT_CC_PACK_HANDLER(_tc, ...)
478#endif
479
Florin Coras3e350af2017-03-30 02:54:28 -0700480#define TCP_EVT_RCV_WND_SHRUNK_HANDLER(_tc, _obs, _av, ...) \
481{ \
482if (_av > 0) \
483{ \
484 ELOG_TYPE_DECLARE (_e) = \
485 { \
486 .format = "huh?: rcv_wnd %u obsd %u av %u rcv_nxt %u rcv_las %u", \
487 .format_args = "i4i4i4i4i4", \
488 }; \
489 DECLARE_ETD(_tc, _e, 5); \
490 ed->data[0] = _tc->rcv_wnd; \
491 ed->data[1] = _obs; \
492 ed->data[2] = _av; \
493 ed->data[3] = _tc->rcv_nxt - _tc->irs; \
494 ed->data[4] = _tc->rcv_las - _tc->irs; \
495} \
496}
497
Florin Coras6792ec02017-03-13 03:49:51 -0700498#if TCP_DBG_VERBOSE
499#define TCP_EVT_SND_WND_HANDLER(_tc, ...) \
500{ \
501 ELOG_TYPE_DECLARE (_e) = \
502 { \
503 .format = "snd_wnd update: %u ", \
504 .format_args = "i4", \
505 }; \
506 DECLARE_ETD(_tc, _e, 1); \
507 ed->data[0] = _tc->snd_wnd; \
508}
509
510#define TCP_EVT_OUTPUT_HANDLER(_tc, flags, n_bytes,...) \
511{ \
512 ELOG_TYPE_DECLARE (_e) = \
513 { \
514 .format = "out: flags %x, bytes %u", \
515 .format_args = "i4i4", \
516 }; \
517 DECLARE_ETD(_tc, _e, 2); \
518 ed->data[0] = flags; \
519 ed->data[1] = n_bytes; \
520}
521#else
522#define TCP_EVT_SND_WND_HANDLER(_tc, ...)
523#define TCP_EVT_OUTPUT_HANDLER(_tc, flags, n_bytes,...)
524#endif
525
Florin Corase69f4952017-03-07 10:06:24 -0800526#define CONCAT_HELPER(_a, _b) _a##_b
527#define CC(_a, _b) CONCAT_HELPER(_a, _b)
Florin Corase69f4952017-03-07 10:06:24 -0800528#define TCP_EVT_DBG(_evt, _args...) CC(_evt, _HANDLER)(_args)
529
530#else
531#define TCP_EVT_DBG(_evt, _args...)
532#endif
533
534
535#endif /* SRC_VNET_TCP_TCP_DEBUG_H_ */
536/*
537 * fd.io coding-style-patch-verification: ON
538 *
539 * Local Variables:
540 * eval: (c-set-style "gnu")
541 * End:
542 */