aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/unittest/tcp_test.c2
-rw-r--r--src/vnet/tcp/tcp.c14
-rw-r--r--src/vnet/tcp/tcp.h6
-rw-r--r--src/vnet/tcp/tcp_cli.c4
-rw-r--r--src/vnet/tcp/tcp_inlines.h9
-rw-r--r--src/vnet/tcp/tcp_input.c3
-rw-r--r--src/vnet/tcp/tcp_output.c11
7 files changed, 21 insertions, 28 deletions
diff --git a/src/plugins/unittest/tcp_test.c b/src/plugins/unittest/tcp_test.c
index bd39474ce93..4b53bc18906 100644
--- a/src/plugins/unittest/tcp_test.c
+++ b/src/plugins/unittest/tcp_test.c
@@ -1005,7 +1005,7 @@ static void
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
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index 8851fb9c77e..02239d991bd 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -1467,7 +1467,7 @@ tcp_stats_collector_fn (vlib_stats_collector_data_t *d)
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
@@ -1515,7 +1515,7 @@ tcp_main_enable (vlib_main_t * vm)
int thread;
/* Already initialized */
- if (tm->wrk_ctx)
+ if (tm->wrk)
return 0;
if ((error = vlib_call_init_function (vm, ip_main_init)))
@@ -1537,11 +1537,11 @@ tcp_main_enable (vlib_main_t * vm)
*/
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,
@@ -1549,7 +1549,7 @@ tcp_main_enable (vlib_main_t * vm)
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);
@@ -1562,8 +1562,8 @@ tcp_main_enable (vlib_main_t * vm)
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];
}
/*
diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h
index 8feac807d59..830b81df9ee 100644
--- a/src/vnet/tcp/tcp.h
+++ b/src/vnet/tcp/tcp.h
@@ -220,7 +220,7 @@ typedef struct tcp_configuration_
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;
@@ -301,8 +301,8 @@ vnet_get_tcp_main ()
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);
diff --git a/src/vnet/tcp/tcp_cli.c b/src/vnet/tcp/tcp_cli.c
index 55bc5764df2..c14994aa440 100644
--- a/src/vnet/tcp/tcp_cli.c
+++ b/src/vnet/tcp/tcp_cli.c
@@ -919,7 +919,7 @@ show_tcp_stats_fn (vlib_main_t * vm, unformat_input_t * input,
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);
@@ -957,7 +957,7 @@ clear_tcp_stats_fn (vlib_main_t * vm, unformat_input_t * 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);
clib_memset (&wrk->stats, 0, sizeof (wrk->stats));
diff --git a/src/vnet/tcp/tcp_inlines.h b/src/vnet/tcp/tcp_inlines.h
index ccd0e3fe3ee..4c48f9ecfc5 100644
--- a/src/vnet/tcp/tcp_inlines.h
+++ b/src/vnet/tcp/tcp_inlines.h
@@ -68,7 +68,7 @@ always_inline tcp_connection_t *
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))
@@ -217,7 +217,7 @@ tcp_is_lost_fin (tcp_connection_t * tc)
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;
}
/**
@@ -226,14 +226,13 @@ tcp_time_tstamp (u32 thread_index)
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
diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c
index cd3e4b7700c..7dadb8becfd 100644
--- a/src/vnet/tcp/tcp_input.c
+++ b/src/vnet/tcp/tcp_input.c
@@ -2819,8 +2819,6 @@ tcp46_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
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,
@@ -2881,7 +2879,6 @@ tcp46_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
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))
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index 2fd20acf241..2e8a10896eb 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -299,7 +299,7 @@ tcp_make_options (tcp_connection_t * tc, tcp_options_t * opts,
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) */
@@ -310,8 +310,7 @@ tcp_update_burst_snd_vars (tcp_connection_t * tc)
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);
@@ -875,7 +874,6 @@ tcp_push_hdr_i (tcp_connection_t * tc, vlib_buffer_t * b, u32 snd_nxt,
{
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;
@@ -907,9 +905,8 @@ tcp_push_hdr_i (tcp_connection_t * tc, vlib_buffer_t * b, u32 snd_nxt,
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
{