Use dynamic log type for power library. Signed-off-by: Stephen Hemminger <step...@networkplumber.org> Acked-by: David Hunt <david.h...@intel.com> --- lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- lib/power/power_common.c | 2 ++ lib/power/power_common.h | 2 ++ lib/power/power_kvm_vm.c | 1 + lib/power/rte_power.c | 1 + lib/power/rte_power_uncore.c | 1 + 7 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/log/log.c b/lib/log/log.c index 49ee89ffdd97..70b3a0995e2e 100644 --- a/lib/log/log.c +++ b/lib/log/log.c @@ -357,7 +357,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_PMD, "pmd"}, {RTE_LOGTYPE_HASH, "lib.hash"}, {RTE_LOGTYPE_LPM, "lib.lpm"}, - {RTE_LOGTYPE_POWER, "lib.power"}, {RTE_LOGTYPE_METER, "lib.meter"}, {RTE_LOGTYPE_SCHED, "lib.sched"}, {RTE_LOGTYPE_PORT, "lib.port"}, diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h index 0c651f58b58e..0cdff28e12d6 100644 --- a/lib/log/rte_log.h +++ b/lib/log/rte_log.h @@ -36,7 +36,7 @@ extern "C" { #define RTE_LOGTYPE_LPM 7 /**< Log related to LPM. */ /* was RTE_LOGTYPE_KNI */ /* was RTE_LOGTYPE_ACL */ -#define RTE_LOGTYPE_POWER 10 /**< Log related to power. */ + /* was RTE_LOGTYPE_POWER */ #define RTE_LOGTYPE_METER 11 /**< Log related to QoS meter. */ #define RTE_LOGTYPE_SCHED 12 /**< Log related to QoS port scheduler. */ #define RTE_LOGTYPE_PORT 13 /**< Log related to port. */ diff --git a/lib/power/power_common.c b/lib/power/power_common.c index 1e09facb863f..bf77eafa886b 100644 --- a/lib/power/power_common.c +++ b/lib/power/power_common.c @@ -12,6 +12,8 @@ #include "power_common.h" +RTE_LOG_REGISTER_DEFAULT(power_logtype, INFO); + #define POWER_SYSFILE_SCALING_DRIVER \ "/sys/devices/system/cpu/cpu%u/cpufreq/scaling_driver" #define POWER_SYSFILE_GOVERNOR \ diff --git a/lib/power/power_common.h b/lib/power/power_common.h index c1c713927621..c3fcbf4c1000 100644 --- a/lib/power/power_common.h +++ b/lib/power/power_common.h @@ -10,6 +10,8 @@ #define RTE_POWER_INVALID_FREQ_INDEX (~0) +extern int power_logtype; +#define RTE_LOGTYPE_POWER power_logtype #ifdef RTE_LIBRTE_POWER_DEBUG #define POWER_DEBUG_TRACE(fmt, args...) \ diff --git a/lib/power/power_kvm_vm.c b/lib/power/power_kvm_vm.c index 6a8109d44959..db031f43105a 100644 --- a/lib/power/power_kvm_vm.c +++ b/lib/power/power_kvm_vm.c @@ -8,6 +8,7 @@ #include "rte_power_guest_channel.h" #include "guest_channel.h" +#include "power_common.h" #include "power_kvm_vm.h" #define FD_PATH "/dev/virtio-ports/virtio.serial.port.poweragent" diff --git a/lib/power/rte_power.c b/lib/power/rte_power.c index 48c2e6b428d8..1502612b0a15 100644 --- a/lib/power/rte_power.c +++ b/lib/power/rte_power.c @@ -10,6 +10,7 @@ #include "rte_power.h" #include "power_acpi_cpufreq.h" #include "power_cppc_cpufreq.h" +#include "power_common.h" #include "power_kvm_vm.h" #include "power_pstate_cpufreq.h" #include "power_amd_pstate_cpufreq.h" diff --git a/lib/power/rte_power_uncore.c b/lib/power/rte_power_uncore.c index ce027bbeb829..9c20fe150d46 100644 --- a/lib/power/rte_power_uncore.c +++ b/lib/power/rte_power_uncore.c @@ -8,6 +8,7 @@ #include <rte_errno.h> #include <rte_spinlock.h> +#include "power_common.h" #include "rte_power_uncore.h" #include "power_intel_uncore.h" -- 2.42.0