* seq_lt (tc->snd_una, ack). This is a condition for calling update_rtt */
else if (tcp_opts_tstamp (&tc->rcv_opts) && tc->rcv_opts.tsecr)
{
- u32 now = tcp_time_now_w_thread (tc->c_thread_index);
+ u32 now = tcp_tstamp (tc);
mrtt = clib_max (now - tc->rcv_opts.tsecr, 1);
}
sack_scoreboard_hole_t *left, *right;
u32 bytes = 0, blks = 0;
+ sb->last_lost_bytes = 0;
sb->lost_bytes = 0;
sb->sacked_bytes = 0;
left = scoreboard_last_hole (sb);
do
{
sb->lost_bytes += scoreboard_hole_bytes (right);
+ sb->last_lost_bytes += left->is_lost ? 0 : left->end - left->start;
left->is_lost = 1;
left = scoreboard_prev_hole (sb, right);
if (left)
sb->high_sacked = 0;
sb->high_rxt = 0;
sb->lost_bytes = 0;
+ sb->last_lost_bytes = 0;
sb->cur_rxt_hole = TCP_INVALID_SACK_HOLE_INDEX;
}
#endif /* CLIB_MARCH_VARIANT */
}
#ifndef CLIB_MARCH_VARIANT
+
void
tcp_rcv_sacks (tcp_connection_t * tc, u32 ack)
{
- sack_scoreboard_t *sb = &tc->sack_sb;
- sack_block_t *blk, tmp;
sack_scoreboard_hole_t *hole, *next_hole, *last_hole;
u32 blk_index = 0, old_sacked_bytes, hole_index;
+ sack_scoreboard_t *sb = &tc->sack_sb;
+ sack_block_t *blk, tmp;
int i, j;
sb->last_sacked_bytes = 0;
sb->last_bytes_delivered += sb->high_sacked - hole->end;
}
}
-
scoreboard_remove_hole (sb, hole);
hole = next_hole;
}
scoreboard_update_bytes (tc, sb);
sb->last_sacked_bytes = sb->sacked_bytes
- (old_sacked_bytes - sb->last_bytes_delivered);
+
ASSERT (sb->last_sacked_bytes <= sb->sacked_bytes || tcp_in_recovery (tc));
ASSERT (sb->sacked_bytes == 0 || tcp_in_recovery (tc)
|| sb->sacked_bytes < tc->snd_nxt - seq_max (tc->snd_una, ack));
- seq_max (tc->snd_una, ack) || tcp_in_recovery (tc));
ASSERT (sb->head == TCP_INVALID_SACK_HOLE_INDEX || tcp_in_recovery (tc)
|| sb->holes[sb->head].start == ack + sb->snd_una_adv);
+ ASSERT (sb->last_lost_bytes <= sb->lost_bytes);
+
TCP_EVT_DBG (TCP_EVT_CC_SCOREBOARD, tc);
}
#endif /* CLIB_MARCH_VARIANT */
TCP_EVT_DBG (TCP_EVT_CC_EVT, tc, 3);
}
-static inline void
-tcp_cc_fastrecovery_clear_inline (tcp_connection_t * tc)
+#ifndef CLIB_MARCH_VARIANT
+void
+tcp_cc_fastrecovery_clear (tcp_connection_t * tc)
{
tc->snd_rxt_bytes = 0;
tc->rcv_dupacks = 0;
TCP_EVT_DBG (TCP_EVT_CC_EVT, tc, 3);
}
-
-static void
-tcp_cc_fastrecovery_exit (tcp_connection_t * tc)
-{
- tc->cc_algo->recovered (tc);
- tcp_cc_fastrecovery_clear_inline (tc);
-}
-
-#ifndef CLIB_MARCH_VARIANT
-void
-tcp_cc_fastrecovery_clear (tcp_connection_t * tc)
-{
- tcp_cc_fastrecovery_clear_inline (tc);
-}
#endif /* CLIB_MARCH_VARIANT */
static void
}
else if (tcp_in_fastrecovery (tc))
{
- tcp_cc_fastrecovery_exit (tc);
+ tcp_cc_fastrecovery_clear (tc);
}
+ tcp_cc_undo_recovery (tc);
ASSERT (tc->rto_boff == 0);
TCP_EVT_DBG (TCP_EVT_CC_EVT, tc, 5);
}
if (tcp_in_recovery (tc))
tcp_cc_recovery_exit (tc);
else if (tcp_in_fastrecovery (tc))
- tcp_cc_fastrecovery_exit (tc);
+ {
+ tcp_cc_recovered (tc);
+ tcp_cc_fastrecovery_clear (tc);
+ }
ASSERT (tc->rto_boff == 0);
ASSERT (!tcp_in_cong_recovery (tc));
{
tcp_connection_set_state (tc0, TCP_STATE_CLOSED);
tcp_timer_set (tc0, TCP_TIMER_WAITCLOSE, TCP_CLEANUP_TIME);
+ session_transport_closed_notify (&tc0->connection);
goto drop;
}
tcp_connection_timers_reset (tc0);
tcp_connection_set_state (tc0, TCP_STATE_TIME_WAIT);
tcp_timer_set (tc0, TCP_TIMER_WAITCLOSE, TCP_TIMEWAIT_TIME);
+ session_transport_closed_notify (&tc0->connection);
goto drop;
break;
}
tcp_connection_set_state (tc0, TCP_STATE_CLOSED);
+ session_transport_closed_notify (&tc0->connection);
/* Don't free the connection from the data path since
* we can't ensure that we have no packets already enqueued
tcp_connection_timers_reset (tc0);
tcp_timer_set (tc0, TCP_TIMER_WAITCLOSE, TCP_TIMEWAIT_TIME);
tcp_program_ack (wrk, tc0);
+ session_transport_closed_notify (&tc0->connection);
break;
case TCP_STATE_TIME_WAIT:
/* Remain in the TIME-WAIT state. Restart the time-wait
}
}
-static inline tcp_connection_t *
+always_inline tcp_connection_t *
tcp_input_lookup_buffer (vlib_buffer_t * b, u8 thread_index, u32 * error,
- u8 is_ip4)
+ u8 is_ip4, u8 is_nolookup)
{
u32 fib_index = vnet_buffer (b)->ip.fib_index;
int n_advance_bytes, n_data_bytes;
return 0;
}
- tc = session_lookup_connection_wt4 (fib_index, &ip4->dst_address,
- &ip4->src_address, tcp->dst_port,
- tcp->src_port, TRANSPORT_PROTO_TCP,
- thread_index, &result);
+ if (!is_nolookup)
+ tc = session_lookup_connection_wt4 (fib_index, &ip4->dst_address,
+ &ip4->src_address, tcp->dst_port,
+ tcp->src_port,
+ TRANSPORT_PROTO_TCP, thread_index,
+ &result);
}
else
{
*error = TCP_ERROR_LENGTH;
return 0;
}
- if (PREDICT_FALSE
- (ip6_address_is_link_local_unicast (&ip6->dst_address)))
+
+ if (!is_nolookup)
{
- ip4_main_t *im = &ip4_main;
- fib_index = vec_elt (im->fib_index_by_sw_if_index,
- vnet_buffer (b)->sw_if_index[VLIB_RX]);
- }
+ if (PREDICT_FALSE
+ (ip6_address_is_link_local_unicast (&ip6->dst_address)))
+ {
+ ip4_main_t *im = &ip4_main;
+ fib_index = vec_elt (im->fib_index_by_sw_if_index,
+ vnet_buffer (b)->sw_if_index[VLIB_RX]);
+ }
- tc = session_lookup_connection_wt6 (fib_index, &ip6->dst_address,
- &ip6->src_address, tcp->dst_port,
- tcp->src_port, TRANSPORT_PROTO_TCP,
- thread_index, &result);
+ tc = session_lookup_connection_wt6 (fib_index, &ip6->dst_address,
+ &ip6->src_address,
+ tcp->dst_port, tcp->src_port,
+ TRANSPORT_PROTO_TCP,
+ thread_index, &result);
+ }
}
+ if (is_nolookup)
+ tc =
+ (transport_connection_t *) tcp_connection_get (vnet_buffer (b)->
+ tcp.connection_index,
+ thread_index);
+
vnet_buffer (b)->tcp.seq_number = clib_net_to_host_u32 (tcp->seq_number);
vnet_buffer (b)->tcp.ack_number = clib_net_to_host_u32 (tcp->ack_number);
vnet_buffer (b)->tcp.data_offset = n_advance_bytes;
always_inline uword
tcp46_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame, int is_ip4)
+ vlib_frame_t * frame, int is_ip4, u8 is_nolookup)
{
u32 n_left_from, *from, thread_index = vm->thread_index;
tcp_main_t *tm = vnet_get_tcp_main ();
next[0] = next[1] = TCP_INPUT_NEXT_DROP;
- tc0 = tcp_input_lookup_buffer (b[0], thread_index, &error0, is_ip4);
- tc1 = tcp_input_lookup_buffer (b[1], thread_index, &error1, is_ip4);
+ tc0 = tcp_input_lookup_buffer (b[0], thread_index, &error0, is_ip4,
+ is_nolookup);
+ tc1 = tcp_input_lookup_buffer (b[1], thread_index, &error1, is_ip4,
+ is_nolookup);
if (PREDICT_TRUE (!tc0 + !tc1 == 0))
{
}
next[0] = TCP_INPUT_NEXT_DROP;
- tc0 = tcp_input_lookup_buffer (b[0], thread_index, &error0, is_ip4);
+ tc0 = tcp_input_lookup_buffer (b[0], thread_index, &error0, is_ip4,
+ is_nolookup);
if (PREDICT_TRUE (tc0 != 0))
{
ASSERT (tcp_lookup_is_valid (tc0, tcp_buffer_hdr (b[0])));
return frame->n_vectors;
}
+VLIB_NODE_FN (tcp4_input_nolookup_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * from_frame)
+{
+ return tcp46_input_inline (vm, node, from_frame, 1 /* is_ip4 */ ,
+ 1 /* is_nolookup */ );
+}
+
+VLIB_NODE_FN (tcp6_input_nolookup_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * from_frame)
+{
+ return tcp46_input_inline (vm, node, from_frame, 0 /* is_ip4 */ ,
+ 1 /* is_nolookup */ );
+}
+
+/* *INDENT-OFF* */
+VLIB_REGISTER_NODE (tcp4_input_nolookup_node) =
+{
+ .name = "tcp4-input-nolookup",
+ /* Takes a vector of packets. */
+ .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) [TCP_INPUT_NEXT_##s] = n,
+ foreach_tcp4_input_next
+#undef _
+ },
+ .format_buffer = format_tcp_header,
+ .format_trace = format_tcp_rx_trace,
+};
+/* *INDENT-ON* */
+
+/* *INDENT-OFF* */
+VLIB_REGISTER_NODE (tcp6_input_nolookup_node) =
+{
+ .name = "tcp6-input-nolookup",
+ /* Takes a vector of packets. */
+ .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) [TCP_INPUT_NEXT_##s] = n,
+ foreach_tcp6_input_next
+#undef _
+ },
+ .format_buffer = format_tcp_header,
+ .format_trace = format_tcp_rx_trace,
+};
+/* *INDENT-ON* */
+
VLIB_NODE_FN (tcp4_input_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
{
- return tcp46_input_inline (vm, node, from_frame, 1 /* is_ip4 */ );
+ return tcp46_input_inline (vm, node, from_frame, 1 /* is_ip4 */ ,
+ 0 /* is_nolookup */ );
}
VLIB_NODE_FN (tcp6_input_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
{
- return tcp46_input_inline (vm, node, from_frame, 0 /* is_ip4 */ );
+ return tcp46_input_inline (vm, node, from_frame, 0 /* is_ip4 */ ,
+ 0 /* is_nolookup */ );
}
/* *INDENT-OFF* */