config_alloc(const char *name)
{
pool *p = rp_new(&root_pool, "Config");
- linpool *l = lp_new(p, 4080);
+ linpool *l = lp_new_default(p);
struct config *c = lp_allocz(l, sizeof(struct config));
/* Duplication of name string in local linear pool */
/* XXX: const -> non-const */
struct f_inst *f = (struct f_inst *) parsed_fn_def;
- linpool *tmp = lp_new(&root_pool, 4096);
+ linpool *tmp = lp_new_default(&root_pool);
struct f_val res = f_eval(f, tmp);
rfree(tmp);
bt_bird_init();
pool *p = rp_new(&root_pool, "helper_pool");
- linpool *l = lp_new(p, 4080);
+ linpool *l = lp_new_default(p);
cfg_mem = l;
}
resource_init();
struct flow_builder *fb = flow_builder_init(&root_pool);
- linpool *lp = lp_new(&root_pool, 4096);
+ linpool *lp = lp_new_default(&root_pool);
/* Expectation */
net_addr_ip6 ip;
resource_init();
- linpool *lp = lp_new(&root_pool, 4096);
+ linpool *lp = lp_new_default(&root_pool);
struct flow_builder *fb = flow_builder_init(&root_pool);
fb->ipv6 = 1;
byte data[0];
};
+const int lp_chunk_size = sizeof(struct lp_chunk);
+
struct linpool {
resource r;
byte *ptr, *end;
void *lp_allocz(linpool *, unsigned size); /* With clear */
void lp_flush(linpool *); /* Free everything, but leave linpool */
+extern const int lp_chunk_size;
+#define LP_GAS 1024
+#define LP_GOOD_SIZE(x) (((x + LP_GAS - 1) & (~(LP_GAS - 1))) - lp_chunk_size)
+#define lp_new_default(p) lp_new(p, LP_GOOD_SIZE(LP_GAS*4))
+
/* Slabs */
typedef struct slab slab;
struct adata *as_path = &empty_as_path;
u32 first_prepended, last_prepended;
first_prepended = last_prepended = 0;
- struct linpool *lp = lp_new(&root_pool, 0);
+ struct linpool *lp = lp_new_default(&root_pool);
struct f_path_mask mask[AS_PATH_LENGTH] = {};
int i;
struct adata empty_as_path = {};
struct adata *as_path = &empty_as_path;
- struct linpool *lp = lp_new(&root_pool, 0);
+ struct linpool *lp = lp_new_default(&root_pool);
uint i;
for (i = 4294967285; i <= 4294967294; i++)
struct adata empty_as_path = {};
struct adata *as_path = &empty_as_path;
- struct linpool *lp = lp_new(&root_pool, 0);
+ struct linpool *lp = lp_new_default(&root_pool);
u32 as_nums[AS_PATH_LENGTH] = {};
int i;
struct adata empty_as_path = {};
struct adata *as_path = &empty_as_path;
- struct linpool *lp = lp_new(&root_pool, 0);
+ struct linpool *lp = lp_new_default(&root_pool);
#define AS_PATH_LENGTH_FOR_CONVERTING_TEST 10
int i;
{
struct adata empty_as_path = {};
set_sequence = set_sequence_same = set_sequence_higher = set_random = &empty_as_path;
- lp = lp_new(&root_pool, 0);
+ lp = lp_new_default(&root_pool);
int i;
for (i = 0; i < SET_SIZE; i++)
struct adata empty_as_path = {};
set_sequence = set_sequence_same = set_sequence_higher = set_random = &empty_as_path;
- lp = lp_new(&root_pool, 0);
+ lp = lp_new_default(&root_pool);
u64 i = 0;
set_sequence = ec_set_add(lp, set_sequence, i);
c->event->hook = cli_event;
c->event->data = c;
c->cont = cli_hello;
- c->parser_pool = lp_new(c->pool, 4080);
- c->show_pool = lp_new(c->pool, 4080);
+ c->parser_pool = lp_new_default(c->pool);
+ c->show_pool = lp_new_default(c->pool);
c->rx_buf = mb_alloc(c->pool, CLI_RX_BUF_SIZE);
ev_schedule(c->event);
return c;
{
rta_init();
rt_table_pool = rp_new(&root_pool, "Routing tables");
- rte_update_pool = lp_new(rt_table_pool, 4080);
+ rte_update_pool = lp_new_default(rt_table_pool);
rte_slab = sl_new(rt_table_pool, sizeof(rte));
init_list(&routing_tables);
}
hc_alloc_table(hc, HC_DEF_ORDER);
hc->slab = sl_new(rt_table_pool, sizeof(struct hostentry));
- hc->lp = lp_new(rt_table_pool, 1008);
+ hc->lp = lp_new(rt_table_pool, LP_GOOD_SIZE(1024));
hc->trie = f_new_trie(hc->lp, sizeof(struct f_trie_node));
tab->hostcache = hc;
if (!bgp_linpool)
{
- bgp_linpool = lp_new(proto_pool, 4080);
- bgp_linpool2 = lp_new(proto_pool, 4080);
+ bgp_linpool = lp_new_default(proto_pool);
+ bgp_linpool2 = lp_new_default(proto_pool);
}
return 0;
struct static_route *r;
if (!static_lp)
- static_lp = lp_new(&root_pool, 1008);
+ static_lp = lp_new(&root_pool, LP_GOOD_SIZE(1024));
if (p->igp_table_ip4)
rt_lock_table(p->igp_table_ip4);
void
krt_sys_io_init(void)
{
- nl_linpool = lp_new(krt_pool, 4080);
+ nl_linpool = lp_new_default(krt_pool);
HASH_INIT(nl_table_map, krt_pool, 6);
}
krt_io_init(void)
{
krt_pool = rp_new(&root_pool, "Kernel Syncer");
- krt_filter_lp = lp_new(krt_pool, 4080);
+ krt_filter_lp = lp_new_default(krt_pool);
init_list(&krt_proto_list);
krt_sys_io_init();
}