* @count: number of &f_val entries
*/
static int
-same_val_list(const struct f_val *v1, const struct f_val *v2, uint len)
+aggregator_same_val_list(const struct f_val *v1, const struct f_val *v2, u32 len)
{
for (u32 i = 0; i < len; i++)
if (!val_same(&v1[i], &v2[i]))
#define AGGR_BUCK_KEY(n) (n)
#define AGGR_BUCK_NEXT(n) ((n)->next_hash)
-#define AGGR_BUCK_EQ(a,b) (((a)->hash == (b)->hash) && (same_val_list((a)->aggr_data, (b)->aggr_data, p->aggr_on_count)))
+#define AGGR_BUCK_EQ(a,b) (((a)->hash == (b)->hash) && (aggregator_same_val_list((a)->aggr_data, (b)->aggr_data, p->aggr_on_count)))
#define AGGR_BUCK_FN(n) ((n)->hash)
#define AGGR_BUCK_ORDER 4 /* Initial */
HASH_INSERT2(p->buckets, AGGR_BUCK, p->p.pool, new_bucket);
/* Create root node */
- p->root = aggregator_create_new_node(p->trie_slab);
+ p->root = aggregator_alloc_node(p->trie_slab);
/*
* Root node is initialized with NON_FIB status.
/* Buckets by aggregator rule */
HASH(struct aggregator_bucket) buckets;
- linpool *bucket_pool;
+ struct linpool *bucket_pool;
/* Routes by net and src */
HASH(struct aggregator_route) routes;
- linpool *route_pool;
+ struct linpool *route_pool;
/* Aggregator rule */
u32 aggr_on_count;
struct hmap bucket_id_map;
/* Route withdrawal */
- linpool *rte_withdrawal_pool;
+ struct linpool *rte_withdrawal_pool;
struct rte_withdrawal_item *rte_withdrawal_stack;
int rte_withdrawal_count;
};
void aggregator_recompute(struct aggregator_proto *p, struct aggregator_route *old, struct aggregator_route *new);
void aggregator_bucket_update(struct aggregator_proto *p, struct aggregator_bucket *bucket, struct network *net);
-struct trie_node *aggregator_create_new_node(struct slab *trie_slab);
+struct trie_node *aggregator_alloc_node(struct slab *trie_slab);
#endif
*/
// TODO: inline in aggregator.h?
struct trie_node *
-aggregator_create_new_node(struct slab *trie_slab)
+aggregator_alloc_node(struct slab *trie_slab)
{
return sl_allocz(trie_slab);
}
int has_changed = 0;
int buckets_count = 0;
- u32 old[ARRAY_SIZE(target->potential_buckets)] = { 0 };
+ u32 before[ARRAY_SIZE(target->potential_buckets)] = { 0 };
for (int i = 0; i < POTENTIAL_BUCKETS_BITMAP_SIZE; i++)
{
/* Save current bitmap values */
- old[i] = target->potential_buckets[i];
+ before[i] = target->potential_buckets[i];
/* Compute intersection */
has_intersection |= !!(target->potential_buckets[i] = left->potential_buckets[i] & right->potential_buckets[i]);
* If old and new values are different, the result of their XOR will be
* non-zero, thus @has_changed will be set to non-zero -- true, as well.
*/
- has_changed |= !!(old[i] ^ target->potential_buckets[i]);
+ has_changed |= !!(before[i] ^ target->potential_buckets[i]);
}
/* Sets have an empty intersection, compute their union instead */
{
target->potential_buckets[i] = left->potential_buckets[i] | right->potential_buckets[i];
buckets_count += u32_popcount(target->potential_buckets[i]);
- has_changed |= !!(old[i] ^ target->potential_buckets[i]);
+ has_changed |= !!(before[i] ^ target->potential_buckets[i]);
}
}
if (!node->child[bit])
{
- struct trie_node *new = aggregator_create_new_node(p->trie_slab);
+ struct trie_node *new = aggregator_alloc_node(p->trie_slab);
*new = (struct trie_node) {
.parent = node,
*/
if (!aggregator_is_bucket_potential(&imaginary_node, imaginary_node_inherited_bucket))
{
- struct trie_node *new = aggregator_create_new_node(p->trie_slab);
+ struct trie_node *new = aggregator_alloc_node(p->trie_slab);
*new = imaginary_node;
/* Connect new node to the trie */