Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 1 | /* |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 2 | * zfcp device driver |
| 3 | * debug feature declarations |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 4 | * |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 5 | * Copyright IBM Corp. 2008, 2010 |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef ZFCP_DBF_H |
| 9 | #define ZFCP_DBF_H |
| 10 | |
Christof Schmitt | 4318e08 | 2009-11-24 16:54:08 +0100 | [diff] [blame] | 11 | #include <scsi/fc/fc_fcp.h> |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 12 | #include "zfcp_ext.h" |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 13 | #include "zfcp_fsf.h" |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 14 | #include "zfcp_def.h" |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 15 | |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 16 | #define ZFCP_DBF_TAG_LEN 7 |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 17 | |
Christof Schmitt | d21e9da | 2010-02-17 11:18:54 +0100 | [diff] [blame] | 18 | #define ZFCP_DBF_INVALID_LUN 0xFFFFFFFFFFFFFFFFull |
| 19 | |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 20 | /** |
| 21 | * struct zfcp_dbf_rec_trigger - trace record for triggered recovery action |
| 22 | * @ready: number of ready recovery actions |
| 23 | * @running: number of running recovery actions |
| 24 | * @want: wanted recovery action |
| 25 | * @need: needed recovery action |
| 26 | */ |
| 27 | struct zfcp_dbf_rec_trigger { |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 28 | u32 ready; |
| 29 | u32 running; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 30 | u8 want; |
| 31 | u8 need; |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 32 | } __packed; |
| 33 | |
| 34 | /** |
| 35 | * struct zfcp_dbf_rec_running - trace record for running recovery |
| 36 | * @fsf_req_id: request id for fsf requests |
| 37 | * @rec_status: status of the fsf request |
| 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, |
Martin Peschke | 7337891 | 2008-05-19 12:17:46 +0200 | [diff] [blame] | 57 | }; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 58 | |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 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 { |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 73 | u8 id; |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 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; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 81 | union { |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 82 | struct zfcp_dbf_rec_trigger trig; |
| 83 | struct zfcp_dbf_rec_running run; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 84 | } u; |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 85 | } __packed; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 86 | |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 87 | /** |
| 88 | * enum zfcp_dbf_san_id - SAN trace record identifier |
| 89 | * @ZFCP_DBF_SAN_REQ: request trace record id |
| 90 | * @ZFCP_DBF_SAN_RES: response trace record id |
| 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, |
| 97 | }; |
| 98 | |
| 99 | /** struct zfcp_dbf_san - trace record for SAN requests and responses |
| 100 | * @id: unique number of recovery record type |
| 101 | * @tag: identifier string specifying the location of initiation |
| 102 | * @fsf_req_id: request id for fsf requests |
| 103 | * @payload: unformatted information related to request/response |
| 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 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 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]; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 127 | u32 fsf_status; |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 128 | u8 fsf_status_qual[FSF_STATUS_QUALIFIER_SIZE]; |
| 129 | } __packed; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 130 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 131 | /** |
| 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 { |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 140 | u32 status_type; |
| 141 | u32 status_subtype; |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 142 | u32 d_id; |
| 143 | u64 lun; |
| 144 | u64 queue_designator; |
| 145 | } __packed; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 146 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 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, |
Steffen Maier | cb452149 | 2012-09-04 15:23:32 +0200 | [diff] [blame] | 157 | ZFCP_DBF_HBA_BASIC = 4, |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 158 | }; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 159 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 160 | /** |
| 161 | * struct zfcp_dbf_hba - common trace record for HBA records |
| 162 | * @id: unique number of recovery record type |
| 163 | * @tag: identifier string specifying the location of initiation |
| 164 | * @fsf_req_id: request id for fsf requests |
| 165 | * @fsf_req_status: status of fsf request |
| 166 | * @fsf_cmd: fsf command |
| 167 | * @fsf_seq_no: fsf sequence number |
| 168 | * @pl_len: length of payload stored as zfcp_dbf_pay |
| 169 | * @u: record type specific data |
| 170 | */ |
| 171 | struct zfcp_dbf_hba { |
| 172 | u8 id; |
| 173 | char tag[ZFCP_DBF_TAG_LEN]; |
| 174 | u64 fsf_req_id; |
| 175 | u32 fsf_req_status; |
| 176 | u32 fsf_cmd; |
| 177 | u32 fsf_seq_no; |
| 178 | u16 pl_len; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 179 | union { |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 180 | struct zfcp_dbf_hba_res res; |
| 181 | struct zfcp_dbf_hba_uss uss; |
| 182 | struct fsf_bit_error_payload be; |
Martin Peschke | 6bc473d | 2008-03-31 11:15:29 +0200 | [diff] [blame] | 183 | } u; |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 184 | } __packed; |
| 185 | |
| 186 | /** |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 187 | * enum zfcp_dbf_scsi_id - scsi trace record identifier |
| 188 | * @ZFCP_DBF_SCSI_CMND: scsi command trace record |
| 189 | */ |
| 190 | enum zfcp_dbf_scsi_id { |
| 191 | ZFCP_DBF_SCSI_CMND = 1, |
| 192 | }; |
| 193 | |
| 194 | /** |
| 195 | * struct zfcp_dbf_scsi - common trace record for SCSI records |
| 196 | * @id: unique number of recovery record type |
| 197 | * @tag: identifier string specifying the location of initiation |
| 198 | * @scsi_id: scsi device id |
| 199 | * @scsi_lun: scsi device logical unit number |
| 200 | * @scsi_result: scsi result |
| 201 | * @scsi_retries: current retry number of scsi request |
| 202 | * @scsi_allowed: allowed retries |
| 203 | * @fcp_rsp_info: FCP response info |
| 204 | * @scsi_opcode: scsi opcode |
| 205 | * @fsf_req_id: request id of fsf request |
| 206 | * @host_scribble: LLD specific data attached to SCSI request |
| 207 | * @pl_len: length of paload stored as zfcp_dbf_pay |
| 208 | * @fsf_rsp: response for fsf request |
| 209 | */ |
| 210 | struct zfcp_dbf_scsi { |
| 211 | u8 id; |
| 212 | char tag[ZFCP_DBF_TAG_LEN]; |
| 213 | u32 scsi_id; |
| 214 | u32 scsi_lun; |
| 215 | u32 scsi_result; |
| 216 | u8 scsi_retries; |
| 217 | u8 scsi_allowed; |
| 218 | u8 fcp_rsp_info; |
| 219 | #define ZFCP_DBF_SCSI_OPCODE 16 |
| 220 | u8 scsi_opcode[ZFCP_DBF_SCSI_OPCODE]; |
| 221 | u64 fsf_req_id; |
| 222 | u64 host_scribble; |
| 223 | u16 pl_len; |
| 224 | struct fcp_resp_with_ext fcp_rsp; |
| 225 | } __packed; |
| 226 | |
| 227 | /** |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 228 | * struct zfcp_dbf_pay - trace record for unformatted payload information |
| 229 | * @area: area this record is originated from |
| 230 | * @counter: ascending record number |
| 231 | * @fsf_req_id: request id of fsf request |
| 232 | * @data: unformatted data |
| 233 | */ |
| 234 | struct zfcp_dbf_pay { |
Swen Schillig | ea4a3a6 | 2010-12-02 15:16:16 +0100 | [diff] [blame] | 235 | u8 counter; |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 236 | char area[ZFCP_DBF_TAG_LEN]; |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 237 | u64 fsf_req_id; |
| 238 | #define ZFCP_DBF_PAY_MAX_REC 0x100 |
| 239 | char data[ZFCP_DBF_PAY_MAX_REC]; |
| 240 | } __packed; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 241 | |
Swen Schillig | ea4a3a6 | 2010-12-02 15:16:16 +0100 | [diff] [blame] | 242 | /** |
| 243 | * struct zfcp_dbf - main dbf trace structure |
| 244 | * @pay: reference to payload trace area |
| 245 | * @rec: reference to recovery trace area |
| 246 | * @hba: reference to hba trace area |
| 247 | * @san: reference to san trace area |
| 248 | * @scsi: reference to scsi trace area |
| 249 | * @pay_lock: lock protecting payload trace buffer |
| 250 | * @rec_lock: lock protecting recovery trace buffer |
| 251 | * @hba_lock: lock protecting hba trace buffer |
| 252 | * @san_lock: lock protecting san trace buffer |
| 253 | * @scsi_lock: lock protecting scsi trace buffer |
| 254 | * @pay_buf: pre-allocated buffer for payload |
| 255 | * @rec_buf: pre-allocated buffer for recovery |
| 256 | * @hba_buf: pre-allocated buffer for hba |
| 257 | * @san_buf: pre-allocated buffer for san |
| 258 | * @scsi_buf: pre-allocated buffer for scsi |
| 259 | */ |
Christof Schmitt | d46f384 | 2009-08-18 15:43:07 +0200 | [diff] [blame] | 260 | struct zfcp_dbf { |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 261 | debug_info_t *pay; |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 262 | debug_info_t *rec; |
| 263 | debug_info_t *hba; |
| 264 | debug_info_t *san; |
| 265 | debug_info_t *scsi; |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 266 | spinlock_t pay_lock; |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 267 | spinlock_t rec_lock; |
| 268 | spinlock_t hba_lock; |
| 269 | spinlock_t san_lock; |
| 270 | spinlock_t scsi_lock; |
Swen Schillig | ea4a3a6 | 2010-12-02 15:16:16 +0100 | [diff] [blame] | 271 | struct zfcp_dbf_pay pay_buf; |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 272 | struct zfcp_dbf_rec rec_buf; |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 273 | struct zfcp_dbf_hba hba_buf; |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 274 | struct zfcp_dbf_san san_buf; |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 275 | struct zfcp_dbf_scsi scsi_buf; |
Christof Schmitt | d46f384 | 2009-08-18 15:43:07 +0200 | [diff] [blame] | 276 | }; |
| 277 | |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 278 | static inline |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 279 | void zfcp_dbf_hba_fsf_resp(char *tag, int level, struct zfcp_fsf_req *req) |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 280 | { |
Hendrik Brueckner | 8e6a828 | 2013-09-18 17:21:34 +0200 | [diff] [blame] | 281 | if (debug_level_enabled(req->adapter->dbf->hba, level)) |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 282 | zfcp_dbf_hba_fsf_res(tag, req); |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 283 | } |
| 284 | |
| 285 | /** |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 286 | * zfcp_dbf_hba_fsf_response - trace event for request completion |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 287 | * @req: request that has been completed |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 288 | */ |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 289 | static inline |
| 290 | void zfcp_dbf_hba_fsf_response(struct zfcp_fsf_req *req) |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 291 | { |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 292 | struct fsf_qtcb *qtcb = req->qtcb; |
| 293 | |
| 294 | if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) && |
| 295 | (qtcb->prefix.prot_status != FSF_PROT_FSF_STATUS_PRESENTED)) { |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 296 | zfcp_dbf_hba_fsf_resp("fs_perr", 1, req); |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 297 | |
| 298 | } else if (qtcb->header.fsf_status != FSF_GOOD) { |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 299 | zfcp_dbf_hba_fsf_resp("fs_ferr", 1, req); |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 300 | |
| 301 | } else if ((req->fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) || |
| 302 | (req->fsf_command == FSF_QTCB_OPEN_LUN)) { |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 303 | zfcp_dbf_hba_fsf_resp("fs_open", 4, req); |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 304 | |
| 305 | } else if (qtcb->header.log_length) { |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 306 | zfcp_dbf_hba_fsf_resp("fs_qtcb", 5, req); |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 307 | |
| 308 | } else { |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame] | 309 | zfcp_dbf_hba_fsf_resp("fs_norm", 6, req); |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 310 | } |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | static inline |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 314 | void _zfcp_dbf_scsi(char *tag, int level, struct scsi_cmnd *scmd, |
| 315 | struct zfcp_fsf_req *req) |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 316 | { |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 317 | struct zfcp_adapter *adapter = (struct zfcp_adapter *) |
| 318 | scmd->device->host->hostdata[0]; |
| 319 | |
Hendrik Brueckner | 8e6a828 | 2013-09-18 17:21:34 +0200 | [diff] [blame] | 320 | if (debug_level_enabled(adapter->dbf->scsi, level)) |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 321 | zfcp_dbf_scsi(tag, scmd, req); |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 322 | } |
| 323 | |
| 324 | /** |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 325 | * zfcp_dbf_scsi_result - trace event for SCSI command completion |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 326 | * @scmd: SCSI command pointer |
Christof Schmitt | ab72528 | 2010-02-17 11:18:57 +0100 | [diff] [blame] | 327 | * @req: FSF request used to issue SCSI command |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 328 | */ |
| 329 | static inline |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 330 | void zfcp_dbf_scsi_result(struct scsi_cmnd *scmd, struct zfcp_fsf_req *req) |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 331 | { |
Christof Schmitt | ab72528 | 2010-02-17 11:18:57 +0100 | [diff] [blame] | 332 | if (scmd->result != 0) |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 333 | _zfcp_dbf_scsi("rsl_err", 3, scmd, req); |
Christof Schmitt | ab72528 | 2010-02-17 11:18:57 +0100 | [diff] [blame] | 334 | else if (scmd->retries > 0) |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 335 | _zfcp_dbf_scsi("rsl_ret", 4, scmd, req); |
Christof Schmitt | ab72528 | 2010-02-17 11:18:57 +0100 | [diff] [blame] | 336 | else |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 337 | _zfcp_dbf_scsi("rsl_nor", 6, scmd, req); |
Christof Schmitt | ab72528 | 2010-02-17 11:18:57 +0100 | [diff] [blame] | 338 | } |
| 339 | |
| 340 | /** |
| 341 | * zfcp_dbf_scsi_fail_send - trace event for failure to send SCSI command |
Christof Schmitt | ab72528 | 2010-02-17 11:18:57 +0100 | [diff] [blame] | 342 | * @scmd: SCSI command pointer |
| 343 | */ |
| 344 | static inline |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 345 | void zfcp_dbf_scsi_fail_send(struct scsi_cmnd *scmd) |
Christof Schmitt | ab72528 | 2010-02-17 11:18:57 +0100 | [diff] [blame] | 346 | { |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 347 | _zfcp_dbf_scsi("rsl_fai", 4, scmd, NULL); |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 348 | } |
| 349 | |
| 350 | /** |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 351 | * zfcp_dbf_scsi_abort - trace event for SCSI command abort |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 352 | * @tag: tag indicating success or failure of abort operation |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 353 | * @scmd: SCSI command to be aborted |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 354 | * @fsf_req: request containing abort (might be NULL) |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 355 | */ |
| 356 | static inline |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 357 | void zfcp_dbf_scsi_abort(char *tag, struct scsi_cmnd *scmd, |
| 358 | struct zfcp_fsf_req *fsf_req) |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 359 | { |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 360 | _zfcp_dbf_scsi(tag, 1, scmd, fsf_req); |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 361 | } |
| 362 | |
| 363 | /** |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 364 | * zfcp_dbf_scsi_devreset - trace event for Logical Unit or Target Reset |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 365 | * @tag: tag indicating success or failure of reset operation |
Christof Schmitt | b62a8d9 | 2010-09-08 14:39:55 +0200 | [diff] [blame] | 366 | * @scmnd: SCSI command which caused this error recovery |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 367 | * @flag: indicates type of reset (Target Reset, Logical Unit Reset) |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 368 | */ |
| 369 | static inline |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 370 | void zfcp_dbf_scsi_devreset(char *tag, struct scsi_cmnd *scmnd, u8 flag) |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 371 | { |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 372 | char tmp_tag[ZFCP_DBF_TAG_LEN]; |
Christof Schmitt | b62a8d9 | 2010-09-08 14:39:55 +0200 | [diff] [blame] | 373 | |
Swen Schillig | 250a135 | 2010-12-02 15:16:15 +0100 | [diff] [blame] | 374 | if (flag == FCP_TMF_TGT_RESET) |
| 375 | memcpy(tmp_tag, "tr_", 3); |
| 376 | else |
| 377 | memcpy(tmp_tag, "lr_", 3); |
| 378 | |
| 379 | memcpy(&tmp_tag[3], tag, 4); |
| 380 | _zfcp_dbf_scsi(tmp_tag, 1, scmnd, NULL); |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 381 | } |
| 382 | |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 383 | #endif /* ZFCP_DBF_H */ |