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 #define CPT_PMD_DRV_LOG_RAW(level, fmt, args...) \ 15 rte_log(RTE_LOG_ ## level, cpt_logtype, \ 16 "cpt: %s(): " fmt "\n", __func__, ##args) 17 18 #define CPT_PMD_INIT_FUNC_TRACE() CPT_PMD_DRV_LOG_RAW(DEBUG, " >>") 19 20 #define CPT_LOG_INFO(fmt, args...) \ 21 CPT_PMD_DRV_LOG_RAW(INFO, fmt, ## args) 22 #define CPT_LOG_WARN(fmt, args...) \ 23 CPT_PMD_DRV_LOG_RAW(WARNING, fmt, ## args) 24 #define CPT_LOG_ERR(fmt, args...) \ 25 CPT_PMD_DRV_LOG_RAW(ERR, fmt, ## args) 26 27 /* 28 * DP logs, toggled out at compile time if level lower than current level. 29 * DP logs would be logged under 'PMD' type. So for dynamic logging, the 30 * level of 'pmd' has to be used. 31 */ 32 #define CPT_LOG_DP(level, fmt, args...) \ 33 RTE_LOG_DP(level, PMD, fmt "\n", ## args) 34 35 #define CPT_LOG_DP_DEBUG(fmt, args...) \ 36 CPT_LOG_DP(DEBUG, fmt, ## args) 37 #define CPT_LOG_DP_INFO(fmt, args...) \ 38 CPT_LOG_DP(INFO, fmt, ## args) 39 #define CPT_LOG_DP_WARN(fmt, args...) \ 40 CPT_LOG_DP(WARNING, fmt, ## args) 41 #define CPT_LOG_DP_ERR(fmt, args...) \ 42 CPT_LOG_DP(ERR, fmt, ## args) 43 44 /* 45 * cpt_logtype will be used for common logging. This field would be initialized 46 * by otx_* driver routines during PCI probe. 47 */ 48 int cpt_logtype; 49 50 #endif /* _CPT_PMD_LOGS_H_ */ 51