misc: refactor clib_bitmap_foreach macro
Type: refactor
Change-Id: I077110e1a422722e20aa546a6f3224c06ab0cde5
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/vnet/crypto/node.c b/src/vnet/crypto/node.c
index 12e6033..63ed95e 100644
--- a/src/vnet/crypto/node.c
+++ b/src/vnet/crypto/node.c
@@ -161,10 +161,10 @@
u32 index;
/* *INDENT-OFF* */
- clib_bitmap_foreach (index, cm->async_active_ids, ({
+ clib_bitmap_foreach (index, cm->async_active_ids) {
n_cache = crypto_dequeue_frame (vm, node, ct, cm->dequeue_handlers[index],
n_cache, &n_dispatched);
- }));
+ }
/* *INDENT-ON* */
if (n_cache)
vlib_buffer_enqueue_to_next (vm, node, ct->buffer_indice, ct->nexts,
diff --git a/src/vnet/fib/ip6_fib.c b/src/vnet/fib/ip6_fib.c
index 6943166..62bf16f 100644
--- a/src/vnet/fib/ip6_fib.c
+++ b/src/vnet/fib/ip6_fib.c
@@ -264,11 +264,11 @@
old = table->prefix_lengths_in_search_order;
/* Note: bitmap reversed so this is in fact a longest prefix match */
- clib_bitmap_foreach (i, table->non_empty_dst_address_length_bitmap,
- ({
+ clib_bitmap_foreach (i, table->non_empty_dst_address_length_bitmap)
+ {
int dst_address_length = 128 - i;
vec_add1(prefix_lengths_in_search_order, dst_address_length);
- }));
+ }
table->prefix_lengths_in_search_order = prefix_lengths_in_search_order;
diff --git a/src/vnet/handoff.c b/src/vnet/handoff.c
index ca46b5a..cbdc528 100644
--- a/src/vnet/handoff.c
+++ b/src/vnet/handoff.c
@@ -213,10 +213,10 @@
{
d->workers_bitmap = bitmap;
/* *INDENT-OFF* */
- clib_bitmap_foreach (i, bitmap,
- ({
+ clib_bitmap_foreach (i, bitmap)
+ {
vec_add1(d->workers, i);
- }));
+ }
/* *INDENT-ON* */
}
diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c
index 240f13f..a06f02f 100644
--- a/src/vnet/interface_api.c
+++ b/src/vnet/interface_api.c
@@ -1078,8 +1078,8 @@
/* *INDENT-OFF* */
foreach_vlib_main (({
- clib_bitmap_foreach (si, pn->sibling_bitmap,
- ({
+ clib_bitmap_foreach (si, pn->sibling_bitmap)
+ {
rt = vlib_node_get_runtime_data (this_vlib_main, si);
vec_foreach (dq, rt->devices_and_queues)
{
@@ -1088,7 +1088,7 @@
send_interface_rx_placement_details (am, reg, hw->sw_if_index, index,
dq->queue_id, dq->mode, mp->context);
}
- }));
+ }
index++;
}));
/* *INDENT-ON* */
diff --git a/src/vnet/interface_cli.c b/src/vnet/interface_cli.c
index 73f70cf..c9f1154 100644
--- a/src/vnet/interface_cli.c
+++ b/src/vnet/interface_cli.c
@@ -139,12 +139,12 @@
hi, verbose);
/* *INDENT-OFF* */
- clib_bitmap_foreach (hw_idx, hi->bond_info,
- ({
+ clib_bitmap_foreach (hw_idx, hi->bond_info)
+ {
shi = vnet_get_hw_interface(vnm, hw_idx);
vlib_cli_output (vm, "%U\n",
format_vnet_hw_interface, vnm, shi, verbose);
- }));
+ }
/* *INDENT-ON* */
}
}
@@ -1663,8 +1663,8 @@
/* *INDENT-OFF* */
foreach_vlib_main (({
- clib_bitmap_foreach (si, pn->sibling_bitmap,
- ({
+ clib_bitmap_foreach (si, pn->sibling_bitmap)
+ {
rt = vlib_node_get_runtime_data (this_vlib_main, si);
if (vec_len (rt->devices_and_queues))
@@ -1679,7 +1679,7 @@
dq->queue_id,
format_vnet_hw_if_rx_mode, dq->mode);
}
- }));
+ }
if (vec_len (s) > 0)
{
vlib_cli_output(vm, "Thread %u (%s):\n%v", index,
diff --git a/src/vnet/interface_format.c b/src/vnet/interface_format.c
index a2adc9b..9038e5d 100644
--- a/src/vnet/interface_format.c
+++ b/src/vnet/interface_format.c
@@ -142,9 +142,9 @@
if (bitmap)
{
/* *INDENT-OFF* */
- clib_bitmap_foreach (i, bitmap, ({
+ clib_bitmap_foreach (i, bitmap) {
s = format (s, "%u ", i);
- }));
+ }
/* *INDENT-ON* */
}
@@ -181,8 +181,8 @@
{
int hw_idx;
s = format (s, "Slave-Idx:");
- clib_bitmap_foreach (hw_idx, hi->bond_info, s =
- format (s, " %d", hw_idx));
+ clib_bitmap_foreach (hw_idx, hi->bond_info)
+ s = format (s, " %d", hw_idx);
}
else if (dev_class->format_device_name)
s = format (s, "%U", dev_class->format_device_name, hi->dev_instance);
diff --git a/src/vnet/l2/l2_rw.c b/src/vnet/l2/l2_rw.c
index 59b7de9..a7c95fe 100644
--- a/src/vnet/l2/l2_rw.c
+++ b/src/vnet/l2/l2_rw.c
@@ -498,9 +498,9 @@
uword i;
/* *INDENT-OFF* */
- clib_bitmap_foreach(i, rw->configs_bitmap, {
+ clib_bitmap_foreach (i, rw->configs_bitmap) {
vlib_cli_output (vm, "sw_if_index:%d %U\n", i, format_l2_rw_config, &rw->configs[i]);
- });
+ }
/* *INDENT-ON* */
return 0;
}
diff --git a/src/vnet/mfib/ip6_mfib.c b/src/vnet/mfib/ip6_mfib.c
index b5e5bce..bbab7ae 100644
--- a/src/vnet/mfib/ip6_mfib.c
+++ b/src/vnet/mfib/ip6_mfib.c
@@ -457,10 +457,10 @@
int i;
vec_reset_length (table->prefix_lengths_in_search_order);
/* Note: bitmap reversed so this is in fact a longest prefix match */
- clib_bitmap_foreach (i, table->non_empty_dst_address_length_bitmap,
- ({
+ clib_bitmap_foreach (i, table->non_empty_dst_address_length_bitmap)
+ {
vec_add1(table->prefix_lengths_in_search_order, (256 - i));
- }));
+ }
}
void
diff --git a/src/vnet/pg/input.c b/src/vnet/pg/input.c
index 63031ce..940bf12 100644
--- a/src/vnet/pg/input.c
+++ b/src/vnet/pg/input.c
@@ -1808,10 +1808,10 @@
worker_index = vlib_get_current_worker_index ();
/* *INDENT-OFF* */
- clib_bitmap_foreach (i, pg->enabled_streams[worker_index], ({
+ clib_bitmap_foreach (i, pg->enabled_streams[worker_index]) {
pg_stream_t *s = vec_elt_at_index (pg->streams, i);
n_packets += pg_input_stream (node, pg, s);
- }));
+ }
/* *INDENT-ON* */
return n_packets;
diff --git a/src/vnet/span/node.c b/src/vnet/span/node.c
index 1a9d1ba..ca5ea68 100644
--- a/src/vnet/span/node.c
+++ b/src/vnet/span/node.c
@@ -85,7 +85,7 @@
return;
/* *INDENT-OFF* */
- clib_bitmap_foreach (i, sm0->mirror_ports, (
+ clib_bitmap_foreach (i, sm0->mirror_ports)
{
if (mirror_frames[i] == 0)
{
@@ -121,7 +121,7 @@
#endif
}
}
- }));
+ }
/* *INDENT-ON* */
}
diff --git a/src/vnet/span/span.c b/src/vnet/span/span.c
index fc923e0..ec47920 100644
--- a/src/vnet/span/span.c
+++ b/src/vnet/span/span.c
@@ -212,7 +212,7 @@
}
s = format (s, "%U", format_vnet_sw_if_index_name, vnm,
si - sm->interfaces);
- clib_bitmap_foreach (i, b, (
+ clib_bitmap_foreach (i, b)
{
int device = (clib_bitmap_get (drxm->mirror_ports, i) +
clib_bitmap_get (dtxm->mirror_ports, i) * 2);
@@ -223,7 +223,7 @@
format_vnet_sw_if_index_name, vnm, i,
states[device], states[l2]);
vec_reset_length (s);
- }));
+ }
clib_bitmap_free (b);
clib_bitmap_free (l);
clib_bitmap_free (d);
diff --git a/src/vnet/span/span_api.c b/src/vnet/span/span_api.c
index dacbe2e..96d1fac 100644
--- a/src/vnet/span/span_api.c
+++ b/src/vnet/span/span_api.c
@@ -86,7 +86,7 @@
clib_bitmap_t *b;
u32 i;
b = clib_bitmap_dup_or (rxm->mirror_ports, txm->mirror_ports);
- clib_bitmap_foreach (i, b, (
+ clib_bitmap_foreach (i, b)
{
rmp = vl_msg_api_alloc (sizeof (*rmp));
clib_memset (rmp, 0, sizeof (*rmp));
@@ -100,7 +100,7 @@
rmp->is_l2 = mp->is_l2;
vl_api_send_msg (reg, (u8 *) rmp);
- }));
+ }
clib_bitmap_free (b);
}
}