22 typedef enum _tcp_output_nect
28 #define foreach_tcp4_output_next \ 29 _ (DROP, "error-drop") \ 31 #define foreach_tcp6_output_next \ 32 _ (DROP, "error-drop") \ 35 #define tcp_error(n,s) s, 109 if (state < TCP_STATE_ESTABLISHED)
114 if (tc->rcv_wnd == 0)
116 tc->flags |= TCP_CONN_SENT_RCV_WND0;
120 tc->flags &= ~TCP_CONN_SENT_RCV_WND0;
123 return tc->rcv_wnd >> tc->rcv_wscale;
130 u32 available_space, max_fifo, wnd;
138 ASSERT (tc->rcv_opts.mss < max_fifo);
139 if (available_space < tc->rcv_opts.mss && available_space < max_fifo >> 3)
146 observed_wnd = (
i32) tc->rcv_wnd - (tc->rcv_nxt - tc->rcv_las);
147 if (observed_wnd < 0)
151 if (available_space < observed_wnd)
154 TCP_EVT_DBG (TCP_EVT_RCV_WND_SHRUNK, tc, observed_wnd, available_space);
158 wnd = available_space;
162 if (wnd && tc->rcv_wscale)
164 wnd &= ~(1 << tc->rcv_wscale);
166 wnd = 1 << tc->rcv_wscale;
179 u32 buf, seq_len = 4;
185 buf = clib_host_to_net_u16 (opts->
mss);
187 data +=
sizeof (opts->
mss);
210 buf = clib_host_to_net_u32 (opts->
tsval);
212 data +=
sizeof (opts->
tsval);
213 buf = clib_host_to_net_u32 (opts->
tsecr);
215 data +=
sizeof (opts->
tsecr);
225 if (n_sack_blocks != 0)
229 for (i = 0; i < n_sack_blocks; i++)
231 buf = clib_host_to_net_u32 (opts->
sacks[i].start);
234 buf = clib_host_to_net_u32 (opts->
sacks[i].end);
263 opts->
flags |= TCP_OPTS_FLAG_MSS;
267 opts->
flags |= TCP_OPTS_FLAG_WSCALE;
271 opts->
flags |= TCP_OPTS_FLAG_TSTAMP;
278 opts->
flags |= TCP_OPTS_FLAG_SACK_PERMITTED;
292 opts->
flags |= TCP_OPTS_FLAG_MSS;
298 opts->
flags |= TCP_OPTS_FLAG_WSCALE;
299 opts->
wscale = tc->rcv_wscale;
305 opts->
flags |= TCP_OPTS_FLAG_TSTAMP;
307 opts->
tsecr = tc->tsval_recent;
313 opts->
flags |= TCP_OPTS_FLAG_SACK_PERMITTED;
331 opts->
flags |= TCP_OPTS_FLAG_TSTAMP;
333 opts->
tsecr = tc->tsval_recent;
340 opts->
flags |= TCP_OPTS_FLAG_SACK;
341 opts->
sacks = tc->snd_sacks;
359 case TCP_STATE_ESTABLISHED:
360 case TCP_STATE_FIN_WAIT_1:
362 case TCP_STATE_SYN_RCVD:
364 case TCP_STATE_SYN_SENT:
398 tc->snd_mss =
clib_min (tc->mss, tc->rcv_opts.mss) - tc->snd_opts_len;
405 u16 default_min_mss = 536;
409 tc->snd_mss =
clib_min (tc->rcv_opts.mss, tc->mss);
411 if (tc->snd_mss < 45)
415 tc->snd_mss = default_min_mss;
416 tc->rcv_opts.mss = default_min_mss;
420 ASSERT (tc->snd_mss > 45);
427 #define tcp_get_free_buffer_index(tm, bidx) \ 429 u32 *my_tx_buffers, n_free_buffers; \ 430 u32 thread_index = vlib_get_thread_index(); \ 431 my_tx_buffers = tm->tx_buffers[thread_index]; \ 432 if (PREDICT_FALSE(vec_len (my_tx_buffers) == 0)) \ 434 n_free_buffers = 32; \ 435 vec_validate (my_tx_buffers, n_free_buffers - 1); \ 436 _vec_len(my_tx_buffers) = vlib_buffer_alloc_from_free_list ( \ 437 tm->vlib_main, my_tx_buffers, n_free_buffers, \ 438 VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX); \ 439 tm->tx_buffers[thread_index] = my_tx_buffers; \ 442 if (PREDICT_FALSE (vec_len (my_tx_buffers) == 0)) \ 444 *bidx = my_tx_buffers[_vec_len (my_tx_buffers)-1]; \ 445 _vec_len (my_tx_buffers) -= 1; \ 448 #define tcp_return_buffer(tm) \ 450 u32 *my_tx_buffers; \ 451 u32 thread_index = vlib_get_thread_index(); \ 452 my_tx_buffers = tm->tx_buffers[thread_index]; \ 453 _vec_len (my_tx_buffers) +=1; \ 482 u8 tcp_opts_len, tcp_hdr_opts_len;
490 tcp_hdr_opts_len = tcp_opts_len +
sizeof (
tcp_header_t);
493 tc->rcv_nxt, tcp_hdr_opts_len, flags, wnd);
496 vnet_buffer (b)->tcp.connection_index = tc->c_c_index;
511 tc->rcv_las = tc->rcv_nxt;
529 vnet_buffer (b)->tcp.flags &= ~TCP_BUF_FLAG_DUPACK;
542 u8 tcp_opts_len, tcp_hdr_opts_len;
547 memset (snd_opts, 0,
sizeof (*snd_opts));
555 tc->snd_una = tc->iss;
556 tc->snd_nxt = tc->iss + 1;
557 tc->snd_una_max = tc->snd_nxt;
563 tcp_hdr_opts_len = tcp_opts_len +
sizeof (
tcp_header_t);
566 tc->rcv_nxt, tcp_hdr_opts_len,
571 vnet_buffer (b)->tcp.connection_index = tc->c_c_index;
582 u32 *to_next, next_index;
611 u16 src_port, dst_port;
635 src_port = th0->src_port;
636 dst_port = th0->dst_port;
639 if (state == TCP_STATE_CLOSED)
644 tmp = clib_net_to_host_u32 (th0->seq_number);
648 ack = clib_host_to_net_u32 (tmp + 1);
654 seq = th0->ack_number;
719 seq = pkt_th->ack_number;
726 ack = clib_host_to_net_u32 (
vnet_buffer (pkt)->tcp.seq_end);
730 seq, ack, tcp_hdr_len, flags, 0);
765 &tc->c_rmt_ip4, IP_PROTOCOL_TCP);
774 &tc->c_rmt_ip6, IP_PROTOCOL_TCP);
795 u8 tcp_hdr_opts_len, tcp_opts_len;
811 tc->snd_una = tc->iss;
812 tc->snd_una_max = tc->snd_nxt = tc->iss + 1;
817 memset (&snd_opts, 0,
sizeof (snd_opts));
819 tcp_hdr_opts_len = tcp_opts_len +
sizeof (
tcp_header_t);
829 tc->rtt_seq = tc->snd_nxt;
845 u32 *to_next, next_index;
881 tc->flags |= TCP_CONN_FINSNT;
891 case TCP_STATE_ESTABLISHED:
893 case TCP_STATE_SYN_RCVD:
895 case TCP_STATE_SYN_SENT:
897 case TCP_STATE_LAST_ACK:
898 case TCP_STATE_FIN_WAIT_1:
913 u32 advertise_wnd, data_len;
914 u8 tcp_hdr_opts_len, opts_write_len,
flags;
923 tcp_hdr_opts_len = tc->snd_opts_len +
sizeof (
tcp_header_t);
929 tc->rcv_nxt, tcp_hdr_opts_len, flags,
933 ASSERT (opts_write_len == tc->snd_opts_len);
934 vnet_buffer (b)->tcp.connection_index = tc->c_c_index;
940 tc->snd_nxt += data_len;
941 tc->rcv_las = tc->rcv_nxt;
944 if (
seq_gt (tc->snd_nxt, tc->snd_una_max))
946 tc->snd_una_max = tc->snd_nxt;
998 ASSERT (tc->state >= TCP_STATE_ESTABLISHED);
1001 max_bytes =
clib_min (tc->snd_mss, max_bytes);
1002 start = tc->snd_una +
offset;
1005 if (
seq_geq (start, tc->snd_congestion))
1009 if (
seq_gt (start + max_bytes, tc->snd_congestion))
1011 max_bytes = tc->snd_congestion - start;
1018 ASSERT (max_bytes <= tc->snd_mss);
1028 tc->snd_rxt_bytes += n_bytes;
1031 TCP_EVT_DBG (TCP_EVT_CC_RTX, tc, offset, n_bytes);
1041 tc->prev_ssthresh = tc->ssthresh;
1042 tc->prev_cwnd = tc->cwnd;
1051 tc->snd_congestion = tc->snd_una_max;
1079 && tc->state >= TCP_STATE_ESTABLISHED)
1089 tc->snd_nxt = tc->snd_una;
1094 if (tc->state >= TCP_STATE_ESTABLISHED)
1097 if (tc->flags & TCP_CONN_FINSNT)
1104 if (tc->rto_boff == 1)
1124 ASSERT (0 || (tc->rto_boff > 1
1125 && tc->snd_una == tc->snd_congestion));
1130 if (tc->rto_boff == 1)
1134 else if (tc->state == TCP_STATE_SYN_RCVD || tc->state == TCP_STATE_SYN_SENT)
1150 ASSERT (tc->state == TCP_STATE_CLOSED);
1164 ASSERT (tc->state == TCP_STATE_SYN_SENT);
1202 u32 bi, old_snd_nxt;
1214 if (tc->state == TCP_STATE_CLOSED || tc->state > TCP_STATE_ESTABLISHED
1230 tc->snd_una_max - tc->snd_una,
1241 ASSERT (tc->snd_nxt == tc->snd_una_max || tc->rto_boff > 1
1245 old_snd_nxt = tc->snd_nxt;
1247 tc->snd_nxt = old_snd_nxt;
1263 u32 bi, n_bytes, old_snd_nxt;
1265 old_snd_nxt = tc->snd_nxt;
1266 tc->snd_nxt = tc->snd_una;
1284 tc->snd_nxt = old_snd_nxt;
1295 u32 n_written = 0,
offset = 0, max_bytes;
1299 u32 bi, old_snd_nxt;
1301 u8 snd_limited = 0, can_rescue = 0;
1306 old_snd_nxt = tc->snd_nxt;
1311 while (hole && snd_space > 0)
1318 &can_rescue, &snd_limited);
1321 if (!can_rescue || !(
seq_lt (sb->rescue_rxt, tc->snd_una)
1322 ||
seq_gt (sb->rescue_rxt,
1323 tc->snd_congestion)))
1331 max_bytes =
clib_min (tc->snd_mss, snd_space);
1332 offset = tc->snd_congestion - tc->snd_una - max_bytes;
1333 sb->rescue_rxt = tc->snd_congestion;
1334 tc->snd_nxt = tc->snd_una +
offset;
1340 max_bytes = snd_limited ? tc->snd_mss : hole->end - sb->high_rxt;
1341 offset = sb->high_rxt - tc->snd_una;
1342 tc->snd_nxt = tc->snd_una +
offset;
1352 sb->high_rxt += n_written;
1354 snd_space -= n_written;
1358 tc->snd_nxt = old_snd_nxt;
1369 u32 n_written = 0,
offset = 0, bi, old_snd_nxt;
1377 old_snd_nxt = tc->snd_nxt;
1378 tc->snd_nxt = tc->snd_una;
1381 while (snd_space > 0)
1397 snd_space -= n_written;
1401 tc->snd_nxt = old_snd_nxt;
1430 u32 n_left_from, next_index, *from, *to_next;
1438 while (n_left_from > 0)
1444 while (n_left_from > 0 && n_left_to_next > 0)
1458 n_left_to_next -= 1;
1463 if (
PREDICT_FALSE (tc0 == 0 || tc0->state == TCP_STATE_CLOSED))
1465 error0 = TCP_ERROR_INVALID_CONNECTION;
1477 &tc0->c_rmt_ip4, IP_PROTOCOL_TCP);
1486 &tc0->c_rmt_ip6, IP_PROTOCOL_TCP);
1494 (
vnet_buffer (b0)->tcp.flags & TCP_BUF_FLAG_DUPACK))
1498 error0 = TCP_ERROR_FILTERED_DUPACKS;
1505 tc0->flags &= ~(TCP_CONN_SNDACK);
1511 if (
seq_lt (tc0->snd_una_max, tc0->snd_nxt))
1513 tc0->snd_una_max = tc0->snd_nxt;
1514 if (tc0->rtt_ts == 0)
1517 tc0->rtt_seq = tc0->snd_nxt;
1524 && tc0->snd_nxt != tc0->snd_una)
1537 tc0->last_fib_check = tc0->snd_opts.tsval;
1548 next0 = tc0->c_rmt_dpo.dpoi_next_node;
1570 n_left_to_next, bi0, next0);
1598 .vector_size =
sizeof (
u32),
1603 #define _(s,n) [TCP_OUTPUT_NEXT_##s] = n, 1618 .name =
"tcp6-output",
1620 .vector_size =
sizeof (
u32),
1625 #define _(s,n) [TCP_OUTPUT_NEXT_##s] = n, 1647 tc->rtt_seq = tc->snd_nxt;
1652 typedef enum _tcp_reset_next
1659 #define foreach_tcp4_reset_next \ 1660 _(DROP, "error-drop") \ 1661 _(IP_LOOKUP, "ip4-lookup") 1663 #define foreach_tcp6_reset_next \ 1664 _(DROP, "error-drop") \ 1665 _(IP_LOOKUP, "ip6-lookup") 1671 u32 n_left_from, next_index, *from, *to_next;
1679 while (n_left_from > 0)
1685 while (n_left_from > 0 && n_left_to_next > 0)
1698 n_left_to_next -= 1;
1703 my_thread_index, is_ip4))
1705 error0 = TCP_ERROR_LOOKUP_DROPS;
1729 n_left_to_next, bi0, next0);
1753 .name =
"tcp4-reset",
1754 .vector_size =
sizeof (
u32),
1759 #define _(s,n) [TCP_RESET_NEXT_##s] = n, 1772 .name =
"tcp6-reset",
1773 .vector_size =
sizeof (
u32),
1778 #define _(s,n) [TCP_RESET_NEXT_##s] = n, void tcp_make_fin(tcp_connection_t *tc, vlib_buffer_t *b)
Convert buffer to FIN-ACK.
#define TCP_IW_N_SEGMENTS
#define tcp_in_cong_recovery(tc)
#define TCP_FIB_RECHECK_PERIOD
Recheck every 1s.
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
sll srl srl sll sra u16x4 i
#define TCP_OPTION_LEN_EOL
static void tcp_enqueue_to_ip_lookup(vlib_main_t *vm, vlib_buffer_t *b, u32 bi, u8 is_ip4)
#define tcp_in_recovery(tc)
static void tcp_retransmit_timer_set(tcp_connection_t *tc)
#define TCP_OPTION_LEN_SACK_PERMITTED
void tcp_timer_retransmit_handler(u32 index)
struct _transport_connection transport_connection_t
#define TCP_TO_TIMER_TICK
fib_node_index_t tcp_lookup_rmt_in_fib(tcp_connection_t *tc)
static u8 svm_fifo_has_ooo_data(svm_fifo_t *f)
#define tcp_opts_tstamp(_to)
static uword tcp4_send_reset(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
void tcp_make_synack(tcp_connection_t *tc, vlib_buffer_t *b)
Convert buffer to SYN-ACK.
static void tcp_enqueue_to_output(vlib_main_t *vm, vlib_buffer_t *b, u32 bi, u8 is_ip4)
#define tcp_return_buffer(tm)
static tcp_connection_t * tcp_connection_get_if_valid(u32 conn_index, u32 thread_index)
static int tcp_make_syn_options(tcp_options_t *opts, u8 wnd_scale)
struct _sack_scoreboard sack_scoreboard_t
static tcp_connection_t * tcp_half_open_connection_get(u32 conn_index)
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
void tcp_update_rcv_mss(tcp_connection_t *tc)
Update max segment size we're able to process.
struct _tcp_main tcp_main_t
static u32 tcp_initial_wnd_unscaled(tcp_connection_t *tc)
TCP's IW as recommended by RFC6928.
struct _vlib_node_registration vlib_node_registration_t
static u32 tcp_session_has_ooo_data(tcp_connection_t *tc)
struct _tcp_connection tcp_connection_t
#define tcp_get_free_buffer_index(tm, bidx)
#define tcp_opts_sack(_to)
void tcp_make_ack_i(tcp_connection_t *tc, vlib_buffer_t *b, tcp_state_t state, u8 flags)
Prepare ACK.
static void scoreboard_clear(sack_scoreboard_t *sb)
static uword tcp46_send_reset_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, u8 is_ip4)
vlib_error_t * errors
Vector of errors for this node.
int tcp_make_reset_in_place(vlib_main_t *vm, vlib_buffer_t *b0, tcp_state_t state, u8 thread_index, u8 is_ip4)
u8 n_sack_blocks
Number of SACKs blocks.
struct _tcp_header tcp_header_t
static u32 tcp_available_snd_space(const tcp_connection_t *tc)
static u32 stream_session_max_rx_enqueue(transport_connection_t *tc)
struct _sack_scoreboard_hole sack_scoreboard_hole_t
u8 wscale
Window scale advertised.
static void tcp_reuse_buffer(vlib_main_t *vm, vlib_buffer_t *b)
#define TCP_OPTS_MAX_SACK_BLOCKS
#define TCP_MAX_RX_FIFO_SIZE
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
struct _stream_session_t stream_session_t
static void tcp_timer_retransmit_handler_i(u32 index, u8 is_syn)
#define foreach_tcp4_reset_next
#define VLIB_BUFFER_NEXT_PRESENT
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
void tcp_push_ip_hdr(tcp_main_t *tm, tcp_connection_t *tc, vlib_buffer_t *b)
#define TCP_OPTION_LEN_SACK_BLOCK
static tcp_header_t * tcp_buffer_hdr(vlib_buffer_t *b)
u8 * format_tcp_tx_trace(u8 *s, va_list *args)
enum _tcp_state tcp_state_t
void tcp_fast_retransmit_no_sack(tcp_connection_t *tc)
Fast retransmit without SACK info.
static void * ip4_next_header(ip4_header_t *i)
static u32 tcp_time_now(void)
sack_block_t * sacks
SACK blocks.
#define TCP_ESTABLISH_TIME
sack_scoreboard_hole_t * scoreboard_next_rxt_hole(sack_scoreboard_t *sb, sack_scoreboard_hole_t *start, u8 have_sent_1_smss, u8 *can_rescue, u8 *snd_limited)
Figure out the next hole to retransmit.
#define tcp_validate_txf_size(_tc, _a)
#define TCP_EVT_DBG(_evt, _args...)
static void tcp_timer_set(tcp_connection_t *tc, u8 timer_id, u32 interval)
#define TCP_OPTION_LEN_WINDOW_SCALE
vlib_node_registration_t tcp6_reset_node
(constructor) VLIB_REGISTER_NODE (tcp6_reset_node)
#define TCP_RTO_SYN_RETRIES
static int tcp_make_synack_options(tcp_connection_t *tc, tcp_options_t *opts)
u16 current_length
Nbytes between current data and the end of this buffer.
static void tcp_push_hdr_i(tcp_connection_t *tc, vlib_buffer_t *b, tcp_state_t next_state, u8 compute_opts)
Push TCP header and update connection variables.
static void * vlib_buffer_make_headroom(vlib_buffer_t *b, u8 size)
Make head room, typically for packet headers.
#define tcp_in_fastrecovery(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.
#define tcp_opts_mss(_to)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define TCP_TIMER_HANDLE_INVALID
#define foreach_tcp6_output_next
static u32 tcp_flight_size(const tcp_connection_t *tc)
Our estimate of the number of bytes in flight (pipe size)
static void * vlib_buffer_push_ip4(vlib_main_t *vm, vlib_buffer_t *b, ip4_address_t *src, ip4_address_t *dst, int proto)
Push IPv4 header to buffer.
void tcp_fast_retransmit(tcp_connection_t *tc)
Do fast retransmit.
static void tcp_rtx_timeout_cc(tcp_connection_t *tc)
Reset congestion control, switch cwnd to loss window and try again.
void tcp_timer_retransmit_syn_handler(u32 index)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
#define TCP_OPTION_LEN_TIMESTAMP
#define foreach_tcp4_output_next
vlib_error_t error
Error code for buffers to be enqueued to error handler.
void tcp_make_ack(tcp_connection_t *tc, vlib_buffer_t *b)
Convert buffer to ACK.
#define TCP_MAX_WND_SCALE
static void tcp_timer_reset(tcp_connection_t *tc, u8 timer_id)
static sack_scoreboard_hole_t * scoreboard_first_hole(sack_scoreboard_t *sb)
#define tcp_fastrecovery_sent_1_smss(tc)
u32 tcp_prepare_retransmit_segment(tcp_connection_t *tc, vlib_buffer_t *b, u32 offset, u32 max_bytes)
Build a retransmit segment.
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.
#define VNET_BUFFER_LOCALLY_ORIGINATED
static_always_inline uword vlib_get_thread_index(void)
enum _tcp_output_nect tcp_output_next_t
#define clib_warning(format, args...)
#define VLIB_BUFFER_IS_TRACED
#define clib_memcpy(a, b, c)
#define TCP_USE_SACKS
Disable only for testing.
#define tcp_recovery_on(tc)
u16 mss
Option flags, see above.
static void * ip6_next_header(ip6_header_t *i)
u16 ip6_tcp_udp_icmp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip6_header_t *ip0, int *bogus_lengthp)
vlib_node_registration_t ip6_lookup_node
(constructor) VLIB_REGISTER_NODE (ip6_lookup_node)
static int tcp_make_established_options(tcp_connection_t *tc, tcp_options_t *opts)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static uword tcp6_output(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
u16 ip4_tcp_udp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip4_header_t *ip0)
u32 tcp_push_header(transport_connection_t *tconn, vlib_buffer_t *b)
#define seq_geq(_s1, _s2)
u32 tcp_window_to_advertise(tcp_connection_t *tc, tcp_state_t state)
Compute and return window to advertise, scaled as per RFC1323.
vhost_vring_state_t state
void tcp_retransmit_first_unacked(tcp_connection_t *tc)
Retransmit first unacked segment.
u32 next_buffer
Next buffer for this linked-list of buffers.
void tcp_init_mss(tcp_connection_t *tc)
static uword tcp6_send_reset(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static uword tcp46_output_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, int is_ip4)
static u8 tcp_make_state_flags(tcp_state_t next_state)
void tcp_send_fin(tcp_connection_t *tc)
Send FIN.
static u8 tcp_window_compute_scale(u32 available_space)
static vlib_main_t * vlib_get_main(void)
VLIB_NODE_FUNCTION_MULTIARCH(tcp4_output_node, tcp4_output)
void tcp_send_ack(tcp_connection_t *tc)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
u32 total_length_not_including_first_buffer
Only valid for first buffer in chain.
template key/value backing page structure
#define tcp_opts_wscale(_to)
static sack_scoreboard_hole_t * scoreboard_get_hole(sack_scoreboard_t *sb, u32 index)
void tcp_connection_reset(tcp_connection_t *tc)
Notify session that connection has been reset.
u32 tsval
Timestamp value.
u32 tsecr
Echoed/reflected time stamp.
static void * vlib_buffer_push_ip6(vlib_main_t *vm, vlib_buffer_t *b, ip6_address_t *src, ip6_address_t *dst, int proto)
Push IPv6 header to buffer.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define foreach_tcp6_reset_next
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
void tcp_timer_delack_handler(u32 index)
#define TCP_OPTION_LEN_MSS
void tcp_update_snd_mss(tcp_connection_t *tc)
Update snd_mss to reflect the effective segment size that we can send by taking into account all TCP ...
struct clib_bihash_value offset
template key/value backing page structure
static void tcp_retransmit_timer_force_update(tcp_connection_t *tc)
u8 * format_tcp_connection(u8 *s, va_list *args)
u32 tcp_initial_window_to_advertise(tcp_connection_t *tc)
Compute initial window and scale factor.
static u32 stream_session_rx_fifo_size(transport_connection_t *tc)
static tcp_connection_t * tcp_connection_get(u32 conn_index, u32 thread_index)
static u32 random_u32(u32 *seed)
32-bit random number generator
void tcp_update_rcv_wnd(tcp_connection_t *tc)
#define VLIB_REGISTER_NODE(x,...)
void tcp_update_rto(tcp_connection_t *tc)
void tcp_fast_retransmit_sack(tcp_connection_t *tc)
Do fast retransmit with SACKs.
#define TCP_OPTION_LEN_NOOP
void tcp_send_syn(tcp_connection_t *tc)
Send SYN.
vlib_node_registration_t tcp6_output_node
(constructor) VLIB_REGISTER_NODE (tcp6_output_node)
enum _tcp_reset_next tcp_reset_next_t
#define tcp_opts_sack_permitted(_to)
tcp_connection_t tcp_connection
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
static u32 tcp_loss_wnd(const tcp_connection_t *tc)
vlib_node_registration_t tcp4_reset_node
(constructor) VLIB_REGISTER_NODE (tcp4_reset_node)
vlib_node_registration_t tcp4_output_node
(constructor) VLIB_REGISTER_NODE (tcp4_output_node)
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
static void tcp_persist_timer_set(tcp_connection_t *tc)
static tcp_main_t * vnet_get_tcp_main()
int stream_session_peek_bytes(transport_connection_t *tc, u8 *buffer, u32 offset, u32 max_bytes)
static char * tcp_error_strings[]
static uword tcp4_output(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
void tcp_cc_fastrecovery_exit(tcp_connection_t *tc)
void tcp_timer_persist_handler(u32 index)
Got 0 snd_wnd from peer, try to do something about it.
static u8 tcp_timer_is_active(tcp_connection_t *tc, tcp_timers_e timer)
static stream_session_t * stream_session_get(u32 si, u32 thread_index)
u32 tcp_options_write(u8 *data, tcp_options_t *opts)
Write TCP options to segment.
void tcp_send_reset(vlib_buffer_t *pkt, u8 is_ip4)
Send reset without reusing existing buffer.
static int tcp_make_options(tcp_connection_t *tc, tcp_options_t *opts, tcp_state_t state)