aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/application_interface.c19
-rw-r--r--src/vnet/session/session.c32
-rwxr-xr-xsrc/vnet/session/session_cli.c4
3 files changed, 33 insertions, 22 deletions
diff --git a/src/vnet/session/application_interface.c b/src/vnet/session/application_interface.c
index 566a52d7984..8dbc3a1ab19 100644
--- a/src/vnet/session/application_interface.c
+++ b/src/vnet/session/application_interface.c
@@ -207,11 +207,22 @@ unformat_vnet_uri (unformat_input_t * input, va_list * args)
return 0;
}
+static u8 *cache_uri;
+static session_type_t cache_sst;
+static transport_endpoint_t *cache_tep;
+
int
parse_uri (char *uri, session_type_t * sst, transport_endpoint_t * tep)
{
unformat_input_t _input, *input = &_input;
+ if (cache_uri && !strncmp (uri, (char *) cache_uri, vec_len (cache_uri)))
+ {
+ *sst = cache_sst;
+ *tep = *cache_tep;
+ return 0;
+ }
+
/* Make sure */
uri = (char *) format (0, "%s%c", uri, 0);
@@ -224,6 +235,14 @@ parse_uri (char *uri, session_type_t * sst, transport_endpoint_t * tep)
}
unformat_free (input);
+ vec_free (cache_uri);
+ cache_uri = (u8 *) uri;
+ cache_sst = *sst;
+ if (cache_tep)
+ clib_mem_free (cache_tep);
+ cache_tep = clib_mem_alloc (sizeof (*tep));
+ *cache_tep = *tep;
+
return 0;
}
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index dcd141f1b5b..17644e292a9 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -889,32 +889,24 @@ session_manager_main_enable (vlib_main_t * vm)
session_vpp_event_queue_allocate (smm, i);
/* Preallocate sessions */
- if (num_threads == 1)
+ if (smm->preallocated_sessions)
{
- for (i = 0; i < smm->preallocated_sessions; i++)
+ if (num_threads == 1)
{
- stream_session_t *ss __attribute__ ((unused));
- pool_get_aligned (smm->sessions[0], ss, CLIB_CACHE_LINE_BYTES);
+ pool_init_fixed (smm->sessions[0], smm->preallocated_sessions);
}
-
- 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 (j = 1; j < num_threads; j++)
+ else
{
- for (i = 0; i < preallocated_sessions_per_worker; i++)
+ int j;
+ preallocated_sessions_per_worker =
+ (1.1 * (f64) smm->preallocated_sessions /
+ (f64) (num_threads - 1));
+
+ for (j = 1; j < num_threads; j++)
{
- stream_session_t *ss __attribute__ ((unused));
- pool_get_aligned (smm->sessions[j], ss, CLIB_CACHE_LINE_BYTES);
+ pool_init_fixed (smm->sessions[j],
+ preallocated_sessions_per_worker);
}
- for (i = 0; i < preallocated_sessions_per_worker; i++)
- pool_put_index (smm->sessions[j], i);
}
}
diff --git a/src/vnet/session/session_cli.c b/src/vnet/session/session_cli.c
index 028dc9d8ad0..d9f516beab9 100755
--- a/src/vnet/session/session_cli.c
+++ b/src/vnet/session/session_cli.c
@@ -115,8 +115,8 @@ unformat_stream_session_id (unformat_input_t * input, va_list * args)
{
*proto = TRANSPORT_PROTO_UDP;
}
- else if (unformat (input, "%U:%d->%U:%d", unformat_ip4_address, &lcl->ip4,
- lcl_port, unformat_ip4_address, &rmt->ip4, rmt_port))
+ if (unformat (input, "%U:%d->%U:%d", unformat_ip4_address, &lcl->ip4,
+ lcl_port, unformat_ip4_address, &rmt->ip4, rmt_port))
{
*is_ip4 = 1;
tuple_is_set = 1;