net/enic: use dynamic log types
[dpdk.git] / drivers / net / qede / qede_logs.h
1 /*
2  * Copyright (c) 2016 QLogic Corporation.
3  * All rights reserved.
4  * www.qlogic.com
5  *
6  * See LICENSE.qede_pmd for copyright and licensing details.
7  */
8
9 #ifndef _QEDE_LOGS_H_
10 #define _QEDE_LOGS_H_
11
12 extern int qede_logtype_driver;
13
14 #define DP_ERR(p_dev, fmt, ...)                         \
15         rte_log(RTE_LOG_ERR, qede_logtype_driver,       \
16                 "[%s:%d(%s)]" fmt,                      \
17                 __func__, __LINE__,                     \
18                 (p_dev)->name ? (p_dev)->name : "",     \
19                 ##__VA_ARGS__)
20
21 #define DP_NOTICE(p_dev, is_assert, fmt, ...) \
22 do { \
23         if (is_assert) \
24                 rte_log(RTE_LOG_ERR, qede_logtype_driver,\
25                         "[QEDE PMD: (%s)]%s:" fmt, \
26                         (p_dev)->name ? (p_dev)->name : "", \
27                          __func__, \
28                         ##__VA_ARGS__); \
29         else \
30                 rte_log(RTE_LOG_NOTICE, qede_logtype_driver,\
31                         "[QEDE PMD: (%s)]%s:" fmt, \
32                         (p_dev)->name ? (p_dev)->name : "", \
33                          __func__, \
34                         ##__VA_ARGS__); \
35 } while (0)
36
37 #ifdef RTE_LIBRTE_QEDE_DEBUG_INFO
38 #define DP_INFO(p_dev, fmt, ...) \
39         rte_log(RTE_LOG_INFO, qede_logtype_driver, \
40                 "[%s:%d(%s)]" fmt, \
41                 __func__, __LINE__, \
42                 (p_dev)->name ? (p_dev)->name : "", \
43                 ##__VA_ARGS__)
44 #else
45 #define DP_INFO(p_dev, fmt, ...) do { } while (0)
46 #endif
47
48 #define DP_VERBOSE(p_dev, module, fmt, ...)                             \
49         do {                                                            \
50                 if ((p_dev)->dp_module & module)                        \
51                         rte_log(RTE_LOG_DEBUG, qede_logtype_driver,     \
52                                 "[%s:%d(%s)]" fmt,                      \
53                                 __func__, __LINE__,                     \
54                                 (p_dev)->name ? (p_dev)->name : "",     \
55                                 ##__VA_ARGS__);                         \
56         } while (0)
57
58 extern int qede_logtype_init;
59 #define PMD_INIT_LOG(level, edev, fmt, args...)         \
60         rte_log(RTE_LOG_ ## level, qede_logtype_init,   \
61                 "[qede_pmd: %s] %s() " fmt "\n",        \
62                 (edev)->name, __func__, ##args)
63
64 #define PMD_INIT_FUNC_TRACE(edev) PMD_INIT_LOG(DEBUG, edev, " >>")
65
66 #ifdef RTE_LIBRTE_QEDE_DEBUG_TX
67 #define PMD_TX_LOG(level, q, fmt, args...) \
68         RTE_LOG(level, PMD, "%s(): port=%u queue=%u " fmt "\n", \
69                 __func__, q->port_id, q->queue_id, ## args)
70 #else
71 #define PMD_TX_LOG(level, fmt, args...) do { } while (0)
72 #endif
73
74 #ifdef RTE_LIBRTE_QEDE_DEBUG_RX
75 #define PMD_RX_LOG(level, q, fmt, args...) \
76         RTE_LOG(level, PMD, "%s(): port=%u queue=%u " fmt "\n", \
77                 __func__, q->port_id, q->queue_id, ## args)
78 #else
79 #define PMD_RX_LOG(level, q, fmt, args...) do { } while (0)
80 #endif
81
82 #endif /* _QEDE_LOGS_H_ */