vnet_buffer (b)->sctp.subconn_idx = MAX_SCTP_CONNECTIONS;
/* Leave enough space for headers */
- return vlib_buffer_make_headroom (b, MAX_HDRS_LEN);
+ return vlib_buffer_make_headroom (b, TRANSPORT_MAX_HDRS_LEN);
}
always_inline void *
sctp_init_buffer (vlib_main_t * vm, vlib_buffer_t * b)
{
ASSERT ((b->flags & VLIB_BUFFER_NEXT_PRESENT) == 0);
- b->flags &= VLIB_BUFFER_NON_DEFAULT_FREELIST;
b->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
b->total_length_not_including_first_buffer = 0;
vnet_buffer (b)->sctp.flags = 0;
vnet_buffer (b)->sctp.subconn_idx = MAX_SCTP_CONNECTIONS;
VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b);
/* Leave enough space for headers */
- return vlib_buffer_make_headroom (b, MAX_HDRS_LEN);
+ return vlib_buffer_make_headroom (b, TRANSPORT_MAX_HDRS_LEN);
}
always_inline int
u8 is_ip4, u32 fib_index)
{
sctp_enqueue_to_ip_lookup_i (vm, b, bi, is_ip4, fib_index, 0);
+ if (vm->thread_index == 0 && vlib_num_workers ())
+ session_flush_frames_main_thread (vm);
}
/**
cookie_echo_chunk->sctp_hdr.verification_tag = sctp_conn->remote_tag;
vnet_sctp_set_chunk_type (&cookie_echo_chunk->chunk_hdr, COOKIE_ECHO);
vnet_sctp_set_chunk_length (&cookie_echo_chunk->chunk_hdr, chunk_len);
- clib_memcpy (&(cookie_echo_chunk->cookie), &sctp_conn->cookie_param,
- sizeof (sctp_state_cookie_param_t));
+ clib_memcpy_fast (&(cookie_echo_chunk->cookie), &sctp_conn->cookie_param,
+ sizeof (sctp_state_cookie_param_t));
vnet_buffer (b)->sctp.connection_index =
sctp_conn->sub_conn[idx].connection.c_index;
clib_host_to_net_u16 (SCTP_STATE_COOKIE_TYPE);
state_cookie_param->param_hdr.length =
clib_host_to_net_u16 (sizeof (sctp_state_cookie_param_t));
- state_cookie_param->creation_time = clib_host_to_net_u32 (sctp_time_now ());
+ state_cookie_param->creation_time = clib_host_to_net_u64 (sctp_time_now ());
state_cookie_param->cookie_lifespan =
clib_host_to_net_u32 (SCTP_VALID_COOKIE_LIFE);
clib_host_to_net_u16 (SCTP_STATE_COOKIE_TYPE);
state_cookie_param->param_hdr.length =
clib_host_to_net_u16 (sizeof (sctp_state_cookie_param_t));
- state_cookie_param->creation_time = clib_host_to_net_u32 (sctp_time_now ());
+ state_cookie_param->creation_time = clib_host_to_net_u64 (sctp_time_now ());
state_cookie_param->cookie_lifespan =
clib_host_to_net_u32 (SCTP_VALID_COOKIE_LIFE);
vlib_main_t *vm = vlib_get_main ();
u8 i;
- u32 now = sctp_time_now ();
+ u64 now = sctp_time_now ();
for (i = 0; i < MAX_SCTP_CONNECTIONS; i++)
{
{
u16 data_len =
b->current_length + b->total_length_not_including_first_buffer;
+
ASSERT (!b->total_length_not_including_first_buffer
|| (b->flags & VLIB_BUFFER_NEXT_PRESENT));
"data_len = %u",
b->current_length, b->current_data, data_len);
+ u16 data_padding = vnet_sctp_calculate_padding (b->current_length);
+ if (data_padding > 0)
+ {
+ u8 *p_tail = vlib_buffer_put_uninit (b, data_padding);
+ clib_memset_u8 (p_tail, 0, data_padding);
+ }
+
u16 bytes_to_add = sizeof (sctp_payload_data_chunk_t);
u16 chunk_length = data_len + bytes_to_add - sizeof (sctp_header_t);
- bytes_to_add += vnet_sctp_calculate_padding (bytes_to_add + data_len);
-
sctp_payload_data_chunk_t *data_chunk =
vlib_buffer_push_uninit (b, bytes_to_add);
* Make sure we can retransmit something
*/
available_bytes =
- stream_session_tx_fifo_max_dequeue (&sctp_conn->sub_conn[idx].connection);
+ session_tx_fifo_max_dequeue (&sctp_conn->sub_conn[idx].connection);
ASSERT (available_bytes >= offset);
available_bytes -= offset;
if (!available_bytes)
vlib_buffer_t *b = 0;
u32 bi, n_bytes = 0;
+ u8 idx = sctp_data_subconn_select (sctp_conn);
+
SCTP_DBG_OUTPUT
("SCTP_CONN = %p, IDX = %u, S_INDEX = %u, C_INDEX = %u, sctp_conn->[...].LCL_PORT = %u, sctp_conn->[...].RMT_PORT = %u",
sctp_conn, idx, sctp_conn->sub_conn[idx].connection.s_index,
return;
}
- u8 idx = sctp_data_subconn_select (sctp_conn);
-
n_bytes =
sctp_prepare_data_retransmit (sctp_conn, idx, 0,
sctp_conn->sub_conn[idx].cwnd, &b);
{
clib_warning
("Trying to send an unrecognized chunk... something is really bad.");
- error0 = SCTP_ERROR_UNKOWN_CHUNK;
+ error0 = SCTP_ERROR_UNKNOWN_CHUNK;
next0 = SCTP_OUTPUT_NEXT_DROP;
goto done;
}
connection.rmt_port,
sctp_hdr->dst_port);
- error0 = SCTP_ERROR_UNKOWN_CHUNK;
+ error0 = SCTP_ERROR_UNKNOWN_CHUNK;
next0 = SCTP_OUTPUT_NEXT_DROP;
goto done;
}
sctp_chunk_to_string (chunk_type),
sctp_state_to_string (sctp_conn->state));
- error0 = SCTP_ERROR_UNKOWN_CHUNK;
+ error0 = SCTP_ERROR_UNKNOWN_CHUNK;
next0 = SCTP_OUTPUT_NEXT_DROP;
goto done;
t0 = vlib_add_trace (vm, node, b0, sizeof (*t0));
if (th0)
{
- clib_memcpy (&t0->sctp_header, th0,
- sizeof (t0->sctp_header));
+ clib_memcpy_fast (&t0->sctp_header, th0,
+ sizeof (t0->sctp_header));
}
else
{
- memset (&t0->sctp_header, 0, sizeof (t0->sctp_header));
+ clib_memset (&t0->sctp_header, 0, sizeof (t0->sctp_header));
}
- clib_memcpy (&t0->sctp_connection, sctp_conn,
- sizeof (t0->sctp_connection));
+ clib_memcpy_fast (&t0->sctp_connection, sctp_conn,
+ sizeof (t0->sctp_connection));
}
vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,