lb_as_t *as;
u32 *as_index;
- pool_foreach(as_index, vip->as_indexes, {
+ pool_foreach (as_index, vip->as_indexes) {
as = &lbm->ass[*as_index];
s = format(s, "%U %U %u buckets %Lu flows dpo:%u %s\n",
format_white_space, indent,
vlib_refcount_get(&lbm->as_refcount, as - lbm->ass),
as->dpo.dpoi_index,
(as->flags & LB_AS_FLAGS_USED)?"used":" removed");
- });
+ }
vec_free(count);
return s;
vip->last_garbage_collection = now;
lb_as_t *as;
u32 *as_index;
- pool_foreach(as_index, vip->as_indexes, {
+ pool_foreach (as_index, vip->as_indexes) {
as = &lbm->ass[*as_index];
if (!(as->flags & LB_AS_FLAGS_USED) && //Not used
clib_u32_loop_gt(now, as->last_used + LB_CONCURRENCY_TIMEOUT) &&
pool_put(vip->as_indexes, as_index);
pool_put(lbm->ass, as);
}
- });
+ }
}
void lb_garbage_collection()
lb_get_writer_lock();
lb_vip_t *vip;
u32 *to_be_removed_vips = 0, *i;
- pool_foreach(vip, lbm->vips, {
+ pool_foreach (vip, lbm->vips) {
lb_vip_garbage_collection(vip);
if (!(vip->flags & LB_VIP_FLAGS_USED) &&
(pool_elts(vip->as_indexes) == 0)) {
vec_add1(to_be_removed_vips, vip - lbm->vips);
}
- });
+ }
vec_foreach(i, to_be_removed_vips) {
vip = &lbm->vips[*i];
//Check if some AS is configured or not
i = 0;
- pool_foreach(as_index, vip->as_indexes, {
+ pool_foreach (as_index, vip->as_indexes) {
as = &lbm->ass[*as_index];
if (as->flags & LB_AS_FLAGS_USED) { //Not used anymore
i = 1;
goto out; //Not sure 'break' works in this macro-loop
}
- });
+ }
out:
if (i == 0) {
vec_alloc(sort_arr, pool_elts(vip->as_indexes));
i = 0;
- pool_foreach(as_index, vip->as_indexes, {
+ pool_foreach (as_index, vip->as_indexes) {
as = &lbm->ass[*as_index];
if (!(as->flags & LB_AS_FLAGS_USED)) //Not used anymore
continue;
sort_arr[i].as_index = as - lbm->ass;
i++;
- });
+ }
_vec_len(sort_arr) = i;
vec_sort_with_function(sort_arr, lb_pseudorand_compare);
/* This must be called with the lock owned */
CLIB_SPINLOCK_ASSERT_LOCKED (&lbm->writer_lock);
ip46_prefix_normalize(prefix, plen);
- pool_foreach(vip, lbm->vips, {
+ pool_foreach (vip, lbm->vips) {
if ((vip->flags & LB_AS_FLAGS_USED) &&
vip->plen == plen &&
vip->prefix.as_u64[0] == prefix->as_u64[0] &&
return 0;
}
}
- });
+ }
return VNET_API_ERROR_NO_SUCH_ENTRY;
}
CLIB_SPINLOCK_ASSERT_LOCKED (&lbm->writer_lock);
lb_as_t *as;
u32 *asi;
- pool_foreach(asi, vip->as_indexes, {
+ pool_foreach (asi, vip->as_indexes) {
as = &lbm->ass[*asi];
if (as->vip_index == (vip - lbm->vips) &&
as->address.as_u64[0] == address->as_u64[0] &&
*as_index = as - lbm->ass;
return 0;
}
- });
+ }
return -1;
}
lb_as_t *as;
u32 *as_index;
- pool_foreach(as_index, vip->as_indexes, {
+ pool_foreach (as_index, vip->as_indexes) {
as = &lbm->ass[*as_index];
vec_add1(ass, as->address);
- });
+ }
if (vec_len(ass))
lb_vip_del_ass_withlock(vip_index, ass, vec_len(ass), 0);
vec_free(ass);