30#ifndef __tcp_log_buf_h__
31#define __tcp_log_buf_h__
33#define TCP_LOG_REASON_LEN 32
34#define TCP_LOG_TAG_LEN 32
35#define TCP_LOG_BUF_VER (9)
44#define ALIGN_TCP_LOG __aligned(8)
57#define TCP_FUNC_LEN 32
120#define TLB_FLAG_RXBUF 0x0001
121#define TLB_FLAG_TXBUF 0x0002
122#define TLB_FLAG_HDR 0x0004
123#define TLB_FLAG_VERBOSE 0x0008
124#define TLB_FLAG_STACKINFO 0x0010
162#define tlb_rack tlb_stackinfo.u_rack
257#define ERRNO_UNK (-1)
267#ifdef __tcp_log_dev_h__
268struct tcp_log_header {
269 struct tcp_log_common_header tlh_common;
270#define tlh_version tlh_common.tlch_version
271#define tlh_type tlh_common.tlch_type
272#define tlh_length tlh_common.tlch_length
274 struct timeval tlh_offset;
275 char tlh_id[TCP_LOG_ID_LEN];
283struct tcp_log_dev_log_queue {
284 struct tcp_log_dev_queue tldl_common;
285 char tldl_id[TCP_LOG_ID_LEN];
289 struct tcp_log_stailq tldl_entries;
298#define TCP_LOG_BUF_DEFAULT_SESSION_LIMIT 5000
299#define TCP_LOG_BUF_DEFAULT_GLOBAL_LIMIT 5000000
305#define TCP_LOG_EVENT_VERBOSE(tp, th, rxbuf, txbuf, eventid, errornum, len, stackinfo, th_hostorder, tv) \
307 if (tp->t_logstate != TCP_LOG_STATE_OFF) \
308 tcp_log_event_(tp, th, rxbuf, txbuf, eventid, \
309 errornum, len, stackinfo, th_hostorder, \
310 tp->t_output_caller, __func__, __LINE__, tv);\
331#ifdef TCP_LOG_FORCEVERBOSE
332#define TCP_LOG_EVENT TCP_LOG_EVENT_VERBOSE
334#define TCP_LOG_EVENT(tp, th, rxbuf, txbuf, eventid, errornum, len, stackinfo, th_hostorder) \
336 if (tcp_log_verbose) \
337 TCP_LOG_EVENT_VERBOSE(tp, th, rxbuf, txbuf, \
338 eventid, errornum, len, stackinfo, \
339 th_hostorder, NULL); \
340 else if (tp->t_logstate != TCP_LOG_STATE_OFF) \
341 tcp_log_event_(tp, th, rxbuf, txbuf, eventid, \
342 errornum, len, stackinfo, th_hostorder, \
343 NULL, NULL, 0, NULL); \
346#define TCP_LOG_EVENTP(tp, th, rxbuf, txbuf, eventid, errornum, len, stackinfo, th_hostorder, tv) \
348 if (tp->t_logstate != TCP_LOG_STATE_OFF) \
349 tcp_log_event_(tp, th, rxbuf, txbuf, eventid, \
350 errornum, len, stackinfo, th_hostorder, \
351 NULL, NULL, 0, tv); \
362 const char *output_caller,
const char *func,
int line,
const struct timeval *tv);
375#define tcp_log_verbose (false)
381 const char *output_caller,
const char *func,
int line,
382 const struct timeval *tv)
uint8_t tlb_opts[TCP_MAXOLEN]
uint32_t tlb_snd_ssthresh
struct tcp_log_sockbuf tlb_rxbuf
struct tcp_log_sockbuf tlb_txbuf
union tcp_log_stackspecific tlb_stackinfo
struct tcp_log_verbose tlb_verbose[0]
char tlv_trace_func[TCP_FUNC_LEN]
char tlv_snd_frm[TCP_FUNC_LEN]
int tcp_log_getlogbuf(struct sockopt *sopt, struct tcpcb *tp)
void tcp_log_drain(struct tcpcb *tp)
void tcp_log_tcpcbinit(struct tcpcb *tp)
u_int tcp_log_get_id_cnt(struct tcpcb *tp)
void tcp_log_flowend(struct tcpcb *tp)
int tcp_log_set_tag(struct tcpcb *tp, char *tag)
void tcp_log_tcpcbfini(struct tcpcb *tp)
size_t tcp_log_get_tag(struct tcpcb *tp, char *buf)
int tcp_log_set_id(struct tcpcb *tp, char *id)
int tcp_log_state_change(struct tcpcb *tp, int state)
int tcp_log_dump_tp_logbuf(struct tcpcb *tp, char *reason, int how, bool force)
void tcp_log_dump_tp_bucket_logbufs(struct tcpcb *tp, char *reason)
size_t tcp_log_get_id(struct tcpcb *tp, char *buf)
@ TCP_LOG_STATE_CONTINUAL
@ TCP_LOG_STATE_TAIL_AUTO
@ TCP_LOG_STATE_HEAD_AUTO
#define TCP_LOG_REASON_LEN
@ BBR_LOG_SRTT_GAIN_EVENT
static struct tcp_log_buffer * tcp_log_event_(struct tcpcb *tp, struct tcphdr *th, struct sockbuf *rxbuf, struct sockbuf *txbuf, uint8_t eventid, int errornum, uint32_t len, union tcp_log_stackspecific *stackinfo, int th_hostorder, const char *output_caller, const char *func, int line, const struct timeval *tv)
struct tcp_log_rack u_rack