aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Uvarov <maxim.uvarov@linaro.org>2016-07-19 17:42:42 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2016-07-20 15:20:29 +0300
commitb7d403b9f8b8f666259dccf9d994ef8a28d9facb (patch)
tree7129a6fd6ca9a3aed7bf1582082642f2aa8d59b6
parent2c80ef58dba783bfbf11060cab273e57ba6d0e62 (diff)
example: odp_switch add termination path
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Reviewed-by: Mike Holmes <mike.holmes@linaro.org>
-rw-r--r--example/switch/odp_switch.c19
-rwxr-xr-xexample/switch/switch_run.sh11
2 files changed, 20 insertions, 10 deletions
diff --git a/example/switch/odp_switch.c b/example/switch/odp_switch.c
index c48a202c0..4b944fe3b 100644
--- a/example/switch/odp_switch.c
+++ b/example/switch/odp_switch.c
@@ -376,7 +376,7 @@ static int print_speed_stats(int num_workers, stats_t (*thr_stats)[MAX_PKTIOS],
} while (loop_forever || (elapsed < duration));
- return rx_pkts_tot > 100 ? 0 : -1;
+ return rx_pkts_tot >= 100 ? 0 : -1;
}
/**
@@ -1033,7 +1033,22 @@ int main(int argc, char **argv)
free(gbl_args->appl.if_names);
free(gbl_args->appl.if_str);
- printf("Exit\n\n");
+ if (odp_pool_destroy(gbl_args->pool)) {
+ printf("Error: pool destroy\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (odp_term_local()) {
+ printf("Error: term local\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (odp_term_global(instance)) {
+ printf("Error: term global\n");
+ exit(EXIT_FAILURE);
+ }
+
+ printf("Exit: %d\n\n", ret);
return ret;
}
diff --git a/example/switch/switch_run.sh b/example/switch/switch_run.sh
index 3f8f9db36..d9aa8bd06 100755
--- a/example/switch/switch_run.sh
+++ b/example/switch/switch_run.sh
@@ -19,15 +19,10 @@ do
RX_PORTS="${RX_PORTS},pcap:out=pcapout${i}.pcap"
done
-./odp_switch -i pcap:in=${PCAP_IN}${RX_PORTS} &
-
-sleep 1
-kill $!
-wait $!
+./odp_switch -i pcap:in=${PCAP_IN}${RX_PORTS} -t 1
STATUS=$?
-
-if [ "$STATUS" -ne 143 ]; then
- echo "Error: status was: $STATUS, expected 143"
+if [ "$STATUS" -ne 0 ]; then
+ echo "Error: status was: $STATUS, expected 0"
RETVAL=1
fi