Change-Id: Iec67ae1232e346d5e0000e0b4c997fdc31865bc6
Signed-off-by: Neale Ranns <nranns@cisco.com>
+static void
+load_balance_map_destroy (load_balance_map_t *lbm)
+{
+ vec_free(lbm->lbm_paths);
+ vec_free(lbm->lbm_buckets);
+ pool_put(load_balance_map_pool, lbm);
+}
+
index_t
load_balance_map_add_or_lock (u32 n_buckets,
u32 sum_of_weights,
index_t
load_balance_map_add_or_lock (u32 n_buckets,
u32 sum_of_weights,
else
{
lbm = load_balance_map_get(lbmi);
else
{
lbm = load_balance_map_get(lbmi);
+ load_balance_map_destroy(tmp);
if (0 == lbm->lbm_locks)
{
load_balance_map_db_remove(lbm);
if (0 == lbm->lbm_locks)
{
load_balance_map_db_remove(lbm);
- vec_free(lbm->lbm_paths);
- vec_free(lbm->lbm_buckets);
- pool_put(load_balance_map_pool, lbm);
+ load_balance_map_destroy(lbm);
const load_balance_t *lb;
test_main_t *tm;
u32 fib_index;
const load_balance_t *lb;
test_main_t *tm;
u32 fib_index;
int ii;
/* via 10.10.10.1 */
int ii;
/* via 10.10.10.1 */
+ /* record the nubmer of load-balances in use before we start */
+ lb_count = pool_elts(load_balance_pool);
+
/* Find or create FIB table 11 */
fib_index = fib_table_find_or_create_and_lock(FIB_PROTOCOL_IP4, 11);
/* Find or create FIB table 11 */
fib_index = fib_table_find_or_create_and_lock(FIB_PROTOCOL_IP4, 11);
"LB maps's bucket 1 is %d",
lbm->lbm_buckets[1]);
"LB maps's bucket 1 is %d",
lbm->lbm_buckets[1]);
- load_balance_map_unlock(lb->lb_map);
+ load_balance_map_unlock(lbmi);
"LB Map for 200.200.200.200/32 at %d is %d",
ii, lbm->lbm_buckets[ii]);
}
"LB Map for 200.200.200.200/32 at %d is %d",
ii, lbm->lbm_buckets[ii]);
}
+ load_balance_map_unlock(lbmi);
fib_entry_pool_size());
FIB_TEST((ENBR-5 == pool_elts(fib_urpf_list_pool)), "uRPF pool size is %d",
pool_elts(fib_urpf_list_pool));
fib_entry_pool_size());
FIB_TEST((ENBR-5 == pool_elts(fib_urpf_list_pool)), "uRPF pool size is %d",
pool_elts(fib_urpf_list_pool));
+ FIB_TEST((0 == pool_elts(load_balance_map_pool)), "LB-map pool size is %d",
+ pool_elts(load_balance_map_pool));
+ FIB_TEST((lb_count == pool_elts(load_balance_pool)), "LB pool size is %d",
+ pool_elts(load_balance_pool));