aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-12-13 23:26:56 +0100
committerDave Barach <openvpp@barachs.net>2020-12-14 12:14:21 +0000
commitf0ca1e8d92114582ec9142bd15a40f1eb0102793 (patch)
treeaba56d88d909387605ba7fdaf7fc0fd5d3ff565c /src/vlib
parentb2c31b685fd2cf28436ca32bc93e23eb24c74878 (diff)
misc: refactor clib_bitmap_foreach macro
Type: refactor Change-Id: I077110e1a422722e20aa546a6f3224c06ab0cde5 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/buffer.c8
-rw-r--r--src/vlib/cli.c4
-rw-r--r--src/vlib/node.c8
-rw-r--r--src/vlib/node_cli.c4
-rw-r--r--src/vlib/node_format.c4
-rw-r--r--src/vlib/threads.c12
6 files changed, 20 insertions, 20 deletions
diff --git a/src/vlib/buffer.c b/src/vlib/buffer.c
index a30fca32d8b..e1c871c2a2a 100644
--- a/src/vlib/buffer.c
+++ b/src/vlib/buffer.c
@@ -886,7 +886,7 @@ vlib_buffer_main_init (struct vlib_main_t * vm)
VLIB_BUFFER_MAX_NUMA_NODES);
/* *INDENT-OFF* */
- clib_bitmap_foreach (numa_node, bmp,
+ clib_bitmap_foreach (numa_node, bmp)
{
u8 *index = bm->default_buffer_pool_index_for_numa + numa_node;
index[0] = ~0;
@@ -899,7 +899,7 @@ vlib_buffer_main_init (struct vlib_main_t * vm)
if (first_valid_buffer_pool_index == 0xff)
first_valid_buffer_pool_index = index[0];
- });
+ }
/* *INDENT-ON* */
if (first_valid_buffer_pool_index == (u8) ~ 0)
@@ -909,12 +909,12 @@ vlib_buffer_main_init (struct vlib_main_t * vm)
}
/* *INDENT-OFF* */
- clib_bitmap_foreach (numa_node, bmp,
+ clib_bitmap_foreach (numa_node, bmp)
{
if (bm->default_buffer_pool_index_for_numa[numa_node] == (u8) ~0)
bm->default_buffer_pool_index_for_numa[numa_node] =
first_valid_buffer_pool_index;
- });
+ }
/* *INDENT-ON* */
vec_foreach (bp, bm->buffer_pools)
diff --git a/src/vlib/cli.c b/src/vlib/cli.c
index db82dede152..e1db95d6af9 100644
--- a/src/vlib/cli.c
+++ b/src/vlib/cli.c
@@ -304,7 +304,7 @@ vlib_cli_get_possible_completions (u8 * str)
* autocomplete the next level of subcommands */
help_next_level = (vec_len (str) == 0) || isspace (str[vec_len (str) - 1]);
/* *INDENT-OFF* */
- clib_bitmap_foreach(index, match_bitmap, {
+ clib_bitmap_foreach (index, match_bitmap) {
if (help_next_level && is_unique) {
c = get_sub_command (vcm, c, index);
vec_foreach (sc, c->sub_commands) {
@@ -314,7 +314,7 @@ vlib_cli_get_possible_completions (u8 * str)
}
sc = &c->sub_commands[index];
vec_add1(result, (u8*) sc->name);
- });
+ }
/* *INDENT-ON* */
done:
diff --git a/src/vlib/node.c b/src/vlib/node.c
index 387b774f305..cf65f297d6a 100644
--- a/src/vlib/node.c
+++ b/src/vlib/node.c
@@ -223,14 +223,14 @@ vlib_node_add_next_with_slot (vlib_main_t * vm,
uword sib_node_index, sib_slot;
vlib_node_t *sib_node;
/* *INDENT-OFF* */
- clib_bitmap_foreach (sib_node_index, node->sibling_bitmap, ({
+ clib_bitmap_foreach (sib_node_index, node->sibling_bitmap) {
sib_node = vec_elt (nm->nodes, sib_node_index);
if (sib_node != node)
{
sib_slot = vlib_node_add_next_with_slot (vm, sib_node_index, next_node_index, slot);
ASSERT (sib_slot == slot);
}
- }));
+ }
/* *INDENT-ON* */
}
@@ -627,7 +627,7 @@ vlib_node_main_init (vlib_main_t * vm)
}
/* *INDENT-OFF* */
- clib_bitmap_foreach (si, sib->sibling_bitmap, ({
+ clib_bitmap_foreach (si, sib->sibling_bitmap) {
vlib_node_t * m = vec_elt (nm->nodes, si);
/* Connect all of sibling's siblings to us. */
@@ -635,7 +635,7 @@ vlib_node_main_init (vlib_main_t * vm)
/* Connect us to all of sibling's siblings. */
n->sibling_bitmap = clib_bitmap_ori (n->sibling_bitmap, si);
- }));
+ }
/* *INDENT-ON* */
/* Connect sibling to us. */
diff --git a/src/vlib/node_cli.c b/src/vlib/node_cli.c
index 7cfc4a36f8c..c5458b218bf 100644
--- a/src/vlib/node_cli.c
+++ b/src/vlib/node_cli.c
@@ -658,14 +658,14 @@ show_node (vlib_main_t * vm, unformat_input_t * input,
{
int j = 0;
/* *INDENT-OFF* */
- clib_bitmap_foreach (i, n->prev_node_bitmap, ({
+ clib_bitmap_foreach (i, n->prev_node_bitmap) {
vlib_node_t *pn = vlib_get_node (vm, i);
if (j++ % 3 == 0)
s = format (s, "\n ");
s2 = format (s2, "%v (%u)", pn->name, i);
s = format (s, "%-35v", s2);
vec_reset_length (s2);
- }));
+ }
/* *INDENT-ON* */
if (vec_len (s) == 0)
diff --git a/src/vlib/node_format.c b/src/vlib/node_format.c
index 19ebfc15b74..822a8f64e1a 100644
--- a/src/vlib/node_format.c
+++ b/src/vlib/node_format.c
@@ -74,11 +74,11 @@ format_vlib_node_graph (u8 * s, va_list * va)
j = 0;
/* *INDENT-OFF* */
- clib_bitmap_foreach (i, n->prev_node_bitmap, ({
+ clib_bitmap_foreach (i, n->prev_node_bitmap) {
vec_validate_init_empty (tmps, j, empty);
tmps[j].prev_node = i;
j++;
- }));
+ }
/* *INDENT-ON* */
for (i = 0; i < vec_len (tmps); i++)
diff --git a/src/vlib/threads.c b/src/vlib/threads.c
index 749770f9597..7efddff54e8 100644
--- a/src/vlib/threads.c
+++ b/src/vlib/threads.c
@@ -320,13 +320,13 @@ vlib_thread_init (vlib_main_t * vm)
{
uword c;
/* *INDENT-OFF* */
- clib_bitmap_foreach (c, tr->coremask, ({
+ clib_bitmap_foreach (c, tr->coremask) {
if (clib_bitmap_get(avail_cpu, c) == 0)
return clib_error_return (0, "cpu %u is not available to be used"
" for the '%s' thread",c, tr->name);
avail_cpu = clib_bitmap_set(avail_cpu, c, 0);
- }));
+ }
/* *INDENT-ON* */
}
else
@@ -606,14 +606,14 @@ vlib_get_thread_core_numa (vlib_worker_thread_t * w, unsigned cpu_id)
/* *INDENT-OFF* */
clib_sysfs_read ("/sys/devices/system/node/online", "%U",
unformat_bitmap_list, &nbmp);
- clib_bitmap_foreach (node, nbmp, ({
+ clib_bitmap_foreach (node, nbmp) {
p = format (p, "%s%u/cpulist%c", sys_node_path, node, 0);
clib_sysfs_read ((char *) p, "%U", unformat_bitmap_list, &cbmp);
if (clib_bitmap_get (cbmp, cpu_id))
numa_id = node;
vec_reset_length (cbmp);
vec_reset_length (p);
- }));
+ }
/* *INDENT-ON* */
vec_free (nbmp);
vec_free (cbmp);
@@ -976,13 +976,13 @@ start_workers (vlib_main_t * vm)
{
uword c;
/* *INDENT-OFF* */
- clib_bitmap_foreach (c, tr->coremask, ({
+ clib_bitmap_foreach (c, tr->coremask) {
w = vlib_worker_threads + worker_thread_index++;
err = vlib_launch_thread_int (vlib_worker_thread_bootstrap_fn,
w, c);
if (err)
clib_error_report (err);
- }));
+ }
/* *INDENT-ON* */
}
}