xref: /dpdk/drivers/common/cpt/cpt_pmd_logs.h (revision 68a03efeed657e6e05f281479b33b51102797e15)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Cavium, Inc
3  */
4 
5 #ifndef _CPT_PMD_LOGS_H_
6 #define _CPT_PMD_LOGS_H_
7 
8 #include <rte_log.h>
9 
10 /*
11  * This file defines log macros
12  */
13 
14 /*
15  * otx*_cryptodev.h file would define the CPT_LOGTYPE macro for the
16  * platform.
17  */
18 #define CPT_PMD_DRV_LOG_RAW(level, fmt, args...) \
19 		rte_log(RTE_LOG_ ## level, CPT_LOGTYPE, \
20 			"cpt: %s(): " fmt "\n", __func__, ##args)
21 
22 #define CPT_PMD_INIT_FUNC_TRACE() CPT_PMD_DRV_LOG_RAW(DEBUG, " >>")
23 
24 #define CPT_LOG_INFO(fmt, args...) \
25 	CPT_PMD_DRV_LOG_RAW(INFO, fmt, ## args)
26 #define CPT_LOG_WARN(fmt, args...) \
27 	CPT_PMD_DRV_LOG_RAW(WARNING, fmt, ## args)
28 #define CPT_LOG_ERR(fmt, args...) \
29 	CPT_PMD_DRV_LOG_RAW(ERR, fmt, ## args)
30 
31 /*
32  * DP logs, toggled out at compile time if level lower than current level.
33  * DP logs would be logged under 'PMD' type. So for dynamic logging, the
34  * level of 'pmd' has to be used.
35  */
36 #define CPT_LOG_DP(level, fmt, args...) \
37 	RTE_LOG_DP(level, PMD, fmt "\n", ## args)
38 
39 #define CPT_LOG_DP_DEBUG(fmt, args...) \
40 	CPT_LOG_DP(DEBUG, fmt, ## args)
41 #define CPT_LOG_DP_INFO(fmt, args...) \
42 	CPT_LOG_DP(INFO, fmt, ## args)
43 #define CPT_LOG_DP_WARN(fmt, args...) \
44 	CPT_LOG_DP(WARNING, fmt, ## args)
45 #define CPT_LOG_DP_ERR(fmt, args...) \
46 	CPT_LOG_DP(ERR, fmt, ## args)
47 
48 #endif /* _CPT_PMD_LOGS_H_ */
49