Skip to contentSkip to conversation

testpmd: fixes for 19.08

PATCH Applied Stephen Hemminger 3 participants 7 messages Aug 2, 2019 – Aug 5, 2019

lore
Share & tools
lore
#0 lore raw

cover testpmd: fixes for 19.08

Small fixes to testpmd, found while trying to get testpmd to work correctly as secondary process. Fixing that goes deeper and another set of patches to do that will come (for 19.11).

Stephen Hemminger (3):
testpmd: allow configuring log level on command line
testpmd: block secondary process
testpmd: use exit instead of panic

 app/test-pmd/testpmd.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

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

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.

---
 app/test-pmd/testpmd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
app/test-pmd/testpmd.c +4 -4
index 518865a7db25..159c2ef05b6c 100644
@@ -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");
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/3 testpmd: block secondary process

In reply to Stephen Hemminger

Since testpmd has several issues which keep it from working correctly as a secondary process; abort if user tries to do it, rather than running into later problems.

---
 app/test-pmd/testpmd.c | 3 +++
 1 file changed, 3 insertions(+)
app/test-pmd/testpmd.c +3 -0
index 159c2ef05b6c..d0142cae68d7 100644
@@ -3243,6 +3243,9 @@ main(int argc, char** argv)
 	if (diag < 0)
 		rte_panic("Cannot init EAL\n");
 
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY)
+		rte_panic("Secondary process type not supported.\n");
+
 	ret = register_eth_event_callback();
 	if (ret != 0)
 		rte_panic("Cannot register for ethdev events");
Signature · 1 line
2.20.1
#3 lore raw

PATCH 3/3 testpmd: use exit instead of panic

In reply to Stephen Hemminger

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.

---
 app/test-pmd/testpmd.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
app/test-pmd/testpmd.c +8 -6
index d0142cae68d7..a461cef188e3 100644
@@ -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
Signature · 1 line
2.20.1
Reviewed-by on v1 3/3
#4 lore raw

Re: [dpdk-dev] [PATCH 3/3] testpmd: use exit instead of panic

Quoted 6 lines · Stephen Hemminger

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.

---

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

Signature · 2 lines
Thanks,
Anatoly
#5 lore raw

Re: [dpdk-dev] [PATCH 3/3] testpmd: use exit instead of panic

Quoted 9 lines · Anatoly
Quoted 6 lines · Stephen Hemminger

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.

---

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

Great...