aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2017-11-29 00:07:11 -0500
committerDamjan Marion <dmarion.lists@gmail.com>2017-11-29 11:59:46 +0000
commit93e658058033e251b98d18a1f0717a07a85adfc2 (patch)
tree469bda92e663851b7925aa60fd8677d38a5e6a86 /src
parentc6fb36fc2eb43c6158b390918d295f2c8eba737b (diff)
session: fix preallocation of local endpoint table
Change-Id: I67a73e31bda9e497859297fcc1765e880572884a Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/session/session.c11
-rw-r--r--src/vnet/session/session.h26
-rw-r--r--src/vnet/session/session_node.c5
-rw-r--r--src/vnet/session/transport.c12
-rw-r--r--src/vnet/tcp/tcp.c13
-rw-r--r--src/vnet/tcp/tcp.h4
-rw-r--r--src/vnet/tcp/tcp_output.c4
7 files changed, 41 insertions, 34 deletions
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index d995eeb04a5..b1bd7a7f041 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -1239,6 +1239,17 @@ session_config_fn (vlib_main_t * vm, unformat_input_t * input)
tmp, tmp);
smm->configured_v6_halfopen_table_memory = tmp;
}
+ else if (unformat (input, "local-endpoints-table-memory %U",
+ unformat_memory_size, &tmp))
+ {
+ if (tmp >= 0x100000000)
+ return clib_error_return (0, "memory size %llx (%lld) too large",
+ tmp, tmp);
+ smm->local_endpoints_table_memory = tmp;
+ }
+ else if (unformat (input, "local-endpoints-table-buckets %d",
+ &smm->local_endpoints_table_buckets))
+ ;
else
return clib_error_return (0, "unknown input `%U'",
format_unformat_error, input);
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index 2a0b0cc47bd..d7bb18e4127 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -140,7 +140,7 @@ struct _session_manager_main
stream_session_t *listen_sessions[SESSION_N_TYPES];
/** Per-proto, per-worker enqueue epoch counters */
- u8 *current_enqueue_epoch[TRANSPORT_N_PROTO];
+ u32 *current_enqueue_epoch[TRANSPORT_N_PROTO];
/** Per-proto, per-worker thread vector of sessions to enqueue */
u32 **session_to_enqueue[TRANSPORT_N_PROTO];
@@ -160,9 +160,22 @@ struct _session_manager_main
/** vpp fifo event queue */
unix_shared_memory_queue_t **vpp_event_queues;
+ /** Unique segment name counter */
+ u32 unique_segment_name_counter;
+
+ /** Per transport rx function that can either dequeue or peek */
+ session_fifo_rx_fn *session_tx_fns[SESSION_N_TYPES];
+
+ /** Session manager is enabled */
+ u8 is_enabled;
+
/** vpp fifo event queue configured length */
u32 configured_event_queue_length;
+ /*
+ * Config parameters
+ */
+
/** session table size parameters */
u32 configured_v4_session_table_buckets;
u32 configured_v4_session_table_memory;
@@ -173,14 +186,9 @@ struct _session_manager_main
u32 configured_v6_halfopen_table_buckets;
u32 configured_v6_halfopen_table_memory;
- /** Unique segment name counter */
- u32 unique_segment_name_counter;
-
- /** Per transport rx function that can either dequeue or peek */
- session_fifo_rx_fn *session_tx_fns[SESSION_N_TYPES];
-
- /** Session manager is enabled */
- u8 is_enabled;
+ /** Transport table (preallocation) size parameters */
+ u32 local_endpoints_table_memory;
+ u32 local_endpoints_table_buckets;
/** Preallocate session config parameter */
u32 preallocated_sessions;
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index f647360ea5b..08baa447864 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -629,7 +629,10 @@ skip_dequeue:
/* Can retransmit for closed sessions but can't do anything if
* session is not ready or closed */
if (PREDICT_FALSE (s0->session_state < SESSION_STATE_READY))
- continue;
+ {
+ vec_add1 (smm->pending_event_vector[my_thread_index], *e0);
+ continue;
+ }
/* Spray packets in per session type frames, since they go to
* different nodes */
rv = (smm->session_tx_fns[s0->session_type]) (vm, node, smm, e0, s0,
diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c
index c18cf15974e..b0a5906383d 100644
--- a/src/vnet/session/transport.c
+++ b/src/vnet/session/transport.c
@@ -314,16 +314,20 @@ void
transport_init (void)
{
vlib_thread_main_t *vtm = vlib_get_thread_main ();
- u32 local_endpoints_table_buckets = 250000;
- u32 local_endpoints_table_memory = 512 << 20;
+ session_manager_main_t *smm = vnet_get_session_manager_main ();
u32 num_threads;
+ if (smm->local_endpoints_table_buckets == 0)
+ smm->local_endpoints_table_buckets = 250000;
+ if (smm->local_endpoints_table_memory == 0)
+ smm->local_endpoints_table_memory = 512 << 20;
+
/* Initialize [port-allocator] random number seed */
port_allocator_seed = (u32) clib_cpu_time_now ();
clib_bihash_init_24_8 (&local_endpoints_table, "local endpoints table",
- local_endpoints_table_buckets,
- local_endpoints_table_memory);
+ smm->local_endpoints_table_buckets,
+ smm->local_endpoints_table_memory);
num_threads = 1 /* main thread */ + vtm->n_threads;
if (num_threads > 1)
clib_spinlock_init (&local_endpoints_lock);
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index b16b2a7dfb2..aee18d997e0 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -1297,7 +1297,6 @@ static clib_error_t *
tcp_config_fn (vlib_main_t * vm, unformat_input_t * input)
{
tcp_main_t *tm = vnet_get_tcp_main ();
- u64 tmp;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
@@ -1308,18 +1307,6 @@ tcp_config_fn (vlib_main_t * vm, unformat_input_t * input)
else if (unformat (input, "preallocated-half-open-connections %d",
&tm->preallocated_half_open_connections))
;
- else if (unformat (input, "local-endpoints-table-memory %U",
- unformat_memory_size, &tmp))
- {
- if (tmp >= 0x100000000)
- return clib_error_return (0, "memory size %llx (%lld) too large",
- tmp, tmp);
- tm->local_endpoints_table_memory = tmp;
- }
- else if (unformat (input, "local-endpoints-table-buckets %d",
- &tm->local_endpoints_table_buckets))
- ;
-
else if (unformat (input, "buffer-fail-fraction %f",
&tm->buffer_fail_fraction))
;
diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h
index 1ddfac0ce96..a7ae74e06ed 100644
--- a/src/vnet/tcp/tcp.h
+++ b/src/vnet/tcp/tcp.h
@@ -395,10 +395,6 @@ typedef struct _tcp_main
u32 preallocated_connections;
u32 preallocated_half_open_connections;
- /** Transport table (preallocation) size parameters */
- u32 local_endpoints_table_memory;
- u32 local_endpoints_table_buckets;
-
/** Vectors of src addresses. Optional unless one needs > 63K active-opens */
ip4_address_t *ip4_src_addresses;
u32 last_v4_address_rotor;
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index f377c912073..dd5b384b0c9 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -1376,7 +1376,7 @@ tcp_timer_retransmit_handler_i (u32 index, u8 is_syn)
if (tc->state >= TCP_STATE_ESTABLISHED)
{
/* Lost FIN, retransmit and return */
- if (tc->state == TCP_STATE_FIN_WAIT_1)
+ if (tcp_is_lost_fin (tc))
{
tcp_send_fin (tc);
tc->rto_boff += 1;
@@ -1495,8 +1495,6 @@ tcp_timer_retransmit_handler_i (u32 index, u8 is_syn)
else
{
ASSERT (tc->state == TCP_STATE_CLOSED);
- if (CLIB_DEBUG)
- TCP_DBG ("connection state: %U", format_tcp_connection, tc, 2);
return;
}
}