/*
* Figure out how much space we have available
*/
- available_space = stream_session_max_rx_enqueue (&tc->connection);
- max_fifo = stream_session_rx_fifo_size (&tc->connection);
+ available_space = transport_max_rx_enqueue (&tc->connection);
+ max_fifo = transport_rx_fifo_size (&tc->connection);
ASSERT (tc->rcv_opts.mss < max_fifo);
if (available_space < tc->rcv_opts.mss && available_space < max_fifo >> 3)
tcp_cc_fastrecovery_exit (tc);
/* Start again from the beginning */
- tc->ssthresh = clib_max (tcp_flight_size (tc) / 2, 2 * tc->snd_mss);
+ tc->cc_algo->congestion (tc);
tc->cwnd = tcp_loss_wnd (tc);
tc->snd_congestion = tc->snd_una_max;
tc->rtt_ts = 0;
+ tc->cwnd_acc_bytes = 0;
+
tcp_recovery_on (tc);
}
}
/* Shouldn't be here */
- if (tc->snd_una == tc->snd_una_max)
+ if (seq_geq (tc->snd_una, tc->snd_congestion))
{
tcp_recovery_off (tc);
return;
if (tc->rto_boff == 1)
tcp_rtx_timeout_cc (tc);
- tc->snd_nxt = tc->snd_una;
+ tc->snd_una_max = tc->snd_nxt = tc->snd_una;
tc->rto = clib_min (tc->rto << 1, TCP_RTO_MAX);
TCP_EVT_DBG (TCP_EVT_CC_EVT, tc, 1);
return svm_fifo_has_ooo_data (s->server_rx_fifo);
}
-typedef struct
-{
- fib_protocol_t nh_proto;
- vnet_link_t link_type;
- ip46_address_t ip;
- u32 sw_if_index;
-} tcp_adj_add_args_t;
-
-void
-tcp_output_add_adj (tcp_adj_add_args_t * args)
-{
- adj_nbr_add_or_lock (args->nh_proto, args->link_type, &args->ip,
- args->sw_if_index);
-}
-
static void
tcp_output_handle_link_local (tcp_connection_t * tc0, vlib_buffer_t * b0,
u32 * next0, u32 * error0)
ip_adjacency_t *adj;
adj_index_t ai;
+ /* Not thread safe but as long as the connection exists the adj should
+ * not be removed */
ai = adj_nbr_find (FIB_PROTOCOL_IP6, VNET_LINK_IP6, &tc0->c_rmt_ip,
tc0->sw_if_index);
if (ai == ADJ_INDEX_INVALID)
{
- tcp_adj_add_args_t args = {
- .nh_proto = FIB_PROTOCOL_IP6,
- .link_type = VNET_LINK_IP6,
- .ip = tc0->c_rmt_ip,
- .sw_if_index = tc0->sw_if_index
- };
- vlib_rpc_call_main_thread (tcp_output_add_adj, (u8 *) & args,
- sizeof (args));
vnet_buffer (b0)->sw_if_index[VLIB_TX] = ~0;
*next0 = TCP_OUTPUT_NEXT_DROP;
*error0 = TCP_ERROR_LINK_LOCAL_RW;
}
adj = adj_get (ai);
- if (adj->lookup_next_index == IP_LOOKUP_NEXT_REWRITE)
+ if (PREDICT_TRUE (adj->lookup_next_index == IP_LOOKUP_NEXT_REWRITE))
*next0 = TCP_OUTPUT_NEXT_IP_REWRITE;
else if (adj->lookup_next_index == IP_LOOKUP_NEXT_ARP)
*next0 = TCP_OUTPUT_NEXT_IP_ARP;
+ else
+ {
+ *next0 = TCP_OUTPUT_NEXT_DROP;
+ *error0 = TCP_ERROR_LINK_LOCAL_RW;
+ }
+ vnet_buffer (b0)->ip.adj_index[VLIB_TX] = ai;
}
always_inline uword