summaryrefslogtreecommitdiffstats
path: root/drivers/net/qede/qede_logs.h
blob: 159315e7253bf9de76d6e19838ccc8eeb117d26d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 * Copyright (c) 2016 QLogic Corporation.
 * All rights reserved.
 * www.qlogic.com
 *
 * See LICENSE.qede_pmd for copyright and licensing details.
 */

#ifndef _QEDE_LOGS_H_
#define _QEDE_LOGS_H_

extern int qede_logtype_driver;

#define DP_ERR(p_dev, fmt, ...)				\
	rte_log(RTE_LOG_ERR, qede_logtype_driver,	\
		"[%s:%d(%s)]" fmt,			\
		__func__, __LINE__,			\
		(p_dev)->name ? (p_dev)->name : "",	\
		##__VA_ARGS__)

#define DP_NOTICE(p_dev, is_assert, fmt, ...) \
do { \
	if (is_assert) \
		rte_log(RTE_LOG_ERR, qede_logtype_driver,\
			"[QEDE PMD: (%s)]%s:" fmt, \
			(p_dev)->name ? (p_dev)->name : "", \
			 __func__, \
			##__VA_ARGS__); \
	else \
		rte_log(RTE_LOG_NOTICE, qede_logtype_driver,\
			"[QEDE PMD: (%s)]%s:" fmt, \
			(p_dev)->name ? (p_dev)->name : "", \
			 __func__, \
			##__VA_ARGS__); \
} while (0)

#define DP_INFO(p_dev, fmt, ...) \
	rte_log(RTE_LOG_INFO, qede_logtype_driver, \
		"[%s:%d(%s)]" fmt, \
		__func__, __LINE__, \
		(p_dev)->name ? (p_dev)->name : "", \
		##__VA_ARGS__)

#define DP_VERBOSE(p_dev, module, fmt, ...)				\
	do {								\
		if ((p_dev)->dp_module & module)			\
			rte_log(RTE_LOG_DEBUG, qede_logtype_driver,	\
				"[%s:%d(%s)]" fmt,			\
				__func__, __LINE__,			\
				(p_dev)->name ? (p_dev)->name : "",	\
				##__VA_ARGS__);				\
	} while (0)

extern int qede_logtype_init;
#define PMD_INIT_LOG(level, edev, fmt, args...)		\
	rte_log(RTE_LOG_ ## level, qede_logtype_init,	\
		"[qede_pmd: %s] %s() " fmt "\n",	\
		(edev)->name, __func__, ##args)

#define PMD_INIT_FUNC_TRACE(edev) PMD_INIT_LOG(DEBUG, edev, " >>")

#ifdef RTE_LIBRTE_QEDE_DEBUG_TX
#define PMD_TX_LOG(level, q, fmt, args...) \
	RTE_LOG(level, PMD, "%s(): port=%u queue=%u " fmt "\n", \
		__func__, q->port_id, q->queue_id, ## args)
#else
#define PMD_TX_LOG(level, fmt, args...) do { } while (0)
#endif

#ifdef RTE_LIBRTE_QEDE_DEBUG_RX
#define PMD_RX_LOG(level, q, fmt, args...) \
	RTE_LOG(level, PMD, "%s(): port=%u queue=%u " fmt "\n",	\
		__func__, q->port_id, q->queue_id, ## args)
#else
#define PMD_RX_LOG(level, q, fmt, args...) do { } while (0)
#endif

#endif /* _QEDE_LOGS_H_ */