treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / scsi / qedi / qedi_dbg.h
blob37d084086fd4341079b63d31286a73e298624f86
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * QLogic iSCSI Offload Driver
4 * Copyright (c) 2016 Cavium Inc.
5 */
7 #ifndef _QEDI_DBG_H_
8 #define _QEDI_DBG_H_
10 #include <linux/types.h>
11 #include <linux/kernel.h>
12 #include <linux/compiler.h>
13 #include <linux/string.h>
14 #include <linux/version.h>
15 #include <linux/pci.h>
16 #include <linux/delay.h>
17 #include <scsi/scsi_transport.h>
18 #include <scsi/scsi_transport_iscsi.h>
19 #include <linux/fs.h>
21 #define __PREVENT_QED_HSI__
22 #include <linux/qed/common_hsi.h>
23 #include <linux/qed/qed_if.h>
25 extern uint qedi_dbg_log;
27 /* Debug print level definitions */
28 #define QEDI_LOG_DEFAULT 0x1 /* Set default logging mask */
29 #define QEDI_LOG_INFO 0x2 /* Informational logs,
30 * MAC address, WWPN, WWNN
32 #define QEDI_LOG_DISC 0x4 /* Init, discovery, rport */
33 #define QEDI_LOG_LL2 0x8 /* LL2, VLAN logs */
34 #define QEDI_LOG_CONN 0x10 /* Connection setup, cleanup */
35 #define QEDI_LOG_EVT 0x20 /* Events, link, mtu */
36 #define QEDI_LOG_TIMER 0x40 /* Timer events */
37 #define QEDI_LOG_MP_REQ 0x80 /* Middle Path (MP) logs */
38 #define QEDI_LOG_SCSI_TM 0x100 /* SCSI Aborts, Task Mgmt */
39 #define QEDI_LOG_UNSOL 0x200 /* unsolicited event logs */
40 #define QEDI_LOG_IO 0x400 /* scsi cmd, completion */
41 #define QEDI_LOG_MQ 0x800 /* Multi Queue logs */
42 #define QEDI_LOG_BSG 0x1000 /* BSG logs */
43 #define QEDI_LOG_DEBUGFS 0x2000 /* debugFS logs */
44 #define QEDI_LOG_LPORT 0x4000 /* lport logs */
45 #define QEDI_LOG_ELS 0x8000 /* ELS logs */
46 #define QEDI_LOG_NPIV 0x10000 /* NPIV logs */
47 #define QEDI_LOG_SESS 0x20000 /* Connection setup, cleanup */
48 #define QEDI_LOG_UIO 0x40000 /* iSCSI UIO logs */
49 #define QEDI_LOG_TID 0x80000 /* FW TID context acquire,
50 * free
52 #define QEDI_TRACK_TID 0x100000 /* Track TID state. To be
53 * enabled only at module load
54 * and not run-time.
56 #define QEDI_TRACK_CMD_LIST 0x300000 /* Track active cmd list nodes,
57 * done with reference to TID,
58 * hence TRACK_TID also enabled.
60 #define QEDI_LOG_NOTICE 0x40000000 /* Notice logs */
61 #define QEDI_LOG_WARN 0x80000000 /* Warning logs */
63 /* Debug context structure */
64 struct qedi_dbg_ctx {
65 unsigned int host_no;
66 struct pci_dev *pdev;
67 #ifdef CONFIG_DEBUG_FS
68 struct dentry *bdf_dentry;
69 #endif
72 #define QEDI_ERR(pdev, fmt, ...) \
73 qedi_dbg_err(pdev, __func__, __LINE__, fmt, ## __VA_ARGS__)
74 #define QEDI_WARN(pdev, fmt, ...) \
75 qedi_dbg_warn(pdev, __func__, __LINE__, fmt, ## __VA_ARGS__)
76 #define QEDI_NOTICE(pdev, fmt, ...) \
77 qedi_dbg_notice(pdev, __func__, __LINE__, fmt, ## __VA_ARGS__)
78 #define QEDI_INFO(pdev, level, fmt, ...) \
79 qedi_dbg_info(pdev, __func__, __LINE__, level, fmt, \
80 ## __VA_ARGS__)
82 void qedi_dbg_err(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
83 const char *fmt, ...);
84 void qedi_dbg_warn(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
85 const char *fmt, ...);
86 void qedi_dbg_notice(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
87 const char *fmt, ...);
88 void qedi_dbg_info(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
89 u32 info, const char *fmt, ...);
91 struct Scsi_Host;
93 struct sysfs_bin_attrs {
94 char *name;
95 struct bin_attribute *attr;
98 int qedi_create_sysfs_attr(struct Scsi_Host *shost,
99 struct sysfs_bin_attrs *iter);
100 void qedi_remove_sysfs_attr(struct Scsi_Host *shost,
101 struct sysfs_bin_attrs *iter);
103 /* DebugFS related code */
104 struct qedi_list_of_funcs {
105 char *oper_str;
106 ssize_t (*oper_func)(struct qedi_dbg_ctx *qedi);
109 struct qedi_debugfs_ops {
110 char *name;
111 struct qedi_list_of_funcs *qedi_funcs;
114 #define qedi_dbg_fileops(drv, ops) \
116 .owner = THIS_MODULE, \
117 .open = simple_open, \
118 .read = drv##_dbg_##ops##_cmd_read, \
119 .write = drv##_dbg_##ops##_cmd_write \
122 /* Used for debugfs sequential files */
123 #define qedi_dbg_fileops_seq(drv, ops) \
125 .owner = THIS_MODULE, \
126 .open = drv##_dbg_##ops##_open, \
127 .read = seq_read, \
128 .llseek = seq_lseek, \
129 .release = single_release, \
132 void qedi_dbg_host_init(struct qedi_dbg_ctx *qedi,
133 const struct qedi_debugfs_ops *dops,
134 const struct file_operations *fops);
135 void qedi_dbg_host_exit(struct qedi_dbg_ctx *qedi);
136 void qedi_dbg_init(char *drv_name);
137 void qedi_dbg_exit(void);
139 #endif /* _QEDI_DBG_H_ */