4ebbe84dae
This commit fixes a compilation error if EM_PMD is not defined, bug IGB_PMD is. The root cause of the issue was that log init variables are declared as extern in a header file, while the definition of the variables was in e1000_ethdev.c. Hence, the definitions were not available if the e1000 PMD is disabled. To fix this, a new file is added e1000_logs.c, which matches the e1000_logs.h header. The log variables are always compiled in, but the PMD logs are only registered if a PMD is enabled in the configuration. Extra checks are added in order to avoid duplicate registering. Fixes: ed5bbb767c3e ("net/e1000: implement dynamic logging") Cc: stable@dpdk.org Reported-by: Vipin Varghese <vipin.varghese@intel.com> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com> Acked-by: Vipin Varghese <vipin.varghese@intel.com>
27 lines
719 B
C
27 lines
719 B
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright(c) 2018 Intel Corporation
|
|
*/
|
|
|
|
#include "e1000_logs.h"
|
|
|
|
/* declared as extern in e1000_logs.h */
|
|
int e1000_logtype_init;
|
|
int e1000_logtype_driver;
|
|
|
|
/* avoids double registering of logs if EM and IGB drivers are in use */
|
|
static int e1000_log_initialized;
|
|
|
|
void
|
|
e1000_igb_init_log(void)
|
|
{
|
|
if (!e1000_log_initialized) {
|
|
e1000_logtype_init = rte_log_register("pmd.net.e1000.init");
|
|
if (e1000_logtype_init >= 0)
|
|
rte_log_set_level(e1000_logtype_init, RTE_LOG_NOTICE);
|
|
e1000_logtype_driver = rte_log_register("pmd.net.e1000.driver");
|
|
if (e1000_logtype_driver >= 0)
|
|
rte_log_set_level(e1000_logtype_driver, RTE_LOG_NOTICE);
|
|
e1000_log_initialized = 1;
|
|
}
|
|
}
|