2 * This file is part of the zfcp device driver for
3 * FCP adapters for IBM System z9 and zSeries.
5 * Copyright IBM Corp. 2008, 2009
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #define ZFCP_DBF_TAG_SIZE 4
30 #define ZFCP_DBF_ID_SIZE 7
32 struct zfcp_dbf_dump
{
33 u8 tag
[ZFCP_DBF_TAG_SIZE
];
34 u32 total_size
; /* size of total dump data */
35 u32 offset
; /* how much data has being already dumped */
36 u32 size
; /* how much data comes with this record */
37 u8 data
[]; /* dump data */
38 } __attribute__ ((packed
));
40 struct zfcp_rec_dbf_record_thread
{
46 struct zfcp_rec_dbf_record_target
{
55 struct zfcp_rec_dbf_record_trigger
{
67 struct zfcp_rec_dbf_record_action
{
74 struct zfcp_rec_dbf_record
{
78 struct zfcp_rec_dbf_record_action action
;
79 struct zfcp_rec_dbf_record_thread thread
;
80 struct zfcp_rec_dbf_record_target target
;
81 struct zfcp_rec_dbf_record_trigger trigger
;
86 ZFCP_REC_DBF_ID_ACTION
,
87 ZFCP_REC_DBF_ID_THREAD
,
88 ZFCP_REC_DBF_ID_TARGET
,
89 ZFCP_REC_DBF_ID_TRIGGER
,
92 struct zfcp_hba_dbf_record_response
{
99 u8 fsf_prot_status_qual
[FSF_PROT_STATUS_QUAL_SIZE
];
100 u8 fsf_status_qual
[FSF_STATUS_QUALIFIER_SIZE
];
128 } __attribute__ ((packed
));
130 struct zfcp_hba_dbf_record_status
{
134 struct fsf_queue_designator
137 #define ZFCP_DBF_UNSOL_PAYLOAD 80
138 #define ZFCP_DBF_UNSOL_PAYLOAD_SENSE_DATA_AVAIL 32
139 #define ZFCP_DBF_UNSOL_PAYLOAD_BIT_ERROR_THRESHOLD 56
140 #define ZFCP_DBF_UNSOL_PAYLOAD_FEATURE_UPDATE_ALERT 2 * sizeof(u32)
141 u8 payload
[ZFCP_DBF_UNSOL_PAYLOAD
];
142 } __attribute__ ((packed
));
144 struct zfcp_hba_dbf_record_qdio
{
148 } __attribute__ ((packed
));
150 struct zfcp_hba_dbf_record
{
151 u8 tag
[ZFCP_DBF_TAG_SIZE
];
152 u8 tag2
[ZFCP_DBF_TAG_SIZE
];
154 struct zfcp_hba_dbf_record_response response
;
155 struct zfcp_hba_dbf_record_status status
;
156 struct zfcp_hba_dbf_record_qdio qdio
;
157 struct fsf_bit_error_payload berr
;
159 } __attribute__ ((packed
));
161 struct zfcp_san_dbf_record_ct_request
{
169 } __attribute__ ((packed
));
171 struct zfcp_san_dbf_record_ct_response
{
179 } __attribute__ ((packed
));
181 struct zfcp_san_dbf_record_els
{
184 } __attribute__ ((packed
));
186 struct zfcp_san_dbf_record
{
187 u8 tag
[ZFCP_DBF_TAG_SIZE
];
193 struct zfcp_san_dbf_record_ct_request ct_req
;
194 struct zfcp_san_dbf_record_ct_response ct_resp
;
195 struct zfcp_san_dbf_record_els els
;
197 #define ZFCP_DBF_SAN_MAX_PAYLOAD 1024
199 } __attribute__ ((packed
));
201 struct zfcp_scsi_dbf_record
{
202 u8 tag
[ZFCP_DBF_TAG_SIZE
];
203 u8 tag2
[ZFCP_DBF_TAG_SIZE
];
209 #define ZFCP_DBF_SCSI_OPCODE 16
210 u8 scsi_opcode
[ZFCP_DBF_SCSI_OPCODE
];
221 #define ZFCP_DBF_SCSI_FCP_SNS_INFO 16
222 #define ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO 256
224 u8 sns_info
[ZFCP_DBF_SCSI_FCP_SNS_INFO
];
225 } __attribute__ ((packed
));
228 debug_info_t
*rec_dbf
;
229 debug_info_t
*hba_dbf
;
230 debug_info_t
*san_dbf
;
231 debug_info_t
*scsi_dbf
;
232 spinlock_t rec_dbf_lock
;
233 spinlock_t hba_dbf_lock
;
234 spinlock_t san_dbf_lock
;
235 spinlock_t scsi_dbf_lock
;
236 struct zfcp_rec_dbf_record rec_dbf_buf
;
237 struct zfcp_hba_dbf_record hba_dbf_buf
;
238 struct zfcp_san_dbf_record san_dbf_buf
;
239 struct zfcp_scsi_dbf_record scsi_dbf_buf
;
243 void zfcp_scsi_dbf_event(const char *tag
, const char *tag2
, int level
,
244 struct zfcp_adapter
*adapter
, struct scsi_cmnd
*scmd
,
245 struct zfcp_fsf_req
*req
, unsigned long old_id
)
247 struct zfcp_dbf
*dbf
= adapter
->dbf
;
249 if (level
<= dbf
->scsi_dbf
->level
)
250 _zfcp_scsi_dbf_event(tag
, tag2
, level
, dbf
, scmd
, req
, old_id
);
254 * zfcp_scsi_dbf_event_result - trace event for SCSI command completion
255 * @tag: tag indicating success or failure of SCSI command
256 * @level: trace level applicable for this event
257 * @adapter: adapter that has been used to issue the SCSI command
258 * @scmd: SCSI command pointer
259 * @fsf_req: request used to issue SCSI command (might be NULL)
262 void zfcp_scsi_dbf_event_result(const char *tag
, int level
,
263 struct zfcp_adapter
*adapter
,
264 struct scsi_cmnd
*scmd
,
265 struct zfcp_fsf_req
*fsf_req
)
267 zfcp_scsi_dbf_event("rslt", tag
, level
, adapter
, scmd
, fsf_req
, 0);
271 * zfcp_scsi_dbf_event_abort - trace event for SCSI command abort
272 * @tag: tag indicating success or failure of abort operation
273 * @adapter: adapter thas has been used to issue SCSI command to be aborted
274 * @scmd: SCSI command to be aborted
275 * @new_req: request containing abort (might be NULL)
276 * @old_id: identifier of request containg SCSI command to be aborted
279 void zfcp_scsi_dbf_event_abort(const char *tag
, struct zfcp_adapter
*adapter
,
280 struct scsi_cmnd
*scmd
,
281 struct zfcp_fsf_req
*new_req
,
282 unsigned long old_id
)
284 zfcp_scsi_dbf_event("abrt", tag
, 1, adapter
, scmd
, new_req
, old_id
);
288 * zfcp_scsi_dbf_event_devreset - trace event for Logical Unit or Target Reset
289 * @tag: tag indicating success or failure of reset operation
290 * @flag: indicates type of reset (Target Reset, Logical Unit Reset)
291 * @unit: unit that needs reset
292 * @scsi_cmnd: SCSI command which caused this error recovery
295 void zfcp_scsi_dbf_event_devreset(const char *tag
, u8 flag
,
296 struct zfcp_unit
*unit
,
297 struct scsi_cmnd
*scsi_cmnd
)
299 zfcp_scsi_dbf_event(flag
== FCP_TARGET_RESET
? "trst" : "lrst", tag
, 1,
300 unit
->port
->adapter
, scsi_cmnd
, NULL
, 0);
303 #endif /* ZFCP_DBF_H */