numam-dpdk/drivers/common/cpt/cpt_pmd_logs.h
Anoob Joseph 98c7b9c97e crypto/octeontx: fix global log variable definition
'cpt_logtype' & 'otx_cryptodev_driver_id' global variables are defined
in a header file which was causing multiple definitions of the
variables. Fixed it by moving the required vars to the .c file and
introducing a new macro so the CPT_LOG macros in common/cpt would use
the associated PMD log var.

Issue has been detected by '-fno-common' gcc flag.

Fixes: bfe2ae495e ("crypto/octeontx: add PMD skeleton")
Cc: stable@dpdk.org

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
2019-10-09 11:50:12 +02:00

49 lines
1.3 KiB
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2018 Cavium, Inc
*/
#ifndef _CPT_PMD_LOGS_H_
#define _CPT_PMD_LOGS_H_
#include <rte_log.h>
/*
* This file defines log macros
*/
/*
* otx*_cryptodev.h file would define the CPT_LOGTYPE macro for the
* platform.
*/
#define CPT_PMD_DRV_LOG_RAW(level, fmt, args...) \
rte_log(RTE_LOG_ ## level, CPT_LOGTYPE, \
"cpt: %s(): " fmt "\n", __func__, ##args)
#define CPT_PMD_INIT_FUNC_TRACE() CPT_PMD_DRV_LOG_RAW(DEBUG, " >>")
#define CPT_LOG_INFO(fmt, args...) \
CPT_PMD_DRV_LOG_RAW(INFO, fmt, ## args)
#define CPT_LOG_WARN(fmt, args...) \
CPT_PMD_DRV_LOG_RAW(WARNING, fmt, ## args)
#define CPT_LOG_ERR(fmt, args...) \
CPT_PMD_DRV_LOG_RAW(ERR, fmt, ## args)
/*
* DP logs, toggled out at compile time if level lower than current level.
* DP logs would be logged under 'PMD' type. So for dynamic logging, the
* level of 'pmd' has to be used.
*/
#define CPT_LOG_DP(level, fmt, args...) \
RTE_LOG_DP(level, PMD, fmt "\n", ## args)
#define CPT_LOG_DP_DEBUG(fmt, args...) \
CPT_LOG_DP(DEBUG, fmt, ## args)
#define CPT_LOG_DP_INFO(fmt, args...) \
CPT_LOG_DP(INFO, fmt, ## args)
#define CPT_LOG_DP_WARN(fmt, args...) \
CPT_LOG_DP(WARNING, fmt, ## args)
#define CPT_LOG_DP_ERR(fmt, args...) \
CPT_LOG_DP(ERR, fmt, ## args)
#endif /* _CPT_PMD_LOGS_H_ */