[v12,08/22] examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER

Message ID 20230329234049.11071-9-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Covert static log types in libraries to dynamic |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger March 29, 2023, 11:40 p.m. UTC
  Convert to using a dynamic logtype for the application.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: David Hunt <david.hunt@intel.com>
---
 examples/l3fwd-power/main.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
  

Patch

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 3f01cbd9e277..f3330fd735dd 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -51,7 +51,8 @@ 
 #include "perf_core.h"
 #include "main.h"
 
-#define RTE_LOGTYPE_L3FWD_POWER RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER(l3fwd_power_logtype, l3fwd.power, INFO);
+#define RTE_LOGTYPE_L3FWD_POWER l3fwd_power_logtype
 
 #define MAX_PKT_BURST 32
 
@@ -2236,7 +2237,7 @@  init_power_library(void)
 		/* init power management library */
 		ret = rte_power_init(lcore_id);
 		if (ret) {
-			RTE_LOG(ERR, POWER,
+			RTE_LOG(ERR, L3FWD_POWER,
 				"Library initialization failed on core %u\n",
 				lcore_id);
 			return ret;
@@ -2246,8 +2247,8 @@  init_power_library(void)
 		if (env != PM_ENV_ACPI_CPUFREQ &&
 				env != PM_ENV_PSTATE_CPUFREQ &&
 				env != PM_ENV_CPPC_CPUFREQ) {
-			RTE_LOG(ERR, POWER,
-				"Only ACPI, PSTATE and CPPC mode are supported\n");
+			RTE_LOG(ERR, L3FWD_POWER,
+				"Only ACPI and PSTATE mode are supported\n");
 			return -1;
 		}
 	}
@@ -2264,7 +2265,7 @@  deinit_power_library(void)
 		/* deinit power management library */
 		ret = rte_power_exit(lcore_id);
 		if (ret) {
-			RTE_LOG(ERR, POWER,
+			RTE_LOG(ERR, L3FWD_POWER,
 				"Library deinitialization failed on core %u\n",
 				lcore_id);
 			return ret;
@@ -2333,7 +2334,7 @@  update_telemetry(__rte_unused struct rte_timer *tim,
 	ret = rte_metrics_update_values(RTE_METRICS_GLOBAL, telstats_index,
 					values, RTE_DIM(values));
 	if (ret < 0)
-		RTE_LOG(WARNING, POWER, "failed to update metrics\n");
+		RTE_LOG(WARNING, L3FWD_POWER, "failed to update metrics\n");
 }
 
 static int
@@ -2382,7 +2383,7 @@  launch_timer(unsigned int lcore_id)
 				rte_get_main_lcore());
 	}
 
-	RTE_LOG(INFO, POWER, "Bring up the Timer\n");
+	RTE_LOG(INFO, L3FWD_POWER, "Bring up the Timer\n");
 
 	telemetry_setup_timer();
 
@@ -2398,7 +2399,7 @@  launch_timer(unsigned int lcore_id)
 		}
 	}
 
-	RTE_LOG(INFO, POWER, "Timer_subsystem is done\n");
+	RTE_LOG(INFO, L3FWD_POWER, "Timer_subsystem is done\n");
 
 	return 0;
 }