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 | #define ZFCP_DBF_TAG_SIZE 4 |
Swen Schillig | 5ffd51a | 2009-03-02 13:09:04 +0100 | [diff] [blame] | 18 | #define ZFCP_DBF_ID_SIZE 7 |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 19 | |
Christof Schmitt | d21e9da | 2010-02-17 11:18:54 +0100 | [diff] [blame] | 20 | #define ZFCP_DBF_INVALID_LUN 0xFFFFFFFFFFFFFFFFull |
| 21 | |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 22 | struct zfcp_dbf_dump { |
| 23 | u8 tag[ZFCP_DBF_TAG_SIZE]; |
| 24 | u32 total_size; /* size of total dump data */ |
| 25 | u32 offset; /* how much data has being already dumped */ |
| 26 | u32 size; /* how much data comes with this record */ |
| 27 | u8 data[]; /* dump data */ |
| 28 | } __attribute__ ((packed)); |
| 29 | |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 30 | /** |
| 31 | * struct zfcp_dbf_rec_trigger - trace record for triggered recovery action |
| 32 | * @ready: number of ready recovery actions |
| 33 | * @running: number of running recovery actions |
| 34 | * @want: wanted recovery action |
| 35 | * @need: needed recovery action |
| 36 | */ |
| 37 | struct zfcp_dbf_rec_trigger { |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 38 | u32 ready; |
| 39 | u32 running; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 40 | u8 want; |
| 41 | u8 need; |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 42 | } __packed; |
| 43 | |
| 44 | /** |
| 45 | * struct zfcp_dbf_rec_running - trace record for running recovery |
| 46 | * @fsf_req_id: request id for fsf requests |
| 47 | * @rec_status: status of the fsf request |
| 48 | * @rec_step: current step of the recovery action |
| 49 | * rec_count: recovery counter |
| 50 | */ |
| 51 | struct zfcp_dbf_rec_running { |
| 52 | u64 fsf_req_id; |
| 53 | u32 rec_status; |
| 54 | u16 rec_step; |
| 55 | u8 rec_action; |
| 56 | u8 rec_count; |
| 57 | } __packed; |
| 58 | |
| 59 | /** |
| 60 | * enum zfcp_dbf_rec_id - recovery trace record id |
| 61 | * @ZFCP_DBF_REC_TRIG: triggered recovery identifier |
| 62 | * @ZFCP_DBF_REC_RUN: running recovery identifier |
| 63 | */ |
| 64 | enum zfcp_dbf_rec_id { |
| 65 | ZFCP_DBF_REC_TRIG = 1, |
| 66 | ZFCP_DBF_REC_RUN = 2, |
Martin Peschke | 7337891 | 2008-05-19 12:17:46 +0200 | [diff] [blame] | 67 | }; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 68 | |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 69 | /** |
| 70 | * struct zfcp_dbf_rec - trace record for error recovery actions |
| 71 | * @id: unique number of recovery record type |
| 72 | * @tag: identifier string specifying the location of initiation |
| 73 | * @lun: logical unit number |
| 74 | * @wwpn: word wide port number |
| 75 | * @d_id: destination ID |
| 76 | * @adapter_status: current status of the adapter |
| 77 | * @port_status: current status of the port |
| 78 | * @lun_status: current status of the lun |
| 79 | * @u.trig: structure zfcp_dbf_rec_trigger |
| 80 | * @u.run: structure zfcp_dbf_rec_running |
| 81 | */ |
| 82 | struct zfcp_dbf_rec { |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 83 | u8 id; |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 84 | char tag[ZFCP_DBF_TAG_LEN]; |
| 85 | u64 lun; |
| 86 | u64 wwpn; |
| 87 | u32 d_id; |
| 88 | u32 adapter_status; |
| 89 | u32 port_status; |
| 90 | u32 lun_status; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 91 | union { |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 92 | struct zfcp_dbf_rec_trigger trig; |
| 93 | struct zfcp_dbf_rec_running run; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 94 | } u; |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 95 | } __packed; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 96 | |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 97 | /** |
| 98 | * enum zfcp_dbf_san_id - SAN trace record identifier |
| 99 | * @ZFCP_DBF_SAN_REQ: request trace record id |
| 100 | * @ZFCP_DBF_SAN_RES: response trace record id |
| 101 | * @ZFCP_DBF_SAN_ELS: extended link service record id |
| 102 | */ |
| 103 | enum zfcp_dbf_san_id { |
| 104 | ZFCP_DBF_SAN_REQ = 1, |
| 105 | ZFCP_DBF_SAN_RES = 2, |
| 106 | ZFCP_DBF_SAN_ELS = 3, |
| 107 | }; |
| 108 | |
| 109 | /** struct zfcp_dbf_san - trace record for SAN requests and responses |
| 110 | * @id: unique number of recovery record type |
| 111 | * @tag: identifier string specifying the location of initiation |
| 112 | * @fsf_req_id: request id for fsf requests |
| 113 | * @payload: unformatted information related to request/response |
| 114 | * @d_id: destination id |
| 115 | */ |
| 116 | struct zfcp_dbf_san { |
| 117 | u8 id; |
| 118 | char tag[ZFCP_DBF_TAG_LEN]; |
| 119 | u64 fsf_req_id; |
| 120 | u32 d_id; |
| 121 | #define ZFCP_DBF_SAN_MAX_PAYLOAD (FC_CT_HDR_LEN + 32) |
| 122 | char payload[ZFCP_DBF_SAN_MAX_PAYLOAD]; |
| 123 | } __packed; |
| 124 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 125 | /** |
| 126 | * struct zfcp_dbf_hba_res - trace record for hba responses |
| 127 | * @req_issued: timestamp when request was issued |
| 128 | * @prot_status: protocol status |
| 129 | * @prot_status_qual: protocol status qualifier |
| 130 | * @fsf_status: fsf status |
| 131 | * @fsf_status_qual: fsf status qualifier |
| 132 | */ |
| 133 | struct zfcp_dbf_hba_res { |
| 134 | u64 req_issued; |
| 135 | u32 prot_status; |
| 136 | u8 prot_status_qual[FSF_PROT_STATUS_QUAL_SIZE]; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 137 | u32 fsf_status; |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 138 | u8 fsf_status_qual[FSF_STATUS_QUALIFIER_SIZE]; |
| 139 | } __packed; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 140 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 141 | /** |
| 142 | * struct zfcp_dbf_hba_uss - trace record for unsolicited status |
| 143 | * @status_type: type of unsolicited status |
| 144 | * @status_subtype: subtype of unsolicited status |
| 145 | * @d_id: destination ID |
| 146 | * @lun: logical unit number |
| 147 | * @queue_designator: queue designator |
| 148 | */ |
| 149 | struct zfcp_dbf_hba_uss { |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 150 | u32 status_type; |
| 151 | u32 status_subtype; |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 152 | u32 d_id; |
| 153 | u64 lun; |
| 154 | u64 queue_designator; |
| 155 | } __packed; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 156 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 157 | /** |
| 158 | * enum zfcp_dbf_hba_id - HBA trace record identifier |
| 159 | * @ZFCP_DBF_HBA_RES: response trace record |
| 160 | * @ZFCP_DBF_HBA_USS: unsolicited status trace record |
| 161 | * @ZFCP_DBF_HBA_BIT: bit error trace record |
| 162 | */ |
| 163 | enum zfcp_dbf_hba_id { |
| 164 | ZFCP_DBF_HBA_RES = 1, |
| 165 | ZFCP_DBF_HBA_USS = 2, |
| 166 | ZFCP_DBF_HBA_BIT = 3, |
| 167 | }; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 168 | |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 169 | /** |
| 170 | * struct zfcp_dbf_hba - common trace record for HBA records |
| 171 | * @id: unique number of recovery record type |
| 172 | * @tag: identifier string specifying the location of initiation |
| 173 | * @fsf_req_id: request id for fsf requests |
| 174 | * @fsf_req_status: status of fsf request |
| 175 | * @fsf_cmd: fsf command |
| 176 | * @fsf_seq_no: fsf sequence number |
| 177 | * @pl_len: length of payload stored as zfcp_dbf_pay |
| 178 | * @u: record type specific data |
| 179 | */ |
| 180 | struct zfcp_dbf_hba { |
| 181 | u8 id; |
| 182 | char tag[ZFCP_DBF_TAG_LEN]; |
| 183 | u64 fsf_req_id; |
| 184 | u32 fsf_req_status; |
| 185 | u32 fsf_cmd; |
| 186 | u32 fsf_seq_no; |
| 187 | u16 pl_len; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 188 | union { |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 189 | struct zfcp_dbf_hba_res res; |
| 190 | struct zfcp_dbf_hba_uss uss; |
| 191 | struct fsf_bit_error_payload be; |
Martin Peschke | 6bc473d | 2008-03-31 11:15:29 +0200 | [diff] [blame] | 192 | } u; |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 193 | } __packed; |
| 194 | |
| 195 | /** |
| 196 | * struct zfcp_dbf_pay - trace record for unformatted payload information |
| 197 | * @area: area this record is originated from |
| 198 | * @counter: ascending record number |
| 199 | * @fsf_req_id: request id of fsf request |
| 200 | * @data: unformatted data |
| 201 | */ |
| 202 | struct zfcp_dbf_pay { |
| 203 | char area[ZFCP_DBF_TAG_LEN]; |
| 204 | char counter; |
| 205 | u64 fsf_req_id; |
| 206 | #define ZFCP_DBF_PAY_MAX_REC 0x100 |
| 207 | char data[ZFCP_DBF_PAY_MAX_REC]; |
| 208 | } __packed; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 209 | |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 210 | struct zfcp_dbf_scsi_record { |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 211 | u8 tag[ZFCP_DBF_TAG_SIZE]; |
| 212 | u8 tag2[ZFCP_DBF_TAG_SIZE]; |
| 213 | u32 scsi_id; |
| 214 | u32 scsi_lun; |
| 215 | u32 scsi_result; |
| 216 | u64 scsi_cmnd; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 217 | #define ZFCP_DBF_SCSI_OPCODE 16 |
| 218 | u8 scsi_opcode[ZFCP_DBF_SCSI_OPCODE]; |
| 219 | u8 scsi_retries; |
| 220 | u8 scsi_allowed; |
| 221 | u64 fsf_reqid; |
| 222 | u32 fsf_seqno; |
| 223 | u64 fsf_issued; |
Martin Peschke | 6bc473d | 2008-03-31 11:15:29 +0200 | [diff] [blame] | 224 | u64 old_fsf_reqid; |
| 225 | u8 rsp_validity; |
| 226 | u8 rsp_scsi_status; |
| 227 | u32 rsp_resid; |
| 228 | u8 rsp_code; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 229 | #define ZFCP_DBF_SCSI_FCP_SNS_INFO 16 |
| 230 | #define ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO 256 |
Martin Peschke | 6bc473d | 2008-03-31 11:15:29 +0200 | [diff] [blame] | 231 | u32 sns_info_len; |
| 232 | u8 sns_info[ZFCP_DBF_SCSI_FCP_SNS_INFO]; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 233 | } __attribute__ ((packed)); |
| 234 | |
Christof Schmitt | d46f384 | 2009-08-18 15:43:07 +0200 | [diff] [blame] | 235 | struct zfcp_dbf { |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 236 | debug_info_t *pay; |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 237 | debug_info_t *rec; |
| 238 | debug_info_t *hba; |
| 239 | debug_info_t *san; |
| 240 | debug_info_t *scsi; |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 241 | spinlock_t pay_lock; |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 242 | spinlock_t rec_lock; |
| 243 | spinlock_t hba_lock; |
| 244 | spinlock_t san_lock; |
| 245 | spinlock_t scsi_lock; |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame] | 246 | struct zfcp_dbf_rec rec_buf; |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 247 | struct zfcp_dbf_hba hba_buf; |
Swen Schillig | 2c55b75 | 2010-12-02 15:16:13 +0100 | [diff] [blame] | 248 | struct zfcp_dbf_san san_buf; |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 249 | struct zfcp_dbf_scsi_record scsi_buf; |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 250 | struct zfcp_dbf_pay pay_buf; |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 251 | struct zfcp_adapter *adapter; |
Christof Schmitt | d46f384 | 2009-08-18 15:43:07 +0200 | [diff] [blame] | 252 | }; |
| 253 | |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 254 | static inline |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 255 | 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] | 256 | { |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 257 | if (level <= req->adapter->dbf->hba->level) |
| 258 | zfcp_dbf_hba_fsf_res(tag, req); |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 259 | } |
| 260 | |
| 261 | /** |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 262 | * zfcp_dbf_hba_fsf_response - trace event for request completion |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 263 | * @fsf_req: request that has been completed |
| 264 | */ |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 265 | static inline |
| 266 | void zfcp_dbf_hba_fsf_response(struct zfcp_fsf_req *req) |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 267 | { |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 268 | struct fsf_qtcb *qtcb = req->qtcb; |
| 269 | |
| 270 | if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) && |
| 271 | (qtcb->prefix.prot_status != FSF_PROT_FSF_STATUS_PRESENTED)) { |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 272 | zfcp_dbf_hba_fsf_resp("fs_perr", 1, req); |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 273 | |
| 274 | } else if (qtcb->header.fsf_status != FSF_GOOD) { |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 275 | zfcp_dbf_hba_fsf_resp("fs_ferr", 1, req); |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 276 | |
| 277 | } else if ((req->fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) || |
| 278 | (req->fsf_command == FSF_QTCB_OPEN_LUN)) { |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 279 | zfcp_dbf_hba_fsf_resp("fs_open", 4, req); |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 280 | |
| 281 | } else if (qtcb->header.log_length) { |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 282 | zfcp_dbf_hba_fsf_resp("fs_qtcb", 5, req); |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 283 | |
| 284 | } else { |
Swen Schillig | a54ca0f | 2010-12-02 15:16:14 +0100 | [diff] [blame^] | 285 | zfcp_dbf_hba_fsf_resp("fs_norm", 6, req); |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 286 | } |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 287 | } |
| 288 | |
| 289 | static inline |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 290 | void zfcp_dbf_scsi(const char *tag, const char *tag2, int level, |
| 291 | struct zfcp_dbf *dbf, struct scsi_cmnd *scmd, |
| 292 | struct zfcp_fsf_req *req, unsigned long old_id) |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 293 | { |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 294 | if (level <= dbf->scsi->level) |
| 295 | _zfcp_dbf_scsi(tag, tag2, level, dbf, scmd, req, old_id); |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 296 | } |
| 297 | |
| 298 | /** |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 299 | * zfcp_dbf_scsi_result - trace event for SCSI command completion |
Christof Schmitt | ab72528 | 2010-02-17 11:18:57 +0100 | [diff] [blame] | 300 | * @dbf: adapter dbf trace |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 301 | * @scmd: SCSI command pointer |
Christof Schmitt | ab72528 | 2010-02-17 11:18:57 +0100 | [diff] [blame] | 302 | * @req: FSF request used to issue SCSI command |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 303 | */ |
| 304 | static inline |
Christof Schmitt | ab72528 | 2010-02-17 11:18:57 +0100 | [diff] [blame] | 305 | void zfcp_dbf_scsi_result(struct zfcp_dbf *dbf, struct scsi_cmnd *scmd, |
| 306 | struct zfcp_fsf_req *req) |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 307 | { |
Christof Schmitt | ab72528 | 2010-02-17 11:18:57 +0100 | [diff] [blame] | 308 | if (scmd->result != 0) |
| 309 | zfcp_dbf_scsi("rslt", "erro", 3, dbf, scmd, req, 0); |
| 310 | else if (scmd->retries > 0) |
| 311 | zfcp_dbf_scsi("rslt", "retr", 4, dbf, scmd, req, 0); |
| 312 | else |
| 313 | zfcp_dbf_scsi("rslt", "norm", 6, dbf, scmd, req, 0); |
| 314 | } |
| 315 | |
| 316 | /** |
| 317 | * zfcp_dbf_scsi_fail_send - trace event for failure to send SCSI command |
| 318 | * @dbf: adapter dbf trace |
| 319 | * @scmd: SCSI command pointer |
| 320 | */ |
| 321 | static inline |
| 322 | void zfcp_dbf_scsi_fail_send(struct zfcp_dbf *dbf, struct scsi_cmnd *scmd) |
| 323 | { |
| 324 | zfcp_dbf_scsi("rslt", "fail", 4, dbf, scmd, NULL, 0); |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 325 | } |
| 326 | |
| 327 | /** |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 328 | * zfcp_dbf_scsi_abort - trace event for SCSI command abort |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 329 | * @tag: tag indicating success or failure of abort operation |
| 330 | * @adapter: adapter thas has been used to issue SCSI command to be aborted |
| 331 | * @scmd: SCSI command to be aborted |
| 332 | * @new_req: request containing abort (might be NULL) |
| 333 | * @old_id: identifier of request containg SCSI command to be aborted |
| 334 | */ |
| 335 | static inline |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 336 | void zfcp_dbf_scsi_abort(const char *tag, struct zfcp_dbf *dbf, |
| 337 | struct scsi_cmnd *scmd, struct zfcp_fsf_req *new_req, |
| 338 | unsigned long old_id) |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 339 | { |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 340 | zfcp_dbf_scsi("abrt", tag, 1, dbf, scmd, new_req, old_id); |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 341 | } |
| 342 | |
| 343 | /** |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 344 | * zfcp_dbf_scsi_devreset - trace event for Logical Unit or Target Reset |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 345 | * @tag: tag indicating success or failure of reset operation |
Christof Schmitt | b62a8d9 | 2010-09-08 14:39:55 +0200 | [diff] [blame] | 346 | * @scmnd: SCSI command which caused this error recovery |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 347 | * @flag: indicates type of reset (Target Reset, Logical Unit Reset) |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 348 | */ |
| 349 | static inline |
Christof Schmitt | b62a8d9 | 2010-09-08 14:39:55 +0200 | [diff] [blame] | 350 | void zfcp_dbf_scsi_devreset(const char *tag, struct scsi_cmnd *scmnd, u8 flag) |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 351 | { |
Christof Schmitt | b62a8d9 | 2010-09-08 14:39:55 +0200 | [diff] [blame] | 352 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scmnd->device); |
| 353 | |
Christof Schmitt | 4318e08 | 2009-11-24 16:54:08 +0100 | [diff] [blame] | 354 | zfcp_dbf_scsi(flag == FCP_TMF_TGT_RESET ? "trst" : "lrst", tag, 1, |
Christof Schmitt | b62a8d9 | 2010-09-08 14:39:55 +0200 | [diff] [blame] | 355 | zfcp_sdev->port->adapter->dbf, scmnd, NULL, 0); |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 356 | } |
| 357 | |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 358 | #endif /* ZFCP_DBF_H */ |