[3/3] testpmd: use exit instead of panic

Message ID 20190802025154.328-4-stephen@networkplumber.org (mailing list archive)
State Accepted, archived
Headers
Series testpmd: fixes for 19.08 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Stephen Hemminger Aug. 2, 2019, 2:51 a.m. UTC
  rte_panic causes a backtrace (which is uniformative since all
these calls are in main). Instead use rte_exit and try and make the
messages informative.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test-pmd/testpmd.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
  

Comments

Burakov, Anatoly Aug. 2, 2019, 4:08 p.m. UTC | #1
On 02-Aug-19 3:51 AM, Stephen Hemminger wrote:
> rte_panic causes a backtrace (which is uniformative since all
> these calls are in main). Instead use rte_exit and try and make the
> messages informative.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---

Missed opportunity for a "keep calm" joke...

Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
  
Stephen Hemminger Aug. 2, 2019, 4:13 p.m. UTC | #2
On Fri, 2 Aug 2019 17:08:26 +0100
"Burakov, Anatoly" <anatoly.burakov@intel.com> wrote:

> On 02-Aug-19 3:51 AM, Stephen Hemminger wrote:
> > rte_panic causes a backtrace (which is uniformative since all
> > these calls are in main). Instead use rte_exit and try and make the
> > messages informative.
> > 
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---  
> 
> Missed opportunity for a "keep calm" joke...

Great...
  

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index d0142cae68d7..a461cef188e3 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -3236,19 +3236,21 @@  main(int argc, char** argv)
 
 	testpmd_logtype = rte_log_register("testpmd");
 	if (testpmd_logtype < 0)
-		rte_panic("Cannot register log type");
+		rte_exit(EXIT_FAILURE, "Cannot register log type");
 	rte_log_set_level(testpmd_logtype, RTE_LOG_DEBUG);
 
 	diag = rte_eal_init(argc, argv);
 	if (diag < 0)
-		rte_panic("Cannot init EAL\n");
+		rte_exit(EXIT_FAILURE, "Cannot init EAL: %s\n",
+			 rte_strerror(rte_errno));
 
 	if (rte_eal_process_type() == RTE_PROC_SECONDARY)
-		rte_panic("Secondary process type not supported.\n");
+		rte_exit(EXIT_FAILURE,
+			 "Secondary process type not supported.\n");
 
 	ret = register_eth_event_callback();
 	if (ret != 0)
-		rte_panic("Cannot register for ethdev events");
+		rte_exit(EXIT_FAILURE, "Cannot register for ethdev events");
 
 #ifdef RTE_LIBRTE_PDUMP
 	/* initialize packet capture framework */
@@ -3269,8 +3271,8 @@  main(int argc, char** argv)
 
 	set_def_fwd_config();
 	if (nb_lcores == 0)
-		rte_panic("Empty set of forwarding logical cores - check the "
-			  "core mask supplied in the command parameters\n");
+		rte_exit(EXIT_FAILURE, "No cores defined for forwarding\n"
+			 "Check the core mask argument\n");
 
 	/* Bitrate/latency stats disabled by default */
 #ifdef RTE_LIBRTE_BITRATE