From 9a834c0112b0987bbbb173f6da67d3c111aeecad Mon Sep 17 00:00:00 2001 From: Mohsin Kazmi Date: Mon, 10 Feb 2025 11:19:47 +0000 Subject: ip: add support to preallocate pools MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: BenoƮt Ganne Change-Id: Ib0f1d40e3efb8b4fce989219196c718d6834498a --- src/vnet/dpo/load_balance.c | 7 +++++++ src/vnet/dpo/load_balance.h | 1 + 2 files changed, 8 insertions(+) (limited to 'src/vnet/dpo') diff --git a/src/vnet/dpo/load_balance.c b/src/vnet/dpo/load_balance.c index 8f2a0de6ea8..f6f9392a42b 100644 --- a/src/vnet/dpo/load_balance.c +++ b/src/vnet/dpo/load_balance.c @@ -1030,6 +1030,7 @@ load_balance_module_init (void) * This should never be used, but just in case, stack it on a drop. */ lbi = load_balance_create(1, DPO_PROTO_IP4, 0); + ASSERT(0 == lbi); load_balance_set_bucket(lbi, 0, drop_dpo_get(DPO_PROTO_IP4)); load_balance_logger = @@ -1038,6 +1039,12 @@ load_balance_module_init (void) load_balance_map_module_init(); } +void +load_balance_pool_alloc (uword size) +{ + pool_alloc_aligned(load_balance_pool, size, CLIB_CACHE_LINE_BYTES); +} + static clib_error_t * load_balance_show (vlib_main_t * vm, unformat_input_t * input, diff --git a/src/vnet/dpo/load_balance.h b/src/vnet/dpo/load_balance.h index eee073f5892..76aa7982401 100644 --- a/src/vnet/dpo/load_balance.h +++ b/src/vnet/dpo/load_balance.h @@ -260,5 +260,6 @@ load_balance_get_bucket_i (const load_balance_t *lb, } extern void load_balance_module_init(void); +extern void load_balance_pool_alloc (uword size); #endif -- cgit