2 * QLogic iSCSI Offload Driver
3 * Copyright (c) 2016 Cavium Inc.
5 * This software is available under the terms of the GNU General Public License
6 * (GPL) Version 2, available from the file COPYING in the main directory of
13 #include <linux/types.h>
14 #include <linux/kernel.h>
15 #include <linux/compiler.h>
16 #include <linux/string.h>
17 #include <linux/version.h>
18 #include <linux/pci.h>
19 #include <linux/delay.h>
20 #include <scsi/scsi_transport.h>
21 #include <scsi/scsi_transport_iscsi.h>
24 #define __PREVENT_QED_HSI__
25 #include <linux/qed/common_hsi.h>
26 #include <linux/qed/qed_if.h>
28 extern uint qedi_dbg_log
;
30 /* Debug print level definitions */
31 #define QEDI_LOG_DEFAULT 0x1 /* Set default logging mask */
32 #define QEDI_LOG_INFO 0x2 /* Informational logs,
33 * MAC address, WWPN, WWNN
35 #define QEDI_LOG_DISC 0x4 /* Init, discovery, rport */
36 #define QEDI_LOG_LL2 0x8 /* LL2, VLAN logs */
37 #define QEDI_LOG_CONN 0x10 /* Connection setup, cleanup */
38 #define QEDI_LOG_EVT 0x20 /* Events, link, mtu */
39 #define QEDI_LOG_TIMER 0x40 /* Timer events */
40 #define QEDI_LOG_MP_REQ 0x80 /* Middle Path (MP) logs */
41 #define QEDI_LOG_SCSI_TM 0x100 /* SCSI Aborts, Task Mgmt */
42 #define QEDI_LOG_UNSOL 0x200 /* unsolicited event logs */
43 #define QEDI_LOG_IO 0x400 /* scsi cmd, completion */
44 #define QEDI_LOG_MQ 0x800 /* Multi Queue logs */
45 #define QEDI_LOG_BSG 0x1000 /* BSG logs */
46 #define QEDI_LOG_DEBUGFS 0x2000 /* debugFS logs */
47 #define QEDI_LOG_LPORT 0x4000 /* lport logs */
48 #define QEDI_LOG_ELS 0x8000 /* ELS logs */
49 #define QEDI_LOG_NPIV 0x10000 /* NPIV logs */
50 #define QEDI_LOG_SESS 0x20000 /* Conection setup, cleanup */
51 #define QEDI_LOG_UIO 0x40000 /* iSCSI UIO logs */
52 #define QEDI_LOG_TID 0x80000 /* FW TID context acquire,
55 #define QEDI_TRACK_TID 0x100000 /* Track TID state. To be
56 * enabled only at module load
59 #define QEDI_TRACK_CMD_LIST 0x300000 /* Track active cmd list nodes,
60 * done with reference to TID,
61 * hence TRACK_TID also enabled.
63 #define QEDI_LOG_NOTICE 0x40000000 /* Notice logs */
64 #define QEDI_LOG_WARN 0x80000000 /* Warning logs */
66 /* Debug context structure */
70 #ifdef CONFIG_DEBUG_FS
71 struct dentry
*bdf_dentry
;
75 #define QEDI_ERR(pdev, fmt, ...) \
76 qedi_dbg_err(pdev, __func__, __LINE__, fmt, ## __VA_ARGS__)
77 #define QEDI_WARN(pdev, fmt, ...) \
78 qedi_dbg_warn(pdev, __func__, __LINE__, fmt, ## __VA_ARGS__)
79 #define QEDI_NOTICE(pdev, fmt, ...) \
80 qedi_dbg_notice(pdev, __func__, __LINE__, fmt, ## __VA_ARGS__)
81 #define QEDI_INFO(pdev, level, fmt, ...) \
82 qedi_dbg_info(pdev, __func__, __LINE__, level, fmt, \
85 void qedi_dbg_err(struct qedi_dbg_ctx
*qedi
, const char *func
, u32 line
,
86 const char *fmt
, ...);
87 void qedi_dbg_warn(struct qedi_dbg_ctx
*qedi
, const char *func
, u32 line
,
88 const char *fmt
, ...);
89 void qedi_dbg_notice(struct qedi_dbg_ctx
*qedi
, const char *func
, u32 line
,
90 const char *fmt
, ...);
91 void qedi_dbg_info(struct qedi_dbg_ctx
*qedi
, const char *func
, u32 line
,
92 u32 info
, const char *fmt
, ...);
96 struct sysfs_bin_attrs
{
98 struct bin_attribute
*attr
;
101 int qedi_create_sysfs_attr(struct Scsi_Host
*shost
,
102 struct sysfs_bin_attrs
*iter
);
103 void qedi_remove_sysfs_attr(struct Scsi_Host
*shost
,
104 struct sysfs_bin_attrs
*iter
);
106 /* DebugFS related code */
107 struct qedi_list_of_funcs
{
109 ssize_t (*oper_func
)(struct qedi_dbg_ctx
*qedi
);
112 struct qedi_debugfs_ops
{
114 struct qedi_list_of_funcs
*qedi_funcs
;
117 #define qedi_dbg_fileops(drv, ops) \
119 .owner = THIS_MODULE, \
120 .open = simple_open, \
121 .read = drv##_dbg_##ops##_cmd_read, \
122 .write = drv##_dbg_##ops##_cmd_write \
125 /* Used for debugfs sequential files */
126 #define qedi_dbg_fileops_seq(drv, ops) \
128 .owner = THIS_MODULE, \
129 .open = drv##_dbg_##ops##_open, \
131 .llseek = seq_lseek, \
132 .release = single_release, \
135 void qedi_dbg_host_init(struct qedi_dbg_ctx
*qedi
,
136 const struct qedi_debugfs_ops
*dops
,
137 const struct file_operations
*fops
);
138 void qedi_dbg_host_exit(struct qedi_dbg_ctx
*qedi
);
139 void qedi_dbg_init(char *drv_name
);
140 void qedi_dbg_exit(void);
142 #endif /* _QEDI_DBG_H_ */