New upstream version 18.02
[deb_dpdk.git] / drivers / net / sfc / sfc_debug.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  * Copyright (c) 2016-2018 Solarflare Communications Inc.
4  * All rights reserved.
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, args...) \
27         do {                                                            \
28                 const struct sfc_adapter *_sa = (sa);                   \
29                                                                         \
30                 rte_panic("sfc " PCI_PRI_FMT " #%" PRIu8 ": " fmt "\n", \
31                           _sa->pci_addr.domain, _sa->pci_addr.bus,      \
32                           _sa->pci_addr.devid, _sa->pci_addr.function,  \
33                           _sa->port_id, ##args);                        \
34         } while (0)
35
36 #endif /* _SFC_DEBUG_H_ */