Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the zfcp device driver for |
| 3 | * FCP adapters for IBM System z9 and zSeries. |
| 4 | * |
Christof Schmitt | d46f384 | 2009-08-18 15:43:07 +0200 | [diff] [blame] | 5 | * Copyright IBM Corp. 2008, 2009 |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 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 | */ |
| 21 | |
| 22 | #ifndef ZFCP_DBF_H |
| 23 | #define ZFCP_DBF_H |
| 24 | |
Christof Schmitt | 4318e08 | 2009-11-24 16:54:08 +0100 | [diff] [blame] | 25 | #include <scsi/fc/fc_fcp.h> |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 26 | #include "zfcp_ext.h" |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 27 | #include "zfcp_fsf.h" |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 28 | #include "zfcp_def.h" |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 29 | |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame^] | 30 | #define ZFCP_DBF_TAG_LEN 7 |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 31 | #define ZFCP_DBF_TAG_SIZE 4 |
Swen Schillig | 5ffd51a | 2009-03-02 13:09:04 +0100 | [diff] [blame] | 32 | #define ZFCP_DBF_ID_SIZE 7 |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 33 | |
Christof Schmitt | d21e9da | 2010-02-17 11:18:54 +0100 | [diff] [blame] | 34 | #define ZFCP_DBF_INVALID_LUN 0xFFFFFFFFFFFFFFFFull |
| 35 | |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 36 | struct zfcp_dbf_dump { |
| 37 | u8 tag[ZFCP_DBF_TAG_SIZE]; |
| 38 | u32 total_size; /* size of total dump data */ |
| 39 | u32 offset; /* how much data has being already dumped */ |
| 40 | u32 size; /* how much data comes with this record */ |
| 41 | u8 data[]; /* dump data */ |
| 42 | } __attribute__ ((packed)); |
| 43 | |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame^] | 44 | /** |
| 45 | * struct zfcp_dbf_rec_trigger - trace record for triggered recovery action |
| 46 | * @ready: number of ready recovery actions |
| 47 | * @running: number of running recovery actions |
| 48 | * @want: wanted recovery action |
| 49 | * @need: needed recovery action |
| 50 | */ |
| 51 | struct zfcp_dbf_rec_trigger { |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 52 | u32 ready; |
| 53 | u32 running; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 54 | u8 want; |
| 55 | u8 need; |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame^] | 56 | } __packed; |
| 57 | |
| 58 | /** |
| 59 | * struct zfcp_dbf_rec_running - trace record for running recovery |
| 60 | * @fsf_req_id: request id for fsf requests |
| 61 | * @rec_status: status of the fsf request |
| 62 | * @rec_step: current step of the recovery action |
| 63 | * rec_count: recovery counter |
| 64 | */ |
| 65 | struct zfcp_dbf_rec_running { |
| 66 | u64 fsf_req_id; |
| 67 | u32 rec_status; |
| 68 | u16 rec_step; |
| 69 | u8 rec_action; |
| 70 | u8 rec_count; |
| 71 | } __packed; |
| 72 | |
| 73 | /** |
| 74 | * enum zfcp_dbf_rec_id - recovery trace record id |
| 75 | * @ZFCP_DBF_REC_TRIG: triggered recovery identifier |
| 76 | * @ZFCP_DBF_REC_RUN: running recovery identifier |
| 77 | */ |
| 78 | enum zfcp_dbf_rec_id { |
| 79 | ZFCP_DBF_REC_TRIG = 1, |
| 80 | ZFCP_DBF_REC_RUN = 2, |
Martin Peschke | 7337891 | 2008-05-19 12:17:46 +0200 | [diff] [blame] | 81 | }; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 82 | |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame^] | 83 | /** |
| 84 | * struct zfcp_dbf_rec - trace record for error recovery actions |
| 85 | * @id: unique number of recovery record type |
| 86 | * @tag: identifier string specifying the location of initiation |
| 87 | * @lun: logical unit number |
| 88 | * @wwpn: word wide port number |
| 89 | * @d_id: destination ID |
| 90 | * @adapter_status: current status of the adapter |
| 91 | * @port_status: current status of the port |
| 92 | * @lun_status: current status of the lun |
| 93 | * @u.trig: structure zfcp_dbf_rec_trigger |
| 94 | * @u.run: structure zfcp_dbf_rec_running |
| 95 | */ |
| 96 | struct zfcp_dbf_rec { |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 97 | u8 id; |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame^] | 98 | char tag[ZFCP_DBF_TAG_LEN]; |
| 99 | u64 lun; |
| 100 | u64 wwpn; |
| 101 | u32 d_id; |
| 102 | u32 adapter_status; |
| 103 | u32 port_status; |
| 104 | u32 lun_status; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 105 | union { |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame^] | 106 | struct zfcp_dbf_rec_trigger trig; |
| 107 | struct zfcp_dbf_rec_running run; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 108 | } u; |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame^] | 109 | } __packed; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 110 | |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 111 | struct zfcp_dbf_hba_record_response { |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 112 | u32 fsf_command; |
| 113 | u64 fsf_reqid; |
| 114 | u32 fsf_seqno; |
| 115 | u64 fsf_issued; |
| 116 | u32 fsf_prot_status; |
| 117 | u32 fsf_status; |
| 118 | u8 fsf_prot_status_qual[FSF_PROT_STATUS_QUAL_SIZE]; |
| 119 | u8 fsf_status_qual[FSF_STATUS_QUALIFIER_SIZE]; |
| 120 | u32 fsf_req_status; |
| 121 | u8 sbal_first; |
Martin Peschke | e891bff | 2008-05-19 12:17:43 +0200 | [diff] [blame] | 122 | u8 sbal_last; |
Martin Peschke | c3baa9a2 | 2008-05-19 12:17:44 +0200 | [diff] [blame] | 123 | u8 sbal_response; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 124 | u8 pool; |
| 125 | u64 erp_action; |
| 126 | union { |
| 127 | struct { |
Martin Peschke | 6bc473d | 2008-03-31 11:15:29 +0200 | [diff] [blame] | 128 | u64 cmnd; |
Felix Beck | ef3eb71 | 2010-07-16 15:37:42 +0200 | [diff] [blame] | 129 | u32 data_dir; |
Martin Peschke | 6bc473d | 2008-03-31 11:15:29 +0200 | [diff] [blame] | 130 | } fcp; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 131 | struct { |
| 132 | u64 wwpn; |
| 133 | u32 d_id; |
| 134 | u32 port_handle; |
| 135 | } port; |
| 136 | struct { |
| 137 | u64 wwpn; |
| 138 | u64 fcp_lun; |
| 139 | u32 port_handle; |
| 140 | u32 lun_handle; |
| 141 | } unit; |
| 142 | struct { |
| 143 | u32 d_id; |
Martin Peschke | 6bc473d | 2008-03-31 11:15:29 +0200 | [diff] [blame] | 144 | } els; |
| 145 | } u; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 146 | } __attribute__ ((packed)); |
| 147 | |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 148 | struct zfcp_dbf_hba_record_status { |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 149 | u8 failed; |
| 150 | u32 status_type; |
| 151 | u32 status_subtype; |
| 152 | struct fsf_queue_designator |
| 153 | queue_designator; |
| 154 | u32 payload_size; |
| 155 | #define ZFCP_DBF_UNSOL_PAYLOAD 80 |
| 156 | #define ZFCP_DBF_UNSOL_PAYLOAD_SENSE_DATA_AVAIL 32 |
| 157 | #define ZFCP_DBF_UNSOL_PAYLOAD_BIT_ERROR_THRESHOLD 56 |
| 158 | #define ZFCP_DBF_UNSOL_PAYLOAD_FEATURE_UPDATE_ALERT 2 * sizeof(u32) |
| 159 | u8 payload[ZFCP_DBF_UNSOL_PAYLOAD]; |
| 160 | } __attribute__ ((packed)); |
| 161 | |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 162 | struct zfcp_dbf_hba_record_qdio { |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 163 | u32 qdio_error; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 164 | u8 sbal_index; |
| 165 | u8 sbal_count; |
| 166 | } __attribute__ ((packed)); |
| 167 | |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 168 | struct zfcp_dbf_hba_record { |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 169 | u8 tag[ZFCP_DBF_TAG_SIZE]; |
| 170 | u8 tag2[ZFCP_DBF_TAG_SIZE]; |
| 171 | union { |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 172 | struct zfcp_dbf_hba_record_response response; |
| 173 | struct zfcp_dbf_hba_record_status status; |
| 174 | struct zfcp_dbf_hba_record_qdio qdio; |
Swen Schillig | 5706938 | 2008-10-01 12:42:21 +0200 | [diff] [blame] | 175 | struct fsf_bit_error_payload berr; |
Martin Peschke | 6bc473d | 2008-03-31 11:15:29 +0200 | [diff] [blame] | 176 | } u; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 177 | } __attribute__ ((packed)); |
| 178 | |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 179 | struct zfcp_dbf_san_record_ct_request { |
Martin Peschke | 6bc473d | 2008-03-31 11:15:29 +0200 | [diff] [blame] | 180 | u16 cmd_req_code; |
| 181 | u8 revision; |
| 182 | u8 gs_type; |
| 183 | u8 gs_subtype; |
| 184 | u8 options; |
| 185 | u16 max_res_size; |
| 186 | u32 len; |
Christof Schmitt | 7c7dc19 | 2009-11-24 16:54:13 +0100 | [diff] [blame] | 187 | u32 d_id; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 188 | } __attribute__ ((packed)); |
| 189 | |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 190 | struct zfcp_dbf_san_record_ct_response { |
Martin Peschke | 6bc473d | 2008-03-31 11:15:29 +0200 | [diff] [blame] | 191 | u16 cmd_rsp_code; |
| 192 | u8 revision; |
| 193 | u8 reason_code; |
| 194 | u8 expl; |
| 195 | u8 vendor_unique; |
Christof Schmitt | 39eb7e9 | 2008-12-19 16:57:01 +0100 | [diff] [blame] | 196 | u16 max_res_size; |
Martin Peschke | 6bc473d | 2008-03-31 11:15:29 +0200 | [diff] [blame] | 197 | u32 len; |
Martin Peschke | 6bc473d | 2008-03-31 11:15:29 +0200 | [diff] [blame] | 198 | } __attribute__ ((packed)); |
| 199 | |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 200 | struct zfcp_dbf_san_record_els { |
Christof Schmitt | 7c7dc19 | 2009-11-24 16:54:13 +0100 | [diff] [blame] | 201 | u32 d_id; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 202 | } __attribute__ ((packed)); |
| 203 | |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 204 | struct zfcp_dbf_san_record { |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 205 | u8 tag[ZFCP_DBF_TAG_SIZE]; |
| 206 | u64 fsf_reqid; |
| 207 | u32 fsf_seqno; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 208 | union { |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 209 | struct zfcp_dbf_san_record_ct_request ct_req; |
| 210 | struct zfcp_dbf_san_record_ct_response ct_resp; |
| 211 | struct zfcp_dbf_san_record_els els; |
Martin Peschke | 6bc473d | 2008-03-31 11:15:29 +0200 | [diff] [blame] | 212 | } u; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 213 | } __attribute__ ((packed)); |
| 214 | |
Christof Schmitt | 67feeeb | 2010-02-17 11:18:52 +0100 | [diff] [blame] | 215 | #define ZFCP_DBF_SAN_MAX_PAYLOAD 1024 |
| 216 | |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 217 | struct zfcp_dbf_scsi_record { |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 218 | u8 tag[ZFCP_DBF_TAG_SIZE]; |
| 219 | u8 tag2[ZFCP_DBF_TAG_SIZE]; |
| 220 | u32 scsi_id; |
| 221 | u32 scsi_lun; |
| 222 | u32 scsi_result; |
| 223 | u64 scsi_cmnd; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 224 | #define ZFCP_DBF_SCSI_OPCODE 16 |
| 225 | u8 scsi_opcode[ZFCP_DBF_SCSI_OPCODE]; |
| 226 | u8 scsi_retries; |
| 227 | u8 scsi_allowed; |
| 228 | u64 fsf_reqid; |
| 229 | u32 fsf_seqno; |
| 230 | u64 fsf_issued; |
Martin Peschke | 6bc473d | 2008-03-31 11:15:29 +0200 | [diff] [blame] | 231 | u64 old_fsf_reqid; |
| 232 | u8 rsp_validity; |
| 233 | u8 rsp_scsi_status; |
| 234 | u32 rsp_resid; |
| 235 | u8 rsp_code; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 236 | #define ZFCP_DBF_SCSI_FCP_SNS_INFO 16 |
| 237 | #define ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO 256 |
Martin Peschke | 6bc473d | 2008-03-31 11:15:29 +0200 | [diff] [blame] | 238 | u32 sns_info_len; |
| 239 | u8 sns_info[ZFCP_DBF_SCSI_FCP_SNS_INFO]; |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 240 | } __attribute__ ((packed)); |
| 241 | |
Christof Schmitt | d46f384 | 2009-08-18 15:43:07 +0200 | [diff] [blame] | 242 | struct zfcp_dbf { |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 243 | debug_info_t *rec; |
| 244 | debug_info_t *hba; |
| 245 | debug_info_t *san; |
| 246 | debug_info_t *scsi; |
| 247 | spinlock_t rec_lock; |
| 248 | spinlock_t hba_lock; |
| 249 | spinlock_t san_lock; |
| 250 | spinlock_t scsi_lock; |
Swen Schillig | ae0904f | 2010-12-02 15:16:12 +0100 | [diff] [blame^] | 251 | struct zfcp_dbf_rec rec_buf; |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 252 | struct zfcp_dbf_hba_record hba_buf; |
| 253 | struct zfcp_dbf_san_record san_buf; |
| 254 | struct zfcp_dbf_scsi_record scsi_buf; |
| 255 | struct zfcp_adapter *adapter; |
Christof Schmitt | d46f384 | 2009-08-18 15:43:07 +0200 | [diff] [blame] | 256 | }; |
| 257 | |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 258 | static inline |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 259 | void zfcp_dbf_hba_fsf_resp(const char *tag2, int level, |
| 260 | struct zfcp_fsf_req *req, struct zfcp_dbf *dbf) |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 261 | { |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 262 | if (level <= dbf->hba->level) |
| 263 | _zfcp_dbf_hba_fsf_response(tag2, level, req, dbf); |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 264 | } |
| 265 | |
| 266 | /** |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 267 | * zfcp_dbf_hba_fsf_response - trace event for request completion |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 268 | * @fsf_req: request that has been completed |
| 269 | */ |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 270 | static inline void zfcp_dbf_hba_fsf_response(struct zfcp_fsf_req *req) |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 271 | { |
| 272 | struct zfcp_dbf *dbf = req->adapter->dbf; |
| 273 | struct fsf_qtcb *qtcb = req->qtcb; |
| 274 | |
| 275 | if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) && |
| 276 | (qtcb->prefix.prot_status != FSF_PROT_FSF_STATUS_PRESENTED)) { |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 277 | zfcp_dbf_hba_fsf_resp("perr", 1, req, dbf); |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 278 | |
| 279 | } else if (qtcb->header.fsf_status != FSF_GOOD) { |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 280 | zfcp_dbf_hba_fsf_resp("ferr", 1, req, dbf); |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 281 | |
| 282 | } else if ((req->fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) || |
| 283 | (req->fsf_command == FSF_QTCB_OPEN_LUN)) { |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 284 | zfcp_dbf_hba_fsf_resp("open", 4, req, dbf); |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 285 | |
| 286 | } else if (qtcb->header.log_length) { |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 287 | zfcp_dbf_hba_fsf_resp("qtcb", 5, req, dbf); |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 288 | |
| 289 | } else { |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 290 | zfcp_dbf_hba_fsf_resp("norm", 6, req, dbf); |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 291 | } |
| 292 | } |
| 293 | |
| 294 | /** |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 295 | * zfcp_dbf_hba_fsf_unsol - trace event for an unsolicited status buffer |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 296 | * @tag: tag indicating which kind of unsolicited status has been received |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 297 | * @dbf: reference to dbf structure |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 298 | * @status_buffer: buffer containing payload of unsolicited status |
| 299 | */ |
| 300 | static inline |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 301 | void zfcp_dbf_hba_fsf_unsol(const char *tag, struct zfcp_dbf *dbf, |
| 302 | struct fsf_status_read_buffer *buf) |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 303 | { |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 304 | int level = 2; |
| 305 | |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 306 | if (level <= dbf->hba->level) |
| 307 | _zfcp_dbf_hba_fsf_unsol(tag, level, dbf, buf); |
Christof Schmitt | 2e261af | 2009-08-18 15:43:09 +0200 | [diff] [blame] | 308 | } |
| 309 | |
| 310 | static inline |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 311 | void zfcp_dbf_scsi(const char *tag, const char *tag2, int level, |
| 312 | struct zfcp_dbf *dbf, struct scsi_cmnd *scmd, |
| 313 | struct zfcp_fsf_req *req, unsigned long old_id) |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 314 | { |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 315 | if (level <= dbf->scsi->level) |
| 316 | _zfcp_dbf_scsi(tag, tag2, level, dbf, scmd, req, old_id); |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 317 | } |
| 318 | |
| 319 | /** |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 320 | * zfcp_dbf_scsi_result - trace event for SCSI command completion |
Christof Schmitt | ab72528 | 2010-02-17 11:18:57 +0100 | [diff] [blame] | 321 | * @dbf: adapter dbf trace |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 322 | * @scmd: SCSI command pointer |
Christof Schmitt | ab72528 | 2010-02-17 11:18:57 +0100 | [diff] [blame] | 323 | * @req: FSF request used to issue SCSI command |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 324 | */ |
| 325 | static inline |
Christof Schmitt | ab72528 | 2010-02-17 11:18:57 +0100 | [diff] [blame] | 326 | void zfcp_dbf_scsi_result(struct zfcp_dbf *dbf, struct scsi_cmnd *scmd, |
| 327 | struct zfcp_fsf_req *req) |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 328 | { |
Christof Schmitt | ab72528 | 2010-02-17 11:18:57 +0100 | [diff] [blame] | 329 | if (scmd->result != 0) |
| 330 | zfcp_dbf_scsi("rslt", "erro", 3, dbf, scmd, req, 0); |
| 331 | else if (scmd->retries > 0) |
| 332 | zfcp_dbf_scsi("rslt", "retr", 4, dbf, scmd, req, 0); |
| 333 | else |
| 334 | zfcp_dbf_scsi("rslt", "norm", 6, dbf, scmd, req, 0); |
| 335 | } |
| 336 | |
| 337 | /** |
| 338 | * zfcp_dbf_scsi_fail_send - trace event for failure to send SCSI command |
| 339 | * @dbf: adapter dbf trace |
| 340 | * @scmd: SCSI command pointer |
| 341 | */ |
| 342 | static inline |
| 343 | void zfcp_dbf_scsi_fail_send(struct zfcp_dbf *dbf, struct scsi_cmnd *scmd) |
| 344 | { |
| 345 | zfcp_dbf_scsi("rslt", "fail", 4, dbf, scmd, NULL, 0); |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 346 | } |
| 347 | |
| 348 | /** |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 349 | * zfcp_dbf_scsi_abort - trace event for SCSI command abort |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 350 | * @tag: tag indicating success or failure of abort operation |
| 351 | * @adapter: adapter thas has been used to issue SCSI command to be aborted |
| 352 | * @scmd: SCSI command to be aborted |
| 353 | * @new_req: request containing abort (might be NULL) |
| 354 | * @old_id: identifier of request containg SCSI command to be aborted |
| 355 | */ |
| 356 | static inline |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 357 | void zfcp_dbf_scsi_abort(const char *tag, struct zfcp_dbf *dbf, |
| 358 | struct scsi_cmnd *scmd, struct zfcp_fsf_req *new_req, |
| 359 | unsigned long old_id) |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 360 | { |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 361 | zfcp_dbf_scsi("abrt", tag, 1, dbf, scmd, new_req, old_id); |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 362 | } |
| 363 | |
| 364 | /** |
Swen Schillig | 5771710 | 2009-08-18 15:43:21 +0200 | [diff] [blame] | 365 | * zfcp_dbf_scsi_devreset - trace event for Logical Unit or Target Reset |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 366 | * @tag: tag indicating success or failure of reset operation |
Christof Schmitt | b62a8d9 | 2010-09-08 14:39:55 +0200 | [diff] [blame] | 367 | * @scmnd: SCSI command which caused this error recovery |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 368 | * @flag: indicates type of reset (Target Reset, Logical Unit Reset) |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 369 | */ |
| 370 | static inline |
Christof Schmitt | b62a8d9 | 2010-09-08 14:39:55 +0200 | [diff] [blame] | 371 | 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] | 372 | { |
Christof Schmitt | b62a8d9 | 2010-09-08 14:39:55 +0200 | [diff] [blame] | 373 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scmnd->device); |
| 374 | |
Christof Schmitt | 4318e08 | 2009-11-24 16:54:08 +0100 | [diff] [blame] | 375 | zfcp_dbf_scsi(flag == FCP_TMF_TGT_RESET ? "trst" : "lrst", tag, 1, |
Christof Schmitt | b62a8d9 | 2010-09-08 14:39:55 +0200 | [diff] [blame] | 376 | zfcp_sdev->port->adapter->dbf, scmnd, NULL, 0); |
Christof Schmitt | dcd20e2 | 2009-08-18 15:43:08 +0200 | [diff] [blame] | 377 | } |
| 378 | |
Christof Schmitt | 2b604c9 | 2008-03-31 11:15:28 +0200 | [diff] [blame] | 379 | #endif /* ZFCP_DBF_H */ |