xref: /dpdk/drivers/net/ionic/ionic_logs.h (revision 8b8036a66e3d59ffa58afb8d96fa2c73262155a7)
1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
2  * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
3  */
4 
5 #ifndef _IONIC_LOGS_H_
6 #define _IONIC_LOGS_H_
7 
8 #include <rte_log.h>
9 
10 extern int ionic_logtype;
11 
12 #define IONIC_PRINT(level, fmt, args...) rte_log(RTE_LOG_ ## level, \
13 	ionic_logtype, "%s(): " fmt "\n", __func__, ##args)
14 
15 #define IONIC_PRINT_CALL() IONIC_PRINT(DEBUG, " >>")
16 
17 #ifndef IONIC_WARN_ON
18 #define IONIC_WARN_ON(x) do { \
19 	int ret = !!(x); \
20 	if (unlikely(ret)) \
21 		IONIC_PRINT(WARNING, "WARN_ON: \"" #x "\" at %s:%d\n", \
22 			__func__, __LINE__); \
23 } while (0)
24 #endif
25 
26 #endif /* _IONIC_LOGS_H_ */
27