1 /* SPDX-License-Identifier: BSD-3-Clause
3 * Copyright(c) 2019-2021 Xilinx, Inc.
4 * Copyright(c) 2016-2019 Solarflare Communications Inc.
6 * This software was jointly developed between OKTET Labs (under contract
7 * for Solarflare) and Solarflare Communications, Inc.
13 /** Generic driver log type */
14 extern uint32_t sfc_logtype_driver;
16 /** Common log type name prefix */
17 #define SFC_LOGTYPE_PREFIX "pmd.net.sfc."
19 /** Log PMD generic message, add a prefix and a line break */
20 #define SFC_GENERIC_LOG(level, ...) \
21 rte_log(RTE_LOG_ ## level, sfc_logtype_driver, \
22 RTE_FMT("PMD: " RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
23 RTE_FMT_TAIL(__VA_ARGS__ ,)))
25 /** Name prefix for the per-device log type used to report basic information */
26 #define SFC_LOGTYPE_MAIN_STR SFC_LOGTYPE_PREFIX "main"
28 /** Device MCDI log type name prefix */
29 #define SFC_LOGTYPE_MCDI_STR SFC_LOGTYPE_PREFIX "mcdi"
31 #define SFC_LOG_PREFIX_MAX 32
33 /* Log PMD message, automatically add prefix and \n */
34 #define SFC_LOG(sas, level, type, ...) \
36 const struct sfc_adapter_shared *_sas = (sas); \
38 rte_log(level, type, \
39 RTE_FMT("%s" RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
41 RTE_FMT_TAIL(__VA_ARGS__,))); \
44 #define sfc_err(sa, ...) \
46 const struct sfc_adapter *_sa = (sa); \
48 SFC_LOG(_sa->priv.shared, RTE_LOG_ERR, \
49 _sa->priv.logtype_main, __VA_ARGS__); \
52 #define sfc_warn(sa, ...) \
54 const struct sfc_adapter *_sa = (sa); \
56 SFC_LOG(_sa->priv.shared, RTE_LOG_WARNING, \
57 _sa->priv.logtype_main, __VA_ARGS__); \
60 #define sfc_notice(sa, ...) \
62 const struct sfc_adapter *_sa = (sa); \
64 SFC_LOG(_sa->priv.shared, RTE_LOG_NOTICE, \
65 _sa->priv.logtype_main, __VA_ARGS__); \
68 #define sfc_info(sa, ...) \
70 const struct sfc_adapter *_sa = (sa); \
72 SFC_LOG(_sa->priv.shared, RTE_LOG_INFO, \
73 _sa->priv.logtype_main, __VA_ARGS__); \
76 #define sfc_dbg(sa, ...) \
78 const struct sfc_adapter *_sa = (sa); \
80 SFC_LOG(_sa->priv.shared, RTE_LOG_DEBUG, \
81 _sa->priv.logtype_main, __VA_ARGS__); \
84 #define sfc_log_init(sa, ...) \
86 const struct sfc_adapter *_sa = (sa); \
88 SFC_LOG(_sa->priv.shared, RTE_LOG_INFO, \
89 _sa->priv.logtype_main, \
91 RTE_FMT_HEAD(__VA_ARGS__ ,), \
93 RTE_FMT_TAIL(__VA_ARGS__ ,))); \
97 #endif /* _SFC_LOG_H_ */