New upstream version 18.11-rc1
[deb_dpdk.git] / drivers / net / bnx2x / bnx2x_logs.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2013-2015 Brocade Communications Systems, Inc.
3  * Copyright (c) 2015-2018 Cavium Inc.
4  * All rights reserved.
5  * www.cavium.com
6  */
7
8 #ifndef _PMD_LOGS_H_
9 #define _PMD_LOGS_H_
10
11 extern int bnx2x_logtype_init;
12 #define PMD_INIT_LOG(level, sc, fmt, args...) \
13         RTE_LOG(level, PMD, \
14         "[bnx2x_pmd: %s] %s() " fmt "\n", (sc)->devinfo.name, __func__, ##args)
15
16 #define PMD_INIT_FUNC_TRACE(sc) PMD_INIT_LOG(DEBUG, sc, " >>")
17
18 #ifdef RTE_LIBRTE_BNX2X_DEBUG_RX
19 #define PMD_RX_LOG(level, fmt, args...) \
20         RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
21 #else
22 #define PMD_RX_LOG(level, fmt, args...) do { } while(0)
23 #endif
24
25 #ifdef RTE_LIBRTE_BNX2X_DEBUG_TX
26 #define PMD_TX_LOG(level, fmt, args...) \
27         RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
28 #else
29 #define PMD_TX_LOG(level, fmt, args...) do { } while(0)
30 #endif
31
32 #ifdef RTE_LIBRTE_BNX2X_DEBUG_TX_FREE
33 #define PMD_TX_FREE_LOG(level, fmt, args...) \
34         RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
35 #else
36 #define PMD_TX_FREE_LOG(level, fmt, args...) do { } while(0)
37 #endif
38
39 extern int bnx2x_logtype_driver;
40 #define PMD_DRV_LOG_RAW(level, sc, fmt, args...) \
41         RTE_LOG(level, PMD, "[%s:%d(%s)] " fmt, __func__, __LINE__, \
42                 (sc)->devinfo.name ? (sc)->devinfo.name : "", ## args)
43
44 #define PMD_DRV_LOG(level, sc, fmt, args...) \
45         PMD_DRV_LOG_RAW(level, sc, fmt "\n", ## args)
46
47 #ifdef RTE_LIBRTE_BNX2X_DEBUG_PERIODIC
48 #define PMD_DEBUG_PERIODIC_LOG(level, sc, fmt, args...) \
49         RTE_LOG(level, PMD, "%s(%s): " fmt "\n", __func__, \
50                 (sc)->devinfo.name ? (sc)->devinfo.name : "", ## args)
51 #else
52 #define PMD_DEBUG_PERIODIC_LOG(level, sc, fmt, args...) do { } while (0)
53 #endif
54
55 #endif /* _PMD_LOGS_H_ */