+#define foreach_tcp_wrk_stat \
+ _(timer_expirations, u64, "timer expirations") \
+ _(rxt_segs, u64, "segments retransmitted") \
+ _(tr_events, u32, "timer retransmit events") \
+ _(to_closewait, u32, "timeout close-wait") \
+ _(to_closewait2, u32, "timeout close-wait w/data") \
+ _(to_finwait1, u32, "timeout fin-wait-1") \
+ _(to_finwait2, u32, "timeout fin-wait-2") \
+ _(to_lastack, u32, "timeout last-ack") \
+ _(to_closing, u32, "timeout closing") \
+ _(tr_abort, u32, "timer retransmit abort") \
+ _(rst_unread, u32, "reset on close due to unread data") \
+
+typedef struct tcp_wrk_stats_
+{
+#define _(name, type, str) type name;
+ foreach_tcp_wrk_stat
+#undef _
+} tcp_wrk_stats_t;
+
+typedef struct tcp_free_req_
+{
+ clib_time_type_t free_time;
+ u32 connection_index;
+} tcp_cleanup_req_t;
+
+typedef struct tcp_worker_ctx_
+{
+ CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
+
+ /** worker's pool of connections */
+ tcp_connection_t *connections;
+
+ /** vector of pending ack dequeues */
+ u32 *pending_deq_acked;
+
+ /** vector of pending disconnect notifications */
+ u32 *pending_disconnects;
+
+ /** vector of pending reset notifications */
+ u32 *pending_resets;
+
+ /** convenience pointer to this thread's vlib main */
+ vlib_main_t *vm;
+
+ /** worker time */
+ u32 time_now;
+
+ /* Max timers to be handled per dispatch loop */
+ u32 max_timers_per_loop;
+
+ /** tx frames for ip 4/6 lookup nodes */
+ vlib_frame_t *ip_lookup_tx_frames[2];
+
+ CLIB_CACHE_LINE_ALIGN_MARK (cacheline1);
+
+ /** cached 'on the wire' options for bursts */
+ u8 cached_opts[40];
+
+ /** tx buffer free list */
+ u32 *tx_buffers;
+
+ /* Fifo of pending timer expirations */
+ u32 *pending_timers;
+
+ /* fifo of pending free requests */
+ tcp_cleanup_req_t *pending_cleanups;
+
+ /** worker timer wheel */
+ tw_timer_wheel_16t_2w_512sl_t timer_wheel;
+
+ CLIB_CACHE_LINE_ALIGN_MARK (cacheline2);
+
+ tcp_wrk_stats_t stats;
+} tcp_worker_ctx_t;
+
+#define tcp_worker_stats_inc(_ti,_stat,_val) \
+ tcp_main.wrk_ctx[_ti].stats._stat += _val
+
+#define tcp_workerp_stats_inc(_wrk,_stat,_val) \
+ _wrk->stats._stat += _val
+
+typedef struct tcp_iss_seed_
+{
+ u64 first;
+ u64 second;
+} tcp_iss_seed_t;
+
+typedef struct tcp_configuration_
+{
+ /** Max rx fifo size for a session (in bytes). It is used in to compute the
+ * rfc 7323 window scaling factor */
+ u32 max_rx_fifo;
+
+ /** Min rx fifo for a session (in bytes) */
+ u32 min_rx_fifo;
+
+ /** Default MTU to be used when establishing connections */
+ u16 default_mtu;
+
+ /** Initial CWND multiplier, which multiplies MSS to determine initial CWND.
+ * Set 0 to determine the initial CWND by another way */
+ u16 initial_cwnd_multiplier;
+
+ /** Enable tx pacing for new connections */
+ u8 enable_tx_pacing;
+
+ /** Allow use of TSO whenever available */
+ u8 allow_tso;
+
+ /** Set if csum offloading is enabled */
+ u8 csum_offload;
+
+ /** Default congestion control algorithm type */
+ tcp_cc_algorithm_type_e cc_algo;
+
+ /** Min rwnd, as number of snd_mss segments, for update ack to be sent after
+ * a zero rwnd advertisement */
+ u32 rwnd_min_update_ack;
+
+ /** Delayed ack time (disabled) */
+ u16 delack_time;
+
+ /** Timer ticks to wait for close from app */
+ u16 closewait_time;
+
+ /** Timer ticks to wait in time-wait. Also known as 2MSL */
+ u16 timewait_time;
+
+ /** Timer ticks to wait in fin-wait1 to send fin and rcv fin-ack */
+ u16 finwait1_time;
+
+ /** Timer ticks to wait in last ack for ack */
+ u16 lastack_time;
+
+ /** Timer ticks to wait in fin-wait2 for fin */
+ u16 finwait2_time;
+
+ /** Timer ticks to wait in closing for fin ack */
+ u16 closing_time;
+
+ /** Time to wait (sec) before cleaning up the connection */
+ f32 cleanup_time;
+
+ /** Number of preallocated connections */
+ u32 preallocated_connections;
+
+ /** Number of preallocated half-open connections */
+ u32 preallocated_half_open_connections;
+
+ /** Vectors of src addresses. Optional unless one needs > 63K active-opens */
+ ip4_address_t *ip4_src_addrs;
+ ip6_address_t *ip6_src_addrs;
+
+ /** Fault-injection. Debug only */
+ f64 buffer_fail_fraction;
+} tcp_configuration_t;
+