From b2c31b685fd2cf28436ca32bc93e23eb24c74878 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Sun, 13 Dec 2020 21:47:40 +0100 Subject: misc: move to new pool_foreach macros Type: refactor Change-Id: Ie67dc579e88132ddb1ee4a34cb69f96920101772 Signed-off-by: Damjan Marion --- src/plugins/ioam/ip6/ioam_cache.c | 25 +++++--------- src/plugins/ioam/ip6/ioam_cache.h | 19 +++++------ src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c | 44 ++++++++++--------------- 3 files changed, 35 insertions(+), 53 deletions(-) (limited to 'src/plugins/ioam') diff --git a/src/plugins/ioam/ip6/ioam_cache.c b/src/plugins/ioam/ip6/ioam_cache.c index 74b50c9282e..d9f7029717a 100644 --- a/src/plugins/ioam/ip6/ioam_cache.c +++ b/src/plugins/ioam/ip6/ioam_cache.c @@ -253,12 +253,10 @@ ioam_cache_table_print (vlib_main_t * vm, u8 verbose) int no_of_threads = vec_len (vlib_worker_threads); int i; - pool_foreach (entry, cm->ioam_rewrite_pool, ( - { - vlib_cli_output (vm, "%U", - format_ioam_cache_entry, - entry); - })); + pool_foreach (entry, cm->ioam_rewrite_pool) + { + vlib_cli_output (vm, "%U", format_ioam_cache_entry, entry); + } if (cm->ts_stats) for (i = 0; i < no_of_threads; i++) @@ -269,16 +267,11 @@ ioam_cache_table_print (vlib_main_t * vm, u8 verbose) if (verbose == 1) vlib_worker_thread_barrier_sync (vm); - pool_foreach (ts_entry, cm->ioam_ts_pool[i], ( - { - vlib_cli_output (vm, - "%U", - format_ioam_cache_ts_entry, - ts_entry, - (u32) - i); - } - )); + pool_foreach (ts_entry, cm->ioam_ts_pool[i]) + { + vlib_cli_output (vm, "%U", format_ioam_cache_ts_entry, ts_entry, + (u32) i); + } vlib_worker_thread_barrier_release (vm); } diff --git a/src/plugins/ioam/ip6/ioam_cache.h b/src/plugins/ioam/ip6/ioam_cache.h index dc4ae0053fa..b85172e8ac1 100644 --- a/src/plugins/ioam/ip6/ioam_cache.h +++ b/src/plugins/ioam/ip6/ioam_cache.h @@ -471,10 +471,10 @@ ioam_cache_table_destroy (vlib_main_t * vm) ioam_cache_entry_t *entry = 0; /* free pool and hash table */ clib_bihash_free_8_8 (&cm->ioam_rewrite_cache_table); - pool_foreach (entry, cm->ioam_rewrite_pool, ( - { - ioam_cache_entry_free (entry); - })); + pool_foreach (entry, cm->ioam_rewrite_pool) + { + ioam_cache_entry_free (entry); + } pool_free (cm->ioam_rewrite_pool); cm->ioam_rewrite_pool = 0; vec_free (cm->sr_rewrite_template); @@ -610,13 +610,10 @@ ioam_cache_ts_table_destroy (vlib_main_t * vm) /* free pool and hash table */ for (i = 0; i < no_of_threads; i++) { - pool_foreach (entry, cm->ioam_ts_pool[i], ( - { - ioam_cache_ts_entry_free (i, - entry, - cm->error_node_index); - } - )); + pool_foreach (entry, cm->ioam_ts_pool[i]) + { + ioam_cache_ts_entry_free (i, entry, cm->error_node_index); + } pool_free (cm->ioam_ts_pool[i]); cm->ioam_ts_pool = 0; tw_timer_wheel_free_16t_2w_512sl (&cm->timer_wheels[i]); diff --git a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c index 5a59e75bf01..108b0c0765b 100644 --- a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c +++ b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c @@ -187,11 +187,10 @@ vxlan_gpe_clear_output_feature_on_all_intfs (vlib_main_t * vm) vnet_main_t *vnm = vnet_get_main (); vnet_interface_main_t *im = &vnm->interface_main; - pool_foreach (si, im->sw_interfaces, ( - { - vxlan_gpe_set_clear_output_feature_on_intf - (vm, si->sw_if_index, 0); - })); + pool_foreach (si, im->sw_interfaces) + { + vxlan_gpe_set_clear_output_feature_on_intf (vm, si->sw_if_index, 0); + } return; } @@ -377,17 +376,12 @@ vxlan_gpe_refresh_output_feature_on_all_dest (void) i = vec_len (hm->bool_ref_by_sw_if_index); vec_free (hm->bool_ref_by_sw_if_index); vec_validate_init_empty (hm->bool_ref_by_sw_if_index, i, ~0); - pool_foreach (t, hm->dst_tunnels, ( - { - vxlan_gpe_enable_disable_ioam_for_dest - (hm->vlib_main, - t->dst_addr, - t->outer_fib_index, - (t->fp_proto == FIB_PROTOCOL_IP4), 1 - /* is_add */ - ); - } - )); + pool_foreach (t, hm->dst_tunnels) + { + vxlan_gpe_enable_disable_ioam_for_dest + (hm->vlib_main, t->dst_addr, t->outer_fib_index, + (t->fp_proto == FIB_PROTOCOL_IP4), 1 /* is_add */ ); + } return; } @@ -621,16 +615,14 @@ int vxlan_gpe_ioam_disable_for_dest return 0; } - pool_foreach (t, hm->dst_tunnels, ( - { - vxlan_gpe_enable_disable_ioam_for_dest - (hm->vlib_main, - t->dst_addr, - t->outer_fib_index, - (t->fp_proto == - FIB_PROTOCOL_IP4), 1 /* is_add */ ); - } - )); + pool_foreach (t, hm->dst_tunnels) + { + vxlan_gpe_enable_disable_ioam_for_dest + (hm->vlib_main, + t->dst_addr, + t->outer_fib_index, + (t->fp_proto == FIB_PROTOCOL_IP4), 1 /* is_add */ ); + } vxlan_gpe_clear_output_feature_on_select_intfs (); return (0); -- cgit 1.2.3-korg