aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip4_mtrie.c
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2025-02-10 11:19:47 +0000
committerNeale Ranns <neale@graphiant.com>2025-02-15 03:06:12 +0000
commit9a834c0112b0987bbbb173f6da67d3c111aeecad (patch)
tree10759b22ddca07480c4e801eb89b1cf8e7c8d1a7 /src/vnet/ip/ip4_mtrie.c
parent884ab372500c9937d4ae21e0bc77ea51e6144307 (diff)
ip: add support to preallocate pools
Type: improvement In certain use cases, the underlying pools expand by allocating a new, larger pool and copying the existing elements into it. This process can be time-consuming, leading to slower control plane configurations, especially when a large number of elements are already present. This patch allows users to pre-configure some of these pools through startup.conf. It also fixes alignment for ip4 mtrie. Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Signed-off-by: BenoƮt Ganne <bganne@cisco.com> Change-Id: Ib0f1d40e3efb8b4fce989219196c718d6834498a
Diffstat (limited to 'src/vnet/ip/ip4_mtrie.c')
-rw-r--r--src/vnet/ip/ip4_mtrie.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/vnet/ip/ip4_mtrie.c b/src/vnet/ip/ip4_mtrie.c
index 00855f7db43..df70dc9edca 100644
--- a/src/vnet/ip/ip4_mtrie.c
+++ b/src/vnet/ip/ip4_mtrie.c
@@ -190,7 +190,7 @@ ip4_mtrie_8_init (ip4_mtrie_8_t *m)
{
ip4_mtrie_8_ply_t *root;
- pool_get (ip4_ply_pool, root);
+ pool_get_aligned (ip4_ply_pool, root, CLIB_CACHE_LINE_BYTES);
m->root_ply = root - ip4_ply_pool;
ply_8_init (root, IP4_MTRIE_LEAF_EMPTY, 0, 0);
@@ -853,13 +853,19 @@ ip4_mtrie_module_init (vlib_main_t * vm)
clib_error_t *error = NULL;
/* Burn one ply so index 0 is taken */
- pool_get (ip4_ply_pool, p);
+ pool_get_aligned (ip4_ply_pool, p, CLIB_CACHE_LINE_BYTES);
return (error);
}
VLIB_INIT_FUNCTION (ip4_mtrie_module_init);
+void
+ip4_mtrie_pool_alloc (uword size)
+{
+ pool_alloc_aligned (ip4_ply_pool, size, CLIB_CACHE_LINE_BYTES);
+}
+
/*
* fd.io coding-style-patch-verification: ON
*