FD.io VPP  v17.04.2-2-ga8f93f8
Vector Packet Processing
tcp.h File Reference
+ Include dependency graph for tcp.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TCP_TICK   10e-3
 TCP tick period (s) More...
 
#define THZ   1/TCP_TICK
 TCP tick frequency. More...
 
#define TCP_TSTAMP_RESOLUTION   TCP_TICK
 Time stamp resolution. More...
 
#define TCP_PAWS_IDLE   24 * 24 * 60 * 60 * THZ
 24 days More...
 
#define TCP_MAX_OPTION_SPACE   40
 
#define TCP_DUPACK_THRESHOLD   3
 
#define TCP_MAX_RX_FIFO_SIZE   2 << 20
 
#define TCP_IW_N_SEGMENTS   10
 
#define foreach_tcp_fsm_state
 TCP FSM state definitions as per RFC793. More...
 
#define foreach_tcp_timer
 TCP timers. More...
 
#define TCP_TIMER_HANDLE_INVALID   ((u32) ~0)
 
#define TCP_TO_TIMER_TICK
 
#define TCP_DELACK_TIME   1 /* 0.1s */
 
#define TCP_ESTABLISH_TIME   750 /* 75s */
 
#define TCP_2MSL_TIME   300 /* 30s */
 
#define TCP_CLOSEWAIT_TIME   1 /* 0.1s */
 
#define TCP_CLEANUP_TIME   5 /* 0.5s Time to wait before cleanup */
 
#define TCP_RTO_MAX   60 * THZ /* Min max RTO (60s) as per RFC6298 */
 
#define TCP_RTT_MAX   30 * THZ /* 30s (probably too much) */
 
#define TCP_RTO_SYN_RETRIES   3 /* SYN retries without doubling RTO */
 
#define TCP_RTO_INIT   1 * THZ /* Initial retransmit timer */
 
#define foreach_tcp_connection_flag
 TCP connection flags. More...
 
#define foreach_tcp_buf_flag
 TCP buffer flags. More...
 
#define TCP_MAX_SACK_BLOCKS   5
 Max number of SACK blocks stored. More...
 
#define TCP_INVALID_SACK_HOLE_INDEX   ((u32)~0)
 
#define tcp_fastrecovery_on(tc)   (tc)->flags |= TCP_CONN_FAST_RECOVERY
 
#define tcp_fastrecovery_off(tc)   (tc)->flags &= ~TCP_CONN_FAST_RECOVERY
 
#define tcp_in_fastrecovery(tc)   ((tc)->flags & TCP_CONN_FAST_RECOVERY)
 
#define tcp_in_recovery(tc)   ((tc)->flags & (TCP_CONN_FAST_RECOVERY | TCP_CONN_RECOVERY))
 
#define tcp_recovery_off(tc)   ((tc)->flags &= ~(TCP_CONN_FAST_RECOVERY | TCP_CONN_RECOVERY))
 
#define tcp_in_slowstart(tc)   (tc->cwnd < tc->ssthresh)
 
#define tcp_error(n, s)   TCP_ERROR_##n,
 
#define seq_lt(_s1, _s2)   ((i32)((_s1)-(_s2)) < 0)
 
#define seq_leq(_s1, _s2)   ((i32)((_s1)-(_s2)) <= 0)
 
#define seq_gt(_s1, _s2)   ((i32)((_s1)-(_s2)) > 0)
 
#define seq_geq(_s1, _s2)   ((i32)((_s1)-(_s2)) >= 0)
 
#define timestamp_lt(_t1, _t2)   ((i32)((_t1)-(_t2)) < 0)
 
#define timestamp_leq(_t1, _t2)   ((i32)((_t1)-(_t2)) <= 0)
 

Typedefs

typedef enum _tcp_state tcp_state_t
 
typedef enum _tcp_timers tcp_timers_e
 
typedef void( timer_expiration_handler) (u32 index)
 
typedef enum _tcp_connection_flag_bits tcp_connection_flag_bits_e
 
typedef enum _tcp_connection_flag tcp_connection_flags_e
 
typedef struct _sack_scoreboard_hole sack_scoreboard_hole_t
 
typedef struct _sack_scoreboard sack_scoreboard_t
 
typedef enum _tcp_cc_algorithm_type tcp_cc_algorithm_type_e
 
typedef struct _tcp_cc_algorithm tcp_cc_algorithm_t
 
typedef enum _tcp_cc_ack_t tcp_cc_ack_t
 
typedef struct _tcp_connection tcp_connection_t
 
typedef enum _tcp_error tcp_error_t
 
typedef struct _tcp_lookup_dispatch tcp_lookup_dispatch_t
 
typedef struct _tcp_main tcp_main_t
 

Enumerations

enum  { TCP_N_BUF_BITS }
 
enum  { foreach_tcp_buf_flag }
 
enum  tcp_af_t { TCP_IP4, TCP_IP6, TCP_N_AF }
 

Functions

void tcp_update_time (f64 now, u32 thread_index)
 
static tcp_main_tvnet_get_tcp_main ()
 
clib_error_tvnet_tcp_enable_disable (vlib_main_t *vm, u8 is_en)
 
static tcp_connection_ttcp_connection_get (u32 conn_index, u32 thread_index)
 
static tcp_connection_ttcp_connection_get_if_valid (u32 conn_index, u32 thread_index)
 
void tcp_connection_close (tcp_connection_t *tc)
 Begin connection closing procedure. More...
 
void tcp_connection_cleanup (tcp_connection_t *tc)
 Cleans up connection state. More...
 
void tcp_connection_del (tcp_connection_t *tc)
 Connection removal. More...
 
void tcp_connection_reset (tcp_connection_t *tc)
 Notify session that connection has been reset. More...
 
u8format_tcp_connection (u8 *s, va_list *args)
 
u8format_tcp_connection_verbose (u8 *s, va_list *args)
 
static tcp_connection_ttcp_listener_get (u32 tli)
 
static tcp_connection_ttcp_half_open_connection_get (u32 conn_index)
 
void tcp_make_ack (tcp_connection_t *ts, vlib_buffer_t *b)
 Convert buffer to ACK. More...
 
void tcp_make_fin (tcp_connection_t *tc, vlib_buffer_t *b)
 Convert buffer to FIN-ACK. More...
 
void tcp_make_synack (tcp_connection_t *ts, vlib_buffer_t *b)
 Convert buffer to SYN-ACK. More...
 
void tcp_send_reset (vlib_buffer_t *pkt, u8 is_ip4)
 Send reset without reusing existing buffer. More...
 
void tcp_send_syn (tcp_connection_t *tc)
 Send SYN. More...
 
void tcp_send_fin (tcp_connection_t *tc)
 Send FIN. More...
 
void tcp_set_snd_mss (tcp_connection_t *tc)
 
static u32 tcp_end_seq (tcp_header_t *th, u32 len)
 
static u32 tcp_flight_size (const tcp_connection_t *tc)
 
static u32 tcp_initial_cwnd (const tcp_connection_t *tc)
 Initial cwnd as per RFC5681. More...
 
static u32 tcp_loss_wnd (const tcp_connection_t *tc)
 
static u32 tcp_available_wnd (const tcp_connection_t *tc)
 
static u32 tcp_available_snd_space (const tcp_connection_t *tc)
 
void tcp_retransmit_first_unacked (tcp_connection_t *tc)
 Retansmit first unacked segment. More...
 
void tcp_fast_retransmit (tcp_connection_t *tc)
 
static u32 tcp_time_now (void)
 
u32 tcp_push_header (transport_connection_t *tconn, vlib_buffer_t *b)
 
u32 tcp_prepare_retransmit_segment (tcp_connection_t *tc, vlib_buffer_t *b, u32 max_bytes)
 Build a retransmit segment. More...
 
void tcp_connection_timers_init (tcp_connection_t *tc)
 Initialize all connection timers as invalid. More...
 
void tcp_connection_timers_reset (tcp_connection_t *tc)
 Stop all connection timers. More...
 
void tcp_connection_init_vars (tcp_connection_t *tc)
 Initialize tcp connection variables. More...
 
static void tcp_connection_force_ack (tcp_connection_t *tc, vlib_buffer_t *b)
 
static void tcp_timer_set (tcp_connection_t *tc, u8 timer_id, u32 interval)
 
static void tcp_retransmit_timer_set (tcp_connection_t *tc)
 
static void tcp_timer_reset (tcp_connection_t *tc, u8 timer_id)
 
static void tcp_timer_update (tcp_connection_t *tc, u8 timer_id, u32 interval)
 
static u8 tcp_timer_is_active (tcp_connection_t *tc, tcp_timers_e timer)
 
void scoreboard_remove_hole (sack_scoreboard_t *sb, sack_scoreboard_hole_t *hole)
 
static sack_scoreboard_hole_tscoreboard_next_hole (sack_scoreboard_t *sb, sack_scoreboard_hole_t *hole)
 
static sack_scoreboard_hole_tscoreboard_first_hole (sack_scoreboard_t *sb)
 
static void scoreboard_clear (sack_scoreboard_t *sb)
 
static u32 scoreboard_hole_bytes (sack_scoreboard_hole_t *hole)
 
static void tcp_cc_algo_register (tcp_cc_algorithm_type_e type, const tcp_cc_algorithm_t *vft)
 
static tcp_cc_algorithm_ttcp_cc_algo_get (tcp_cc_algorithm_type_e type)
 
void tcp_cc_init (tcp_connection_t *tc)
 
static void * vlib_buffer_push_tcp_net_order (vlib_buffer_t *b, u16 sp, u16 dp, u32 seq, u32 ack, u8 tcp_hdr_opts_len, u8 flags, u16 wnd)
 Push TCP header to buffer. More...
 
static void * vlib_buffer_push_tcp (vlib_buffer_t *b, u16 sp_net, u16 dp_net, u32 seq, u32 ack, u8 tcp_hdr_opts_len, u8 flags, u16 wnd)
 Push TCP header to buffer. More...
 

Variables

format_function_t format_tcp_state
 
timer_expiration_handler tcp_timer_delack_handler
 
timer_expiration_handler tcp_timer_retransmit_handler
 
timer_expiration_handler tcp_timer_retransmit_syn_handler
 
tcp_main_t tcp_main
 
vlib_node_registration_t tcp4_input_node
 (constructor) VLIB_REGISTER_NODE (tcp4_input_node) More...
 
vlib_node_registration_t tcp6_input_node
 (constructor) VLIB_REGISTER_NODE (tcp6_input_node) More...
 
vlib_node_registration_t tcp4_output_node
 (constructor) VLIB_REGISTER_NODE (tcp4_output_node) More...
 
vlib_node_registration_t tcp6_output_node
 (constructor) VLIB_REGISTER_NODE (tcp6_output_node) More...
 

Macro Definition Documentation

#define foreach_tcp_buf_flag
Value:
_ (ACK) /**< Sending ACK. */ \
_ (DUPACK)

TCP buffer flags.

Sending DUPACK.

Definition at line 130 of file tcp.h.

#define foreach_tcp_connection_flag
Value:
_(DELACK, "Delay ACK") \
_(SNDACK, "Send ACK") \
_(BURSTACK, "Burst ACK set") \
_(FINSNT, "FIN sent") \
_(SENT_RCV_WND0, "Sent 0 receive window") \
_(RECOVERY, "Recovery on") \
_(FAST_RECOVERY, "Fast Recovery on")

TCP connection flags.

Definition at line 104 of file tcp.h.

#define foreach_tcp_fsm_state
Value:
_(CLOSED, "CLOSED") \
_(LISTEN, "LISTEN") \
_(SYN_SENT, "SYN_SENT") \
_(SYN_RCVD, "SYN_RCVD") \
_(ESTABLISHED, "ESTABLISHED") \
_(CLOSE_WAIT, "CLOSE_WAIT") \
_(FIN_WAIT_1, "FIN_WAIT_1") \
_(LAST_ACK, "LAST_ACK") \
_(CLOSING, "CLOSING") \
_(FIN_WAIT_2, "FIN_WAIT_2") \
_(TIME_WAIT, "TIME_WAIT")

TCP FSM state definitions as per RFC793.

Definition at line 38 of file tcp.h.

#define foreach_tcp_timer
Value:
_(RETRANSMIT, "RETRANSMIT") \
_(DELACK, "DELAYED ACK") \
_(PERSIST, "PERSIST") \
_(KEEP, "KEEP") \
_(WAITCLOSE, "WAIT CLOSE") \
_(RETRANSMIT_SYN, "RETRANSMIT SYN") \
_(ESTABLISH, "ESTABLISH")

TCP timers.

Definition at line 62 of file tcp.h.

#define seq_geq (   _s1,
  _s2 
)    ((i32)((_s1)-(_s2)) >= 0)

Definition at line 392 of file tcp.h.

#define seq_gt (   _s1,
  _s2 
)    ((i32)((_s1)-(_s2)) > 0)

Definition at line 391 of file tcp.h.

#define seq_leq (   _s1,
  _s2 
)    ((i32)((_s1)-(_s2)) <= 0)

Definition at line 390 of file tcp.h.

#define seq_lt (   _s1,
  _s2 
)    ((i32)((_s1)-(_s2)) < 0)

Definition at line 389 of file tcp.h.

#define TCP_2MSL_TIME   300 /* 30s */

Definition at line 92 of file tcp.h.

#define TCP_CLEANUP_TIME   5 /* 0.5s Time to wait before cleanup */

Definition at line 94 of file tcp.h.

#define TCP_CLOSEWAIT_TIME   1 /* 0.1s */

Definition at line 93 of file tcp.h.

#define TCP_DELACK_TIME   1 /* 0.1s */

Definition at line 90 of file tcp.h.

#define TCP_DUPACK_THRESHOLD   3

Definition at line 33 of file tcp.h.

#define tcp_error (   n,
 
)    TCP_ERROR_##n,

Definition at line 266 of file tcp.h.

#define TCP_ESTABLISH_TIME   750 /* 75s */

Definition at line 91 of file tcp.h.

#define tcp_fastrecovery_off (   tc)    (tc)->flags &= ~TCP_CONN_FAST_RECOVERY

Definition at line 251 of file tcp.h.

#define tcp_fastrecovery_on (   tc)    (tc)->flags |= TCP_CONN_FAST_RECOVERY

Definition at line 250 of file tcp.h.

#define tcp_in_fastrecovery (   tc)    ((tc)->flags & TCP_CONN_FAST_RECOVERY)

Definition at line 252 of file tcp.h.

#define tcp_in_recovery (   tc)    ((tc)->flags & (TCP_CONN_FAST_RECOVERY | TCP_CONN_RECOVERY))

Definition at line 253 of file tcp.h.

#define tcp_in_slowstart (   tc)    (tc->cwnd < tc->ssthresh)

Definition at line 255 of file tcp.h.

#define TCP_INVALID_SACK_HOLE_INDEX   ((u32)~0)

Definition at line 151 of file tcp.h.

#define TCP_IW_N_SEGMENTS   10

Definition at line 35 of file tcp.h.

#define TCP_MAX_OPTION_SPACE   40

Definition at line 31 of file tcp.h.

#define TCP_MAX_RX_FIFO_SIZE   2 << 20

Definition at line 34 of file tcp.h.

#define TCP_MAX_SACK_BLOCKS   5

Max number of SACK blocks stored.

Definition at line 150 of file tcp.h.

#define TCP_PAWS_IDLE   24 * 24 * 60 * 60 * THZ

24 days

Definition at line 30 of file tcp.h.

#define tcp_recovery_off (   tc)    ((tc)->flags &= ~(TCP_CONN_FAST_RECOVERY | TCP_CONN_RECOVERY))

Definition at line 254 of file tcp.h.

#define TCP_RTO_INIT   1 * THZ /* Initial retransmit timer */

Definition at line 99 of file tcp.h.

#define TCP_RTO_MAX   60 * THZ /* Min max RTO (60s) as per RFC6298 */

Definition at line 96 of file tcp.h.

#define TCP_RTO_SYN_RETRIES   3 /* SYN retries without doubling RTO */

Definition at line 98 of file tcp.h.

#define TCP_RTT_MAX   30 * THZ /* 30s (probably too much) */

Definition at line 97 of file tcp.h.

#define TCP_TICK   10e-3

TCP tick period (s)

Definition at line 27 of file tcp.h.

#define TCP_TIMER_HANDLE_INVALID   ((u32) ~0)

Definition at line 85 of file tcp.h.

#define TCP_TO_TIMER_TICK
Value:
TCP_TICK*10 /* Period for converting from TCP
* ticks to timer units */
#define TCP_TICK
TCP tick period (s)
Definition: tcp.h:27

Definition at line 88 of file tcp.h.

#define TCP_TSTAMP_RESOLUTION   TCP_TICK

Time stamp resolution.

Definition at line 29 of file tcp.h.

#define THZ   1/TCP_TICK

TCP tick frequency.

Definition at line 28 of file tcp.h.

#define timestamp_leq (   _t1,
  _t2 
)    ((i32)((_t1)-(_t2)) <= 0)

Definition at line 396 of file tcp.h.

#define timestamp_lt (   _t1,
  _t2 
)    ((i32)((_t1)-(_t2)) < 0)

Definition at line 395 of file tcp.h.

Typedef Documentation

typedef struct _sack_scoreboard_hole sack_scoreboard_hole_t
typedef struct _sack_scoreboard sack_scoreboard_t
typedef enum _tcp_cc_ack_t tcp_cc_ack_t
typedef struct _tcp_cc_algorithm tcp_cc_algorithm_t

Definition at line 173 of file tcp.h.

typedef enum _tcp_cc_algorithm_type tcp_cc_algorithm_type_e
typedef enum _tcp_connection_flag_bits tcp_connection_flag_bits_e
typedef enum _tcp_connection_flag tcp_connection_flags_e
typedef struct _tcp_connection tcp_connection_t
typedef enum _tcp_error tcp_error_t
typedef struct _tcp_lookup_dispatch tcp_lookup_dispatch_t
typedef struct _tcp_main tcp_main_t
typedef enum _tcp_state tcp_state_t
typedef enum _tcp_timers tcp_timers_e
typedef void( timer_expiration_handler) (u32 index)

Definition at line 79 of file tcp.h.

Enumeration Type Documentation

anonymous enum
Enumerator
TCP_N_BUF_BITS 

Definition at line 135 of file tcp.h.

anonymous enum
Enumerator
foreach_tcp_buf_flag 

Definition at line 143 of file tcp.h.

enum tcp_af_t
Enumerator
TCP_IP4 
TCP_IP6 
TCP_N_AF 

Definition at line 257 of file tcp.h.

Function Documentation

u8* format_tcp_connection ( u8 s,
va_list *  args 
)

Definition at line 482 of file tcp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_tcp_connection_verbose ( u8 s,
va_list *  args 
)

Definition at line 505 of file tcp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void scoreboard_clear ( sack_scoreboard_t sb)
inlinestatic

Definition at line 537 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static sack_scoreboard_hole_t* scoreboard_first_hole ( sack_scoreboard_t sb)
inlinestatic

Definition at line 529 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 scoreboard_hole_bytes ( sack_scoreboard_hole_t hole)
inlinestatic

Definition at line 547 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static sack_scoreboard_hole_t* scoreboard_next_hole ( sack_scoreboard_t sb,
sack_scoreboard_hole_t hole 
)
inlinestatic

Definition at line 521 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void scoreboard_remove_hole ( sack_scoreboard_t sb,
sack_scoreboard_hole_t hole 
)

Definition at line 408 of file tcp_input.c.

+ Here is the caller graph for this function:

static u32 tcp_available_snd_space ( const tcp_connection_t tc)
inlinestatic

Definition at line 432 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 tcp_available_wnd ( const tcp_connection_t tc)
inlinestatic

Definition at line 426 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static tcp_cc_algorithm_t* tcp_cc_algo_get ( tcp_cc_algorithm_type_e  type)
inlinestatic

Definition at line 563 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void tcp_cc_algo_register ( tcp_cc_algorithm_type_e  type,
const tcp_cc_algorithm_t vft 
)
inlinestatic

Definition at line 553 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void tcp_cc_init ( tcp_connection_t tc)

Definition at line 679 of file tcp_input.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void tcp_connection_cleanup ( tcp_connection_t tc)

Cleans up connection state.

No notifications.

Definition at line 99 of file tcp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void tcp_connection_close ( tcp_connection_t tc)

Begin connection closing procedure.

If at the end the connection is not in CLOSED state, it is not removed. Instead, we rely on on TCP to advance through state machine to either 1) LAST_ACK (passive close) whereby when the last ACK is received tcp_connection_del is called. This notifies session of the delete and calls cleanup. 2) TIME_WAIT (active close) whereby after 2MSL the 2MSL timer triggers and cleanup is called.

N.B. Half-close connections are not supported

Definition at line 170 of file tcp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void tcp_connection_del ( tcp_connection_t tc)

Connection removal.

This should be called only once connection enters CLOSED state. Note that it notifies the session of the removal event, so if the goal is to just remove the connection, call tcp_connection_cleanup instead.

Definition at line 135 of file tcp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void tcp_connection_force_ack ( tcp_connection_t tc,
vlib_buffer_t b 
)
inlinestatic

Definition at line 465 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static tcp_connection_t* tcp_connection_get ( u32  conn_index,
u32  thread_index 
)
inlinestatic

Definition at line 337 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static tcp_connection_t* tcp_connection_get_if_valid ( u32  conn_index,
u32  thread_index 
)
inlinestatic

Definition at line 345 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void tcp_connection_init_vars ( tcp_connection_t tc)

Initialize tcp connection variables.

Should be called after having received a msg from the peer, i.e., a SYN or a SYNACK, such that connection options have already been exchanged.

Definition at line 327 of file tcp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void tcp_connection_reset ( tcp_connection_t tc)

Notify session that connection has been reset.

Switch state to closed and wait for session to call cleanup.

Definition at line 147 of file tcp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void tcp_connection_timers_init ( tcp_connection_t tc)

Initialize all connection timers as invalid.

Definition at line 296 of file tcp.c.

+ Here is the caller graph for this function:

void tcp_connection_timers_reset ( tcp_connection_t tc)

Stop all connection timers.

Definition at line 313 of file tcp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 tcp_end_seq ( tcp_header_t th,
u32  len 
)
inlinestatic

Definition at line 383 of file tcp.h.

+ Here is the caller graph for this function:

void tcp_fast_retransmit ( tcp_connection_t tc)

Definition at line 1098 of file tcp_output.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 tcp_flight_size ( const tcp_connection_t tc)
inlinestatic

Definition at line 399 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static tcp_connection_t* tcp_half_open_connection_get ( u32  conn_index)
inlinestatic

Definition at line 369 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 tcp_initial_cwnd ( const tcp_connection_t tc)
inlinestatic

Initial cwnd as per RFC5681.

Definition at line 409 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static tcp_connection_t* tcp_listener_get ( u32  tli)
inlinestatic

Definition at line 363 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 tcp_loss_wnd ( const tcp_connection_t tc)
inlinestatic

Definition at line 420 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void tcp_make_ack ( tcp_connection_t ts,
vlib_buffer_t b 
)

Convert buffer to ACK.

Definition at line 433 of file tcp_output.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void tcp_make_fin ( tcp_connection_t tc,
vlib_buffer_t b 
)

Convert buffer to FIN-ACK.

Definition at line 447 of file tcp_output.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void tcp_make_synack ( tcp_connection_t ts,
vlib_buffer_t b 
)

Convert buffer to SYN-ACK.

Definition at line 468 of file tcp_output.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 tcp_prepare_retransmit_segment ( tcp_connection_t tc,
vlib_buffer_t b,
u32  max_bytes 
)

Build a retransmit segment.

Returns
the number of bytes in the segment or 0 if there's nothing to retransmit

Definition at line 922 of file tcp_output.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 tcp_push_header ( transport_connection_t tconn,
vlib_buffer_t b 
)

Definition at line 1336 of file tcp_output.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void tcp_retransmit_first_unacked ( tcp_connection_t tc)

Retansmit first unacked segment.

Definition at line 1077 of file tcp_output.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void tcp_retransmit_timer_set ( tcp_connection_t tc)
inlinestatic

Definition at line 481 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void tcp_send_fin ( tcp_connection_t tc)

Send FIN.

Definition at line 811 of file tcp_output.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void tcp_send_reset ( vlib_buffer_t pkt,
u8  is_ip4 
)

Send reset without reusing existing buffer.

Definition at line 629 of file tcp_output.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void tcp_send_syn ( tcp_connection_t tc)

Send SYN.

Builds a SYN packet for a half-open connection and sends it to ipx_lookup. The packet is not forwarded through tcpx_output to avoid doing lookups in the half_open pool.

Definition at line 734 of file tcp_output.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void tcp_set_snd_mss ( tcp_connection_t tc)

Definition at line 64 of file tcp_output.c.

+ Here is the caller graph for this function:

static u32 tcp_time_now ( void  )
inlinestatic

Definition at line 448 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u8 tcp_timer_is_active ( tcp_connection_t tc,
tcp_timers_e  timer 
)
inlinestatic

Definition at line 511 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void tcp_timer_reset ( tcp_connection_t tc,
u8  timer_id 
)
inlinestatic

Definition at line 489 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void tcp_timer_set ( tcp_connection_t tc,
u8  timer_id,
u32  interval 
)
inlinestatic

Definition at line 473 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void tcp_timer_update ( tcp_connection_t tc,
u8  timer_id,
u32  interval 
)
inlinestatic

Definition at line 500 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void tcp_update_time ( f64  now,
u32  thread_index 
)

Definition at line 2265 of file tcp_input.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vlib_buffer_push_tcp ( vlib_buffer_t b,
u16  sp_net,
u16  dp_net,
u32  seq,
u32  ack,
u8  tcp_hdr_opts_len,
u8  flags,
u16  wnd 
)
inlinestatic

Push TCP header to buffer.

Parameters
b- buffer to write the header to
sp_net- source port net order
dp_net- destination port net order
seq- sequence number host order
ack- ack number host order
tcp_hdr_opts_len- header and options length in bytes
flags- header flags
wnd- window size
Returns
- pointer to start of TCP header

Definition at line 622 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vlib_buffer_push_tcp_net_order ( vlib_buffer_t b,
u16  sp,
u16  dp,
u32  seq,
u32  ack,
u8  tcp_hdr_opts_len,
u8  flags,
u16  wnd 
)
inlinestatic

Push TCP header to buffer.

Parameters
vm- vlib_main
b- buffer to write the header to
sp_net- source port net order
dp_net- destination port net order
seq- sequence number net order
ack- ack number net order
tcp_hdr_opts_len- header and options length in bytes
flags- header flags
wnd- window size
Returns
- pointer to start of TCP header

Definition at line 587 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static tcp_main_t* vnet_get_tcp_main ( )
inlinestatic

Definition at line 329 of file tcp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* vnet_tcp_enable_disable ( vlib_main_t vm,
u8  is_en 
)

Definition at line 780 of file tcp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

format_function_t format_tcp_state

Definition at line 59 of file tcp.h.

vlib_node_registration_t tcp4_input_node
Initial value:
=
{
.function = tcp4_input,
.name = "tcp4-input",
.vector_size = sizeof (u32),
.n_errors = TCP_N_ERROR,
.error_strings = tcp_error_strings,
.n_next_nodes = TCP_INPUT_N_NEXT,
.next_nodes =
{
#define _(s,n)
},
.format_buffer = format_tcp_header,
.format_trace = format_tcp_rx_trace,
}
u8 * format_tcp_rx_trace(u8 *s, va_list *args)
Definition: tcp_input.c:2077
#define foreach_tcp4_input_next
Definition: tcp_input.c:2053
format_function_t format_tcp_header
Definition: format.h:102
unsigned int u32
Definition: types.h:88
static uword tcp4_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Definition: tcp_input.c:2206
static char * tcp_error_strings[]
Definition: tcp_input.c:22

(constructor) VLIB_REGISTER_NODE (tcp4_input_node)

Definition at line 2220 of file tcp_input.c.

vlib_node_registration_t tcp4_output_node
Initial value:
=
{
.function = tcp4_output,.name = "tcp4-output",
.vector_size = sizeof (u32),
.n_errors = TCP_N_ERROR,
.error_strings = tcp_error_strings,
.n_next_nodes = TCP_OUTPUT_N_NEXT,
.next_nodes = {
#define _(s,n)
},
.format_buffer = format_tcp_header,
.format_trace = format_tcp_tx_trace,
}
u8 * format_tcp_tx_trace(u8 *s, va_list *args)
Definition: tcp_output.c:53
#define foreach_tcp4_output_next
Definition: tcp_output.c:29
format_function_t format_tcp_header
Definition: format.h:102
unsigned int u32
Definition: types.h:88
static uword tcp4_output(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Definition: tcp_output.c:1279
static char * tcp_error_strings[]
Definition: tcp_input.c:22

(constructor) VLIB_REGISTER_NODE (tcp4_output_node)

Definition at line 1293 of file tcp_output.c.

vlib_node_registration_t tcp6_input_node
Initial value:
=
{
.function = tcp6_input,
.name = "tcp6-input",
.vector_size = sizeof (u32),
.n_errors = TCP_N_ERROR,
.error_strings = tcp_error_strings,
.n_next_nodes = TCP_INPUT_N_NEXT,
.next_nodes =
{
#define _(s,n)
},
.format_buffer = format_tcp_header,
.format_trace = format_tcp_rx_trace,
}
static uword tcp6_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Definition: tcp_input.c:2213
u8 * format_tcp_rx_trace(u8 *s, va_list *args)
Definition: tcp_input.c:2077
#define foreach_tcp6_input_next
Definition: tcp_input.c:2061
format_function_t format_tcp_header
Definition: format.h:102
unsigned int u32
Definition: types.h:88
static char * tcp_error_strings[]
Definition: tcp_input.c:22

(constructor) VLIB_REGISTER_NODE (tcp6_input_node)

Definition at line 2243 of file tcp_input.c.

vlib_node_registration_t tcp6_output_node
Initial value:
=
{
.function = tcp6_output,
.name = "tcp6-output",
.vector_size = sizeof (u32),
.n_errors = TCP_N_ERROR,
.error_strings = tcp_error_strings,
.n_next_nodes = TCP_OUTPUT_N_NEXT,
.next_nodes = {
#define _(s,n)
},
.format_buffer = format_tcp_header,
.format_trace = format_tcp_tx_trace,
}
u8 * format_tcp_tx_trace(u8 *s, va_list *args)
Definition: tcp_output.c:53
#define foreach_tcp6_output_next
Definition: tcp_output.c:33
format_function_t format_tcp_header
Definition: format.h:102
unsigned int u32
Definition: types.h:88
static uword tcp6_output(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Definition: tcp_output.c:1286
static char * tcp_error_strings[]
Definition: tcp_input.c:22

(constructor) VLIB_REGISTER_NODE (tcp6_output_node)

Definition at line 1314 of file tcp_output.c.

tcp_main_t tcp_main

Definition at line 21 of file tcp.c.

timer_expiration_handler tcp_timer_delack_handler
timer_expiration_handler tcp_timer_retransmit_handler
timer_expiration_handler tcp_timer_retransmit_syn_handler