MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tcp_log_event_

Function tcp_log_event_

freebsd/netinet/tcp_log_buf.c:1519–1739  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1517 */
1518
1519struct tcp_log_buffer *
1520tcp_log_event_(struct tcpcb *tp, struct tcphdr *th, struct sockbuf *rxbuf,
1521 struct sockbuf *txbuf, uint8_t eventid, int errornum, uint32_t len,
1522 union tcp_log_stackspecific *stackinfo, int th_hostorder,
1523 const char *output_caller, const char *func, int line, const struct timeval *itv)
1524{
1525 struct tcp_log_mem *log_entry;
1526 struct tcp_log_buffer *log_buf;
1527 int attempt_count = 0;
1528 struct tcp_log_verbose *log_verbose;
1529 uint32_t logsn;
1530
1531 KASSERT((func == NULL && line == 0) || (func != NULL && line > 0),
1532 ("%s called with inconsistent func (%p) and line (%d) arguments",
1533 __func__, func, line));
1534
1535 INP_WLOCK_ASSERT(tp->t_inpcb);
1536 if (tcp_disable_all_bb_logs) {
1537 /*
1538 * The global shutdown logging
1539 * switch has been thrown. Call
1540 * the purge function that frees
1541 * purges out the logs and
1542 * turns off logging.
1543 */
1544 tcp_log_purge_tp_logbuf(tp);
1545 return (NULL);
1546 }
1547 KASSERT(tp->t_logstate == TCP_LOG_STATE_HEAD ||
1548 tp->t_logstate == TCP_LOG_STATE_TAIL ||
1549 tp->t_logstate == TCP_LOG_STATE_CONTINUAL ||
1550 tp->t_logstate == TCP_LOG_STATE_HEAD_AUTO ||
1551 tp->t_logstate == TCP_LOG_STATE_TAIL_AUTO,
1552 ("%s called with unexpected tp->t_logstate (%d)", __func__,
1553 tp->t_logstate));
1554
1555 /*
1556 * Get the serial number. We do this early so it will
1557 * increment even if we end up skipping the log entry for some
1558 * reason.
1559 */
1560 logsn = tp->t_logsn++;
1561
1562 /*
1563 * Can we get a new log entry? If so, increment the lognum counter
1564 * here.
1565 */
1566retry:
1567 if (tp->t_lognum < tp->t_loglimit) {
1568 if ((log_entry = uma_zalloc(tcp_log_zone, M_NOWAIT)) != NULL)
1569 tp->t_lognum++;
1570 } else
1571 log_entry = NULL;
1572
1573 /* Do we need to try to reuse? */
1574 if (log_entry == NULL) {
1575 /*
1576 * Sacrifice auto-logged sessions without a log ID if

Callers 2

rack.cFile · 0.50
bbr.cFile · 0.50

Calls 10

tcp_log_purge_tp_logbufFunction · 0.85
tcp_log_state_changeFunction · 0.85
tcp_log_dump_tp_logbufFunction · 0.85
getmicrouptimeFunction · 0.85
tcp_fields_to_netFunction · 0.70
uma_zallocFunction · 0.50
panicFunction · 0.50
counter_u64_addFunction · 0.50
memcpyFunction · 0.50
strlcpyFunction · 0.50

Tested by

no test coverage detected