xref: /f-stack/dpdk/drivers/bus/dpaa/rte_dpaa_logs.h (revision 2d9fd380)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  *   Copyright 2017 NXP
4  *
5  */
6 
7 #ifndef _DPAA_LOGS_H_
8 #define _DPAA_LOGS_H_
9 
10 #include <rte_log.h>
11 
12 extern int dpaa_logtype_bus;
13 
14 #define DPAA_BUS_LOG(level, fmt, args...) \
15 	rte_log(RTE_LOG_ ## level, dpaa_logtype_bus, "dpaa: " fmt "\n", ##args)
16 
17 #ifdef RTE_LIBRTE_DPAA_DEBUG_BUS
18 #define DPAA_BUS_HWWARN(cond, fmt, args...) \
19 	do {\
20 		if (cond) \
21 			DPAA_BUS_LOG(DEBUG, "WARN: " fmt, ##args); \
22 	} while (0)
23 #else
24 #define DPAA_BUS_HWWARN(cond, fmt, args...) do { } while (0)
25 #endif
26 
27 #define DPAA_BUS_DEBUG(fmt, args...) \
28 	rte_log(RTE_LOG_DEBUG, dpaa_logtype_bus, "dpaa: %s(): " fmt "\n", \
29 		__func__, ##args)
30 
31 #define BUS_INIT_FUNC_TRACE() DPAA_BUS_DEBUG(" >>")
32 
33 #define DPAA_BUS_INFO(fmt, args...) \
34 	DPAA_BUS_LOG(INFO, fmt, ## args)
35 #define DPAA_BUS_ERR(fmt, args...) \
36 	DPAA_BUS_LOG(ERR, fmt, ## args)
37 #define DPAA_BUS_WARN(fmt, args...) \
38 	DPAA_BUS_LOG(WARNING, fmt, ## args)
39 
40 #endif /* _DPAA_LOGS_H_ */
41