summaryrefslogtreecommitdiffstats
path: root/src/spdk/dpdk/drivers/net/e1000/e1000_logs.c
blob: 231f5c03efe91174381ca5a83f10e59283108787 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* 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;

#ifdef RTE_LIBRTE_E1000_DEBUG_RX
int e1000_logtype_rx;
#endif
#ifdef RTE_LIBRTE_E1000_DEBUG_TX
int e1000_logtype_tx;
#endif
#ifdef RTE_LIBRTE_E1000_DEBUG_TX_FREE
int e1000_logtype_tx_free;
#endif

/* 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)
		return;

	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);

#ifdef RTE_LIBRTE_E1000_DEBUG_RX
	e1000_logtype_rx = rte_log_register("pmd.net.e1000.rx");
	if (e1000_logtype_rx >= 0)
		rte_log_set_level(e1000_logtype_rx, RTE_LOG_DEBUG);
#endif

#ifdef RTE_LIBRTE_E1000_DEBUG_TX
	e1000_logtype_tx = rte_log_register("pmd.net.e1000.tx");
	if (e1000_logtype_tx >= 0)
		rte_log_set_level(e1000_logtype_tx, RTE_LOG_DEBUG);
#endif

#ifdef RTE_LIBRTE_E1000_DEBUG_TX_FREE
	e1000_logtype_tx_free = rte_log_register("pmd.net.e1000.tx_free");
	if (e1000_logtype_tx_free >= 0)
		rte_log_set_level(e1000_logtype_tx_free, RTE_LOG_DEBUG);
#endif

	e1000_log_initialized = 1;
}