summaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2017-07-31 17:18:03 -0700
committerFlorin Coras <fcoras@cisco.com>2017-08-02 01:49:39 -0700
commit66b11318a1e5f24880e3ec77c95d70647732a4a8 (patch)
tree5711f1b28863d0a2130f6370f39c7777ea34b07e /src/vnet/session
parentfdbc38249a8c672937a74667dcfaafa2cfd292e7 (diff)
Fix tcp tx buffer allocation
- Make tcp output buffer allocation macro an inline function - Use per ip version per thread tx frames for retransmits and timer events - Fix / parameterize tcp data structure preallocation - Add a couple of gdb-callable show commands - Fix local endpoint cleanup Change-Id: I67b47b7570aa14cb4634b6fd93c57cd2eacbfa29 Signed-off-by: Florin Coras <fcoras@cisco.com> Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/session.c82
-rw-r--r--src/vnet/session/session.h10
-rwxr-xr-xsrc/vnet/session/session_cli.c2
-rw-r--r--src/vnet/session/session_lookup.c40
4 files changed, 116 insertions, 18 deletions
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 004c7193b94..4ba152917ac 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -759,6 +759,7 @@ session_manager_main_enable (vlib_main_t * vm)
session_manager_main_t *smm = &session_manager_main;
vlib_thread_main_t *vtm = vlib_get_thread_main ();
u32 num_threads;
+ u32 preallocated_sessions_per_worker;
int i;
num_threads = 1 /* main thread */ + vtm->n_threads;
@@ -795,15 +796,35 @@ session_manager_main_enable (vlib_main_t * vm)
for (i = 0; i < vec_len (smm->vpp_event_queues); i++)
session_vpp_event_queue_allocate (smm, i);
- /* $$$$ preallocate hack config parameter */
- for (i = 0; i < smm->preallocated_sessions; i++)
+ /* Preallocate sessions */
+ if (num_threads == 1)
{
- stream_session_t *ss __attribute__ ((unused));
- pool_get_aligned (smm->sessions[0], ss, CLIB_CACHE_LINE_BYTES);
+ for (i = 0; i < smm->preallocated_sessions; i++)
+ {
+ stream_session_t *ss __attribute__ ((unused));
+ pool_get_aligned (smm->sessions[0], ss, CLIB_CACHE_LINE_BYTES);
+ }
+
+ for (i = 0; i < smm->preallocated_sessions; i++)
+ pool_put_index (smm->sessions[0], i);
}
+ else
+ {
+ int j;
+ preallocated_sessions_per_worker = smm->preallocated_sessions /
+ (num_threads - 1);
- for (i = 0; i < smm->preallocated_sessions; i++)
- pool_put_index (smm->sessions[0], i);
+ for (j = 1; j < num_threads; j++)
+ {
+ for (i = 0; i < preallocated_sessions_per_worker; i++)
+ {
+ stream_session_t *ss __attribute__ ((unused));
+ pool_get_aligned (smm->sessions[j], ss, CLIB_CACHE_LINE_BYTES);
+ }
+ for (i = 0; i < preallocated_sessions_per_worker; i++)
+ pool_put_index (smm->sessions[j], i);
+ }
+ }
session_lookup_init ();
@@ -863,6 +884,7 @@ session_config_fn (vlib_main_t * vm, unformat_input_t * input)
{
session_manager_main_t *smm = &session_manager_main;
u32 nitems;
+ uword tmp;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
@@ -873,9 +895,53 @@ session_config_fn (vlib_main_t * vm, unformat_input_t * input)
else
clib_warning ("event queue length %d too small, ignored", nitems);
}
- if (unformat (input, "preallocated-sessions %d",
- &smm->preallocated_sessions))
+ else if (unformat (input, "preallocated-sessions %d",
+ &smm->preallocated_sessions))
+ ;
+ else if (unformat (input, "v4-session-table-buckets %d",
+ &smm->configured_v4_session_table_buckets))
;
+ else if (unformat (input, "v4-halfopen-table-buckets %d",
+ &smm->configured_v4_halfopen_table_buckets))
+ ;
+ else if (unformat (input, "v6-session-table-buckets %d",
+ &smm->configured_v6_session_table_buckets))
+ ;
+ else if (unformat (input, "v6-halfopen-table-buckets %d",
+ &smm->configured_v6_halfopen_table_buckets))
+ ;
+ else if (unformat (input, "v4-session-table-memory %U",
+ unformat_memory_size, &tmp))
+ {
+ if (tmp >= 0x100000000)
+ return clib_error_return (0, "memory size %llx (%lld) too large",
+ tmp, tmp);
+ smm->configured_v4_session_table_memory = tmp;
+ }
+ else if (unformat (input, "v4-halfopen-table-memory %U",
+ unformat_memory_size, &tmp))
+ {
+ if (tmp >= 0x100000000)
+ return clib_error_return (0, "memory size %llx (%lld) too large",
+ tmp, tmp);
+ smm->configured_v4_halfopen_table_memory = tmp;
+ }
+ else if (unformat (input, "v6-session-table-memory %U",
+ unformat_memory_size, &tmp))
+ {
+ if (tmp >= 0x100000000)
+ return clib_error_return (0, "memory size %llx (%lld) too large",
+ tmp, tmp);
+ smm->configured_v6_session_table_memory = tmp;
+ }
+ else if (unformat (input, "v6-halfopen-table-memory %U",
+ unformat_memory_size, &tmp))
+ {
+ if (tmp >= 0x100000000)
+ return clib_error_return (0, "memory size %llx (%lld) too large",
+ tmp, tmp);
+ smm->configured_v6_halfopen_table_memory = tmp;
+ }
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 180b9f8a496..538433da0f2 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -133,6 +133,16 @@ struct _session_manager_main
/** vpp fifo event queue configured length */
u32 configured_event_queue_length;
+ /** session table size parameters */
+ u32 configured_v4_session_table_buckets;
+ u32 configured_v4_session_table_memory;
+ u32 configured_v4_halfopen_table_buckets;
+ u32 configured_v4_halfopen_table_memory;
+ u32 configured_v6_session_table_buckets;
+ u32 configured_v6_session_table_memory;
+ u32 configured_v6_halfopen_table_buckets;
+ u32 configured_v6_halfopen_table_memory;
+
/** Unique segment name counter */
u32 unique_segment_name_counter;
diff --git a/src/vnet/session/session_cli.c b/src/vnet/session/session_cli.c
index de564ea7272..9f3d217cf61 100755
--- a/src/vnet/session/session_cli.c
+++ b/src/vnet/session/session_cli.c
@@ -312,7 +312,7 @@ show_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
}
/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (show_session_command, static) =
+VLIB_CLI_COMMAND (vlib_cli_show_session_command) =
{
.path = "show session",
.short_help = "show session [verbose]",
diff --git a/src/vnet/session/session_lookup.c b/src/vnet/session/session_lookup.c
index 1ce22f808e5..41f9dbf0c1e 100644
--- a/src/vnet/session/session_lookup.c
+++ b/src/vnet/session/session_lookup.c
@@ -569,23 +569,45 @@ stream_session_lookup_transport6 (ip6_address_t * lcl, ip6_address_t * rmt,
return 0;
}
+#define foreach_hash_table_parameter \
+ _(v4,session,buckets,20000) \
+ _(v4,session,memory,(64<<20)) \
+ _(v6,session,buckets,20000) \
+ _(v6,session,memory,(64<<20)) \
+ _(v4,halfopen,buckets,20000) \
+ _(v4,halfopen,memory,(64<<20)) \
+ _(v6,halfopen,buckets,20000) \
+ _(v6,halfopen,memory,(64<<20))
+
void
session_lookup_init (void)
{
session_lookup_t *sl = &session_lookup;
+
+#define _(af,table,parm,value) \
+ u32 configured_##af##_##table##_table_##parm = value;
+ foreach_hash_table_parameter;
+#undef _
+
+#define _(af,table,parm,value) \
+ if (session_manager_main.configured_##af##_##table##_table_##parm) \
+ configured_##af##_##table##_table_##parm = \
+ session_manager_main.configured_##af##_##table##_table_##parm;
+ foreach_hash_table_parameter;
+#undef _
+
clib_bihash_init_16_8 (&sl->v4_session_hash, "v4 session table",
- 200000 /* $$$$ config parameter nbuckets */ ,
- (64 << 20) /*$$$ config parameter table size */ );
+ configured_v4_session_table_buckets,
+ configured_v4_session_table_memory);
clib_bihash_init_48_8 (&sl->v6_session_hash, "v6 session table",
- 200000 /* $$$$ config parameter nbuckets */ ,
- (64 << 20) /*$$$ config parameter table size */ );
-
+ configured_v6_session_table_buckets,
+ configured_v6_session_table_memory);
clib_bihash_init_16_8 (&sl->v4_half_open_hash, "v4 half-open table",
- 200000 /* $$$$ config parameter nbuckets */ ,
- (64 << 20) /*$$$ config parameter table size */ );
+ configured_v4_halfopen_table_buckets,
+ configured_v4_halfopen_table_memory);
clib_bihash_init_48_8 (&sl->v6_half_open_hash, "v6 half-open table",
- 200000 /* $$$$ config parameter nbuckets */ ,
- (64 << 20) /*$$$ config parameter table size */ );
+ configured_v6_halfopen_table_buckets,
+ configured_v6_halfopen_table_memory);
}
/*