diff options
author | Damjan Marion <damarion@cisco.com> | 2021-03-26 11:38:01 +0100 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2021-03-26 16:35:22 +0100 |
commit | 92ccf9bcd2692b4b415f31044560c735d639a35c (patch) | |
tree | f5308e25329d6853921b7ea4a74d5c3b6f149b25 /src/plugins | |
parent | fd8deb48c7ad63b47c5d7465ceefcadef0316f93 (diff) |
vlib: convert foreach_vlib_main macro to be more gdb and clang-format friendly
Type: improvement
Change-Id: I1152e58d7bfcb3c4347147f87a834d45ad51cdfe
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/dispatch-trace/main.c | 48 | ||||
-rw-r--r-- | src/plugins/quic/quic.c | 23 | ||||
-rw-r--r-- | src/plugins/tlsopenssl/tls_async.c | 17 | ||||
-rw-r--r-- | src/plugins/tracedump/tracedump.c | 38 |
4 files changed, 62 insertions, 64 deletions
diff --git a/src/plugins/dispatch-trace/main.c b/src/plugins/dispatch-trace/main.c index 0650997889d..ce662dc0eea 100644 --- a/src/plugins/dispatch-trace/main.c +++ b/src/plugins/dispatch-trace/main.c @@ -257,23 +257,24 @@ vlib_pcap_dispatch_trace_configure (vlib_pcap_dispatch_trace_args_t *a) /* Independent of enable/disable, to allow buffer trace multi nodes */ if (a->buffer_trace_node_index != ~0) { - foreach_vlib_main (({ - tm = &this_vlib_main->trace_main; - tm->verbose = 0; /* not sure this ever did anything... */ - vec_validate (tm->nodes, a->buffer_trace_node_index); - tn = tm->nodes + a->buffer_trace_node_index; - tn->limit += a->buffer_traces_to_capture; - if (a->post_mortem) - { - tm->filter_flag = FILTER_FLAG_POST_MORTEM; - tm->filter_count = ~0; - } - tm->trace_enable = 1; - if (vlib_node_set_dispatch_wrapper (this_vlib_main, - dispatch_pcap_trace)) - clib_warning (0, "Dispatch wrapper already in use on thread %u", - this_vlib_main->thread_index); - })); + foreach_vlib_main () + { + tm = &this_vlib_main->trace_main; + tm->verbose = 0; /* not sure this ever did anything... */ + vec_validate (tm->nodes, a->buffer_trace_node_index); + tn = tm->nodes + a->buffer_trace_node_index; + tn->limit += a->buffer_traces_to_capture; + if (a->post_mortem) + { + tm->filter_flag = FILTER_FLAG_POST_MORTEM; + tm->filter_count = ~0; + } + tm->trace_enable = 1; + if (vlib_node_set_dispatch_wrapper (this_vlib_main, + dispatch_pcap_trace)) + clib_warning (0, "Dispatch wrapper already in use on thread %u", + this_vlib_main->thread_index); + } vec_add1 (dtm->dispatch_buffer_trace_nodes, a->buffer_trace_node_index); } @@ -301,12 +302,13 @@ vlib_pcap_dispatch_trace_configure (vlib_pcap_dispatch_trace_args_t *a) else { dtm->enable = 0; - foreach_vlib_main (({ - tm = &this_vlib_main->trace_main; - tm->filter_flag = 0; - tm->filter_count = 0; - vlib_node_set_dispatch_wrapper (this_vlib_main, 0); - })); + foreach_vlib_main () + { + tm = &this_vlib_main->trace_main; + tm->filter_flag = 0; + tm->filter_count = 0; + vlib_node_set_dispatch_wrapper (this_vlib_main, 0); + } vec_reset_length (dtm->dispatch_buffer_trace_nodes); if (pm->n_packets_captured) { diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c index 03e6f64b95a..cf4d1470ffd 100644 --- a/src/plugins/quic/quic.c +++ b/src/plugins/quic/quic.c @@ -2649,18 +2649,17 @@ quic_get_counter_value (u32 event_code) em = &vm->error_main; n = vlib_get_node (vm, quic_input_node.index); code = event_code; - /* *INDENT-OFF* */ - foreach_vlib_main(({ - em = &this_vlib_main->error_main; - i = n->error_heap_index + code; - c = em->counters[i]; - - if (i < vec_len (em->counters_last_clear)) - c -= em->counters_last_clear[i]; - sum += c; - index++; - })); - /* *INDENT-ON* */ + foreach_vlib_main () + { + em = &this_vlib_main->error_main; + i = n->error_heap_index + code; + c = em->counters[i]; + + if (i < vec_len (em->counters_last_clear)) + c -= em->counters_last_clear[i]; + sum += c; + index++; + } return sum; } diff --git a/src/plugins/tlsopenssl/tls_async.c b/src/plugins/tlsopenssl/tls_async.c index 2988816a255..49987baef16 100644 --- a/src/plugins/tlsopenssl/tls_async.c +++ b/src/plugins/tlsopenssl/tls_async.c @@ -415,15 +415,14 @@ openssl_async_node_enable_disable (u8 is_en) vlib_thread_main_t *vtm = vlib_get_thread_main (); u8 have_workers = vtm->n_threads != 0; - /* *INDENT-OFF* */ - foreach_vlib_main (({ - if (have_workers && ii != 0) - { - vlib_node_set_state (this_vlib_main, tls_async_process_node.index, - state); - } - })); - /* *INDENT-ON* */ + foreach_vlib_main () + { + if (have_workers && ii != 0) + { + vlib_node_set_state (this_vlib_main, tls_async_process_node.index, + state); + } + } } int diff --git a/src/plugins/tracedump/tracedump.c b/src/plugins/tracedump/tracedump.c index 7c83ba25dc9..f1073fe247d 100644 --- a/src/plugins/tracedump/tracedump.c +++ b/src/plugins/tracedump/tracedump.c @@ -230,26 +230,24 @@ vl_api_trace_dump_t_handler (vl_api_trace_dump_t * mp) vec_validate (client_trace_cache, vlib_get_n_threads () - 1); i = 0; - /* *INDENT-OFF* */ - foreach_vlib_main ( - ({ - vlib_trace_main_t *tm = &this_vlib_main->trace_main; - - /* Filter as directed */ - trace_apply_filter(this_vlib_main); - - pool_foreach (th, tm->trace_buffer_pool) - { - vec_add1 (client_trace_cache[i], th[0]); - } - - /* Sort them by increasing time. */ - if (vec_len (client_trace_cache[i])) - vec_sort_with_function (client_trace_cache[i], trace_cmp); - - i++; - })); - /* *INDENT-ON* */ + foreach_vlib_main () + { + vlib_trace_main_t *tm = &this_vlib_main->trace_main; + + /* Filter as directed */ + trace_apply_filter (this_vlib_main); + + pool_foreach (th, tm->trace_buffer_pool) + { + vec_add1 (client_trace_cache[i], th[0]); + } + + /* Sort them by increasing time. */ + if (vec_len (client_trace_cache[i])) + vec_sort_with_function (client_trace_cache[i], trace_cmp); + + i++; + } vlib_worker_thread_barrier_release (vlib_get_first_main ()); } |