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