231f5c03efe91174381ca5a83f10e59283108787
[dpdk.git] / drivers / net / e1000 / e1000_logs.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Intel Corporation
3  */
4
5 #include "e1000_logs.h"
6
7 /* declared as extern in e1000_logs.h */
8 int e1000_logtype_init;
9 int e1000_logtype_driver;
10
11 #ifdef RTE_LIBRTE_E1000_DEBUG_RX
12 int e1000_logtype_rx;
13 #endif
14 #ifdef RTE_LIBRTE_E1000_DEBUG_TX
15 int e1000_logtype_tx;
16 #endif
17 #ifdef RTE_LIBRTE_E1000_DEBUG_TX_FREE
18 int e1000_logtype_tx_free;
19 #endif
20
21 /* avoids double registering of logs if EM and IGB drivers are in use */
22 static int e1000_log_initialized;
23
24 void
25 e1000_igb_init_log(void)
26 {
27         if (e1000_log_initialized)
28                 return;
29
30         e1000_logtype_init = rte_log_register("pmd.net.e1000.init");
31         if (e1000_logtype_init >= 0)
32                 rte_log_set_level(e1000_logtype_init, RTE_LOG_NOTICE);
33         e1000_logtype_driver = rte_log_register("pmd.net.e1000.driver");
34         if (e1000_logtype_driver >= 0)
35                 rte_log_set_level(e1000_logtype_driver, RTE_LOG_NOTICE);
36
37 #ifdef RTE_LIBRTE_E1000_DEBUG_RX
38         e1000_logtype_rx = rte_log_register("pmd.net.e1000.rx");
39         if (e1000_logtype_rx >= 0)
40                 rte_log_set_level(e1000_logtype_rx, RTE_LOG_DEBUG);
41 #endif
42
43 #ifdef RTE_LIBRTE_E1000_DEBUG_TX
44         e1000_logtype_tx = rte_log_register("pmd.net.e1000.tx");
45         if (e1000_logtype_tx >= 0)
46                 rte_log_set_level(e1000_logtype_tx, RTE_LOG_DEBUG);
47 #endif
48
49 #ifdef RTE_LIBRTE_E1000_DEBUG_TX_FREE
50         e1000_logtype_tx_free = rte_log_register("pmd.net.e1000.tx_free");
51         if (e1000_logtype_tx_free >= 0)
52                 rte_log_set_level(e1000_logtype_tx_free, RTE_LOG_DEBUG);
53 #endif
54
55         e1000_log_initialized = 1;
56 }