aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
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/plugins
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/plugins')
-rw-r--r--src/plugins/acl/acl.c4
-rw-r--r--src/plugins/cnat/cnat_snat.c6
-rw-r--r--src/plugins/dpdk/device/device.c4
-rw-r--r--src/plugins/dpdk/device/init.c8
-rw-r--r--src/plugins/lisp/lisp-cp/gid_dictionary.c12
-rw-r--r--src/plugins/map/lpm.c6
-rw-r--r--src/plugins/nat/nat.c14
-rw-r--r--src/plugins/nat/nat64/nat64.c6
8 files changed, 30 insertions, 30 deletions
diff --git a/src/plugins/acl/acl.c b/src/plugins/acl/acl.c
index 05251c6fcd8..35f8b8cb82d 100644
--- a/src/plugins/acl/acl.c
+++ b/src/plugins/acl/acl.c
@@ -679,7 +679,7 @@ acl_interface_set_inout_acl_list (acl_main_t * am, u32 sw_if_index,
seen_acl_bitmap, format_bitmap_hex, change_acl_bitmap);
/* *INDENT-OFF* */
- clib_bitmap_foreach(acln, change_acl_bitmap, ({
+ clib_bitmap_foreach (acln, change_acl_bitmap) {
if (clib_bitmap_get(old_seen_acl_bitmap, acln)) {
/* ACL is being removed. */
if (acln < vec_len((*pinout_sw_if_index_vec_by_acl))) {
@@ -691,7 +691,7 @@ acl_interface_set_inout_acl_list (acl_main_t * am, u32 sw_if_index,
vec_validate((*pinout_sw_if_index_vec_by_acl), acln);
vec_add1((*pinout_sw_if_index_vec_by_acl)[acln], sw_if_index);
}
- }));
+ }
/* *INDENT-ON* */
vec_free ((*pinout_acl_vec_by_sw_if_index)[sw_if_index]);
diff --git a/src/plugins/cnat/cnat_snat.c b/src/plugins/cnat/cnat_snat.c
index cc83dce4b20..7c799065b57 100644
--- a/src/plugins/cnat/cnat_snat.c
+++ b/src/plugins/cnat/cnat_snat.c
@@ -25,11 +25,11 @@ cnat_compute_prefix_lengths_in_search_order (cnat_snat_pfx_table_t *
vec_reset_length (table->meta[af].prefix_lengths_in_search_order);
/* Note: bitmap reversed so this is in fact a longest prefix match */
/* *INDENT-OFF* */
- clib_bitmap_foreach (i, table->meta[af].non_empty_dst_address_length_bitmap,
- ({
+ clib_bitmap_foreach (i, table->meta[af].non_empty_dst_address_length_bitmap)
+ {
int dst_address_length = 128 - i;
vec_add1 (table->meta[af].prefix_lengths_in_search_order, dst_address_length);
- }));
+ }
/* *INDENT-ON* */
}
diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c
index 7a86ee0fe6b..4d26abde214 100644
--- a/src/plugins/dpdk/device/device.c
+++ b/src/plugins/dpdk/device/device.c
@@ -629,14 +629,14 @@ dpdk_interface_set_rss_queues (struct vnet_main_t *vnm,
valid_queue_count = 0;
/* *INDENT-OFF* */
- clib_bitmap_foreach (i, bitmap, ({
+ clib_bitmap_foreach (i, bitmap) {
if (i >= dev_info.nb_rx_queues)
{
err = clib_error_return (0, "illegal queue number");
goto done;
}
reta[valid_queue_count++] = i;
- }));
+ }
/* *INDENT-ON* */
/* check valid_queue_count not zero, make coverity happy */
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index bd8d435975c..19898b186fe 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -707,10 +707,10 @@ dpdk_lib_init (dpdk_main_t * dm)
{
int i;
q = 0;
- clib_bitmap_foreach (i, devconf->workers, ({
+ clib_bitmap_foreach (i, devconf->workers) {
vnet_hw_interface_assign_rx_thread (dm->vnet_main, xd->hw_if_index, q++,
vdm->first_worker_thread_index + i);
- }));
+ }
}
else
for (q = 0; q < xd->rx_q_used; q++)
@@ -1354,7 +1354,7 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
default_hugepage_sz = clib_mem_get_default_hugepage_size ();
/* *INDENT-OFF* */
- clib_bitmap_foreach (x, tm->cpu_socket_bitmap, (
+ clib_bitmap_foreach (x, tm->cpu_socket_bitmap)
{
clib_error_t *e;
uword n_pages;
@@ -1365,7 +1365,7 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
if ((e = clib_sysfs_prealloc_hugepages(x, 0, n_pages)))
clib_error_report (e);
- }));
+ }
/* *INDENT-ON* */
}
diff --git a/src/plugins/lisp/lisp-cp/gid_dictionary.c b/src/plugins/lisp/lisp-cp/gid_dictionary.c
index 9b0af3f5c6d..a0cc9c09e3c 100644
--- a/src/plugins/lisp/lisp-cp/gid_dictionary.c
+++ b/src/plugins/lisp/lisp-cp/gid_dictionary.c
@@ -489,11 +489,11 @@ ip4_compute_prefix_lengths_in_search_order (gid_ip4_table_t * db)
/* Note: bitmap reversed so this is in fact a longest prefix match */
/* *INDENT-OFF* */
- clib_bitmap_foreach (i, db->ip4_non_empty_dst_address_length_bitmap,
- ({
+ clib_bitmap_foreach (i, db->ip4_non_empty_dst_address_length_bitmap)
+ {
int dst_address_length = 32 - i;
vec_add1 (db->ip4_prefix_lengths_in_search_order, dst_address_length);
- }));
+ }
/* *INDENT-ON* */
}
@@ -672,11 +672,11 @@ ip6_compute_prefix_lengths_in_search_order (gid_ip6_table_t * db)
/* Note: bitmap reversed so this is in fact a longest prefix match */
/* *INDENT-OFF* */
- clib_bitmap_foreach (i, db->ip6_non_empty_dst_address_length_bitmap,
- ({
+ clib_bitmap_foreach (i, db->ip6_non_empty_dst_address_length_bitmap)
+ {
int dst_address_length = 128 - i;
vec_add1 (db->ip6_prefix_lengths_in_search_order, dst_address_length);
- }));
+ }
/* *INDENT-ON* */
}
diff --git a/src/plugins/map/lpm.c b/src/plugins/map/lpm.c
index 4abeefca06d..c0e5bad1417 100644
--- a/src/plugins/map/lpm.c
+++ b/src/plugins/map/lpm.c
@@ -111,12 +111,12 @@ lpm_128_lookup (lpm_t *lpm, void *addr_v, u8 pfxlen)
ip6_address_t *addr = addr_v;
int i = 0, rv;
u32 value;
- clib_bitmap_foreach (i, lpm->prefix_lengths_bitmap,
- ({
+ clib_bitmap_foreach (i, lpm->prefix_lengths_bitmap)
+ {
rv = lpm_128_lookup_core(lpm, addr, i, &value);
if (rv == 0)
return value;
- }));
+ }
return ~0;
}
diff --git a/src/plugins/nat/nat.c b/src/plugins/nat/nat.c
index 0694c348c12..05c7afc2b16 100644
--- a/src/plugins/nat/nat.c
+++ b/src/plugins/nat/nat.c
@@ -1491,10 +1491,10 @@ nat44_add_del_lb_static_mapping (ip4_address_t e_addr, u16 e_port,
if (sm->num_workers > 1)
{
/* *INDENT-OFF* */
- clib_bitmap_foreach (i, bitmap,
- ({
+ clib_bitmap_foreach (i, bitmap)
+ {
vec_add1(m->workers, i);
- }));
+ }
/* *INDENT-ON* */
}
}
@@ -1739,7 +1739,7 @@ nat44_lb_static_mapping_add_del_local (ip4_address_t e_addr, u16 e_port,
if (sm->num_workers > 1)
{
/* *INDENT-OFF* */
- clib_bitmap_foreach (i, bitmap, ({ vec_add1(m->workers, i); }));
+ clib_bitmap_foreach (i, bitmap) { vec_add1(m->workers, i); }
/* *INDENT-ON* */
}
@@ -2467,13 +2467,13 @@ snat_set_workers (uword * bitmap)
vec_free (sm->workers);
/* *INDENT-OFF* */
- clib_bitmap_foreach (i, bitmap,
- ({
+ clib_bitmap_foreach (i, bitmap)
+ {
vec_add1(sm->workers, i);
sm->per_thread_data[sm->first_worker_index + i].snat_thread_index = j;
sm->per_thread_data[sm->first_worker_index + i].thread_index = i;
j++;
- }));
+ }
/* *INDENT-ON* */
sm->port_per_thread = (0xffff - 1024) / _vec_len (sm->workers);
diff --git a/src/plugins/nat/nat64/nat64.c b/src/plugins/nat/nat64/nat64.c
index ae7bb350436..6e5ceecb76f 100644
--- a/src/plugins/nat/nat64/nat64.c
+++ b/src/plugins/nat/nat64/nat64.c
@@ -283,10 +283,10 @@ nat64_init (vlib_main_t * vm)
bitmap = clib_bitmap_set (bitmap, i, 1);
/* *INDENT-OFF* */
- clib_bitmap_foreach (i, bitmap,
- ({
+ clib_bitmap_foreach (i, bitmap)
+ {
vec_add1(nm->workers, i);
- }));
+ }
/* *INDENT-ON* */
clib_bitmap_free (bitmap);