X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Ftcp%2Ftcp.h;h=2725c1f51cfed1f4bd8943e93cc344590e3d40c4;hb=a91cb4590;hp=708d7566eb25d95ee2e28981849535b9a06df442;hpb=999840cf805f26a490e8e6b8acc1fe7a7c21a181;p=vpp.git diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h index 708d7566eb2..2725c1f51cf 100644 --- a/src/vnet/tcp/tcp.h +++ b/src/vnet/tcp/tcp.h @@ -28,7 +28,6 @@ typedef void (timer_expiration_handler) (tcp_connection_t * tc); -extern timer_expiration_handler tcp_timer_delack_handler; extern timer_expiration_handler tcp_timer_retransmit_handler; extern timer_expiration_handler tcp_timer_persist_handler; extern timer_expiration_handler tcp_timer_retransmit_syn_handler; @@ -58,6 +57,7 @@ typedef struct _tcp_lookup_dispatch _(to_closing, u32, "timeout closing") \ _(tr_abort, u32, "timer retransmit abort") \ _(rst_unread, u32, "reset on close due to unread data") \ + _(no_buffer, u32, "out of buffers") \ typedef struct tcp_wrk_stats_ { @@ -91,7 +91,7 @@ typedef struct tcp_worker_ctx_ /** convenience pointer to this thread's vlib main */ vlib_main_t *vm; - /** worker time */ + /** Time measured in @ref TCP_TSTAMP_TICK used for time stamps */ u32 time_now; /* Max timers to be handled per dispatch loop */ @@ -115,17 +115,14 @@ typedef struct tcp_worker_ctx_ tcp_cleanup_req_t *pending_cleanups; /** worker timer wheel */ - tw_timer_wheel_16t_2w_512sl_t timer_wheel; + tcp_timer_wheel_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) \ +#define tcp_worker_stats_inc(_wrk,_stat,_val) \ _wrk->stats._stat += _val typedef struct tcp_iss_seed_ @@ -166,26 +163,23 @@ typedef struct tcp_configuration_ * 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; + u32 closewait_time; /** Timer ticks to wait in time-wait. Also known as 2MSL */ - u16 timewait_time; + u32 timewait_time; /** Timer ticks to wait in fin-wait1 to send fin and rcv fin-ack */ - u16 finwait1_time; + u32 finwait1_time; /** Timer ticks to wait in last ack for ack */ - u16 lastack_time; + u32 lastack_time; /** Timer ticks to wait in fin-wait2 for fin */ - u16 finwait2_time; + u32 finwait2_time; /** Timer ticks to wait in closing for fin ack */ - u16 closing_time; + u32 closing_time; /** Time to wait (sec) before cleaning up the connection */ f32 cleanup_time; @@ -196,6 +190,9 @@ typedef struct tcp_configuration_ /** Number of preallocated half-open connections */ u32 preallocated_half_open_connections; + /** Maxium allowed GSO packet size */ + u32 max_gso_size; + /** Vectors of src addresses. Optional unless one needs > 63K active-opens */ ip4_address_t *ip4_src_addrs; ip6_address_t *ip6_src_addrs; @@ -212,8 +209,6 @@ typedef struct _tcp_main /* Pool of listeners. */ tcp_connection_t *listener_pool; - f64 tstamp_ticks_per_clock; - /** vlib buffer size */ u32 bytes_per_buffer; @@ -328,7 +323,7 @@ void tcp_reschedule (tcp_connection_t * tc); fib_node_index_t tcp_lookup_rmt_in_fib (tcp_connection_t * tc); u32 tcp_session_push_header (transport_connection_t * tconn, vlib_buffer_t * b); -int tcp_session_custom_tx (void *conn, u32 max_burst_size); +int tcp_session_custom_tx (void *conn, transport_send_params_t * sp); void tcp_connection_timers_init (tcp_connection_t * tc); void tcp_connection_timers_reset (tcp_connection_t * tc); @@ -356,113 +351,6 @@ format_function_t format_tcp_rcv_sacks; format_function_t format_tcp_connection; format_function_t format_tcp_connection_id; -always_inline void -tcp_timer_set (tcp_connection_t * tc, u8 timer_id, u32 interval) -{ - ASSERT (tc->c_thread_index == vlib_get_thread_index ()); - ASSERT (tc->timers[timer_id] == TCP_TIMER_HANDLE_INVALID); - tc->timers[timer_id] = - tw_timer_start_16t_2w_512sl (&tcp_main. - wrk_ctx[tc->c_thread_index].timer_wheel, - tc->c_c_index, timer_id, interval); -} - -always_inline void -tcp_timer_reset (tcp_connection_t * tc, u8 timer_id) -{ - ASSERT (tc->c_thread_index == vlib_get_thread_index ()); - if (tc->timers[timer_id] == TCP_TIMER_HANDLE_INVALID) - return; - - tw_timer_stop_16t_2w_512sl (&tcp_main. - wrk_ctx[tc->c_thread_index].timer_wheel, - tc->timers[timer_id]); - tc->timers[timer_id] = TCP_TIMER_HANDLE_INVALID; -} - -always_inline void -tcp_timer_update (tcp_connection_t * tc, u8 timer_id, u32 interval) -{ - ASSERT (tc->c_thread_index == vlib_get_thread_index ()); - if (tc->timers[timer_id] != TCP_TIMER_HANDLE_INVALID) - tw_timer_update_16t_2w_512sl (&tcp_main. - wrk_ctx[tc->c_thread_index].timer_wheel, - tc->timers[timer_id], interval); - else - tc->timers[timer_id] = - tw_timer_start_16t_2w_512sl (&tcp_main. - wrk_ctx[tc->c_thread_index].timer_wheel, - tc->c_c_index, timer_id, interval); -} - -always_inline void -tcp_retransmit_timer_set (tcp_connection_t * tc) -{ - ASSERT (tc->snd_una != tc->snd_una_max); - tcp_timer_set (tc, TCP_TIMER_RETRANSMIT, - clib_max (tc->rto * TCP_TO_TIMER_TICK, 1)); -} - -always_inline void -tcp_retransmit_timer_reset (tcp_connection_t * tc) -{ - tcp_timer_reset (tc, TCP_TIMER_RETRANSMIT); -} - -always_inline void -tcp_retransmit_timer_force_update (tcp_connection_t * tc) -{ - tcp_timer_update (tc, TCP_TIMER_RETRANSMIT, - clib_max (tc->rto * TCP_TO_TIMER_TICK, 1)); -} - -always_inline void -tcp_persist_timer_set (tcp_connection_t * tc) -{ - /* Reuse RTO. It's backed off in handler */ - tcp_timer_set (tc, TCP_TIMER_PERSIST, - clib_max (tc->rto * TCP_TO_TIMER_TICK, 1)); -} - -always_inline void -tcp_persist_timer_update (tcp_connection_t * tc) -{ - u32 interval; - - if (seq_leq (tc->snd_una, tc->snd_congestion + tc->burst_acked)) - interval = 1; - else - interval = clib_max (tc->rto * TCP_TO_TIMER_TICK, 1); - - tcp_timer_update (tc, TCP_TIMER_PERSIST, interval); -} - -always_inline void -tcp_persist_timer_reset (tcp_connection_t * tc) -{ - tcp_timer_reset (tc, TCP_TIMER_PERSIST); -} - -always_inline void -tcp_retransmit_timer_update (tcp_connection_t * tc) -{ - if (tc->snd_una == tc->snd_nxt) - { - tcp_retransmit_timer_reset (tc); - if (tc->snd_wnd < tc->snd_mss) - tcp_persist_timer_update (tc); - } - else - tcp_timer_update (tc, TCP_TIMER_RETRANSMIT, - clib_max (tc->rto * TCP_TO_TIMER_TICK, 1)); -} - -always_inline u8 -tcp_timer_is_active (tcp_connection_t * tc, tcp_timers_e timer) -{ - return tc->timers[timer] != TCP_TIMER_HANDLE_INVALID; -} - #define tcp_validate_txf_size(_tc, _a) \ ASSERT(_tc->state != TCP_STATE_ESTABLISHED \ || transport_max_tx_dequeue (&_tc->connection) >= _a)