tcp_test_set_time (u32 thread_index, u32 val)
{
session_main.wrk[thread_index].last_vlib_time = val;
- tcp_set_time_now (&tcp_main.wrk_ctx[thread_index], val);
+ tcp_set_time_now (&tcp_main.wrk[thread_index], val);
}
static int
tcp_wrk_stats_t acc = {};
tcp_worker_ctx_t *wrk;
- vec_foreach (wrk, tm->wrk_ctx)
+ vec_foreach (wrk, tm->wrk)
{
#define _(name, type, str) acc.name += wrk->stats.name;
foreach_tcp_wrk_stat
int thread;
/* Already initialized */
- if (tm->wrk_ctx)
+ if (tm->wrk)
return 0;
if ((error = vlib_call_init_function (vm, ip_main_init)))
*/
num_threads = 1 /* main thread */ + vtm->n_threads;
- vec_validate (tm->wrk_ctx, num_threads - 1);
+ vec_validate (tm->wrk, num_threads - 1);
n_workers = num_threads == 1 ? 1 : vtm->n_threads;
prealloc_conn_per_wrk = tcp_cfg.preallocated_connections / n_workers;
- wrk = &tm->wrk_ctx[0];
+ wrk = &tm->wrk[0];
wrk->tco_next_node[0] = vlib_node_get_next (vm, session_queue_node.index,
tcp4_output_node.index);
wrk->tco_next_node[1] = vlib_node_get_next (vm, session_queue_node.index,
for (thread = 0; thread < num_threads; thread++)
{
- wrk = &tm->wrk_ctx[thread];
+ wrk = &tm->wrk[thread];
vec_validate (wrk->pending_deq_acked, 255);
vec_validate (wrk->pending_disconnects, 255);
if (thread > 0)
{
- wrk->tco_next_node[0] = tm->wrk_ctx[0].tco_next_node[0];
- wrk->tco_next_node[1] = tm->wrk_ctx[0].tco_next_node[1];
+ wrk->tco_next_node[0] = tm->wrk[0].tco_next_node[0];
+ wrk->tco_next_node[1] = tm->wrk[0].tco_next_node[1];
}
/*
typedef struct _tcp_main
{
/** per-worker context */
- tcp_worker_ctx_t *wrk_ctx;
+ tcp_worker_ctx_t *wrk;
/* Pool of listeners. */
tcp_connection_t *listener_pool;
always_inline tcp_worker_ctx_t *
tcp_get_worker (u32 thread_index)
{
- ASSERT (thread_index < vec_len (tcp_main.wrk_ctx));
- return &tcp_main.wrk_ctx[thread_index];
+ ASSERT (thread_index < vec_len (tcp_main.wrk));
+ return &tcp_main.wrk[thread_index];
}
tcp_connection_t *tcp_connection_alloc (u8 thread_index);
if (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
return clib_error_return (0, "unknown input `%U'", format_unformat_error,
input);
- for (thread = 0; thread < vec_len (tm->wrk_ctx); thread++)
+ for (thread = 0; thread < vec_len (tm->wrk); thread++)
{
wrk = tcp_get_worker (thread);
vlib_cli_output (vm, "Thread %u:\n", thread);
return clib_error_return (0, "unknown input `%U'", format_unformat_error,
input);
- for (thread = 0; thread < vec_len (tm->wrk_ctx); thread++)
+ for (thread = 0; thread < vec_len (tm->wrk); thread++)
{
wrk = tcp_get_worker (thread);
clib_memset (&wrk->stats, 0, sizeof (wrk->stats));
tcp_connection_get_if_valid (u32 conn_index, u32 thread_index)
{
tcp_worker_ctx_t *wrk;
- if (thread_index >= vec_len (tcp_main.wrk_ctx))
+ if (thread_index >= vec_len (tcp_main.wrk))
return 0;
wrk = tcp_get_worker (thread_index);
if (pool_is_free_index (wrk->connections, conn_index))
always_inline u32
tcp_time_tstamp (u32 thread_index)
{
- return tcp_main.wrk_ctx[thread_index].time_tstamp;
+ return tcp_main.wrk[thread_index].time_tstamp;
}
/**
always_inline u32
tcp_tstamp (tcp_connection_t * tc)
{
- return (tcp_main.wrk_ctx[tc->c_thread_index].time_tstamp -
- tc->timestamp_delta);
+ return (tcp_main.wrk[tc->c_thread_index].time_tstamp - tc->timestamp_delta);
}
always_inline f64
tcp_time_now_us (u32 thread_index)
{
- return tcp_main.wrk_ctx[thread_index].time_us;
+ return tcp_main.wrk[thread_index].time_us;
}
always_inline void
CLIB_PREFETCH (b[3]->data, 2 * CLIB_CACHE_LINE_BYTES, LOAD);
}
- next[0] = next[1] = TCP_INPUT_NEXT_DROP;
-
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,
CLIB_PREFETCH (b[1]->data, 2 * CLIB_CACHE_LINE_BYTES, LOAD);
}
- next[0] = TCP_INPUT_NEXT_DROP;
tc0 = tcp_input_lookup_buffer (b[0], thread_index, &error0, is_ip4,
is_nolookup);
if (PREDICT_TRUE (tc0 != 0))
void
tcp_update_burst_snd_vars (tcp_connection_t * tc)
{
- tcp_main_t *tm = &tcp_main;
+ tcp_worker_ctx_t *wrk = tcp_get_worker (tc->c_thread_index);
/* Compute options to be used for connection. These may be reused when
* sending data or to compute the effective mss (snd_mss) */
tc->snd_mss = clib_min (tc->mss, tc->rcv_opts.mss) - tc->snd_opts_len;
ASSERT (tc->snd_mss > 0);
- tcp_options_write (tm->wrk_ctx[tc->c_thread_index].cached_opts,
- &tc->snd_opts);
+ tcp_options_write (wrk->cached_opts, &tc->snd_opts);
tcp_update_rcv_wnd (tc);
{
u8 tcp_hdr_opts_len, flags = TCP_FLAG_ACK;
u32 advertise_wnd, data_len;
- tcp_main_t *tm = &tcp_main;
tcp_header_t *th;
data_len = b->current_length;
if (maybe_burst)
{
- clib_memcpy_fast ((u8 *) (th + 1),
- tm->wrk_ctx[tc->c_thread_index].cached_opts,
- tc->snd_opts_len);
+ tcp_worker_ctx_t *wrk = tcp_get_worker (tc->c_thread_index);
+ clib_memcpy_fast ((u8 *) (th + 1), wrk->cached_opts, tc->snd_opts_len);
}
else
{