aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/application_interface.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2017-08-29 11:43:37 -0400
committerDamjan Marion <dmarion.lists@gmail.com>2017-09-01 14:17:53 +0000
commitb7f1faa7fbd4575f28766e552a73810c6de0ace3 (patch)
tree30343f8b6f4778250bd2bcb0d123aedfd7d8c172 /src/vnet/session/application_interface.c
parent774b217916ff34ea4ba89d117e93e5b3dd68276f (diff)
Add fixed-size, preallocated pool support
Simply call pool_init_fixed(...) before using the pool. Note that fixed, preallocated pools live in individually-mmap'ed address segments, except for the free element bitmap. A large fixed pool can exceed 4gb. Fix tcp buffer allocator leak, remove broken assert Change-Id: I4421082e12a77c41c6e20f7747f3150dcd01fc26 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet/session/application_interface.c')
-rw-r--r--src/vnet/session/application_interface.c19
1 files changed, 19 insertions, 0 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;
}