#ifndef _INET_TCP_STATS_H
#define _INET_TCP_STATS_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
#ifndef TCP_DEBUG_COUNTER
#ifdef DEBUG
#define TCP_DEBUG_COUNTER 1
#else
#define TCP_DEBUG_COUNTER 0
#endif
#endif
typedef struct tcp_stat {
kstat_named_t tcp_time_wait_syn_success;
kstat_named_t tcp_clean_death_nondetached;
kstat_named_t tcp_eager_blowoff_q;
kstat_named_t tcp_eager_blowoff_q0;
kstat_named_t tcp_no_listener;
kstat_named_t tcp_listendrop;
kstat_named_t tcp_listendropq0;
kstat_named_t tcp_wsrv_called;
kstat_named_t tcp_flwctl_on;
kstat_named_t tcp_timer_fire_early;
kstat_named_t tcp_timer_fire_miss;
kstat_named_t tcp_zcopy_on;
kstat_named_t tcp_zcopy_off;
kstat_named_t tcp_zcopy_backoff;
kstat_named_t tcp_fusion_flowctl;
kstat_named_t tcp_fusion_backenabled;
kstat_named_t tcp_fusion_urg;
kstat_named_t tcp_fusion_putnext;
kstat_named_t tcp_fusion_unfusable;
kstat_named_t tcp_fusion_aborted;
kstat_named_t tcp_fusion_unqualified;
kstat_named_t tcp_fusion_rrw_busy;
kstat_named_t tcp_fusion_rrw_msgcnt;
kstat_named_t tcp_fusion_rrw_plugged;
kstat_named_t tcp_in_ack_unsent_drop;
kstat_named_t tcp_sock_fallback;
kstat_named_t tcp_lso_enabled;
kstat_named_t tcp_lso_disabled;
kstat_named_t tcp_lso_times;
kstat_named_t tcp_lso_pkt_out;
kstat_named_t tcp_listen_cnt_drop;
kstat_named_t tcp_listen_mem_drop;
kstat_named_t tcp_zwin_mem_drop;
kstat_named_t tcp_zwin_ack_syn;
kstat_named_t tcp_rst_unsent;
kstat_named_t tcp_reclaim_cnt;
kstat_named_t tcp_reass_timeout;
kstat_named_t tcp_sig_no_option;
kstat_named_t tcp_sig_no_space;
kstat_named_t tcp_sig_match_failed;
kstat_named_t tcp_sig_verify_failed;
kstat_named_t tcp_sig_degraded;
#ifdef TCP_DEBUG_COUNTER
kstat_named_t tcp_time_wait;
kstat_named_t tcp_rput_time_wait;
kstat_named_t tcp_detach_time_wait;
kstat_named_t tcp_timeout_calls;
kstat_named_t tcp_timeout_cached_alloc;
kstat_named_t tcp_timeout_cancel_reqs;
kstat_named_t tcp_timeout_canceled;
kstat_named_t tcp_timermp_freed;
kstat_named_t tcp_push_timer_cnt;
kstat_named_t tcp_ack_timer_cnt;
#endif
} tcp_stat_t;
typedef struct tcp_stat_counter_s {
uint64_t tcp_time_wait_syn_success;
uint64_t tcp_clean_death_nondetached;
uint64_t tcp_eager_blowoff_q;
uint64_t tcp_eager_blowoff_q0;
uint64_t tcp_no_listener;
uint64_t tcp_listendrop;
uint64_t tcp_listendropq0;
uint64_t tcp_wsrv_called;
uint64_t tcp_flwctl_on;
uint64_t tcp_timer_fire_early;
uint64_t tcp_timer_fire_miss;
uint64_t tcp_zcopy_on;
uint64_t tcp_zcopy_off;
uint64_t tcp_zcopy_backoff;
uint64_t tcp_fusion_flowctl;
uint64_t tcp_fusion_backenabled;
uint64_t tcp_fusion_urg;
uint64_t tcp_fusion_putnext;
uint64_t tcp_fusion_unfusable;
uint64_t tcp_fusion_aborted;
uint64_t tcp_fusion_unqualified;
uint64_t tcp_fusion_rrw_busy;
uint64_t tcp_fusion_rrw_msgcnt;
uint64_t tcp_fusion_rrw_plugged;
uint64_t tcp_in_ack_unsent_drop;
uint64_t tcp_sock_fallback;
uint64_t tcp_lso_enabled;
uint64_t tcp_lso_disabled;
uint64_t tcp_lso_times;
uint64_t tcp_lso_pkt_out;
uint64_t tcp_listen_cnt_drop;
uint64_t tcp_listen_mem_drop;
uint64_t tcp_zwin_mem_drop;
uint64_t tcp_zwin_ack_syn;
uint64_t tcp_rst_unsent;
uint64_t tcp_reclaim_cnt;
uint64_t tcp_reass_timeout;
uint64_t tcp_sig_no_option;
uint64_t tcp_sig_no_space;
uint64_t tcp_sig_match_failed;
uint64_t tcp_sig_verify_failed;
uint64_t tcp_sig_degraded;
#ifdef TCP_DEBUG_COUNTER
uint64_t tcp_time_wait;
uint64_t tcp_rput_time_wait;
uint64_t tcp_detach_time_wait;
uint64_t tcp_timeout_calls;
uint64_t tcp_timeout_cached_alloc;
uint64_t tcp_timeout_cancel_reqs;
uint64_t tcp_timeout_canceled;
uint64_t tcp_timermp_freed;
uint64_t tcp_push_timer_cnt;
uint64_t tcp_ack_timer_cnt;
#endif
} tcp_stat_counter_t;
typedef struct tcp_g_stat {
kstat_named_t tcp_timermp_alloced;
kstat_named_t tcp_timermp_allocfail;
kstat_named_t tcp_timermp_allocdblfail;
kstat_named_t tcp_freelist_cleanup;
} tcp_g_stat_t;
typedef struct {
int64_t tcp_sc_conn_cnt;
mib2_tcp_t tcp_sc_mib;
tcp_stat_counter_t tcp_sc_stats;
} tcp_stats_cpu_t;
typedef struct tcp_conn_stats {
uint64_t tcp_in_data_inorder_bytes;
uint64_t tcp_in_data_inorder_segs;
uint64_t tcp_in_data_unorder_bytes;
uint64_t tcp_in_data_unorder_segs;
uint64_t tcp_in_zwnd_probes;
uint64_t tcp_out_data_bytes;
uint64_t tcp_out_data_segs;
uint64_t tcp_out_retrans_bytes;
uint64_t tcp_out_retrans_segs;
uint64_t tcp_out_zwnd_probes;
} tcp_conn_stats_t;
#define TCPS_BUMP_MIB(tcps, x) \
BUMP_MIB(&(tcps)->tcps_sc[CPU->cpu_seqid]->tcp_sc_mib, x)
#define TCPS_UPDATE_MIB(tcps, x, y) \
UPDATE_MIB(&(tcps)->tcps_sc[CPU->cpu_seqid]->tcp_sc_mib, x, y)
#if TCP_DEBUG_COUNTER
#define TCP_DBGSTAT(tcps, x) \
atomic_inc_64( \
&((tcps)->tcps_sc[CPU->cpu_seqid]->tcp_sc_stats.x))
#define TCP_G_DBGSTAT(x) \
atomic_inc_64(&(tcp_g_statistics.x.value.ui64))
#else
#define TCP_DBGSTAT(tcps, x)
#define TCP_G_DBGSTAT(x)
#endif
#define TCP_G_STAT(x) (tcp_g_statistics.x.value.ui64++)
#define TCP_STAT(tcps, x) \
((tcps)->tcps_sc[CPU->cpu_seqid]->tcp_sc_stats.x++)
#define TCP_STAT_UPDATE(tcps, x, n) \
((tcps)->tcps_sc[CPU->cpu_seqid]->tcp_sc_stats.x += (n))
#define TCP_STAT_SET(tcps, x, n) \
((tcps)->tcps_sc[CPU->cpu_seqid]->tcp_sc_stats.x = (n))
extern tcp_g_stat_t tcp_g_statistics;
extern kstat_t *tcp_g_kstat;
extern void *tcp_g_kstat_init(tcp_g_stat_t *);
extern void tcp_g_kstat_fini(kstat_t *);
extern void *tcp_kstat_init(netstackid_t);
extern void tcp_kstat_fini(netstackid_t, kstat_t *);
extern void *tcp_kstat2_init(netstackid_t);
extern void tcp_kstat2_fini(netstackid_t, kstat_t *);
#endif
#ifdef __cplusplus
}
#endif
#endif