aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/ioam
diff options
context:
space:
mode:
authorJon Loeliger <jdl@netgate.com>2017-02-01 12:31:41 -0600
committerDave Barach <openvpp@barachs.net>2017-02-02 17:32:27 +0000
commit56c7b01e163c233030359781d7e60f4553e90c51 (patch)
tree6d6ce1f179fdbfa2c2919ac082984fd0bf426f7f /src/plugins/ioam
parent1f9191f6efa5f2e0284c194f920093201b27ef81 (diff)
Refactor fragile msg macro W and W2 to not burry return control flow.
Instead, have them accept and assign a return paramter leaving the return control flow up to the caller. Clean up otherwise misleading returns present even after "NOT REACHED" comments. Change-Id: I0861921f73ab65d55b95eabd27514f0129152723 Signed-off-by: Jon Loeliger <jdl@netgate.com>
Diffstat (limited to 'src/plugins/ioam')
-rw-r--r--src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_test.c4
-rw-r--r--src/plugins/ioam/export/ioam_export_test.c4
-rw-r--r--src/plugins/ioam/lib-pot/pot_test.c18
-rw-r--r--src/plugins/ioam/lib-trace/trace_test.c17
-rw-r--r--src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_test.c36
5 files changed, 45 insertions, 34 deletions
diff --git a/src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_test.c b/src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_test.c
index a7938219fb4..17d31c95bcb 100644
--- a/src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_test.c
+++ b/src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_test.c
@@ -94,6 +94,7 @@ api_vxlan_gpe_ioam_export_enable_disable (vat_main_t * vam)
unformat_input_t *i = vam->input;
int is_disable = 0;
vl_api_vxlan_gpe_ioam_export_enable_disable_t *mp;
+ int ret;
/* Parse args required to build the message */
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -112,7 +113,8 @@ api_vxlan_gpe_ioam_export_enable_disable (vat_main_t * vam)
S (mp);
/* Wait for a reply... */
- W;
+ W (ret);
+ return ret;
}
/*
diff --git a/src/plugins/ioam/export/ioam_export_test.c b/src/plugins/ioam/export/ioam_export_test.c
index 2cb036a5568..5023afd7d63 100644
--- a/src/plugins/ioam/export/ioam_export_test.c
+++ b/src/plugins/ioam/export/ioam_export_test.c
@@ -96,6 +96,7 @@ api_ioam_export_ip6_enable_disable (vat_main_t * vam)
unformat_input_t *i = vam->input;
int is_disable = 0;
vl_api_ioam_export_ip6_enable_disable_t *mp;
+ int ret;
/* Parse args required to build the message */
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -114,7 +115,8 @@ api_ioam_export_ip6_enable_disable (vat_main_t * vam)
S(mp);
/* Wait for a reply... */
- W;
+ W (ret);
+ return ret;
}
/*
diff --git a/src/plugins/ioam/lib-pot/pot_test.c b/src/plugins/ioam/lib-pot/pot_test.c
index d896eb2ff88..1c6dd02dae1 100644
--- a/src/plugins/ioam/lib-pot/pot_test.c
+++ b/src/plugins/ioam/lib-pot/pot_test.c
@@ -134,6 +134,7 @@ static int api_pot_profile_add (vat_main_t *vam)
u64 lpc = 0, poly2 = 0;
u8 id = 0;
int rv = 0;
+ int ret;
while (unformat_check_input(input) != UNFORMAT_END_OF_INPUT)
{
@@ -188,7 +189,8 @@ static int api_pot_profile_add (vat_main_t *vam)
mp->max_bits = bits;
S(mp);
- W;
+ W (ret);
+ return ret;
OUT:
vec_free(name);
@@ -203,6 +205,7 @@ static int api_pot_profile_activate (vat_main_t *vam)
u8 *name = NULL;
u8 id = 0;
int rv = 0;
+ int ret;
while (unformat_check_input(input) != UNFORMAT_END_OF_INPUT)
{
@@ -228,7 +231,8 @@ static int api_pot_profile_activate (vat_main_t *vam)
mp->id = id;
S(mp);
- W;
+ W (ret);
+ return ret;
OUT:
vec_free(name);
@@ -239,12 +243,13 @@ OUT:
static int api_pot_profile_del (vat_main_t *vam)
{
vl_api_pot_profile_del_t *mp;
+ int ret;
M(POT_PROFILE_DEL, mp);
mp->list_name_len = 0;
S(mp);
- W;
- return 0;
+ W (ret);
+ return ret;
}
static int api_pot_profile_show_config_dump (vat_main_t *vam)
@@ -252,6 +257,7 @@ static int api_pot_profile_show_config_dump (vat_main_t *vam)
unformat_input_t *input = vam->input;
vl_api_pot_profile_show_config_dump_t *mp;
u8 id = 0;
+ int ret;
while(unformat_check_input(input) != UNFORMAT_END_OF_INPUT)
{
@@ -264,8 +270,8 @@ static int api_pot_profile_show_config_dump (vat_main_t *vam)
mp->id = id;
S(mp);
- W;
- return 0;
+ W (ret);
+ return ret;
}
/*
diff --git a/src/plugins/ioam/lib-trace/trace_test.c b/src/plugins/ioam/lib-trace/trace_test.c
index d1fb7205ad2..1e287deede4 100644
--- a/src/plugins/ioam/lib-trace/trace_test.c
+++ b/src/plugins/ioam/lib-trace/trace_test.c
@@ -125,10 +125,10 @@ api_trace_profile_add (vat_main_t * vam)
vl_api_trace_profile_add_t *mp;
u8 trace_type = 0;
u8 num_elts = 0;
- int rv = 0;
u32 node_id = 0;
u32 app_data = 0;
u8 trace_tsp = 0;
+ int ret;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
@@ -157,9 +157,8 @@ api_trace_profile_add (vat_main_t * vam)
mp->num_elts = num_elts;
S (mp);
- W;
-
- return (rv);
+ W (ret);
+ return ret;
}
@@ -168,22 +167,24 @@ static int
api_trace_profile_del (vat_main_t * vam)
{
vl_api_trace_profile_del_t *mp;
+ int ret;
M (TRACE_PROFILE_DEL, mp);
S (mp);
- W;
- return 0;
+ W (ret);
+ return ret;
}
static int
api_trace_profile_show_config (vat_main_t * vam)
{
vl_api_trace_profile_show_config_t *mp;
+ int ret;
M (TRACE_PROFILE_SHOW_CONFIG, mp);
S (mp);
- W;
- return 0;
+ W (ret);
+ return ret;
}
/*
diff --git a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_test.c b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_test.c
index 3e7300f5dd2..80e656448c6 100644
--- a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_test.c
+++ b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_test.c
@@ -108,6 +108,7 @@ api_vxlan_gpe_ioam_enable (vat_main_t * vam)
int has_trace_option = 0;
int has_pow_option = 0;
int has_ppc_option = 0;
+ int ret;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
@@ -132,9 +133,8 @@ api_vxlan_gpe_ioam_enable (vat_main_t * vam)
S (mp);
- W;
-
- return (0);
+ W (ret);
+ return ret;
}
@@ -142,11 +142,12 @@ static int
api_vxlan_gpe_ioam_disable (vat_main_t * vam)
{
vl_api_vxlan_gpe_ioam_disable_t *mp;
+ int ret;
M (VXLAN_GPE_IOAM_DISABLE, mp);
S (mp);
- W;
- return 0;
+ W (ret);
+ return ret;
}
static int
@@ -161,6 +162,7 @@ api_vxlan_gpe_ioam_vni_enable (vat_main_t * vam)
u8 remote_set = 0;
u32 vni;
u8 vni_set = 0;
+ int ret;
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
@@ -238,9 +240,8 @@ api_vxlan_gpe_ioam_vni_enable (vat_main_t * vam)
mp->is_ipv6 = ipv6_set;
S (mp);
- W;
-
- return (0);
+ W (ret);
+ return ret;
}
static int
@@ -255,6 +256,7 @@ api_vxlan_gpe_ioam_vni_disable (vat_main_t * vam)
u8 remote_set = 0;
u32 vni;
u8 vni_set = 0;
+ int ret;
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
@@ -332,9 +334,8 @@ api_vxlan_gpe_ioam_vni_disable (vat_main_t * vam)
mp->is_ipv6 = ipv6_set;
S (mp);
- W;
-
- return 0;
+ W (ret);
+ return ret;
}
static int
@@ -347,6 +348,7 @@ api_vxlan_gpe_ioam_transit_enable (vat_main_t * vam)
u8 ipv4_set = 0, ipv6_set = 0;
u8 local_set = 0;
u32 outer_fib_index = 0;
+ int ret;
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
@@ -401,9 +403,8 @@ api_vxlan_gpe_ioam_transit_enable (vat_main_t * vam)
mp->is_ipv6 = ipv6_set;
S (mp);
- W;
-
- return (0);
+ W (ret);
+ return ret;
}
static int
@@ -416,6 +417,7 @@ api_vxlan_gpe_ioam_transit_disable (vat_main_t * vam)
u8 ipv4_set = 0, ipv6_set = 0;
u8 local_set = 0;
u32 outer_fib_index = 0;
+ int ret;
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
@@ -469,10 +471,8 @@ api_vxlan_gpe_ioam_transit_disable (vat_main_t * vam)
mp->is_ipv6 = ipv6_set;
S (mp);
- W;
-
-
- return (0);
+ W (ret);
+ return ret;
}
/*