1 /* SPDX-License-Identifier: BSD-3-Clause
3 * Copyright (c) 2016-2018 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 /* Log PMD message, automatically add prefix and \n */
26 #define SFC_LOG(sa, level, ...) \
28 const struct sfc_adapter *__sa = (sa); \
31 RTE_FMT("sfc_efx " PCI_PRI_FMT " #%" PRIu8 ": " \
32 RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
33 __sa->pci_addr.domain, \
35 __sa->pci_addr.devid, \
36 __sa->pci_addr.function, \
38 RTE_FMT_TAIL(__VA_ARGS__,))); \
41 #define sfc_err(sa, ...) \
42 SFC_LOG(sa, ERR, __VA_ARGS__)
44 #define sfc_warn(sa, ...) \
45 SFC_LOG(sa, WARNING, __VA_ARGS__)
47 #define sfc_notice(sa, ...) \
48 SFC_LOG(sa, NOTICE, __VA_ARGS__)
50 #define sfc_info(sa, ...) \
51 SFC_LOG(sa, INFO, __VA_ARGS__)
53 #define sfc_log_init(sa, ...) \
55 const struct sfc_adapter *_sa = (sa); \
57 if (_sa->debug_init) \
60 RTE_FMT_HEAD(__VA_ARGS__,), \
62 RTE_FMT_TAIL(__VA_ARGS__,))); \
65 #endif /* _SFC_LOG_H_ */