diff options
Diffstat (limited to 'drivers/s390/scsi/zfcp_dbf.h')
-rw-r--r-- | drivers/s390/scsi/zfcp_dbf.h | 175 |
1 files changed, 150 insertions, 25 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.h b/drivers/s390/scsi/zfcp_dbf.h index a573f7344dd..6b1461e8f84 100644 --- a/drivers/s390/scsi/zfcp_dbf.h +++ b/drivers/s390/scsi/zfcp_dbf.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * This file is part of the zfcp device driver for | 2 | * This file is part of the zfcp device driver for |
3 | * FCP adapters for IBM System z9 and zSeries. | 3 | * FCP adapters for IBM System z9 and zSeries. |
4 | * | 4 | * |
5 | * Copyright IBM Corp. 2008, 2008 | 5 | * Copyright IBM Corp. 2008, 2009 |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 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 | 8 | * it under the terms of the GNU General Public License as published by |
@@ -22,7 +22,9 @@ | |||
22 | #ifndef ZFCP_DBF_H | 22 | #ifndef ZFCP_DBF_H |
23 | #define ZFCP_DBF_H | 23 | #define ZFCP_DBF_H |
24 | 24 | ||
25 | #include "zfcp_ext.h" | ||
25 | #include "zfcp_fsf.h" | 26 | #include "zfcp_fsf.h" |
27 | #include "zfcp_def.h" | ||
26 | 28 | ||
27 | #define ZFCP_DBF_TAG_SIZE 4 | 29 | #define ZFCP_DBF_TAG_SIZE 4 |
28 | #define ZFCP_DBF_ID_SIZE 7 | 30 | #define ZFCP_DBF_ID_SIZE 7 |
@@ -35,13 +37,13 @@ struct zfcp_dbf_dump { | |||
35 | u8 data[]; /* dump data */ | 37 | u8 data[]; /* dump data */ |
36 | } __attribute__ ((packed)); | 38 | } __attribute__ ((packed)); |
37 | 39 | ||
38 | struct zfcp_rec_dbf_record_thread { | 40 | struct zfcp_dbf_rec_record_thread { |
39 | u32 total; | 41 | u32 total; |
40 | u32 ready; | 42 | u32 ready; |
41 | u32 running; | 43 | u32 running; |
42 | }; | 44 | }; |
43 | 45 | ||
44 | struct zfcp_rec_dbf_record_target { | 46 | struct zfcp_dbf_rec_record_target { |
45 | u64 ref; | 47 | u64 ref; |
46 | u32 status; | 48 | u32 status; |
47 | u32 d_id; | 49 | u32 d_id; |
@@ -50,7 +52,7 @@ struct zfcp_rec_dbf_record_target { | |||
50 | u32 erp_count; | 52 | u32 erp_count; |
51 | }; | 53 | }; |
52 | 54 | ||
53 | struct zfcp_rec_dbf_record_trigger { | 55 | struct zfcp_dbf_rec_record_trigger { |
54 | u8 want; | 56 | u8 want; |
55 | u8 need; | 57 | u8 need; |
56 | u32 as; | 58 | u32 as; |
@@ -62,21 +64,21 @@ struct zfcp_rec_dbf_record_trigger { | |||
62 | u64 fcp_lun; | 64 | u64 fcp_lun; |
63 | }; | 65 | }; |
64 | 66 | ||
65 | struct zfcp_rec_dbf_record_action { | 67 | struct zfcp_dbf_rec_record_action { |
66 | u32 status; | 68 | u32 status; |
67 | u32 step; | 69 | u32 step; |
68 | u64 action; | 70 | u64 action; |
69 | u64 fsf_req; | 71 | u64 fsf_req; |
70 | }; | 72 | }; |
71 | 73 | ||
72 | struct zfcp_rec_dbf_record { | 74 | struct zfcp_dbf_rec_record { |
73 | u8 id; | 75 | u8 id; |
74 | char id2[7]; | 76 | char id2[7]; |
75 | union { | 77 | union { |
76 | struct zfcp_rec_dbf_record_action action; | 78 | struct zfcp_dbf_rec_record_action action; |
77 | struct zfcp_rec_dbf_record_thread thread; | 79 | struct zfcp_dbf_rec_record_thread thread; |
78 | struct zfcp_rec_dbf_record_target target; | 80 | struct zfcp_dbf_rec_record_target target; |
79 | struct zfcp_rec_dbf_record_trigger trigger; | 81 | struct zfcp_dbf_rec_record_trigger trigger; |
80 | } u; | 82 | } u; |
81 | }; | 83 | }; |
82 | 84 | ||
@@ -87,7 +89,7 @@ enum { | |||
87 | ZFCP_REC_DBF_ID_TRIGGER, | 89 | ZFCP_REC_DBF_ID_TRIGGER, |
88 | }; | 90 | }; |
89 | 91 | ||
90 | struct zfcp_hba_dbf_record_response { | 92 | struct zfcp_dbf_hba_record_response { |
91 | u32 fsf_command; | 93 | u32 fsf_command; |
92 | u64 fsf_reqid; | 94 | u64 fsf_reqid; |
93 | u32 fsf_seqno; | 95 | u32 fsf_seqno; |
@@ -125,7 +127,7 @@ struct zfcp_hba_dbf_record_response { | |||
125 | } u; | 127 | } u; |
126 | } __attribute__ ((packed)); | 128 | } __attribute__ ((packed)); |
127 | 129 | ||
128 | struct zfcp_hba_dbf_record_status { | 130 | struct zfcp_dbf_hba_record_status { |
129 | u8 failed; | 131 | u8 failed; |
130 | u32 status_type; | 132 | u32 status_type; |
131 | u32 status_subtype; | 133 | u32 status_subtype; |
@@ -139,24 +141,24 @@ struct zfcp_hba_dbf_record_status { | |||
139 | u8 payload[ZFCP_DBF_UNSOL_PAYLOAD]; | 141 | u8 payload[ZFCP_DBF_UNSOL_PAYLOAD]; |
140 | } __attribute__ ((packed)); | 142 | } __attribute__ ((packed)); |
141 | 143 | ||
142 | struct zfcp_hba_dbf_record_qdio { | 144 | struct zfcp_dbf_hba_record_qdio { |
143 | u32 qdio_error; | 145 | u32 qdio_error; |
144 | u8 sbal_index; | 146 | u8 sbal_index; |
145 | u8 sbal_count; | 147 | u8 sbal_count; |
146 | } __attribute__ ((packed)); | 148 | } __attribute__ ((packed)); |
147 | 149 | ||
148 | struct zfcp_hba_dbf_record { | 150 | struct zfcp_dbf_hba_record { |
149 | u8 tag[ZFCP_DBF_TAG_SIZE]; | 151 | u8 tag[ZFCP_DBF_TAG_SIZE]; |
150 | u8 tag2[ZFCP_DBF_TAG_SIZE]; | 152 | u8 tag2[ZFCP_DBF_TAG_SIZE]; |
151 | union { | 153 | union { |
152 | struct zfcp_hba_dbf_record_response response; | 154 | struct zfcp_dbf_hba_record_response response; |
153 | struct zfcp_hba_dbf_record_status status; | 155 | struct zfcp_dbf_hba_record_status status; |
154 | struct zfcp_hba_dbf_record_qdio qdio; | 156 | struct zfcp_dbf_hba_record_qdio qdio; |
155 | struct fsf_bit_error_payload berr; | 157 | struct fsf_bit_error_payload berr; |
156 | } u; | 158 | } u; |
157 | } __attribute__ ((packed)); | 159 | } __attribute__ ((packed)); |
158 | 160 | ||
159 | struct zfcp_san_dbf_record_ct_request { | 161 | struct zfcp_dbf_san_record_ct_request { |
160 | u16 cmd_req_code; | 162 | u16 cmd_req_code; |
161 | u8 revision; | 163 | u8 revision; |
162 | u8 gs_type; | 164 | u8 gs_type; |
@@ -166,7 +168,7 @@ struct zfcp_san_dbf_record_ct_request { | |||
166 | u32 len; | 168 | u32 len; |
167 | } __attribute__ ((packed)); | 169 | } __attribute__ ((packed)); |
168 | 170 | ||
169 | struct zfcp_san_dbf_record_ct_response { | 171 | struct zfcp_dbf_san_record_ct_response { |
170 | u16 cmd_rsp_code; | 172 | u16 cmd_rsp_code; |
171 | u8 revision; | 173 | u8 revision; |
172 | u8 reason_code; | 174 | u8 reason_code; |
@@ -176,27 +178,27 @@ struct zfcp_san_dbf_record_ct_response { | |||
176 | u32 len; | 178 | u32 len; |
177 | } __attribute__ ((packed)); | 179 | } __attribute__ ((packed)); |
178 | 180 | ||
179 | struct zfcp_san_dbf_record_els { | 181 | struct zfcp_dbf_san_record_els { |
180 | u8 ls_code; | 182 | u8 ls_code; |
181 | u32 len; | 183 | u32 len; |
182 | } __attribute__ ((packed)); | 184 | } __attribute__ ((packed)); |
183 | 185 | ||
184 | struct zfcp_san_dbf_record { | 186 | struct zfcp_dbf_san_record { |
185 | u8 tag[ZFCP_DBF_TAG_SIZE]; | 187 | u8 tag[ZFCP_DBF_TAG_SIZE]; |
186 | u64 fsf_reqid; | 188 | u64 fsf_reqid; |
187 | u32 fsf_seqno; | 189 | u32 fsf_seqno; |
188 | u32 s_id; | 190 | u32 s_id; |
189 | u32 d_id; | 191 | u32 d_id; |
190 | union { | 192 | union { |
191 | struct zfcp_san_dbf_record_ct_request ct_req; | 193 | struct zfcp_dbf_san_record_ct_request ct_req; |
192 | struct zfcp_san_dbf_record_ct_response ct_resp; | 194 | struct zfcp_dbf_san_record_ct_response ct_resp; |
193 | struct zfcp_san_dbf_record_els els; | 195 | struct zfcp_dbf_san_record_els els; |
194 | } u; | 196 | } u; |
195 | #define ZFCP_DBF_SAN_MAX_PAYLOAD 1024 | 197 | #define ZFCP_DBF_SAN_MAX_PAYLOAD 1024 |
196 | u8 payload[32]; | 198 | u8 payload[32]; |
197 | } __attribute__ ((packed)); | 199 | } __attribute__ ((packed)); |
198 | 200 | ||
199 | struct zfcp_scsi_dbf_record { | 201 | struct zfcp_dbf_scsi_record { |
200 | u8 tag[ZFCP_DBF_TAG_SIZE]; | 202 | u8 tag[ZFCP_DBF_TAG_SIZE]; |
201 | u8 tag2[ZFCP_DBF_TAG_SIZE]; | 203 | u8 tag2[ZFCP_DBF_TAG_SIZE]; |
202 | u32 scsi_id; | 204 | u32 scsi_id; |
@@ -222,4 +224,127 @@ struct zfcp_scsi_dbf_record { | |||
222 | u8 sns_info[ZFCP_DBF_SCSI_FCP_SNS_INFO]; | 224 | u8 sns_info[ZFCP_DBF_SCSI_FCP_SNS_INFO]; |
223 | } __attribute__ ((packed)); | 225 | } __attribute__ ((packed)); |
224 | 226 | ||
227 | struct zfcp_dbf { | ||
228 | debug_info_t *rec; | ||
229 | debug_info_t *hba; | ||
230 | debug_info_t *san; | ||
231 | debug_info_t *scsi; | ||
232 | spinlock_t rec_lock; | ||
233 | spinlock_t hba_lock; | ||
234 | spinlock_t san_lock; | ||
235 | spinlock_t scsi_lock; | ||
236 | struct zfcp_dbf_rec_record rec_buf; | ||
237 | struct zfcp_dbf_hba_record hba_buf; | ||
238 | struct zfcp_dbf_san_record san_buf; | ||
239 | struct zfcp_dbf_scsi_record scsi_buf; | ||
240 | struct zfcp_adapter *adapter; | ||
241 | }; | ||
242 | |||
243 | static inline | ||
244 | void zfcp_dbf_hba_fsf_resp(const char *tag2, int level, | ||
245 | struct zfcp_fsf_req *req, struct zfcp_dbf *dbf) | ||
246 | { | ||
247 | if (level <= dbf->hba->level) | ||
248 | _zfcp_dbf_hba_fsf_response(tag2, level, req, dbf); | ||
249 | } | ||
250 | |||
251 | /** | ||
252 | * zfcp_dbf_hba_fsf_response - trace event for request completion | ||
253 | * @fsf_req: request that has been completed | ||
254 | */ | ||
255 | static inline void zfcp_dbf_hba_fsf_response(struct zfcp_fsf_req *req) | ||
256 | { | ||
257 | struct zfcp_dbf *dbf = req->adapter->dbf; | ||
258 | struct fsf_qtcb *qtcb = req->qtcb; | ||
259 | |||
260 | if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) && | ||
261 | (qtcb->prefix.prot_status != FSF_PROT_FSF_STATUS_PRESENTED)) { | ||
262 | zfcp_dbf_hba_fsf_resp("perr", 1, req, dbf); | ||
263 | |||
264 | } else if (qtcb->header.fsf_status != FSF_GOOD) { | ||
265 | zfcp_dbf_hba_fsf_resp("ferr", 1, req, dbf); | ||
266 | |||
267 | } else if ((req->fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) || | ||
268 | (req->fsf_command == FSF_QTCB_OPEN_LUN)) { | ||
269 | zfcp_dbf_hba_fsf_resp("open", 4, req, dbf); | ||
270 | |||
271 | } else if (qtcb->header.log_length) { | ||
272 | zfcp_dbf_hba_fsf_resp("qtcb", 5, req, dbf); | ||
273 | |||
274 | } else { | ||
275 | zfcp_dbf_hba_fsf_resp("norm", 6, req, dbf); | ||
276 | } | ||
277 | } | ||
278 | |||
279 | /** | ||
280 | * zfcp_dbf_hba_fsf_unsol - trace event for an unsolicited status buffer | ||
281 | * @tag: tag indicating which kind of unsolicited status has been received | ||
282 | * @dbf: reference to dbf structure | ||
283 | * @status_buffer: buffer containing payload of unsolicited status | ||
284 | */ | ||
285 | static inline | ||
286 | void zfcp_dbf_hba_fsf_unsol(const char *tag, struct zfcp_dbf *dbf, | ||
287 | struct fsf_status_read_buffer *buf) | ||
288 | { | ||
289 | int level = 2; | ||
290 | |||
291 | if (level <= dbf->hba->level) | ||
292 | _zfcp_dbf_hba_fsf_unsol(tag, level, dbf, buf); | ||
293 | } | ||
294 | |||
295 | static inline | ||
296 | void zfcp_dbf_scsi(const char *tag, const char *tag2, int level, | ||
297 | struct zfcp_dbf *dbf, struct scsi_cmnd *scmd, | ||
298 | struct zfcp_fsf_req *req, unsigned long old_id) | ||
299 | { | ||
300 | if (level <= dbf->scsi->level) | ||
301 | _zfcp_dbf_scsi(tag, tag2, level, dbf, scmd, req, old_id); | ||
302 | } | ||
303 | |||
304 | /** | ||
305 | * zfcp_dbf_scsi_result - trace event for SCSI command completion | ||
306 | * @tag: tag indicating success or failure of SCSI command | ||
307 | * @level: trace level applicable for this event | ||
308 | * @adapter: adapter that has been used to issue the SCSI command | ||
309 | * @scmd: SCSI command pointer | ||
310 | * @fsf_req: request used to issue SCSI command (might be NULL) | ||
311 | */ | ||
312 | static inline | ||
313 | void zfcp_dbf_scsi_result(const char *tag, int level, struct zfcp_dbf *dbf, | ||
314 | struct scsi_cmnd *scmd, struct zfcp_fsf_req *fsf_req) | ||
315 | { | ||
316 | zfcp_dbf_scsi("rslt", tag, level, dbf, scmd, fsf_req, 0); | ||
317 | } | ||
318 | |||
319 | /** | ||
320 | * zfcp_dbf_scsi_abort - trace event for SCSI command abort | ||
321 | * @tag: tag indicating success or failure of abort operation | ||
322 | * @adapter: adapter thas has been used to issue SCSI command to be aborted | ||
323 | * @scmd: SCSI command to be aborted | ||
324 | * @new_req: request containing abort (might be NULL) | ||
325 | * @old_id: identifier of request containg SCSI command to be aborted | ||
326 | */ | ||
327 | static inline | ||
328 | void zfcp_dbf_scsi_abort(const char *tag, struct zfcp_dbf *dbf, | ||
329 | struct scsi_cmnd *scmd, struct zfcp_fsf_req *new_req, | ||
330 | unsigned long old_id) | ||
331 | { | ||
332 | zfcp_dbf_scsi("abrt", tag, 1, dbf, scmd, new_req, old_id); | ||
333 | } | ||
334 | |||
335 | /** | ||
336 | * zfcp_dbf_scsi_devreset - trace event for Logical Unit or Target Reset | ||
337 | * @tag: tag indicating success or failure of reset operation | ||
338 | * @flag: indicates type of reset (Target Reset, Logical Unit Reset) | ||
339 | * @unit: unit that needs reset | ||
340 | * @scsi_cmnd: SCSI command which caused this error recovery | ||
341 | */ | ||
342 | static inline | ||
343 | void zfcp_dbf_scsi_devreset(const char *tag, u8 flag, struct zfcp_unit *unit, | ||
344 | struct scsi_cmnd *scsi_cmnd) | ||
345 | { | ||
346 | zfcp_dbf_scsi(flag == FCP_TARGET_RESET ? "trst" : "lrst", tag, 1, | ||
347 | unit->port->adapter->dbf, scsi_cmnd, NULL, 0); | ||
348 | } | ||
349 | |||
225 | #endif /* ZFCP_DBF_H */ | 350 | #endif /* ZFCP_DBF_H */ |