FreeBSD kernel IPv4 code
tcp_log_buf.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/arb.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/qmath.h>
#include <sys/queue.h>
#include <sys/refcount.h>
#include <sys/rwlock.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/sysctl.h>
#include <sys/tree.h>
#include <sys/stats.h>
#include <sys/counter.h>
#include <dev/tcp_log/tcp_log_dev.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/vnet.h>
#include <netinet/in.h>
#include <netinet/in_pcb.h>
#include <netinet/in_var.h>
#include <netinet/tcp_var.h>
#include <netinet/tcp_log_buf.h>
Include dependency graph for tcp_log_buf.c:

Go to the source code of this file.

Data Structures

struct  tcp_log_id_bucket
 
struct  tcp_log_id_node
 

Macros

#define TCP_LOG_EXPIRE_TIME   ((sbintime_t)60 * SBT_1S)
 
#define TCP_LOG_EXPIRE_INTVL   ((sbintime_t)5 * SBT_1S)
 
#define ACTIVE_REQUEST_COUNT   10
 
#define TCPID_TREE_WLOCK()   rw_wlock(&tcp_id_tree_lock)
 
#define TCPID_TREE_RLOCK()   rw_rlock(&tcp_id_tree_lock)
 
#define TCPID_TREE_UPGRADE()   rw_try_upgrade(&tcp_id_tree_lock)
 
#define TCPID_TREE_WUNLOCK()   rw_wunlock(&tcp_id_tree_lock)
 
#define TCPID_TREE_RUNLOCK()   rw_runlock(&tcp_id_tree_lock)
 
#define TCPID_TREE_WLOCK_ASSERT()   rw_assert(&tcp_id_tree_lock, RA_WLOCKED)
 
#define TCPID_TREE_RLOCK_ASSERT()   rw_assert(&tcp_id_tree_lock, RA_RLOCKED)
 
#define TCPID_TREE_UNLOCK_ASSERT()   rw_assert(&tcp_id_tree_lock, RA_UNLOCKED)
 
#define TCPID_BUCKET_LOCK_INIT(tlb)   mtx_init(&((tlb)->tlb_mtx), "tcp log id bucket", NULL, MTX_DEF)
 
#define TCPID_BUCKET_LOCK_DESTROY(tlb)   mtx_destroy(&((tlb)->tlb_mtx))
 
#define TCPID_BUCKET_LOCK(tlb)   mtx_lock(&((tlb)->tlb_mtx))
 
#define TCPID_BUCKET_UNLOCK(tlb)   mtx_unlock(&((tlb)->tlb_mtx))
 
#define TCPID_BUCKET_LOCK_ASSERT(tlb)   mtx_assert(&((tlb)->tlb_mtx), MA_OWNED)
 
#define TCPID_BUCKET_UNLOCK_ASSERT(tlb)   mtx_assert(&((tlb)->tlb_mtx), MA_NOTOWNED)
 
#define TCPID_BUCKET_REF(tlb)   refcount_acquire(&((tlb)->tlb_refcnt))
 
#define TCPID_BUCKET_UNREF(tlb)   refcount_release(&((tlb)->tlb_refcnt))
 
#define TCPLOG_EXPIREQ_LOCK()   mtx_lock(&tcp_log_expireq_mtx)
 
#define TCPLOG_EXPIREQ_UNLOCK()   mtx_unlock(&tcp_log_expireq_mtx)
 
#define RECHECK_INP_CLEAN(cleanup)
 
#define RECHECK_INP()   RECHECK_INP_CLEAN(/* noop */)
 
#define FREE_NEW_TLB()
 
#define tcp_log_entry_refcnt_add(l)
 
#define tcp_log_entry_refcnt_rem(l)
 
#define COPY_STAT(f)   log_buf->tlb_ ## f = tp->f
 
#define COPY_STAT_T(f)   log_buf->tlb_ ## f = tp->t_ ## f
 
#define LOCAL_SAVE   10
 

Enumerations

enum  tree_lock_state { TREE_UNLOCKED = 0 , TREE_RLOCKED , TREE_WLOCKED }
 

Functions

 __FBSDID ("$FreeBSD$")
 
 RB_HEAD (tcp_log_id_tree, tcp_log_id_bucket)
 
static STAILQ_HEAD (tcp_log_id_node)
 
 SLIST_HEAD (tcp_log_id_head, tcp_log_id_node)
 
static __inline bool tcp_log_selectauto (void)
 
static __inline int tcp_log_id_cmp (struct tcp_log_id_bucket *a, struct tcp_log_id_bucket *b)
 
static __inline void tcp_log_id_validate_tree_lock (int tree_locked)
 
static __inline void tcp_log_remove_bucket (struct tcp_log_id_bucket *tlb)
 
static bool tcp_log_unref_bucket (struct tcp_log_id_bucket *tlb, int *tree_locked, struct inpcb *inp)
 
static bool tcp_log_remove_id_node (struct inpcb *inp, struct tcpcb *tp, struct tcp_log_id_bucket *tlb, struct tcp_log_id_node *tln, int *tree_locked)
 
static void tcp_log_grow_tlb (char *tlb_id, struct tcpcb *tp)
 
static void tcp_log_increment_reqcnt (struct tcp_log_id_bucket *tlb)
 
int tcp_log_set_tag (struct tcpcb *tp, char *tag)
 
int tcp_log_set_id (struct tcpcb *tp, char *id)
 
size_t tcp_log_get_id (struct tcpcb *tp, char *buf)
 
size_t tcp_log_get_tag (struct tcpcb *tp, char *buf)
 
u_int tcp_log_get_id_cnt (struct tcpcb *tp)
 
static void tcp_log_free_log_common (struct tcp_log_mem *log_entry, int *count __unused)
 
static void tcp_log_free_entries (struct tcp_log_stailq *head, int *count)
 
static void tcp_log_remove_log_cleanup (struct tcpcb *tp, struct tcp_log_mem *log_entry)
 
static void tcp_log_remove_log_head (struct tcpcb *tp, struct tcp_log_mem *log_entry)
 
void tcp_log_init (void)
 
void tcp_log_tcpcbinit (struct tcpcb *tp)
 
static void tcp_log_expire (void *unused __unused)
 
static void tcp_log_move_tp_to_node (struct tcpcb *tp, struct tcp_log_id_node *tln)
 
void tcp_log_tcpcbfini (struct tcpcb *tp)
 
static void tcp_log_purge_tp_logbuf (struct tcpcb *tp)
 
struct tcp_log_buffertcp_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 *itv)
 
int tcp_log_state_change (struct tcpcb *tp, int state)
 
void tcp_log_drain (struct tcpcb *tp)
 
static int tcp_log_copyout (struct sockopt *sopt, void *src, void *dst, size_t len)
 
static int tcp_log_logs_to_buf (struct sockopt *sopt, struct tcp_log_stailq *log_tailqp, struct tcp_log_buffer **end, int count)
 
int tcp_log_getlogbuf (struct sockopt *sopt, struct tcpcb *tp)
 
static void tcp_log_free_queue (struct tcp_log_dev_queue *param)
 
static struct tcp_log_common_header * tcp_log_expandlogbuf (struct tcp_log_dev_queue *param)
 
int tcp_log_dump_tp_logbuf (struct tcpcb *tp, char *reason, int how, bool force)
 
static int tcp_log_dump_node_logbuf (struct tcp_log_id_node *tln, char *reason, int how)
 
static void tcp_log_dumpbucketlogs (struct tcp_log_id_bucket *tlb, char *reason)
 
void tcp_log_dump_tp_bucket_logbufs (struct tcpcb *tp, char *reason)
 
void tcp_log_flowend (struct tcpcb *tp)
 

Variables

bool tcp_log_verbose
 
static uma_zone_t tcp_log_bucket_zone
 
static uma_zone_t tcp_log_node_zone
 
static uma_zone_t tcp_log_zone
 
static int tcp_log_session_limit = TCP_LOG_BUF_DEFAULT_SESSION_LIMIT
 
static uint32_t tcp_log_version = TCP_LOG_BUF_VER
 
static struct tcp_log_id_tree tcp_log_id_head
 
static uint8_t zerobuf [76]
 
static struct rwlock tcp_id_tree_lock
 

Macro Definition Documentation

◆ ACTIVE_REQUEST_COUNT

#define ACTIVE_REQUEST_COUNT   10

◆ COPY_STAT

#define COPY_STAT (   f)    log_buf->tlb_ ## f = tp->f

◆ COPY_STAT_T

#define COPY_STAT_T (   f)    log_buf->tlb_ ## f = tp->t_ ## f

◆ FREE_NEW_TLB

#define FREE_NEW_TLB ( )
Value:
do { \
TCPID_BUCKET_LOCK_DESTROY(tlb); \
uma_zfree(tcp_log_bucket_zone, tlb); \
counter_u64_add(tcp_log_pcb_ids_cur, (int64_t)-1); \
counter_u64_add(tcp_log_pcb_ids_tot, (int64_t)-1); \
bucket_locked = false; \
tlb = NULL; \
} while (0)
static uma_zone_t tcp_log_bucket_zone
Definition: tcp_log_buf.c:68

◆ LOCAL_SAVE

#define LOCAL_SAVE   10

Definition at line 2348 of file tcp_log_buf.c.

◆ RECHECK_INP

#define RECHECK_INP ( )    RECHECK_INP_CLEAN(/* noop */)

Definition at line 496 of file tcp_log_buf.c.

◆ RECHECK_INP_CLEAN

#define RECHECK_INP_CLEAN (   cleanup)
Value:
do { \
if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { \
rv = ECONNRESET; \
cleanup; \
goto done; \
} \
tp = intotcpcb(inp); \
} while (0)
#define INP_TIMEWAIT
Definition: in_pcb.h:644
#define INP_DROPPED
Definition: in_pcb.h:646
#define intotcpcb(ip)
Definition: tcp_var.h:645

Definition at line 487 of file tcp_log_buf.c.

◆ tcp_log_entry_refcnt_add

#define tcp_log_entry_refcnt_add (   l)

Definition at line 1032 of file tcp_log_buf.c.

◆ tcp_log_entry_refcnt_rem

#define tcp_log_entry_refcnt_rem (   l)

Definition at line 1033 of file tcp_log_buf.c.

◆ TCP_LOG_EXPIRE_INTVL

#define TCP_LOG_EXPIRE_INTVL   ((sbintime_t)5 * SBT_1S)

Definition at line 65 of file tcp_log_buf.c.

◆ TCP_LOG_EXPIRE_TIME

#define TCP_LOG_EXPIRE_TIME   ((sbintime_t)60 * SBT_1S)

Definition at line 62 of file tcp_log_buf.c.

◆ TCPID_BUCKET_LOCK

#define TCPID_BUCKET_LOCK (   tlb)    mtx_lock(&((tlb)->tlb_mtx))

Definition at line 240 of file tcp_log_buf.c.

◆ TCPID_BUCKET_LOCK_ASSERT

#define TCPID_BUCKET_LOCK_ASSERT (   tlb)    mtx_assert(&((tlb)->tlb_mtx), MA_OWNED)

Definition at line 242 of file tcp_log_buf.c.

◆ TCPID_BUCKET_LOCK_DESTROY

#define TCPID_BUCKET_LOCK_DESTROY (   tlb)    mtx_destroy(&((tlb)->tlb_mtx))

Definition at line 239 of file tcp_log_buf.c.

◆ TCPID_BUCKET_LOCK_INIT

#define TCPID_BUCKET_LOCK_INIT (   tlb)    mtx_init(&((tlb)->tlb_mtx), "tcp log id bucket", NULL, MTX_DEF)

Definition at line 238 of file tcp_log_buf.c.

◆ TCPID_BUCKET_REF

#define TCPID_BUCKET_REF (   tlb)    refcount_acquire(&((tlb)->tlb_refcnt))

Definition at line 245 of file tcp_log_buf.c.

◆ TCPID_BUCKET_UNLOCK

#define TCPID_BUCKET_UNLOCK (   tlb)    mtx_unlock(&((tlb)->tlb_mtx))

Definition at line 241 of file tcp_log_buf.c.

◆ TCPID_BUCKET_UNLOCK_ASSERT

#define TCPID_BUCKET_UNLOCK_ASSERT (   tlb)    mtx_assert(&((tlb)->tlb_mtx), MA_NOTOWNED)

Definition at line 243 of file tcp_log_buf.c.

◆ TCPID_BUCKET_UNREF

#define TCPID_BUCKET_UNREF (   tlb)    refcount_release(&((tlb)->tlb_refcnt))

Definition at line 246 of file tcp_log_buf.c.

◆ TCPID_TREE_RLOCK

#define TCPID_TREE_RLOCK ( )    rw_rlock(&tcp_id_tree_lock)

Definition at line 230 of file tcp_log_buf.c.

◆ TCPID_TREE_RLOCK_ASSERT

#define TCPID_TREE_RLOCK_ASSERT ( )    rw_assert(&tcp_id_tree_lock, RA_RLOCKED)

Definition at line 235 of file tcp_log_buf.c.

◆ TCPID_TREE_RUNLOCK

#define TCPID_TREE_RUNLOCK ( )    rw_runlock(&tcp_id_tree_lock)

Definition at line 233 of file tcp_log_buf.c.

◆ TCPID_TREE_UNLOCK_ASSERT

#define TCPID_TREE_UNLOCK_ASSERT ( )    rw_assert(&tcp_id_tree_lock, RA_UNLOCKED)

Definition at line 236 of file tcp_log_buf.c.

◆ TCPID_TREE_UPGRADE

#define TCPID_TREE_UPGRADE ( )    rw_try_upgrade(&tcp_id_tree_lock)

Definition at line 231 of file tcp_log_buf.c.

◆ TCPID_TREE_WLOCK

#define TCPID_TREE_WLOCK ( )    rw_wlock(&tcp_id_tree_lock)

Definition at line 229 of file tcp_log_buf.c.

◆ TCPID_TREE_WLOCK_ASSERT

#define TCPID_TREE_WLOCK_ASSERT ( )    rw_assert(&tcp_id_tree_lock, RA_WLOCKED)

Definition at line 234 of file tcp_log_buf.c.

◆ TCPID_TREE_WUNLOCK

#define TCPID_TREE_WUNLOCK ( )    rw_wunlock(&tcp_id_tree_lock)

Definition at line 232 of file tcp_log_buf.c.

◆ TCPLOG_EXPIREQ_LOCK

#define TCPLOG_EXPIREQ_LOCK ( )    mtx_lock(&tcp_log_expireq_mtx)

Definition at line 248 of file tcp_log_buf.c.

◆ TCPLOG_EXPIREQ_UNLOCK

#define TCPLOG_EXPIREQ_UNLOCK ( )    mtx_unlock(&tcp_log_expireq_mtx)

Definition at line 249 of file tcp_log_buf.c.

Enumeration Type Documentation

◆ tree_lock_state

Enumerator
TREE_UNLOCKED 
TREE_RLOCKED 
TREE_WLOCKED 

Definition at line 293 of file tcp_log_buf.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ RB_HEAD()

RB_HEAD ( tcp_log_id_tree  ,
tcp_log_id_bucket   
)

◆ SLIST_HEAD()

SLIST_HEAD ( tcp_log_id_head  ,
tcp_log_id_node   
)

◆ STAILQ_HEAD()

static STAILQ_HEAD ( tcp_log_id_node  )
static

Definition at line 73 of file tcp_log_buf.c.

◆ tcp_log_copyout()

static int tcp_log_copyout ( struct sockopt *  sopt,
void *  src,
void *  dst,
size_t  len 
)
inlinestatic

Definition at line 1838 of file tcp_log_buf.c.

Referenced by tcp_log_logs_to_buf().

Here is the caller graph for this function:

◆ tcp_log_drain()

void tcp_log_drain ( struct tcpcb tp)

◆ tcp_log_dump_node_logbuf()

static int tcp_log_dump_node_logbuf ( struct tcp_log_id_node tln,
char *  reason,
int  how 
)
static

Definition at line 2283 of file tcp_log_buf.c.

References tcp_log_expandlogbuf(), tcp_log_free_queue(), TCP_LOG_REASON_LEN, TCP_LOG_TAG_LEN, TCPID_BUCKET_LOCK, TCPID_BUCKET_LOCK_ASSERT, TCPID_BUCKET_UNLOCK, tcp_log_id_bucket::tlb_id, and tcp_log_id_bucket::tlb_tag.

Referenced by tcp_log_dumpbucketlogs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tcp_log_dump_tp_bucket_logbufs()

void tcp_log_dump_tp_bucket_logbufs ( struct tcpcb tp,
char *  reason 
)

◆ tcp_log_dump_tp_logbuf()

◆ tcp_log_dumpbucketlogs()

◆ tcp_log_event_()

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 *  itv 
)

Definition at line 1520 of file tcp_log_buf.c.

References COPY_STAT, COPY_STAT_T, INP_WLOCK_ASSERT, state, tcpcb::t_fb, tcpcb::t_flags2, tcpcb::t_inpcb, tcpcb::t_lib, tcpcb::t_loglimit, tcpcb::t_lognum, tcpcb::t_logs, tcpcb::t_logsn, tcpcb::t_logstate, tcp_fields_to_net(), TCP_FUNC_LEN, tcp_log_dump_tp_logbuf(), tcp_log_entry_refcnt_add, tcp_log_entry_refcnt_rem, tcp_log_purge_tp_logbuf(), tcp_log_state_change(), TCP_LOG_STATE_CLEAR, TCP_LOG_STATE_CONTINUAL, TCP_LOG_STATE_HEAD, TCP_LOG_STATE_HEAD_AUTO, TCP_LOG_STATE_OFF, TCP_LOG_STATE_TAIL, TCP_LOG_STATE_TAIL_AUTO, tcp_log_zone, TF2_LOG_AUTO, tcp_function_block::tfb_id, tcp_log_buffer::tlb_errno, tcp_log_buffer::tlb_eventflags, tcp_log_buffer::tlb_eventid, TLB_FLAG_HDR, TLB_FLAG_RXBUF, TLB_FLAG_STACKINFO, TLB_FLAG_TXBUF, TLB_FLAG_VERBOSE, tcp_log_buffer::tlb_flex1, tcp_log_buffer::tlb_flex2, tcp_log_buffer::tlb_len, tcp_log_buffer::tlb_opts, tcp_log_buffer::tlb_rxbuf, tcp_log_buffer::tlb_sn, tcp_log_buffer::tlb_stackid, tcp_log_buffer::tlb_stackinfo, tcp_log_buffer::tlb_th, tcp_log_buffer::tlb_ticks, tcp_log_buffer::tlb_tv, tcp_log_buffer::tlb_txbuf, tcp_log_sockbuf::tls_sb_acc, tcp_log_sockbuf::tls_sb_ccc, tcp_log_sockbuf::tls_sb_spare, tcp_log_verbose::tlv_snd_frm, tcp_log_verbose::tlv_trace_func, and tcp_log_verbose::tlv_trace_line.

Referenced by bbr_output_wtime(), rack_ack_received(), rack_do_compressed_ack_processing(), rack_do_segment_nounlock(), rack_fast_output(), rack_fast_rsm_output(), rack_log_fsb(), rack_output(), rack_post_recovery(), rack_set_cc_pacing(), rack_undo_cc_pacing(), and tcp_respond().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tcp_log_expandlogbuf()

static struct tcp_log_common_header * tcp_log_expandlogbuf ( struct tcp_log_dev_queue *  param)
static

Definition at line 2091 of file tcp_log_buf.c.

References TCP_LOG_BUF_VER, tcp_log_free_entries(), tcp_log_logs_to_buf(), TCP_LOG_REASON_LEN, and TCP_LOG_TAG_LEN.

Referenced by tcp_log_dump_node_logbuf(), and tcp_log_dump_tp_logbuf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tcp_log_expire()

static void tcp_log_expire ( void *unused  __unused)
static

◆ tcp_log_flowend()

void tcp_log_flowend ( struct tcpcb tp)

Definition at line 2631 of file tcp_log_buf.c.

References inpcb::inp_socket, tcpcb::t_inpcb, tcpcb::t_logstate, TCP_LOG_EVENT, TCP_LOG_FLOWEND, and TCP_LOG_STATE_OFF.

Referenced by rack_fini().

Here is the caller graph for this function:

◆ tcp_log_free_entries()

static void tcp_log_free_entries ( struct tcp_log_stailq *  head,
int *  count 
)
static

Definition at line 1054 of file tcp_log_buf.c.

References count, tcp_log_entry_refcnt_rem, and tcp_log_free_log_common().

Referenced by tcp_log_dumpbucketlogs(), tcp_log_expandlogbuf(), tcp_log_expire(), and tcp_log_free_queue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tcp_log_free_log_common()

static void tcp_log_free_log_common ( struct tcp_log_mem *  log_entry,
int *count  __unused 
)
inlinestatic

Definition at line 1042 of file tcp_log_buf.c.

References count, and tcp_log_zone.

Referenced by tcp_log_free_entries().

Here is the caller graph for this function:

◆ tcp_log_free_queue()

static void tcp_log_free_queue ( struct tcp_log_dev_queue *  param)
static

Definition at line 2069 of file tcp_log_buf.c.

References tcp_log_free_entries().

Referenced by tcp_log_dump_node_logbuf(), and tcp_log_dump_tp_logbuf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tcp_log_get_id()

size_t tcp_log_get_id ( struct tcpcb tp,
char *  buf 
)

Definition at line 920 of file tcp_log_buf.c.

References INP_LOCK_ASSERT, tcpcb::t_inpcb, tcpcb::t_lib, and tcp_log_id_bucket::tlb_id.

Referenced by tcp_default_ctloutput(), and tcp_inptoxtp().

Here is the caller graph for this function:

◆ tcp_log_get_id_cnt()

u_int tcp_log_get_id_cnt ( struct tcpcb tp)

Definition at line 989 of file tcp_log_buf.c.

References INP_WLOCK_ASSERT, tcpcb::t_inpcb, and tcpcb::t_lib.

◆ tcp_log_get_tag()

◆ tcp_log_getlogbuf()

int tcp_log_getlogbuf ( struct sockopt *  sopt,
struct tcpcb tp 
)

Definition at line 1927 of file tcp_log_buf.c.

References INP_DROPPED, inpcb::inp_flags, INP_TIMEWAIT, INP_WLOCK, INP_WLOCK_ASSERT, INP_WUNLOCK, intotcpcb, tcpcb::t_inpcb, tcpcb::t_lognum, tcpcb::t_logs, tcp_log_entry_refcnt_rem, tcp_log_logs_to_buf(), tcp_log_zone, and TLB_FLAG_VERBOSE.

Referenced by tcp_default_ctloutput().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tcp_log_grow_tlb()

static void tcp_log_grow_tlb ( char *  tlb_id,
struct tcpcb tp 
)
static

Definition at line 499 of file tcp_log_buf.c.

References INP_WLOCK_ASSERT, tcpcb::t_inpcb, tcpcb::t_stats, and tcp_stats_sample_rollthedice().

Referenced by tcp_log_set_id().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tcp_log_id_cmp()

static __inline int tcp_log_id_cmp ( struct tcp_log_id_bucket a,
struct tcp_log_id_bucket b 
)
static

Definition at line 317 of file tcp_log_buf.c.

References tcp_log_id_bucket::tlb_id.

◆ tcp_log_id_validate_tree_lock()

static __inline void tcp_log_id_validate_tree_lock ( int  tree_locked)
static

◆ tcp_log_increment_reqcnt()

static void tcp_log_increment_reqcnt ( struct tcp_log_id_bucket tlb)
static

Definition at line 511 of file tcp_log_buf.c.

Referenced by tcp_log_set_id().

Here is the caller graph for this function:

◆ tcp_log_init()

void tcp_log_init ( void  )

Definition at line 1138 of file tcp_log_buf.c.

References tcp_id_tree_lock, tcp_log_bucket_zone, TCP_LOG_BUF_DEFAULT_GLOBAL_LIMIT, tcp_log_node_zone, and tcp_log_zone.

Referenced by tcp_init().

Here is the caller graph for this function:

◆ tcp_log_logs_to_buf()

static int tcp_log_logs_to_buf ( struct sockopt *  sopt,
struct tcp_log_stailq *  log_tailqp,
struct tcp_log_buffer **  end,
int  count 
)
static

Definition at line 1848 of file tcp_log_buf.c.

References count, tcp_log_copyout(), TLB_FLAG_HDR, TLB_FLAG_VERBOSE, tcp_log_buffer::tlb_th, tcp_log_buffer::tlb_verbose, and zerobuf.

Referenced by tcp_log_expandlogbuf(), and tcp_log_getlogbuf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tcp_log_move_tp_to_node()

static void tcp_log_move_tp_to_node ( struct tcpcb tp,
struct tcp_log_id_node tln 
)
static

Definition at line 1298 of file tcp_log_buf.c.

References in_conninfo::inc_flags, in_conninfo::inc_ie, INC_ISIPV6, inpcb::inp_inc, INP_WLOCK_ASSERT, tcpcb::t_inpcb, tcpcb::t_lib, tcpcb::t_lognum, and tcpcb::t_logs.

Referenced by tcp_log_dumpbucketlogs(), and tcp_log_tcpcbfini().

Here is the caller graph for this function:

◆ tcp_log_purge_tp_logbuf()

static void tcp_log_purge_tp_logbuf ( struct tcpcb tp)
static

Definition at line 1495 of file tcp_log_buf.c.

References INP_WLOCK_ASSERT, tcpcb::t_inpcb, tcpcb::t_lognum, tcpcb::t_logs, tcpcb::t_logstate, tcp_log_remove_log_head(), and TCP_LOG_STATE_OFF.

Referenced by tcp_log_event_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tcp_log_remove_bucket()

static __inline void tcp_log_remove_bucket ( struct tcp_log_id_bucket tlb)
static

Definition at line 349 of file tcp_log_buf.c.

References tcp_log_bucket_zone, tcp_log_id_head, TCPID_BUCKET_LOCK_DESTROY, and TCPID_TREE_WLOCK_ASSERT.

Referenced by tcp_log_unref_bucket().

Here is the caller graph for this function:

◆ tcp_log_remove_id_node()

static bool tcp_log_remove_id_node ( struct inpcb inp,
struct tcpcb tp,
struct tcp_log_id_bucket tlb,
struct tcp_log_id_node tln,
int *  tree_locked 
)
static

Definition at line 449 of file tcp_log_buf.c.

References tcpcb::t_lib, tcpcb::t_lin, tcp_log_id_validate_tree_lock(), tcp_log_unref_bucket(), TCPID_BUCKET_LOCK_ASSERT, and TCPID_BUCKET_UNLOCK.

Referenced by tcp_log_expire(), and tcp_log_set_id().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tcp_log_remove_log_cleanup()

static void tcp_log_remove_log_cleanup ( struct tcpcb tp,
struct tcp_log_mem *  log_entry 
)
inlinestatic

Definition at line 1068 of file tcp_log_buf.c.

References tcpcb::t_lognum, and tcp_log_zone.

Referenced by tcp_log_drain(), and tcp_log_remove_log_head().

Here is the caller graph for this function:

◆ tcp_log_remove_log_head()

static void tcp_log_remove_log_head ( struct tcpcb tp,
struct tcp_log_mem *  log_entry 
)
inlinestatic

Definition at line 1078 of file tcp_log_buf.c.

References tcpcb::t_logs, tcp_log_entry_refcnt_rem, and tcp_log_remove_log_cleanup().

Referenced by tcp_log_drain(), tcp_log_dump_tp_logbuf(), tcp_log_purge_tp_logbuf(), tcp_log_state_change(), and tcp_log_tcpcbfini().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tcp_log_selectauto()

static __inline bool tcp_log_selectauto ( void  )
static

Definition at line 301 of file tcp_log_buf.c.

Referenced by tcp_log_set_id(), and tcp_log_tcpcbinit().

Here is the caller graph for this function:

◆ tcp_log_set_id()

◆ tcp_log_set_tag()

◆ tcp_log_state_change()

int tcp_log_state_change ( struct tcpcb tp,
int  state 
)

◆ tcp_log_tcpcbfini()

◆ tcp_log_tcpcbinit()

void tcp_log_tcpcbinit ( struct tcpcb tp)

Definition at line 1176 of file tcp_log_buf.c.

References tcpcb::t_flags2, tcpcb::t_loglimit, tcpcb::t_logs, tcpcb::t_logstate, tcp_log_selectauto(), tcp_log_session_limit, and TF2_LOG_AUTO.

Referenced by tcp_newtcpcb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tcp_log_unref_bucket()

static bool tcp_log_unref_bucket ( struct tcp_log_id_bucket tlb,
int *  tree_locked,
struct inpcb inp 
)
static

Variable Documentation

◆ tcp_id_tree_lock

struct rwlock tcp_id_tree_lock
static

Definition at line 228 of file tcp_log_buf.c.

Referenced by tcp_log_init().

◆ tcp_log_bucket_zone

uma_zone_t tcp_log_bucket_zone
static

Definition at line 68 of file tcp_log_buf.c.

Referenced by tcp_log_init(), tcp_log_remove_bucket(), and tcp_log_set_id().

◆ tcp_log_id_head

struct tcp_log_id_tree tcp_log_id_head
static

Definition at line 72 of file tcp_log_buf.c.

Referenced by tcp_log_remove_bucket(), and tcp_log_set_id().

◆ tcp_log_node_zone

uma_zone_t tcp_log_node_zone
static

Definition at line 68 of file tcp_log_buf.c.

Referenced by tcp_log_dumpbucketlogs(), tcp_log_expire(), tcp_log_init(), and tcp_log_set_id().

◆ tcp_log_session_limit

int tcp_log_session_limit = TCP_LOG_BUF_DEFAULT_SESSION_LIMIT
static

Definition at line 69 of file tcp_log_buf.c.

Referenced by tcp_log_tcpcbinit().

◆ tcp_log_verbose

Definition at line 67 of file tcp_log_buf.c.

◆ tcp_log_version

uint32_t tcp_log_version = TCP_LOG_BUF_VER
static

Definition at line 70 of file tcp_log_buf.c.

◆ tcp_log_zone

uma_zone_t tcp_log_zone
static

◆ zerobuf

uint8_t zerobuf[76]
static

Definition at line 188 of file tcp_log_buf.c.

Referenced by tcp_log_logs_to_buf().