aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/interface.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2021-03-26 11:38:01 +0100
committerDamjan Marion <damarion@cisco.com>2021-03-26 16:35:22 +0100
commit92ccf9bcd2692b4b415f31044560c735d639a35c (patch)
treef5308e25329d6853921b7ea4a74d5c3b6f149b25 /src/vnet/interface.c
parentfd8deb48c7ad63b47c5d7465ceefcadef0316f93 (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/vnet/interface.c')
-rw-r--r--src/vnet/interface.c73
1 files changed, 35 insertions, 38 deletions
diff --git a/src/vnet/interface.c b/src/vnet/interface.c
index 13deaccea2d..f648440fbf8 100644
--- a/src/vnet/interface.c
+++ b/src/vnet/interface.c
@@ -875,23 +875,23 @@ vnet_register_interface (vnet_main_t * vnm,
vlib_node_rename (vm, hw->tx_node_index, "%v", tx_node_name);
vlib_node_rename (vm, hw->output_node_index, "%v", output_node_name);
- /* *INDENT-OFF* */
- foreach_vlib_main ({
- vnet_interface_output_runtime_t *rt;
-
- rt = vlib_node_get_runtime_data (this_vlib_main, hw->output_node_index);
- ASSERT (rt->is_deleted == 1);
- rt->is_deleted = 0;
- rt->hw_if_index = hw_index;
- rt->sw_if_index = hw->sw_if_index;
- rt->dev_instance = hw->dev_instance;
-
- rt = vlib_node_get_runtime_data (this_vlib_main, hw->tx_node_index);
- rt->hw_if_index = hw_index;
- rt->sw_if_index = hw->sw_if_index;
- rt->dev_instance = hw->dev_instance;
- });
- /* *INDENT-ON* */
+ foreach_vlib_main ()
+ {
+ vnet_interface_output_runtime_t *rt;
+
+ rt =
+ vlib_node_get_runtime_data (this_vlib_main, hw->output_node_index);
+ ASSERT (rt->is_deleted == 1);
+ rt->is_deleted = 0;
+ rt->hw_if_index = hw_index;
+ rt->sw_if_index = hw->sw_if_index;
+ rt->dev_instance = hw->dev_instance;
+
+ rt = vlib_node_get_runtime_data (this_vlib_main, hw->tx_node_index);
+ rt->hw_if_index = hw_index;
+ rt->sw_if_index = hw->sw_if_index;
+ rt->dev_instance = hw->dev_instance;
+ }
/* The new class may differ from the old one.
* Functions have to be updated. */
@@ -900,14 +900,13 @@ vnet_register_interface (vnet_main_t * vnm,
node->node_fn_registrations = if_out_node->node_fn_registrations;
node->function = if_out_node->function;
- /* *INDENT-OFF* */
- foreach_vlib_main ({
- nrt = vlib_node_get_runtime (this_vlib_main, hw->output_node_index);
- nrt->function = node->function;
- vlib_node_runtime_perf_counter (this_vlib_main, nrt, 0, 0, 0,
- VLIB_NODE_RUNTIME_PERF_RESET);
- });
- /* *INDENT-ON* */
+ foreach_vlib_main ()
+ {
+ nrt = vlib_node_get_runtime (this_vlib_main, hw->output_node_index);
+ nrt->function = node->function;
+ vlib_node_runtime_perf_counter (this_vlib_main, nrt, 0, 0, 0,
+ VLIB_NODE_RUNTIME_PERF_RESET);
+ }
node = vlib_get_node (vm, hw->tx_node_index);
if (dev_class->tx_fn_registrations)
@@ -919,14 +918,14 @@ vnet_register_interface (vnet_main_t * vnm,
else
node->function = dev_class->tx_function;
node->format_trace = dev_class->format_tx_trace;
- /* *INDENT-OFF* */
- foreach_vlib_main ({
- nrt = vlib_node_get_runtime (this_vlib_main, hw->tx_node_index);
- nrt->function = node->function;
- vlib_node_runtime_perf_counter (this_vlib_main, nrt, 0, 0, 0,
- VLIB_NODE_RUNTIME_PERF_RESET);
- });
- /* *INDENT-ON* */
+
+ foreach_vlib_main ()
+ {
+ nrt = vlib_node_get_runtime (this_vlib_main, hw->tx_node_index);
+ nrt->function = node->function;
+ vlib_node_runtime_perf_counter (this_vlib_main, nrt, 0, 0, 0,
+ VLIB_NODE_RUNTIME_PERF_RESET);
+ }
_vec_len (im->deleted_hw_interface_nodes) -= 1;
}
@@ -1074,17 +1073,15 @@ vnet_delete_hw_interface (vnet_main_t * vnm, u32 hw_if_index)
/* Put output/tx nodes into recycle pool */
vnet_hw_interface_nodes_t *dn;
- /* *INDENT-OFF* */
- foreach_vlib_main
- ({
+ foreach_vlib_main ()
+ {
vnet_interface_output_runtime_t *rt =
vlib_node_get_runtime_data (this_vlib_main, hw->output_node_index);
/* Mark node runtime as deleted so output node (if called)
* will drop packets. */
rt->is_deleted = 1;
- });
- /* *INDENT-ON* */
+ }
vlib_node_rename (vm, hw->output_node_index,
"interface-%d-output-deleted", hw_if_index);