[1/3] testpmd: allow configuring log level on command line

Message ID 20190802025154.328-2-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/iol-Compile-Testing success Compile Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Stephen Hemminger Aug. 2, 2019, 2:51 a.m. UTC
  Since testpmd registers log type after processing command
line arguments, it is not possible to do:
  # testpmd --log-level='testpmd:info' ...

Fix this by initializing logtype first.

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

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 518865a7db25..159c2ef05b6c 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -3234,15 +3234,15 @@  main(int argc, char** argv)
 	signal(SIGINT, signal_handler);
 	signal(SIGTERM, signal_handler);
 
-	diag = rte_eal_init(argc, argv);
-	if (diag < 0)
-		rte_panic("Cannot init EAL\n");
-
 	testpmd_logtype = rte_log_register("testpmd");
 	if (testpmd_logtype < 0)
 		rte_panic("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");
+
 	ret = register_eth_event_callback();
 	if (ret != 0)
 		rte_panic("Cannot register for ethdev events");