1 /* SPDX-License-Identifier: BSD-3-Clause 2 * 3 * Copyright(c) 2019-2021 Xilinx, Inc. 4 * Copyright(c) 2016-2019 Solarflare Communications Inc. 5 * 6 * This software was jointly developed between OKTET Labs (under contract 7 * for Solarflare) and Solarflare Communications, Inc. 8 */ 9 10 #ifndef _SFC_DEBUG_H_ 11 #define _SFC_DEBUG_H_ 12 13 #include <rte_debug.h> 14 15 #ifdef RTE_LIBRTE_SFC_EFX_DEBUG 16 /* Avoid dependency from RTE_LOG_DP_LEVEL to be able to enable debug check 17 * in the driver only. 18 */ 19 #define SFC_ASSERT(exp) RTE_VERIFY(exp) 20 #else 21 /* If the driver debug is not enabled, follow DPDK debug/non-debug */ 22 #define SFC_ASSERT(exp) RTE_ASSERT(exp) 23 #endif 24 25 /* Log PMD message, automatically add prefix and \n */ 26 #define sfc_panic(sa, fmt, ...) \ 27 do { \ 28 const struct sfc_adapter_shared *_sas; \ 29 \ 30 _sas = (sa)->priv.shared; \ 31 rte_panic("sfc " PCI_PRI_FMT \ 32 " #%" PRIu16 ": " fmt "\n", \ 33 _sas->pci_addr.domain, _sas->pci_addr.bus, \ 34 _sas->pci_addr.devid, _sas->pci_addr.function,\ 35 _sas->port_id, ##__VA_ARGS__); \ 36 } while (0) 37 38 #endif /* _SFC_DEBUG_H_ */ 39