diff options
Diffstat (limited to 'drivers/s390/scsi/zfcp_dbf.h')
-rw-r--r-- | drivers/s390/scsi/zfcp_dbf.h | 503 |
1 files changed, 260 insertions, 243 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.h b/drivers/s390/scsi/zfcp_dbf.h index 2bcc3403126a..714f087eb7a9 100644 --- a/drivers/s390/scsi/zfcp_dbf.h +++ b/drivers/s390/scsi/zfcp_dbf.h | |||
@@ -1,22 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * This file is part of the zfcp device driver for | 2 | * zfcp device driver |
3 | * FCP adapters for IBM System z9 and zSeries. | 3 | * debug feature declarations |
4 | * | 4 | * |
5 | * Copyright IBM Corp. 2008, 2009 | 5 | * Copyright IBM Corp. 2008, 2010 |
6 | * | ||
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) | ||
10 | * any later version. | ||
11 | * | ||
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. | ||
16 | * | ||
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. | ||
20 | */ | 6 | */ |
21 | 7 | ||
22 | #ifndef ZFCP_DBF_H | 8 | #ifndef ZFCP_DBF_H |
@@ -27,339 +13,370 @@ | |||
27 | #include "zfcp_fsf.h" | 13 | #include "zfcp_fsf.h" |
28 | #include "zfcp_def.h" | 14 | #include "zfcp_def.h" |
29 | 15 | ||
30 | #define ZFCP_DBF_TAG_SIZE 4 | 16 | #define ZFCP_DBF_TAG_LEN 7 |
31 | #define ZFCP_DBF_ID_SIZE 7 | ||
32 | 17 | ||
33 | #define ZFCP_DBF_INVALID_LUN 0xFFFFFFFFFFFFFFFFull | 18 | #define ZFCP_DBF_INVALID_LUN 0xFFFFFFFFFFFFFFFFull |
34 | 19 | ||
35 | struct zfcp_dbf_dump { | 20 | /** |
36 | u8 tag[ZFCP_DBF_TAG_SIZE]; | 21 | * struct zfcp_dbf_rec_trigger - trace record for triggered recovery action |
37 | u32 total_size; /* size of total dump data */ | 22 | * @ready: number of ready recovery actions |
38 | u32 offset; /* how much data has being already dumped */ | 23 | * @running: number of running recovery actions |
39 | u32 size; /* how much data comes with this record */ | 24 | * @want: wanted recovery action |
40 | u8 data[]; /* dump data */ | 25 | * @need: needed recovery action |
41 | } __attribute__ ((packed)); | 26 | */ |
42 | 27 | struct zfcp_dbf_rec_trigger { | |
43 | struct zfcp_dbf_rec_record_thread { | ||
44 | u32 total; | ||
45 | u32 ready; | 28 | u32 ready; |
46 | u32 running; | 29 | u32 running; |
47 | }; | ||
48 | |||
49 | struct zfcp_dbf_rec_record_target { | ||
50 | u64 ref; | ||
51 | u32 status; | ||
52 | u32 d_id; | ||
53 | u64 wwpn; | ||
54 | u64 fcp_lun; | ||
55 | u32 erp_count; | ||
56 | }; | ||
57 | |||
58 | struct zfcp_dbf_rec_record_trigger { | ||
59 | u8 want; | 30 | u8 want; |
60 | u8 need; | 31 | u8 need; |
61 | u32 as; | 32 | } __packed; |
62 | u32 ps; | ||
63 | u32 us; | ||
64 | u64 ref; | ||
65 | u64 action; | ||
66 | u64 wwpn; | ||
67 | u64 fcp_lun; | ||
68 | }; | ||
69 | 33 | ||
70 | struct zfcp_dbf_rec_record_action { | 34 | /** |
71 | u32 status; | 35 | * struct zfcp_dbf_rec_running - trace record for running recovery |
72 | u32 step; | 36 | * @fsf_req_id: request id for fsf requests |
73 | u64 action; | 37 | * @rec_status: status of the fsf request |
74 | u64 fsf_req; | 38 | * @rec_step: current step of the recovery action |
39 | * rec_count: recovery counter | ||
40 | */ | ||
41 | struct zfcp_dbf_rec_running { | ||
42 | u64 fsf_req_id; | ||
43 | u32 rec_status; | ||
44 | u16 rec_step; | ||
45 | u8 rec_action; | ||
46 | u8 rec_count; | ||
47 | } __packed; | ||
48 | |||
49 | /** | ||
50 | * enum zfcp_dbf_rec_id - recovery trace record id | ||
51 | * @ZFCP_DBF_REC_TRIG: triggered recovery identifier | ||
52 | * @ZFCP_DBF_REC_RUN: running recovery identifier | ||
53 | */ | ||
54 | enum zfcp_dbf_rec_id { | ||
55 | ZFCP_DBF_REC_TRIG = 1, | ||
56 | ZFCP_DBF_REC_RUN = 2, | ||
75 | }; | 57 | }; |
76 | 58 | ||
77 | struct zfcp_dbf_rec_record { | 59 | /** |
60 | * struct zfcp_dbf_rec - trace record for error recovery actions | ||
61 | * @id: unique number of recovery record type | ||
62 | * @tag: identifier string specifying the location of initiation | ||
63 | * @lun: logical unit number | ||
64 | * @wwpn: word wide port number | ||
65 | * @d_id: destination ID | ||
66 | * @adapter_status: current status of the adapter | ||
67 | * @port_status: current status of the port | ||
68 | * @lun_status: current status of the lun | ||
69 | * @u.trig: structure zfcp_dbf_rec_trigger | ||
70 | * @u.run: structure zfcp_dbf_rec_running | ||
71 | */ | ||
72 | struct zfcp_dbf_rec { | ||
78 | u8 id; | 73 | u8 id; |
79 | char id2[7]; | 74 | char tag[ZFCP_DBF_TAG_LEN]; |
75 | u64 lun; | ||
76 | u64 wwpn; | ||
77 | u32 d_id; | ||
78 | u32 adapter_status; | ||
79 | u32 port_status; | ||
80 | u32 lun_status; | ||
80 | union { | 81 | union { |
81 | struct zfcp_dbf_rec_record_action action; | 82 | struct zfcp_dbf_rec_trigger trig; |
82 | struct zfcp_dbf_rec_record_thread thread; | 83 | struct zfcp_dbf_rec_running run; |
83 | struct zfcp_dbf_rec_record_target target; | ||
84 | struct zfcp_dbf_rec_record_trigger trigger; | ||
85 | } u; | 84 | } u; |
86 | }; | 85 | } __packed; |
87 | 86 | ||
88 | enum { | 87 | /** |
89 | ZFCP_REC_DBF_ID_ACTION, | 88 | * enum zfcp_dbf_san_id - SAN trace record identifier |
90 | ZFCP_REC_DBF_ID_THREAD, | 89 | * @ZFCP_DBF_SAN_REQ: request trace record id |
91 | ZFCP_REC_DBF_ID_TARGET, | 90 | * @ZFCP_DBF_SAN_RES: response trace record id |
92 | ZFCP_REC_DBF_ID_TRIGGER, | 91 | * @ZFCP_DBF_SAN_ELS: extended link service record id |
92 | */ | ||
93 | enum zfcp_dbf_san_id { | ||
94 | ZFCP_DBF_SAN_REQ = 1, | ||
95 | ZFCP_DBF_SAN_RES = 2, | ||
96 | ZFCP_DBF_SAN_ELS = 3, | ||
93 | }; | 97 | }; |
94 | 98 | ||
95 | struct zfcp_dbf_hba_record_response { | 99 | /** struct zfcp_dbf_san - trace record for SAN requests and responses |
96 | u32 fsf_command; | 100 | * @id: unique number of recovery record type |
97 | u64 fsf_reqid; | 101 | * @tag: identifier string specifying the location of initiation |
98 | u32 fsf_seqno; | 102 | * @fsf_req_id: request id for fsf requests |
99 | u64 fsf_issued; | 103 | * @payload: unformatted information related to request/response |
100 | u32 fsf_prot_status; | 104 | * @d_id: destination id |
105 | */ | ||
106 | struct zfcp_dbf_san { | ||
107 | u8 id; | ||
108 | char tag[ZFCP_DBF_TAG_LEN]; | ||
109 | u64 fsf_req_id; | ||
110 | u32 d_id; | ||
111 | #define ZFCP_DBF_SAN_MAX_PAYLOAD (FC_CT_HDR_LEN + 32) | ||
112 | char payload[ZFCP_DBF_SAN_MAX_PAYLOAD]; | ||
113 | } __packed; | ||
114 | |||
115 | /** | ||
116 | * struct zfcp_dbf_hba_res - trace record for hba responses | ||
117 | * @req_issued: timestamp when request was issued | ||
118 | * @prot_status: protocol status | ||
119 | * @prot_status_qual: protocol status qualifier | ||
120 | * @fsf_status: fsf status | ||
121 | * @fsf_status_qual: fsf status qualifier | ||
122 | */ | ||
123 | struct zfcp_dbf_hba_res { | ||
124 | u64 req_issued; | ||
125 | u32 prot_status; | ||
126 | u8 prot_status_qual[FSF_PROT_STATUS_QUAL_SIZE]; | ||
101 | u32 fsf_status; | 127 | u32 fsf_status; |
102 | u8 fsf_prot_status_qual[FSF_PROT_STATUS_QUAL_SIZE]; | 128 | u8 fsf_status_qual[FSF_STATUS_QUALIFIER_SIZE]; |
103 | u8 fsf_status_qual[FSF_STATUS_QUALIFIER_SIZE]; | 129 | } __packed; |
104 | u32 fsf_req_status; | ||
105 | u8 sbal_first; | ||
106 | u8 sbal_last; | ||
107 | u8 sbal_response; | ||
108 | u8 pool; | ||
109 | u64 erp_action; | ||
110 | union { | ||
111 | struct { | ||
112 | u64 cmnd; | ||
113 | u64 serial; | ||
114 | u32 data_dir; | ||
115 | } fcp; | ||
116 | struct { | ||
117 | u64 wwpn; | ||
118 | u32 d_id; | ||
119 | u32 port_handle; | ||
120 | } port; | ||
121 | struct { | ||
122 | u64 wwpn; | ||
123 | u64 fcp_lun; | ||
124 | u32 port_handle; | ||
125 | u32 lun_handle; | ||
126 | } unit; | ||
127 | struct { | ||
128 | u32 d_id; | ||
129 | } els; | ||
130 | } u; | ||
131 | } __attribute__ ((packed)); | ||
132 | 130 | ||
133 | struct zfcp_dbf_hba_record_status { | 131 | /** |
134 | u8 failed; | 132 | * struct zfcp_dbf_hba_uss - trace record for unsolicited status |
133 | * @status_type: type of unsolicited status | ||
134 | * @status_subtype: subtype of unsolicited status | ||
135 | * @d_id: destination ID | ||
136 | * @lun: logical unit number | ||
137 | * @queue_designator: queue designator | ||
138 | */ | ||
139 | struct zfcp_dbf_hba_uss { | ||
135 | u32 status_type; | 140 | u32 status_type; |
136 | u32 status_subtype; | 141 | u32 status_subtype; |
137 | struct fsf_queue_designator | ||
138 | queue_designator; | ||
139 | u32 payload_size; | ||
140 | #define ZFCP_DBF_UNSOL_PAYLOAD 80 | ||
141 | #define ZFCP_DBF_UNSOL_PAYLOAD_SENSE_DATA_AVAIL 32 | ||
142 | #define ZFCP_DBF_UNSOL_PAYLOAD_BIT_ERROR_THRESHOLD 56 | ||
143 | #define ZFCP_DBF_UNSOL_PAYLOAD_FEATURE_UPDATE_ALERT 2 * sizeof(u32) | ||
144 | u8 payload[ZFCP_DBF_UNSOL_PAYLOAD]; | ||
145 | } __attribute__ ((packed)); | ||
146 | |||
147 | struct zfcp_dbf_hba_record_qdio { | ||
148 | u32 qdio_error; | ||
149 | u8 sbal_index; | ||
150 | u8 sbal_count; | ||
151 | } __attribute__ ((packed)); | ||
152 | |||
153 | struct zfcp_dbf_hba_record { | ||
154 | u8 tag[ZFCP_DBF_TAG_SIZE]; | ||
155 | u8 tag2[ZFCP_DBF_TAG_SIZE]; | ||
156 | union { | ||
157 | struct zfcp_dbf_hba_record_response response; | ||
158 | struct zfcp_dbf_hba_record_status status; | ||
159 | struct zfcp_dbf_hba_record_qdio qdio; | ||
160 | struct fsf_bit_error_payload berr; | ||
161 | } u; | ||
162 | } __attribute__ ((packed)); | ||
163 | |||
164 | struct zfcp_dbf_san_record_ct_request { | ||
165 | u16 cmd_req_code; | ||
166 | u8 revision; | ||
167 | u8 gs_type; | ||
168 | u8 gs_subtype; | ||
169 | u8 options; | ||
170 | u16 max_res_size; | ||
171 | u32 len; | ||
172 | u32 d_id; | ||
173 | } __attribute__ ((packed)); | ||
174 | |||
175 | struct zfcp_dbf_san_record_ct_response { | ||
176 | u16 cmd_rsp_code; | ||
177 | u8 revision; | ||
178 | u8 reason_code; | ||
179 | u8 expl; | ||
180 | u8 vendor_unique; | ||
181 | u16 max_res_size; | ||
182 | u32 len; | ||
183 | } __attribute__ ((packed)); | ||
184 | |||
185 | struct zfcp_dbf_san_record_els { | ||
186 | u32 d_id; | 142 | u32 d_id; |
187 | } __attribute__ ((packed)); | 143 | u64 lun; |
144 | u64 queue_designator; | ||
145 | } __packed; | ||
146 | |||
147 | /** | ||
148 | * enum zfcp_dbf_hba_id - HBA trace record identifier | ||
149 | * @ZFCP_DBF_HBA_RES: response trace record | ||
150 | * @ZFCP_DBF_HBA_USS: unsolicited status trace record | ||
151 | * @ZFCP_DBF_HBA_BIT: bit error trace record | ||
152 | */ | ||
153 | enum zfcp_dbf_hba_id { | ||
154 | ZFCP_DBF_HBA_RES = 1, | ||
155 | ZFCP_DBF_HBA_USS = 2, | ||
156 | ZFCP_DBF_HBA_BIT = 3, | ||
157 | }; | ||
188 | 158 | ||
189 | struct zfcp_dbf_san_record { | 159 | /** |
190 | u8 tag[ZFCP_DBF_TAG_SIZE]; | 160 | * struct zfcp_dbf_hba - common trace record for HBA records |
191 | u64 fsf_reqid; | 161 | * @id: unique number of recovery record type |
192 | u32 fsf_seqno; | 162 | * @tag: identifier string specifying the location of initiation |
163 | * @fsf_req_id: request id for fsf requests | ||
164 | * @fsf_req_status: status of fsf request | ||
165 | * @fsf_cmd: fsf command | ||
166 | * @fsf_seq_no: fsf sequence number | ||
167 | * @pl_len: length of payload stored as zfcp_dbf_pay | ||
168 | * @u: record type specific data | ||
169 | */ | ||
170 | struct zfcp_dbf_hba { | ||
171 | u8 id; | ||
172 | char tag[ZFCP_DBF_TAG_LEN]; | ||
173 | u64 fsf_req_id; | ||
174 | u32 fsf_req_status; | ||
175 | u32 fsf_cmd; | ||
176 | u32 fsf_seq_no; | ||
177 | u16 pl_len; | ||
193 | union { | 178 | union { |
194 | struct zfcp_dbf_san_record_ct_request ct_req; | 179 | struct zfcp_dbf_hba_res res; |
195 | struct zfcp_dbf_san_record_ct_response ct_resp; | 180 | struct zfcp_dbf_hba_uss uss; |
196 | struct zfcp_dbf_san_record_els els; | 181 | struct fsf_bit_error_payload be; |
197 | } u; | 182 | } u; |
198 | } __attribute__ ((packed)); | 183 | } __packed; |
199 | 184 | ||
200 | #define ZFCP_DBF_SAN_MAX_PAYLOAD 1024 | 185 | /** |
186 | * enum zfcp_dbf_scsi_id - scsi trace record identifier | ||
187 | * @ZFCP_DBF_SCSI_CMND: scsi command trace record | ||
188 | */ | ||
189 | enum zfcp_dbf_scsi_id { | ||
190 | ZFCP_DBF_SCSI_CMND = 1, | ||
191 | }; | ||
201 | 192 | ||
202 | struct zfcp_dbf_scsi_record { | 193 | /** |
203 | u8 tag[ZFCP_DBF_TAG_SIZE]; | 194 | * struct zfcp_dbf_scsi - common trace record for SCSI records |
204 | u8 tag2[ZFCP_DBF_TAG_SIZE]; | 195 | * @id: unique number of recovery record type |
196 | * @tag: identifier string specifying the location of initiation | ||
197 | * @scsi_id: scsi device id | ||
198 | * @scsi_lun: scsi device logical unit number | ||
199 | * @scsi_result: scsi result | ||
200 | * @scsi_retries: current retry number of scsi request | ||
201 | * @scsi_allowed: allowed retries | ||
202 | * @fcp_rsp_info: FCP response info | ||
203 | * @scsi_opcode: scsi opcode | ||
204 | * @fsf_req_id: request id of fsf request | ||
205 | * @host_scribble: LLD specific data attached to SCSI request | ||
206 | * @pl_len: length of paload stored as zfcp_dbf_pay | ||
207 | * @fsf_rsp: response for fsf request | ||
208 | */ | ||
209 | struct zfcp_dbf_scsi { | ||
210 | u8 id; | ||
211 | char tag[ZFCP_DBF_TAG_LEN]; | ||
205 | u32 scsi_id; | 212 | u32 scsi_id; |
206 | u32 scsi_lun; | 213 | u32 scsi_lun; |
207 | u32 scsi_result; | 214 | u32 scsi_result; |
208 | u64 scsi_cmnd; | ||
209 | u64 scsi_serial; | ||
210 | #define ZFCP_DBF_SCSI_OPCODE 16 | ||
211 | u8 scsi_opcode[ZFCP_DBF_SCSI_OPCODE]; | ||
212 | u8 scsi_retries; | 215 | u8 scsi_retries; |
213 | u8 scsi_allowed; | 216 | u8 scsi_allowed; |
214 | u64 fsf_reqid; | 217 | u8 fcp_rsp_info; |
215 | u32 fsf_seqno; | 218 | #define ZFCP_DBF_SCSI_OPCODE 16 |
216 | u64 fsf_issued; | 219 | u8 scsi_opcode[ZFCP_DBF_SCSI_OPCODE]; |
217 | u64 old_fsf_reqid; | 220 | u64 fsf_req_id; |
218 | u8 rsp_validity; | 221 | u64 host_scribble; |
219 | u8 rsp_scsi_status; | 222 | u16 pl_len; |
220 | u32 rsp_resid; | 223 | struct fcp_resp_with_ext fcp_rsp; |
221 | u8 rsp_code; | 224 | } __packed; |
222 | #define ZFCP_DBF_SCSI_FCP_SNS_INFO 16 | 225 | |
223 | #define ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO 256 | 226 | /** |
224 | u32 sns_info_len; | 227 | * struct zfcp_dbf_pay - trace record for unformatted payload information |
225 | u8 sns_info[ZFCP_DBF_SCSI_FCP_SNS_INFO]; | 228 | * @area: area this record is originated from |
226 | } __attribute__ ((packed)); | 229 | * @counter: ascending record number |
230 | * @fsf_req_id: request id of fsf request | ||
231 | * @data: unformatted data | ||
232 | */ | ||
233 | struct zfcp_dbf_pay { | ||
234 | u8 counter; | ||
235 | char area[ZFCP_DBF_TAG_LEN]; | ||
236 | u64 fsf_req_id; | ||
237 | #define ZFCP_DBF_PAY_MAX_REC 0x100 | ||
238 | char data[ZFCP_DBF_PAY_MAX_REC]; | ||
239 | } __packed; | ||
227 | 240 | ||
241 | /** | ||
242 | * struct zfcp_dbf - main dbf trace structure | ||
243 | * @pay: reference to payload trace area | ||
244 | * @rec: reference to recovery trace area | ||
245 | * @hba: reference to hba trace area | ||
246 | * @san: reference to san trace area | ||
247 | * @scsi: reference to scsi trace area | ||
248 | * @pay_lock: lock protecting payload trace buffer | ||
249 | * @rec_lock: lock protecting recovery trace buffer | ||
250 | * @hba_lock: lock protecting hba trace buffer | ||
251 | * @san_lock: lock protecting san trace buffer | ||
252 | * @scsi_lock: lock protecting scsi trace buffer | ||
253 | * @pay_buf: pre-allocated buffer for payload | ||
254 | * @rec_buf: pre-allocated buffer for recovery | ||
255 | * @hba_buf: pre-allocated buffer for hba | ||
256 | * @san_buf: pre-allocated buffer for san | ||
257 | * @scsi_buf: pre-allocated buffer for scsi | ||
258 | */ | ||
228 | struct zfcp_dbf { | 259 | struct zfcp_dbf { |
260 | debug_info_t *pay; | ||
229 | debug_info_t *rec; | 261 | debug_info_t *rec; |
230 | debug_info_t *hba; | 262 | debug_info_t *hba; |
231 | debug_info_t *san; | 263 | debug_info_t *san; |
232 | debug_info_t *scsi; | 264 | debug_info_t *scsi; |
265 | spinlock_t pay_lock; | ||
233 | spinlock_t rec_lock; | 266 | spinlock_t rec_lock; |
234 | spinlock_t hba_lock; | 267 | spinlock_t hba_lock; |
235 | spinlock_t san_lock; | 268 | spinlock_t san_lock; |
236 | spinlock_t scsi_lock; | 269 | spinlock_t scsi_lock; |
237 | struct zfcp_dbf_rec_record rec_buf; | 270 | struct zfcp_dbf_pay pay_buf; |
238 | struct zfcp_dbf_hba_record hba_buf; | 271 | struct zfcp_dbf_rec rec_buf; |
239 | struct zfcp_dbf_san_record san_buf; | 272 | struct zfcp_dbf_hba hba_buf; |
240 | struct zfcp_dbf_scsi_record scsi_buf; | 273 | struct zfcp_dbf_san san_buf; |
241 | struct zfcp_adapter *adapter; | 274 | struct zfcp_dbf_scsi scsi_buf; |
242 | }; | 275 | }; |
243 | 276 | ||
244 | static inline | 277 | static inline |
245 | void zfcp_dbf_hba_fsf_resp(const char *tag2, int level, | 278 | void zfcp_dbf_hba_fsf_resp(char *tag, int level, struct zfcp_fsf_req *req) |
246 | struct zfcp_fsf_req *req, struct zfcp_dbf *dbf) | ||
247 | { | 279 | { |
248 | if (level <= dbf->hba->level) | 280 | if (level <= req->adapter->dbf->hba->level) |
249 | _zfcp_dbf_hba_fsf_response(tag2, level, req, dbf); | 281 | zfcp_dbf_hba_fsf_res(tag, req); |
250 | } | 282 | } |
251 | 283 | ||
252 | /** | 284 | /** |
253 | * zfcp_dbf_hba_fsf_response - trace event for request completion | 285 | * zfcp_dbf_hba_fsf_response - trace event for request completion |
254 | * @fsf_req: request that has been completed | 286 | * @req: request that has been completed |
255 | */ | 287 | */ |
256 | static inline void zfcp_dbf_hba_fsf_response(struct zfcp_fsf_req *req) | 288 | static inline |
289 | void zfcp_dbf_hba_fsf_response(struct zfcp_fsf_req *req) | ||
257 | { | 290 | { |
258 | struct zfcp_dbf *dbf = req->adapter->dbf; | ||
259 | struct fsf_qtcb *qtcb = req->qtcb; | 291 | struct fsf_qtcb *qtcb = req->qtcb; |
260 | 292 | ||
261 | if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) && | 293 | if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) && |
262 | (qtcb->prefix.prot_status != FSF_PROT_FSF_STATUS_PRESENTED)) { | 294 | (qtcb->prefix.prot_status != FSF_PROT_FSF_STATUS_PRESENTED)) { |
263 | zfcp_dbf_hba_fsf_resp("perr", 1, req, dbf); | 295 | zfcp_dbf_hba_fsf_resp("fs_perr", 1, req); |
264 | 296 | ||
265 | } else if (qtcb->header.fsf_status != FSF_GOOD) { | 297 | } else if (qtcb->header.fsf_status != FSF_GOOD) { |
266 | zfcp_dbf_hba_fsf_resp("ferr", 1, req, dbf); | 298 | zfcp_dbf_hba_fsf_resp("fs_ferr", 1, req); |
267 | 299 | ||
268 | } else if ((req->fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) || | 300 | } else if ((req->fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) || |
269 | (req->fsf_command == FSF_QTCB_OPEN_LUN)) { | 301 | (req->fsf_command == FSF_QTCB_OPEN_LUN)) { |
270 | zfcp_dbf_hba_fsf_resp("open", 4, req, dbf); | 302 | zfcp_dbf_hba_fsf_resp("fs_open", 4, req); |
271 | 303 | ||
272 | } else if (qtcb->header.log_length) { | 304 | } else if (qtcb->header.log_length) { |
273 | zfcp_dbf_hba_fsf_resp("qtcb", 5, req, dbf); | 305 | zfcp_dbf_hba_fsf_resp("fs_qtcb", 5, req); |
274 | 306 | ||
275 | } else { | 307 | } else { |
276 | zfcp_dbf_hba_fsf_resp("norm", 6, req, dbf); | 308 | zfcp_dbf_hba_fsf_resp("fs_norm", 6, req); |
277 | } | 309 | } |
278 | } | ||
279 | |||
280 | /** | ||
281 | * zfcp_dbf_hba_fsf_unsol - trace event for an unsolicited status buffer | ||
282 | * @tag: tag indicating which kind of unsolicited status has been received | ||
283 | * @dbf: reference to dbf structure | ||
284 | * @status_buffer: buffer containing payload of unsolicited status | ||
285 | */ | ||
286 | static inline | ||
287 | void zfcp_dbf_hba_fsf_unsol(const char *tag, struct zfcp_dbf *dbf, | ||
288 | struct fsf_status_read_buffer *buf) | ||
289 | { | ||
290 | int level = 2; | ||
291 | |||
292 | if (level <= dbf->hba->level) | ||
293 | _zfcp_dbf_hba_fsf_unsol(tag, level, dbf, buf); | ||
294 | } | 310 | } |
295 | 311 | ||
296 | static inline | 312 | static inline |
297 | void zfcp_dbf_scsi(const char *tag, const char *tag2, int level, | 313 | void _zfcp_dbf_scsi(char *tag, int level, struct scsi_cmnd *scmd, |
298 | struct zfcp_dbf *dbf, struct scsi_cmnd *scmd, | 314 | struct zfcp_fsf_req *req) |
299 | struct zfcp_fsf_req *req, unsigned long old_id) | ||
300 | { | 315 | { |
301 | if (level <= dbf->scsi->level) | 316 | struct zfcp_adapter *adapter = (struct zfcp_adapter *) |
302 | _zfcp_dbf_scsi(tag, tag2, level, dbf, scmd, req, old_id); | 317 | scmd->device->host->hostdata[0]; |
318 | |||
319 | if (level <= adapter->dbf->scsi->level) | ||
320 | zfcp_dbf_scsi(tag, scmd, req); | ||
303 | } | 321 | } |
304 | 322 | ||
305 | /** | 323 | /** |
306 | * zfcp_dbf_scsi_result - trace event for SCSI command completion | 324 | * zfcp_dbf_scsi_result - trace event for SCSI command completion |
307 | * @dbf: adapter dbf trace | ||
308 | * @scmd: SCSI command pointer | 325 | * @scmd: SCSI command pointer |
309 | * @req: FSF request used to issue SCSI command | 326 | * @req: FSF request used to issue SCSI command |
310 | */ | 327 | */ |
311 | static inline | 328 | static inline |
312 | void zfcp_dbf_scsi_result(struct zfcp_dbf *dbf, struct scsi_cmnd *scmd, | 329 | void zfcp_dbf_scsi_result(struct scsi_cmnd *scmd, struct zfcp_fsf_req *req) |
313 | struct zfcp_fsf_req *req) | ||
314 | { | 330 | { |
315 | if (scmd->result != 0) | 331 | if (scmd->result != 0) |
316 | zfcp_dbf_scsi("rslt", "erro", 3, dbf, scmd, req, 0); | 332 | _zfcp_dbf_scsi("rsl_err", 3, scmd, req); |
317 | else if (scmd->retries > 0) | 333 | else if (scmd->retries > 0) |
318 | zfcp_dbf_scsi("rslt", "retr", 4, dbf, scmd, req, 0); | 334 | _zfcp_dbf_scsi("rsl_ret", 4, scmd, req); |
319 | else | 335 | else |
320 | zfcp_dbf_scsi("rslt", "norm", 6, dbf, scmd, req, 0); | 336 | _zfcp_dbf_scsi("rsl_nor", 6, scmd, req); |
321 | } | 337 | } |
322 | 338 | ||
323 | /** | 339 | /** |
324 | * zfcp_dbf_scsi_fail_send - trace event for failure to send SCSI command | 340 | * zfcp_dbf_scsi_fail_send - trace event for failure to send SCSI command |
325 | * @dbf: adapter dbf trace | ||
326 | * @scmd: SCSI command pointer | 341 | * @scmd: SCSI command pointer |
327 | */ | 342 | */ |
328 | static inline | 343 | static inline |
329 | void zfcp_dbf_scsi_fail_send(struct zfcp_dbf *dbf, struct scsi_cmnd *scmd) | 344 | void zfcp_dbf_scsi_fail_send(struct scsi_cmnd *scmd) |
330 | { | 345 | { |
331 | zfcp_dbf_scsi("rslt", "fail", 4, dbf, scmd, NULL, 0); | 346 | _zfcp_dbf_scsi("rsl_fai", 4, scmd, NULL); |
332 | } | 347 | } |
333 | 348 | ||
334 | /** | 349 | /** |
335 | * zfcp_dbf_scsi_abort - trace event for SCSI command abort | 350 | * zfcp_dbf_scsi_abort - trace event for SCSI command abort |
336 | * @tag: tag indicating success or failure of abort operation | 351 | * @tag: tag indicating success or failure of abort operation |
337 | * @adapter: adapter thas has been used to issue SCSI command to be aborted | ||
338 | * @scmd: SCSI command to be aborted | 352 | * @scmd: SCSI command to be aborted |
339 | * @new_req: request containing abort (might be NULL) | 353 | * @fsf_req: request containing abort (might be NULL) |
340 | * @old_id: identifier of request containg SCSI command to be aborted | ||
341 | */ | 354 | */ |
342 | static inline | 355 | static inline |
343 | void zfcp_dbf_scsi_abort(const char *tag, struct zfcp_dbf *dbf, | 356 | void zfcp_dbf_scsi_abort(char *tag, struct scsi_cmnd *scmd, |
344 | struct scsi_cmnd *scmd, struct zfcp_fsf_req *new_req, | 357 | struct zfcp_fsf_req *fsf_req) |
345 | unsigned long old_id) | ||
346 | { | 358 | { |
347 | zfcp_dbf_scsi("abrt", tag, 1, dbf, scmd, new_req, old_id); | 359 | _zfcp_dbf_scsi(tag, 1, scmd, fsf_req); |
348 | } | 360 | } |
349 | 361 | ||
350 | /** | 362 | /** |
351 | * zfcp_dbf_scsi_devreset - trace event for Logical Unit or Target Reset | 363 | * zfcp_dbf_scsi_devreset - trace event for Logical Unit or Target Reset |
352 | * @tag: tag indicating success or failure of reset operation | 364 | * @tag: tag indicating success or failure of reset operation |
365 | * @scmnd: SCSI command which caused this error recovery | ||
353 | * @flag: indicates type of reset (Target Reset, Logical Unit Reset) | 366 | * @flag: indicates type of reset (Target Reset, Logical Unit Reset) |
354 | * @unit: unit that needs reset | ||
355 | * @scsi_cmnd: SCSI command which caused this error recovery | ||
356 | */ | 367 | */ |
357 | static inline | 368 | static inline |
358 | void zfcp_dbf_scsi_devreset(const char *tag, u8 flag, struct zfcp_unit *unit, | 369 | void zfcp_dbf_scsi_devreset(char *tag, struct scsi_cmnd *scmnd, u8 flag) |
359 | struct scsi_cmnd *scsi_cmnd) | ||
360 | { | 370 | { |
361 | zfcp_dbf_scsi(flag == FCP_TMF_TGT_RESET ? "trst" : "lrst", tag, 1, | 371 | char tmp_tag[ZFCP_DBF_TAG_LEN]; |
362 | unit->port->adapter->dbf, scsi_cmnd, NULL, 0); | 372 | |
373 | if (flag == FCP_TMF_TGT_RESET) | ||
374 | memcpy(tmp_tag, "tr_", 3); | ||
375 | else | ||
376 | memcpy(tmp_tag, "lr_", 3); | ||
377 | |||
378 | memcpy(&tmp_tag[3], tag, 4); | ||
379 | _zfcp_dbf_scsi(tmp_tag, 1, scmnd, NULL); | ||
363 | } | 380 | } |
364 | 381 | ||
365 | #endif /* ZFCP_DBF_H */ | 382 | #endif /* ZFCP_DBF_H */ |