diff options
Diffstat (limited to 'src/plugins/ioam')
-rw-r--r-- | src/plugins/ioam/analyse/ioam_summary_export.c | 12 | ||||
-rw-r--r-- | src/plugins/ioam/encap/ip6_ioam_e2e.c | 16 | ||||
-rw-r--r-- | src/plugins/ioam/encap/ip6_ioam_pot.c | 47 | ||||
-rw-r--r-- | src/plugins/ioam/encap/ip6_ioam_trace.c | 21 | ||||
-rw-r--r-- | src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c | 19 | ||||
-rw-r--r-- | src/plugins/ioam/udp-ping/udp_ping_export.c | 13 | ||||
-rw-r--r-- | src/plugins/ioam/udp-ping/udp_ping_node.c | 12 |
7 files changed, 65 insertions, 75 deletions
diff --git a/src/plugins/ioam/analyse/ioam_summary_export.c b/src/plugins/ioam/analyse/ioam_summary_export.c index c16e8398bd3..4851491012b 100644 --- a/src/plugins/ioam/analyse/ioam_summary_export.c +++ b/src/plugins/ioam/analyse/ioam_summary_export.c @@ -427,15 +427,15 @@ ioam_flow_create (u8 del) clib_error_t * ioam_flow_report_init (vlib_main_t * vm) { - clib_error_t *error; - - if ((error = vlib_call_init_function (vm, flow_report_init))) - return error; - return 0; } -VLIB_INIT_FUNCTION (ioam_flow_report_init); +/* *INDENT-OFF* */ +VLIB_INIT_FUNCTION (ioam_flow_report_init) = +{ + .runs_after = VLIB_INITS("flow_report_init"), +}; +/* *INDENT-ON* */ /* * fd.io coding-style-patch-verification: ON diff --git a/src/plugins/ioam/encap/ip6_ioam_e2e.c b/src/plugins/ioam/encap/ip6_ioam_e2e.c index cdaf740d251..58714083fe4 100644 --- a/src/plugins/ioam/encap/ip6_ioam_e2e.c +++ b/src/plugins/ioam/encap/ip6_ioam_e2e.c @@ -44,7 +44,7 @@ static u8 * ioam_e2e_trace_handler (u8 * s, return s; } -int +int ioam_e2e_config_handler (void *data, u8 disable) { int *analyse = data; @@ -171,13 +171,6 @@ VLIB_CLI_COMMAND (ioam_show_e2e_cmd, static) = { static clib_error_t * ioam_e2e_init (vlib_main_t * vm) { - clib_error_t * error; - - if ((error = vlib_call_init_function (vm, ip6_hop_by_hop_ioam_init))) - { - return(error); - } - /* * As of now we have only PPC under E2E header. */ @@ -213,4 +206,9 @@ ioam_e2e_init (vlib_main_t * vm) * Init function for the E2E lib. * ip6_hop_by_hop_ioam_e2e_init gets called during init. */ -VLIB_INIT_FUNCTION (ioam_e2e_init); +/* *INDENT-OFF* */ +VLIB_INIT_FUNCTION (ioam_e2e_init) = +{ + .runs_after = VLIB_INITS("ip6_hop_by_hop_ioam_init"), +}; +/* *INDENT-ON* */ diff --git a/src/plugins/ioam/encap/ip6_ioam_pot.c b/src/plugins/ioam/encap/ip6_ioam_pot.c index 8dd06c144e3..71c0cc92709 100644 --- a/src/plugins/ioam/encap/ip6_ioam_pot.c +++ b/src/plugins/ioam/encap/ip6_ioam_pot.c @@ -29,7 +29,7 @@ _(PROCESSED, "Pkts with ip6 hop-by-hop pot options") \ _(PROFILE_MISS, "Pkts with ip6 hop-by-hop pot options but no profile set") \ _(PASSED, "Pkts with POT in Policy") \ - _(FAILED, "Pkts with POT out of Policy") + _(FAILED, "Pkts with POT out of Policy") static char * ip6_hop_by_hop_ioam_pot_stats_strings[] = { #define _(sym,string) string, @@ -47,7 +47,7 @@ typedef enum { typedef struct { /* stats */ u64 counters[ARRAY_LEN(ip6_hop_by_hop_ioam_pot_stats_strings)]; - + /* convenience */ vlib_main_t * vlib_main; vnet_main_t * vnet_main; @@ -55,7 +55,7 @@ typedef struct { ip6_hop_by_hop_ioam_pot_main_t ip6_hop_by_hop_ioam_pot_main; -always_inline void +always_inline void ip6_ioam_stats_increment_counter (u32 counter_index, u64 increment) { ip6_hop_by_hop_ioam_pot_main_t *hm = &ip6_hop_by_hop_ioam_pot_main; @@ -69,13 +69,13 @@ static u8 * format_ioam_pot (u8 * s, va_list * args) ioam_pot_option_t * pot0 = va_arg (*args, ioam_pot_option_t *); u64 random, cumulative; random = cumulative = 0; - if (pot0) - { + if (pot0) + { random = clib_net_to_host_u64 (pot0->random); cumulative = clib_net_to_host_u64 (pot0->cumulative); } - s = format (s, "random = 0x%Lx, Cumulative = 0x%Lx, Index = 0x%x", + s = format (s, "random = 0x%Lx, Cumulative = 0x%Lx, Index = 0x%x", random, cumulative, pot0 ? pot0->reserved_profile_id : ~0); return s; } @@ -117,22 +117,22 @@ ip6_hbh_ioam_proof_of_transit_handler (vlib_buffer_t *b, pot0->reserved_profile_id = pot_profile_index & PROFILE_ID_MASK; pot_profile_incr_usage_stats(pot_profile); - } - else + } + else { /* Non encap node */ - if (PREDICT_FALSE(pot0->reserved_profile_id != - pot_profile_index || pot_profile == 0)) + if (PREDICT_FALSE(pot0->reserved_profile_id != + pot_profile_index || pot_profile == 0)) { /* New profile announced by encap node. */ new_profile = - pot_profile_find(pot0->reserved_profile_id); + pot_profile_find(pot0->reserved_profile_id); if (PREDICT_FALSE(new_profile == 0 || - new_profile->valid == 0)) + new_profile->valid == 0)) { ip6_ioam_stats_increment_counter (IP6_IOAM_POT_PROFILE_MISS, 1); return(-1); - } - else + } + else { pot_profile_index = pot0->reserved_profile_id; pot_profile = new_profile; @@ -143,7 +143,7 @@ ip6_hbh_ioam_proof_of_transit_handler (vlib_buffer_t *b, pot_profile_incr_usage_stats(pot_profile); } - if (pot0->random == 0) + if (pot0->random == 0) { pot0->random = clib_host_to_net_u64(pot_generate_random(pot_profile)); pot0->cumulative = 0; @@ -196,7 +196,7 @@ int ip6_hop_by_hop_ioam_pot_rewrite_handler (u8 *rewrite_string, u8 *rewrite_siz pot_option = (ioam_pot_option_t *)rewrite_string; pot_option->hdr.type = HBH_OPTION_TYPE_IOAM_PROOF_OF_TRANSIT | HBH_OPTION_TYPE_DATA_CHANGE_ENROUTE; - pot_option->hdr.length = sizeof (ioam_pot_option_t) - + pot_option->hdr.length = sizeof (ioam_pot_option_t) - sizeof (ip6_hop_by_hop_option_t); return(0); } @@ -235,15 +235,11 @@ static clib_error_t * ip6_hop_by_hop_ioam_pot_init (vlib_main_t * vm) { ip6_hop_by_hop_ioam_pot_main_t * hm = &ip6_hop_by_hop_ioam_pot_main; - clib_error_t * error; - - if ((error = vlib_call_init_function (vm, ip6_hop_by_hop_ioam_init))) - return(error); hm->vlib_main = vm; hm->vnet_main = vnet_get_main(); clib_memset(hm->counters, 0, sizeof(hm->counters)); - + if (ip6_hbh_register_option(HBH_OPTION_TYPE_IOAM_PROOF_OF_TRANSIT, ip6_hbh_ioam_proof_of_transit_handler, ip6_hbh_ioam_proof_of_transit_trace_handler) < 0) return (clib_error_create("registration of HBH_OPTION_TYPE_IOAM_PROOF_OF_TRANSIT failed")); @@ -260,6 +256,9 @@ ip6_hop_by_hop_ioam_pot_init (vlib_main_t * vm) return (0); } -VLIB_INIT_FUNCTION (ip6_hop_by_hop_ioam_pot_init); - - +/* *INDENT-OFF* */ +VLIB_INIT_FUNCTION (ip6_hop_by_hop_ioam_pot_init) = +{ + .runs_after = VLIB_INITS("ip6_hop_by_hop_ioam_init"), +}; +/* *INDENT-OFF* */ diff --git a/src/plugins/ioam/encap/ip6_ioam_trace.c b/src/plugins/ioam/encap/ip6_ioam_trace.c index ddd9ae99dd5..53fb63ea6fd 100644 --- a/src/plugins/ioam/encap/ip6_ioam_trace.c +++ b/src/plugins/ioam/encap/ip6_ioam_trace.c @@ -417,16 +417,6 @@ static clib_error_t * ip6_hop_by_hop_ioam_trace_init (vlib_main_t * vm) { ip6_hop_by_hop_ioam_trace_main_t *hm = &ip6_hop_by_hop_ioam_trace_main; - clib_error_t *error; - - if ((error = vlib_call_init_function (vm, ip_main_init))) - return (error); - - if ((error = vlib_call_init_function (vm, ip6_lookup_init))) - return error; - - if ((error = vlib_call_init_function (vm, ip6_hop_by_hop_ioam_init))) - return (error); hm->vlib_main = vm; hm->vnet_main = vnet_get_main (); @@ -452,6 +442,14 @@ ip6_hop_by_hop_ioam_trace_init (vlib_main_t * vm) return (0); } +/* *INDENT-OFF* */ +VLIB_INIT_FUNCTION (ip6_hop_by_hop_ioam_trace_init) = +{ + .runs_after = VLIB_INITS ("ip_main_init", "ip6_lookup_init", + "ip6_hop_by_hop_ioam_init"), +}; +/* *INDENT-ON* */ + int ip6_trace_profile_cleanup (void) { @@ -490,9 +488,6 @@ ip6_trace_profile_setup (void) return (0); } - -VLIB_INIT_FUNCTION (ip6_hop_by_hop_ioam_trace_init); - /* * fd.io coding-style-patch-verification: ON * diff --git a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c index e2c130c00df..c51d251bee3 100644 --- a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c +++ b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c @@ -436,16 +436,6 @@ static clib_error_t * vxlan_gpe_ioam_trace_init (vlib_main_t * vm) { vxlan_gpe_ioam_trace_main_t *hm = &vxlan_gpe_ioam_trace_main; - clib_error_t *error; - - if ((error = vlib_call_init_function (vm, ip_main_init))) - return (error); - - if ((error = vlib_call_init_function (vm, ip6_lookup_init))) - return error; - - if ((error = vlib_call_init_function (vm, vxlan_gpe_init))) - return (error); hm->vlib_main = vm; hm->vnet_main = vnet_get_main (); @@ -470,7 +460,14 @@ vxlan_gpe_ioam_trace_init (vlib_main_t * vm) return (0); } -VLIB_INIT_FUNCTION (vxlan_gpe_ioam_trace_init); +/* *INDENT-OFF* */ +VLIB_INIT_FUNCTION (vxlan_gpe_ioam_trace_init) = +{ + .runs_after = VLIB_INITS("ip_main_init", "ip6_lookup_init", + "vxlan_gpe_init"), +}; +/* *INDENT-ON* */ + int vxlan_gpe_trace_profile_cleanup (void) diff --git a/src/plugins/ioam/udp-ping/udp_ping_export.c b/src/plugins/ioam/udp-ping/udp_ping_export.c index 7a7cad4934a..d25eb1041dd 100644 --- a/src/plugins/ioam/udp-ping/udp_ping_export.c +++ b/src/plugins/ioam/udp-ping/udp_ping_export.c @@ -290,15 +290,16 @@ VLIB_CLI_COMMAND (set_udp_ping_export_command, static) = { clib_error_t * udp_ping_flow_report_init (vlib_main_t * vm) { - clib_error_t *error; - - if ((error = vlib_call_init_function (vm, flow_report_init))) - return error; - return 0; } -VLIB_INIT_FUNCTION (udp_ping_flow_report_init); +/* *INDENT-OFF* */ +VLIB_INIT_FUNCTION (udp_ping_flow_report_init) = +{ + .runs_after = VLIB_INITS ("flow_report_init"), +}; +/* *INDENT-ON* */ + /* * fd.io coding-style-patch-verification: ON diff --git a/src/plugins/ioam/udp-ping/udp_ping_node.c b/src/plugins/ioam/udp-ping/udp_ping_node.c index 59e4511eb7d..e5916dbd0e1 100644 --- a/src/plugins/ioam/udp-ping/udp_ping_node.c +++ b/src/plugins/ioam/udp-ping/udp_ping_node.c @@ -819,21 +819,21 @@ VLIB_REGISTER_NODE (udp_ping_local, static) = static clib_error_t * udp_ping_init (vlib_main_t * vm) { - clib_error_t *error = 0; - udp_ping_main.vlib_main = vm; udp_ping_main.vnet_main = vnet_get_main (); udp_ping_main.timer_interval = 1e9; - if ((error = vlib_call_init_function (vm, ip_main_init))) - return (error); - ip6_register_protocol (IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS, udp_ping_local.index); return 0; } -VLIB_INIT_FUNCTION (udp_ping_init); +/* *INDENT-OFF* */ +VLIB_INIT_FUNCTION (udp_ping_init) = +{ + .runs_after = VLIB_INITS("ip_main_init"), +}; +/* *INDENT-ON* */ /* * fd.io coding-style-patch-verification: ON |