diff options
Diffstat (limited to 'drivers/s390/scsi/zfcp_dbf.c')
-rw-r--r-- | drivers/s390/scsi/zfcp_dbf.c | 1281 |
1 files changed, 801 insertions, 480 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c index 701046c9bb33..37b85c67b11d 100644 --- a/drivers/s390/scsi/zfcp_dbf.c +++ b/drivers/s390/scsi/zfcp_dbf.c | |||
@@ -31,123 +31,128 @@ MODULE_PARM_DESC(dbfsize, | |||
31 | 31 | ||
32 | #define ZFCP_LOG_AREA ZFCP_LOG_AREA_OTHER | 32 | #define ZFCP_LOG_AREA ZFCP_LOG_AREA_OTHER |
33 | 33 | ||
34 | static int | 34 | static void zfcp_dbf_hexdump(debug_info_t *dbf, void *to, int to_len, |
35 | zfcp_dbf_stck(char *out_buf, const char *label, unsigned long long stck) | 35 | int level, char *from, int from_len) |
36 | { | ||
37 | int offset; | ||
38 | struct zfcp_dbf_dump *dump = to; | ||
39 | int room = to_len - sizeof(*dump); | ||
40 | |||
41 | for (offset = 0; offset < from_len; offset += dump->size) { | ||
42 | memset(to, 0, to_len); | ||
43 | strncpy(dump->tag, "dump", ZFCP_DBF_TAG_SIZE); | ||
44 | dump->total_size = from_len; | ||
45 | dump->offset = offset; | ||
46 | dump->size = min(from_len - offset, room); | ||
47 | memcpy(dump->data, from + offset, dump->size); | ||
48 | debug_event(dbf, level, dump, dump->size); | ||
49 | } | ||
50 | } | ||
51 | |||
52 | /* FIXME: this duplicate this code in s390 debug feature */ | ||
53 | static void zfcp_dbf_timestamp(unsigned long long stck, struct timespec *time) | ||
36 | { | 54 | { |
37 | unsigned long long sec; | 55 | unsigned long long sec; |
38 | struct timespec dbftime; | ||
39 | int len = 0; | ||
40 | 56 | ||
41 | stck -= 0x8126d60e46000000LL - (0x3c26700LL * 1000000 * 4096); | 57 | stck -= 0x8126d60e46000000LL - (0x3c26700LL * 1000000 * 4096); |
42 | sec = stck >> 12; | 58 | sec = stck >> 12; |
43 | do_div(sec, 1000000); | 59 | do_div(sec, 1000000); |
44 | dbftime.tv_sec = sec; | 60 | time->tv_sec = sec; |
45 | stck -= (sec * 1000000) << 12; | 61 | stck -= (sec * 1000000) << 12; |
46 | dbftime.tv_nsec = ((stck * 1000) >> 12); | 62 | time->tv_nsec = ((stck * 1000) >> 12); |
47 | len += sprintf(out_buf + len, "%-24s%011lu:%06lu\n", | ||
48 | label, dbftime.tv_sec, dbftime.tv_nsec); | ||
49 | |||
50 | return len; | ||
51 | } | 63 | } |
52 | 64 | ||
53 | static int zfcp_dbf_tag(char *out_buf, const char *label, const char *tag) | 65 | static void zfcp_dbf_tag(char **p, const char *label, const char *tag) |
54 | { | 66 | { |
55 | int len = 0, i; | 67 | int i; |
56 | 68 | ||
57 | len += sprintf(out_buf + len, "%-24s", label); | 69 | *p += sprintf(*p, "%-24s", label); |
58 | for (i = 0; i < ZFCP_DBF_TAG_SIZE; i++) | 70 | for (i = 0; i < ZFCP_DBF_TAG_SIZE; i++) |
59 | len += sprintf(out_buf + len, "%c", tag[i]); | 71 | *p += sprintf(*p, "%c", tag[i]); |
60 | len += sprintf(out_buf + len, "\n"); | 72 | *p += sprintf(*p, "\n"); |
73 | } | ||
61 | 74 | ||
62 | return len; | 75 | static void zfcp_dbf_outs(char **buf, const char *s1, const char *s2) |
76 | { | ||
77 | *buf += sprintf(*buf, "%-24s%s\n", s1, s2); | ||
63 | } | 78 | } |
64 | 79 | ||
65 | static int | 80 | static void zfcp_dbf_out(char **buf, const char *s, const char *format, ...) |
66 | zfcp_dbf_view(char *out_buf, const char *label, const char *format, ...) | ||
67 | { | 81 | { |
68 | va_list arg; | 82 | va_list arg; |
69 | int len = 0; | ||
70 | 83 | ||
71 | len += sprintf(out_buf + len, "%-24s", label); | 84 | *buf += sprintf(*buf, "%-24s", s); |
72 | va_start(arg, format); | 85 | va_start(arg, format); |
73 | len += vsprintf(out_buf + len, format, arg); | 86 | *buf += vsprintf(*buf, format, arg); |
74 | va_end(arg); | 87 | va_end(arg); |
75 | len += sprintf(out_buf + len, "\n"); | 88 | *buf += sprintf(*buf, "\n"); |
76 | |||
77 | return len; | ||
78 | } | 89 | } |
79 | 90 | ||
80 | static int | 91 | static void zfcp_dbf_outd(char **p, const char *label, char *buffer, |
81 | zfcp_dbf_view_dump(char *out_buf, const char *label, | 92 | int buflen, int offset, int total_size) |
82 | char *buffer, int buflen, int offset, int total_size) | ||
83 | { | 93 | { |
84 | int len = 0; | 94 | if (!offset) |
85 | 95 | *p += sprintf(*p, "%-24s ", label); | |
86 | if (offset == 0) | ||
87 | len += sprintf(out_buf + len, "%-24s ", label); | ||
88 | |||
89 | while (buflen--) { | 96 | while (buflen--) { |
90 | if (offset > 0) { | 97 | if (offset > 0) { |
91 | if ((offset % 32) == 0) | 98 | if ((offset % 32) == 0) |
92 | len += sprintf(out_buf + len, "\n%-24c ", ' '); | 99 | *p += sprintf(*p, "\n%-24c ", ' '); |
93 | else if ((offset % 4) == 0) | 100 | else if ((offset % 4) == 0) |
94 | len += sprintf(out_buf + len, " "); | 101 | *p += sprintf(*p, " "); |
95 | } | 102 | } |
96 | len += sprintf(out_buf + len, "%02x", *buffer++); | 103 | *p += sprintf(*p, "%02x", *buffer++); |
97 | if (++offset == total_size) { | 104 | if (++offset == total_size) { |
98 | len += sprintf(out_buf + len, "\n"); | 105 | *p += sprintf(*p, "\n"); |
99 | break; | 106 | break; |
100 | } | 107 | } |
101 | } | 108 | } |
102 | 109 | if (!total_size) | |
103 | if (total_size == 0) | 110 | *p += sprintf(*p, "\n"); |
104 | len += sprintf(out_buf + len, "\n"); | ||
105 | |||
106 | return len; | ||
107 | } | 111 | } |
108 | 112 | ||
109 | static int | 113 | static int zfcp_dbf_view_header(debug_info_t *id, struct debug_view *view, |
110 | zfcp_dbf_view_header(debug_info_t * id, struct debug_view *view, int area, | 114 | int area, debug_entry_t *entry, char *out_buf) |
111 | debug_entry_t * entry, char *out_buf) | ||
112 | { | 115 | { |
113 | struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)DEBUG_DATA(entry); | 116 | struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)DEBUG_DATA(entry); |
114 | int len = 0; | 117 | struct timespec t; |
118 | char *p = out_buf; | ||
115 | 119 | ||
116 | if (strncmp(dump->tag, "dump", ZFCP_DBF_TAG_SIZE) != 0) { | 120 | if (strncmp(dump->tag, "dump", ZFCP_DBF_TAG_SIZE) != 0) { |
117 | len += zfcp_dbf_stck(out_buf + len, "timestamp", | 121 | zfcp_dbf_timestamp(entry->id.stck, &t); |
118 | entry->id.stck); | 122 | zfcp_dbf_out(&p, "timestamp", "%011lu:%06lu", |
119 | len += zfcp_dbf_view(out_buf + len, "cpu", "%02i", | 123 | t.tv_sec, t.tv_nsec); |
120 | entry->id.fields.cpuid); | 124 | zfcp_dbf_out(&p, "cpu", "%02i", entry->id.fields.cpuid); |
121 | } else { | 125 | } else { |
122 | len += zfcp_dbf_view_dump(out_buf + len, NULL, | 126 | zfcp_dbf_outd(&p, NULL, dump->data, dump->size, dump->offset, |
123 | dump->data, | 127 | dump->total_size); |
124 | dump->size, | ||
125 | dump->offset, dump->total_size); | ||
126 | if ((dump->offset + dump->size) == dump->total_size) | 128 | if ((dump->offset + dump->size) == dump->total_size) |
127 | len += sprintf(out_buf + len, "\n"); | 129 | p += sprintf(p, "\n"); |
128 | } | 130 | } |
129 | 131 | return p - out_buf; | |
130 | return len; | ||
131 | } | 132 | } |
132 | 133 | ||
134 | /** | ||
135 | * zfcp_hba_dbf_event_fsf_response - trace event for request completion | ||
136 | * @fsf_req: request that has been completed | ||
137 | */ | ||
133 | void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req) | 138 | void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req) |
134 | { | 139 | { |
135 | struct zfcp_adapter *adapter = fsf_req->adapter; | 140 | struct zfcp_adapter *adapter = fsf_req->adapter; |
136 | struct fsf_qtcb *qtcb = fsf_req->qtcb; | 141 | struct fsf_qtcb *qtcb = fsf_req->qtcb; |
137 | union fsf_prot_status_qual *prot_status_qual = | 142 | union fsf_prot_status_qual *prot_status_qual = |
138 | &qtcb->prefix.prot_status_qual; | 143 | &qtcb->prefix.prot_status_qual; |
139 | union fsf_status_qual *fsf_status_qual = &qtcb->header.fsf_status_qual; | 144 | union fsf_status_qual *fsf_status_qual = &qtcb->header.fsf_status_qual; |
140 | struct scsi_cmnd *scsi_cmnd; | 145 | struct scsi_cmnd *scsi_cmnd; |
141 | struct zfcp_port *port; | 146 | struct zfcp_port *port; |
142 | struct zfcp_unit *unit; | 147 | struct zfcp_unit *unit; |
143 | struct zfcp_send_els *send_els; | 148 | struct zfcp_send_els *send_els; |
144 | struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf; | 149 | struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf; |
145 | struct zfcp_hba_dbf_record_response *response = &rec->type.response; | 150 | struct zfcp_hba_dbf_record_response *response = &rec->u.response; |
146 | int level; | 151 | int level; |
147 | unsigned long flags; | 152 | unsigned long flags; |
148 | 153 | ||
149 | spin_lock_irqsave(&adapter->hba_dbf_lock, flags); | 154 | spin_lock_irqsave(&adapter->hba_dbf_lock, flags); |
150 | memset(rec, 0, sizeof(struct zfcp_hba_dbf_record)); | 155 | memset(rec, 0, sizeof(*rec)); |
151 | strncpy(rec->tag, "resp", ZFCP_DBF_TAG_SIZE); | 156 | strncpy(rec->tag, "resp", ZFCP_DBF_TAG_SIZE); |
152 | 157 | ||
153 | if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) && | 158 | if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) && |
@@ -161,6 +166,9 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req) | |||
161 | (fsf_req->fsf_command == FSF_QTCB_OPEN_LUN)) { | 166 | (fsf_req->fsf_command == FSF_QTCB_OPEN_LUN)) { |
162 | strncpy(rec->tag2, "open", ZFCP_DBF_TAG_SIZE); | 167 | strncpy(rec->tag2, "open", ZFCP_DBF_TAG_SIZE); |
163 | level = 4; | 168 | level = 4; |
169 | } else if (qtcb->header.log_length) { | ||
170 | strncpy(rec->tag2, "qtcb", ZFCP_DBF_TAG_SIZE); | ||
171 | level = 5; | ||
164 | } else { | 172 | } else { |
165 | strncpy(rec->tag2, "norm", ZFCP_DBF_TAG_SIZE); | 173 | strncpy(rec->tag2, "norm", ZFCP_DBF_TAG_SIZE); |
166 | level = 6; | 174 | level = 6; |
@@ -188,11 +196,9 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req) | |||
188 | if (fsf_req->status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT) | 196 | if (fsf_req->status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT) |
189 | break; | 197 | break; |
190 | scsi_cmnd = (struct scsi_cmnd *)fsf_req->data; | 198 | scsi_cmnd = (struct scsi_cmnd *)fsf_req->data; |
191 | if (scsi_cmnd != NULL) { | 199 | if (scsi_cmnd) { |
192 | response->data.send_fcp.scsi_cmnd | 200 | response->u.fcp.cmnd = (unsigned long)scsi_cmnd; |
193 | = (unsigned long)scsi_cmnd; | 201 | response->u.fcp.serial = scsi_cmnd->serial_number; |
194 | response->data.send_fcp.scsi_serial | ||
195 | = scsi_cmnd->serial_number; | ||
196 | } | 202 | } |
197 | break; | 203 | break; |
198 | 204 | ||
@@ -200,25 +206,25 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req) | |||
200 | case FSF_QTCB_CLOSE_PORT: | 206 | case FSF_QTCB_CLOSE_PORT: |
201 | case FSF_QTCB_CLOSE_PHYSICAL_PORT: | 207 | case FSF_QTCB_CLOSE_PHYSICAL_PORT: |
202 | port = (struct zfcp_port *)fsf_req->data; | 208 | port = (struct zfcp_port *)fsf_req->data; |
203 | response->data.port.wwpn = port->wwpn; | 209 | response->u.port.wwpn = port->wwpn; |
204 | response->data.port.d_id = port->d_id; | 210 | response->u.port.d_id = port->d_id; |
205 | response->data.port.port_handle = qtcb->header.port_handle; | 211 | response->u.port.port_handle = qtcb->header.port_handle; |
206 | break; | 212 | break; |
207 | 213 | ||
208 | case FSF_QTCB_OPEN_LUN: | 214 | case FSF_QTCB_OPEN_LUN: |
209 | case FSF_QTCB_CLOSE_LUN: | 215 | case FSF_QTCB_CLOSE_LUN: |
210 | unit = (struct zfcp_unit *)fsf_req->data; | 216 | unit = (struct zfcp_unit *)fsf_req->data; |
211 | port = unit->port; | 217 | port = unit->port; |
212 | response->data.unit.wwpn = port->wwpn; | 218 | response->u.unit.wwpn = port->wwpn; |
213 | response->data.unit.fcp_lun = unit->fcp_lun; | 219 | response->u.unit.fcp_lun = unit->fcp_lun; |
214 | response->data.unit.port_handle = qtcb->header.port_handle; | 220 | response->u.unit.port_handle = qtcb->header.port_handle; |
215 | response->data.unit.lun_handle = qtcb->header.lun_handle; | 221 | response->u.unit.lun_handle = qtcb->header.lun_handle; |
216 | break; | 222 | break; |
217 | 223 | ||
218 | case FSF_QTCB_SEND_ELS: | 224 | case FSF_QTCB_SEND_ELS: |
219 | send_els = (struct zfcp_send_els *)fsf_req->data; | 225 | send_els = (struct zfcp_send_els *)fsf_req->data; |
220 | response->data.send_els.d_id = qtcb->bottom.support.d_id; | 226 | response->u.els.d_id = qtcb->bottom.support.d_id; |
221 | response->data.send_els.ls_code = send_els->ls_code >> 24; | 227 | response->u.els.ls_code = send_els->ls_code >> 24; |
222 | break; | 228 | break; |
223 | 229 | ||
224 | case FSF_QTCB_ABORT_FCP_CMND: | 230 | case FSF_QTCB_ABORT_FCP_CMND: |
@@ -230,39 +236,54 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req) | |||
230 | break; | 236 | break; |
231 | } | 237 | } |
232 | 238 | ||
233 | debug_event(adapter->hba_dbf, level, | 239 | debug_event(adapter->hba_dbf, level, rec, sizeof(*rec)); |
234 | rec, sizeof(struct zfcp_hba_dbf_record)); | 240 | |
241 | /* have fcp channel microcode fixed to use as little as possible */ | ||
242 | if (fsf_req->fsf_command != FSF_QTCB_FCP_CMND) { | ||
243 | /* adjust length skipping trailing zeros */ | ||
244 | char *buf = (char *)qtcb + qtcb->header.log_start; | ||
245 | int len = qtcb->header.log_length; | ||
246 | for (; len && !buf[len - 1]; len--); | ||
247 | zfcp_dbf_hexdump(adapter->hba_dbf, rec, sizeof(*rec), level, | ||
248 | buf, len); | ||
249 | } | ||
250 | |||
235 | spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); | 251 | spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); |
236 | } | 252 | } |
237 | 253 | ||
238 | void | 254 | /** |
239 | zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter, | 255 | * zfcp_hba_dbf_event_fsf_unsol - trace event for an unsolicited status buffer |
240 | struct fsf_status_read_buffer *status_buffer) | 256 | * @tag: tag indicating which kind of unsolicited status has been received |
257 | * @adapter: adapter that has issued the unsolicited status buffer | ||
258 | * @status_buffer: buffer containing payload of unsolicited status | ||
259 | */ | ||
260 | void zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter, | ||
261 | struct fsf_status_read_buffer *status_buffer) | ||
241 | { | 262 | { |
242 | struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf; | 263 | struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf; |
243 | unsigned long flags; | 264 | unsigned long flags; |
244 | 265 | ||
245 | spin_lock_irqsave(&adapter->hba_dbf_lock, flags); | 266 | spin_lock_irqsave(&adapter->hba_dbf_lock, flags); |
246 | memset(rec, 0, sizeof(struct zfcp_hba_dbf_record)); | 267 | memset(rec, 0, sizeof(*rec)); |
247 | strncpy(rec->tag, "stat", ZFCP_DBF_TAG_SIZE); | 268 | strncpy(rec->tag, "stat", ZFCP_DBF_TAG_SIZE); |
248 | strncpy(rec->tag2, tag, ZFCP_DBF_TAG_SIZE); | 269 | strncpy(rec->tag2, tag, ZFCP_DBF_TAG_SIZE); |
249 | 270 | ||
250 | rec->type.status.failed = adapter->status_read_failed; | 271 | rec->u.status.failed = adapter->status_read_failed; |
251 | if (status_buffer != NULL) { | 272 | if (status_buffer != NULL) { |
252 | rec->type.status.status_type = status_buffer->status_type; | 273 | rec->u.status.status_type = status_buffer->status_type; |
253 | rec->type.status.status_subtype = status_buffer->status_subtype; | 274 | rec->u.status.status_subtype = status_buffer->status_subtype; |
254 | memcpy(&rec->type.status.queue_designator, | 275 | memcpy(&rec->u.status.queue_designator, |
255 | &status_buffer->queue_designator, | 276 | &status_buffer->queue_designator, |
256 | sizeof(struct fsf_queue_designator)); | 277 | sizeof(struct fsf_queue_designator)); |
257 | 278 | ||
258 | switch (status_buffer->status_type) { | 279 | switch (status_buffer->status_type) { |
259 | case FSF_STATUS_READ_SENSE_DATA_AVAIL: | 280 | case FSF_STATUS_READ_SENSE_DATA_AVAIL: |
260 | rec->type.status.payload_size = | 281 | rec->u.status.payload_size = |
261 | ZFCP_DBF_UNSOL_PAYLOAD_SENSE_DATA_AVAIL; | 282 | ZFCP_DBF_UNSOL_PAYLOAD_SENSE_DATA_AVAIL; |
262 | break; | 283 | break; |
263 | 284 | ||
264 | case FSF_STATUS_READ_BIT_ERROR_THRESHOLD: | 285 | case FSF_STATUS_READ_BIT_ERROR_THRESHOLD: |
265 | rec->type.status.payload_size = | 286 | rec->u.status.payload_size = |
266 | ZFCP_DBF_UNSOL_PAYLOAD_BIT_ERROR_THRESHOLD; | 287 | ZFCP_DBF_UNSOL_PAYLOAD_BIT_ERROR_THRESHOLD; |
267 | break; | 288 | break; |
268 | 289 | ||
@@ -270,119 +291,101 @@ zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter, | |||
270 | switch (status_buffer->status_subtype) { | 291 | switch (status_buffer->status_subtype) { |
271 | case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK: | 292 | case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK: |
272 | case FSF_STATUS_READ_SUB_FDISC_FAILED: | 293 | case FSF_STATUS_READ_SUB_FDISC_FAILED: |
273 | rec->type.status.payload_size = | 294 | rec->u.status.payload_size = |
274 | sizeof(struct fsf_link_down_info); | 295 | sizeof(struct fsf_link_down_info); |
275 | } | 296 | } |
276 | break; | 297 | break; |
277 | 298 | ||
278 | case FSF_STATUS_READ_FEATURE_UPDATE_ALERT: | 299 | case FSF_STATUS_READ_FEATURE_UPDATE_ALERT: |
279 | rec->type.status.payload_size = | 300 | rec->u.status.payload_size = |
280 | ZFCP_DBF_UNSOL_PAYLOAD_FEATURE_UPDATE_ALERT; | 301 | ZFCP_DBF_UNSOL_PAYLOAD_FEATURE_UPDATE_ALERT; |
281 | break; | 302 | break; |
282 | } | 303 | } |
283 | memcpy(&rec->type.status.payload, | 304 | memcpy(&rec->u.status.payload, |
284 | &status_buffer->payload, rec->type.status.payload_size); | 305 | &status_buffer->payload, rec->u.status.payload_size); |
285 | } | 306 | } |
286 | 307 | ||
287 | debug_event(adapter->hba_dbf, 2, | 308 | debug_event(adapter->hba_dbf, 2, rec, sizeof(*rec)); |
288 | rec, sizeof(struct zfcp_hba_dbf_record)); | ||
289 | spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); | 309 | spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); |
290 | } | 310 | } |
291 | 311 | ||
292 | void | 312 | /** |
293 | zfcp_hba_dbf_event_qdio(struct zfcp_adapter *adapter, unsigned int status, | 313 | * zfcp_hba_dbf_event_qdio - trace event for QDIO related failure |
294 | unsigned int qdio_error, unsigned int siga_error, | 314 | * @adapter: adapter affected by this QDIO related event |
295 | int sbal_index, int sbal_count) | 315 | * @status: as passed by qdio module |
316 | * @qdio_error: as passed by qdio module | ||
317 | * @siga_error: as passed by qdio module | ||
318 | * @sbal_index: first buffer with error condition, as passed by qdio module | ||
319 | * @sbal_count: number of buffers affected, as passed by qdio module | ||
320 | */ | ||
321 | void zfcp_hba_dbf_event_qdio(struct zfcp_adapter *adapter, unsigned int status, | ||
322 | unsigned int qdio_error, unsigned int siga_error, | ||
323 | int sbal_index, int sbal_count) | ||
296 | { | 324 | { |
297 | struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf; | 325 | struct zfcp_hba_dbf_record *r = &adapter->hba_dbf_buf; |
298 | unsigned long flags; | 326 | unsigned long flags; |
299 | 327 | ||
300 | spin_lock_irqsave(&adapter->hba_dbf_lock, flags); | 328 | spin_lock_irqsave(&adapter->hba_dbf_lock, flags); |
301 | memset(rec, 0, sizeof(struct zfcp_hba_dbf_record)); | 329 | memset(r, 0, sizeof(*r)); |
302 | strncpy(rec->tag, "qdio", ZFCP_DBF_TAG_SIZE); | 330 | strncpy(r->tag, "qdio", ZFCP_DBF_TAG_SIZE); |
303 | rec->type.qdio.status = status; | 331 | r->u.qdio.status = status; |
304 | rec->type.qdio.qdio_error = qdio_error; | 332 | r->u.qdio.qdio_error = qdio_error; |
305 | rec->type.qdio.siga_error = siga_error; | 333 | r->u.qdio.siga_error = siga_error; |
306 | rec->type.qdio.sbal_index = sbal_index; | 334 | r->u.qdio.sbal_index = sbal_index; |
307 | rec->type.qdio.sbal_count = sbal_count; | 335 | r->u.qdio.sbal_count = sbal_count; |
308 | debug_event(adapter->hba_dbf, 0, | 336 | debug_event(adapter->hba_dbf, 0, r, sizeof(*r)); |
309 | rec, sizeof(struct zfcp_hba_dbf_record)); | ||
310 | spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); | 337 | spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); |
311 | } | 338 | } |
312 | 339 | ||
313 | static int | 340 | static void zfcp_hba_dbf_view_response(char **p, |
314 | zfcp_hba_dbf_view_response(char *out_buf, | 341 | struct zfcp_hba_dbf_record_response *r) |
315 | struct zfcp_hba_dbf_record_response *rec) | 342 | { |
316 | { | 343 | struct timespec t; |
317 | int len = 0; | 344 | |
318 | 345 | zfcp_dbf_out(p, "fsf_command", "0x%08x", r->fsf_command); | |
319 | len += zfcp_dbf_view(out_buf + len, "fsf_command", "0x%08x", | 346 | zfcp_dbf_out(p, "fsf_reqid", "0x%0Lx", r->fsf_reqid); |
320 | rec->fsf_command); | 347 | zfcp_dbf_out(p, "fsf_seqno", "0x%08x", r->fsf_seqno); |
321 | len += zfcp_dbf_view(out_buf + len, "fsf_reqid", "0x%0Lx", | 348 | zfcp_dbf_timestamp(r->fsf_issued, &t); |
322 | rec->fsf_reqid); | 349 | zfcp_dbf_out(p, "fsf_issued", "%011lu:%06lu", t.tv_sec, t.tv_nsec); |
323 | len += zfcp_dbf_view(out_buf + len, "fsf_seqno", "0x%08x", | 350 | zfcp_dbf_out(p, "fsf_prot_status", "0x%08x", r->fsf_prot_status); |
324 | rec->fsf_seqno); | 351 | zfcp_dbf_out(p, "fsf_status", "0x%08x", r->fsf_status); |
325 | len += zfcp_dbf_stck(out_buf + len, "fsf_issued", rec->fsf_issued); | 352 | zfcp_dbf_outd(p, "fsf_prot_status_qual", r->fsf_prot_status_qual, |
326 | len += zfcp_dbf_view(out_buf + len, "fsf_prot_status", "0x%08x", | 353 | FSF_PROT_STATUS_QUAL_SIZE, 0, FSF_PROT_STATUS_QUAL_SIZE); |
327 | rec->fsf_prot_status); | 354 | zfcp_dbf_outd(p, "fsf_status_qual", r->fsf_status_qual, |
328 | len += zfcp_dbf_view(out_buf + len, "fsf_status", "0x%08x", | 355 | FSF_STATUS_QUALIFIER_SIZE, 0, FSF_STATUS_QUALIFIER_SIZE); |
329 | rec->fsf_status); | 356 | zfcp_dbf_out(p, "fsf_req_status", "0x%08x", r->fsf_req_status); |
330 | len += zfcp_dbf_view_dump(out_buf + len, "fsf_prot_status_qual", | 357 | zfcp_dbf_out(p, "sbal_first", "0x%02x", r->sbal_first); |
331 | rec->fsf_prot_status_qual, | 358 | zfcp_dbf_out(p, "sbal_curr", "0x%02x", r->sbal_curr); |
332 | FSF_PROT_STATUS_QUAL_SIZE, | 359 | zfcp_dbf_out(p, "sbal_last", "0x%02x", r->sbal_last); |
333 | 0, FSF_PROT_STATUS_QUAL_SIZE); | 360 | zfcp_dbf_out(p, "pool", "0x%02x", r->pool); |
334 | len += zfcp_dbf_view_dump(out_buf + len, "fsf_status_qual", | 361 | |
335 | rec->fsf_status_qual, | 362 | switch (r->fsf_command) { |
336 | FSF_STATUS_QUALIFIER_SIZE, | ||
337 | 0, FSF_STATUS_QUALIFIER_SIZE); | ||
338 | len += zfcp_dbf_view(out_buf + len, "fsf_req_status", "0x%08x", | ||
339 | rec->fsf_req_status); | ||
340 | len += zfcp_dbf_view(out_buf + len, "sbal_first", "0x%02x", | ||
341 | rec->sbal_first); | ||
342 | len += zfcp_dbf_view(out_buf + len, "sbal_curr", "0x%02x", | ||
343 | rec->sbal_curr); | ||
344 | len += zfcp_dbf_view(out_buf + len, "sbal_last", "0x%02x", | ||
345 | rec->sbal_last); | ||
346 | len += zfcp_dbf_view(out_buf + len, "pool", "0x%02x", rec->pool); | ||
347 | |||
348 | switch (rec->fsf_command) { | ||
349 | case FSF_QTCB_FCP_CMND: | 363 | case FSF_QTCB_FCP_CMND: |
350 | if (rec->fsf_req_status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT) | 364 | if (r->fsf_req_status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT) |
351 | break; | 365 | break; |
352 | len += zfcp_dbf_view(out_buf + len, "scsi_cmnd", "0x%0Lx", | 366 | zfcp_dbf_out(p, "scsi_cmnd", "0x%0Lx", r->u.fcp.cmnd); |
353 | rec->data.send_fcp.scsi_cmnd); | 367 | zfcp_dbf_out(p, "scsi_serial", "0x%016Lx", r->u.fcp.serial); |
354 | len += zfcp_dbf_view(out_buf + len, "scsi_serial", "0x%016Lx", | ||
355 | rec->data.send_fcp.scsi_serial); | ||
356 | break; | 368 | break; |
357 | 369 | ||
358 | case FSF_QTCB_OPEN_PORT_WITH_DID: | 370 | case FSF_QTCB_OPEN_PORT_WITH_DID: |
359 | case FSF_QTCB_CLOSE_PORT: | 371 | case FSF_QTCB_CLOSE_PORT: |
360 | case FSF_QTCB_CLOSE_PHYSICAL_PORT: | 372 | case FSF_QTCB_CLOSE_PHYSICAL_PORT: |
361 | len += zfcp_dbf_view(out_buf + len, "wwpn", "0x%016Lx", | 373 | zfcp_dbf_out(p, "wwpn", "0x%016Lx", r->u.port.wwpn); |
362 | rec->data.port.wwpn); | 374 | zfcp_dbf_out(p, "d_id", "0x%06x", r->u.port.d_id); |
363 | len += zfcp_dbf_view(out_buf + len, "d_id", "0x%06x", | 375 | zfcp_dbf_out(p, "port_handle", "0x%08x", r->u.port.port_handle); |
364 | rec->data.port.d_id); | ||
365 | len += zfcp_dbf_view(out_buf + len, "port_handle", "0x%08x", | ||
366 | rec->data.port.port_handle); | ||
367 | break; | 376 | break; |
368 | 377 | ||
369 | case FSF_QTCB_OPEN_LUN: | 378 | case FSF_QTCB_OPEN_LUN: |
370 | case FSF_QTCB_CLOSE_LUN: | 379 | case FSF_QTCB_CLOSE_LUN: |
371 | len += zfcp_dbf_view(out_buf + len, "wwpn", "0x%016Lx", | 380 | zfcp_dbf_out(p, "wwpn", "0x%016Lx", r->u.unit.wwpn); |
372 | rec->data.unit.wwpn); | 381 | zfcp_dbf_out(p, "fcp_lun", "0x%016Lx", r->u.unit.fcp_lun); |
373 | len += zfcp_dbf_view(out_buf + len, "fcp_lun", "0x%016Lx", | 382 | zfcp_dbf_out(p, "port_handle", "0x%08x", r->u.unit.port_handle); |
374 | rec->data.unit.fcp_lun); | 383 | zfcp_dbf_out(p, "lun_handle", "0x%08x", r->u.unit.lun_handle); |
375 | len += zfcp_dbf_view(out_buf + len, "port_handle", "0x%08x", | ||
376 | rec->data.unit.port_handle); | ||
377 | len += zfcp_dbf_view(out_buf + len, "lun_handle", "0x%08x", | ||
378 | rec->data.unit.lun_handle); | ||
379 | break; | 384 | break; |
380 | 385 | ||
381 | case FSF_QTCB_SEND_ELS: | 386 | case FSF_QTCB_SEND_ELS: |
382 | len += zfcp_dbf_view(out_buf + len, "d_id", "0x%06x", | 387 | zfcp_dbf_out(p, "d_id", "0x%06x", r->u.els.d_id); |
383 | rec->data.send_els.d_id); | 388 | zfcp_dbf_out(p, "ls_code", "0x%02x", r->u.els.ls_code); |
384 | len += zfcp_dbf_view(out_buf + len, "ls_code", "0x%02x", | ||
385 | rec->data.send_els.ls_code); | ||
386 | break; | 389 | break; |
387 | 390 | ||
388 | case FSF_QTCB_ABORT_FCP_CMND: | 391 | case FSF_QTCB_ABORT_FCP_CMND: |
@@ -393,74 +396,52 @@ zfcp_hba_dbf_view_response(char *out_buf, | |||
393 | case FSF_QTCB_UPLOAD_CONTROL_FILE: | 396 | case FSF_QTCB_UPLOAD_CONTROL_FILE: |
394 | break; | 397 | break; |
395 | } | 398 | } |
396 | |||
397 | return len; | ||
398 | } | 399 | } |
399 | 400 | ||
400 | static int | 401 | static void zfcp_hba_dbf_view_status(char **p, |
401 | zfcp_hba_dbf_view_status(char *out_buf, struct zfcp_hba_dbf_record_status *rec) | 402 | struct zfcp_hba_dbf_record_status *r) |
402 | { | 403 | { |
403 | int len = 0; | 404 | zfcp_dbf_out(p, "failed", "0x%02x", r->failed); |
404 | 405 | zfcp_dbf_out(p, "status_type", "0x%08x", r->status_type); | |
405 | len += zfcp_dbf_view(out_buf + len, "failed", "0x%02x", rec->failed); | 406 | zfcp_dbf_out(p, "status_subtype", "0x%08x", r->status_subtype); |
406 | len += zfcp_dbf_view(out_buf + len, "status_type", "0x%08x", | 407 | zfcp_dbf_outd(p, "queue_designator", (char *)&r->queue_designator, |
407 | rec->status_type); | 408 | sizeof(struct fsf_queue_designator), 0, |
408 | len += zfcp_dbf_view(out_buf + len, "status_subtype", "0x%08x", | 409 | sizeof(struct fsf_queue_designator)); |
409 | rec->status_subtype); | 410 | zfcp_dbf_outd(p, "payload", (char *)&r->payload, r->payload_size, 0, |
410 | len += zfcp_dbf_view_dump(out_buf + len, "queue_designator", | 411 | r->payload_size); |
411 | (char *)&rec->queue_designator, | ||
412 | sizeof(struct fsf_queue_designator), | ||
413 | 0, sizeof(struct fsf_queue_designator)); | ||
414 | len += zfcp_dbf_view_dump(out_buf + len, "payload", | ||
415 | (char *)&rec->payload, | ||
416 | rec->payload_size, 0, rec->payload_size); | ||
417 | |||
418 | return len; | ||
419 | } | 412 | } |
420 | 413 | ||
421 | static int | 414 | static void zfcp_hba_dbf_view_qdio(char **p, struct zfcp_hba_dbf_record_qdio *r) |
422 | zfcp_hba_dbf_view_qdio(char *out_buf, struct zfcp_hba_dbf_record_qdio *rec) | ||
423 | { | 415 | { |
424 | int len = 0; | 416 | zfcp_dbf_out(p, "status", "0x%08x", r->status); |
425 | 417 | zfcp_dbf_out(p, "qdio_error", "0x%08x", r->qdio_error); | |
426 | len += zfcp_dbf_view(out_buf + len, "status", "0x%08x", rec->status); | 418 | zfcp_dbf_out(p, "siga_error", "0x%08x", r->siga_error); |
427 | len += zfcp_dbf_view(out_buf + len, "qdio_error", "0x%08x", | 419 | zfcp_dbf_out(p, "sbal_index", "0x%02x", r->sbal_index); |
428 | rec->qdio_error); | 420 | zfcp_dbf_out(p, "sbal_count", "0x%02x", r->sbal_count); |
429 | len += zfcp_dbf_view(out_buf + len, "siga_error", "0x%08x", | ||
430 | rec->siga_error); | ||
431 | len += zfcp_dbf_view(out_buf + len, "sbal_index", "0x%02x", | ||
432 | rec->sbal_index); | ||
433 | len += zfcp_dbf_view(out_buf + len, "sbal_count", "0x%02x", | ||
434 | rec->sbal_count); | ||
435 | |||
436 | return len; | ||
437 | } | 421 | } |
438 | 422 | ||
439 | static int | 423 | static int zfcp_hba_dbf_view_format(debug_info_t *id, struct debug_view *view, |
440 | zfcp_hba_dbf_view_format(debug_info_t * id, struct debug_view *view, | 424 | char *out_buf, const char *in_buf) |
441 | char *out_buf, const char *in_buf) | ||
442 | { | 425 | { |
443 | struct zfcp_hba_dbf_record *rec = (struct zfcp_hba_dbf_record *)in_buf; | 426 | struct zfcp_hba_dbf_record *r = (struct zfcp_hba_dbf_record *)in_buf; |
444 | int len = 0; | 427 | char *p = out_buf; |
445 | 428 | ||
446 | if (strncmp(rec->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) | 429 | if (strncmp(r->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) |
447 | return 0; | 430 | return 0; |
448 | 431 | ||
449 | len += zfcp_dbf_tag(out_buf + len, "tag", rec->tag); | 432 | zfcp_dbf_tag(&p, "tag", r->tag); |
450 | if (isalpha(rec->tag2[0])) | 433 | if (isalpha(r->tag2[0])) |
451 | len += zfcp_dbf_tag(out_buf + len, "tag2", rec->tag2); | 434 | zfcp_dbf_tag(&p, "tag2", r->tag2); |
452 | if (strncmp(rec->tag, "resp", ZFCP_DBF_TAG_SIZE) == 0) | ||
453 | len += zfcp_hba_dbf_view_response(out_buf + len, | ||
454 | &rec->type.response); | ||
455 | else if (strncmp(rec->tag, "stat", ZFCP_DBF_TAG_SIZE) == 0) | ||
456 | len += zfcp_hba_dbf_view_status(out_buf + len, | ||
457 | &rec->type.status); | ||
458 | else if (strncmp(rec->tag, "qdio", ZFCP_DBF_TAG_SIZE) == 0) | ||
459 | len += zfcp_hba_dbf_view_qdio(out_buf + len, &rec->type.qdio); | ||
460 | 435 | ||
461 | len += sprintf(out_buf + len, "\n"); | 436 | if (strncmp(r->tag, "resp", ZFCP_DBF_TAG_SIZE) == 0) |
437 | zfcp_hba_dbf_view_response(&p, &r->u.response); | ||
438 | else if (strncmp(r->tag, "stat", ZFCP_DBF_TAG_SIZE) == 0) | ||
439 | zfcp_hba_dbf_view_status(&p, &r->u.status); | ||
440 | else if (strncmp(r->tag, "qdio", ZFCP_DBF_TAG_SIZE) == 0) | ||
441 | zfcp_hba_dbf_view_qdio(&p, &r->u.qdio); | ||
462 | 442 | ||
463 | return len; | 443 | p += sprintf(p, "\n"); |
444 | return p - out_buf; | ||
464 | } | 445 | } |
465 | 446 | ||
466 | static struct debug_view zfcp_hba_dbf_view = { | 447 | static struct debug_view zfcp_hba_dbf_view = { |
@@ -472,219 +453,570 @@ static struct debug_view zfcp_hba_dbf_view = { | |||
472 | NULL | 453 | NULL |
473 | }; | 454 | }; |
474 | 455 | ||
475 | static void | 456 | static const char *zfcp_rec_dbf_tags[] = { |
476 | _zfcp_san_dbf_event_common_ct(const char *tag, struct zfcp_fsf_req *fsf_req, | 457 | [ZFCP_REC_DBF_ID_THREAD] = "thread", |
477 | u32 s_id, u32 d_id, void *buffer, int buflen) | 458 | [ZFCP_REC_DBF_ID_TARGET] = "target", |
459 | [ZFCP_REC_DBF_ID_TRIGGER] = "trigger", | ||
460 | [ZFCP_REC_DBF_ID_ACTION] = "action", | ||
461 | }; | ||
462 | |||
463 | static const char *zfcp_rec_dbf_ids[] = { | ||
464 | [1] = "new", | ||
465 | [2] = "ready", | ||
466 | [3] = "kill", | ||
467 | [4] = "down sleep", | ||
468 | [5] = "down wakeup", | ||
469 | [6] = "down sleep ecd", | ||
470 | [7] = "down wakeup ecd", | ||
471 | [8] = "down sleep epd", | ||
472 | [9] = "down wakeup epd", | ||
473 | [10] = "online", | ||
474 | [11] = "operational", | ||
475 | [12] = "scsi slave destroy", | ||
476 | [13] = "propagate failed adapter", | ||
477 | [14] = "propagate failed port", | ||
478 | [15] = "block adapter", | ||
479 | [16] = "unblock adapter", | ||
480 | [17] = "block port", | ||
481 | [18] = "unblock port", | ||
482 | [19] = "block unit", | ||
483 | [20] = "unblock unit", | ||
484 | [21] = "unit recovery failed", | ||
485 | [22] = "port recovery failed", | ||
486 | [23] = "adapter recovery failed", | ||
487 | [24] = "qdio queues down", | ||
488 | [25] = "p2p failed", | ||
489 | [26] = "nameserver lookup failed", | ||
490 | [27] = "nameserver port failed", | ||
491 | [28] = "link up", | ||
492 | [29] = "link down", | ||
493 | [30] = "link up status read", | ||
494 | [31] = "open port failed", | ||
495 | [32] = "open port failed", | ||
496 | [33] = "close port", | ||
497 | [34] = "open unit failed", | ||
498 | [35] = "exclusive open unit failed", | ||
499 | [36] = "shared open unit failed", | ||
500 | [37] = "link down", | ||
501 | [38] = "link down status read no link", | ||
502 | [39] = "link down status read fdisc login", | ||
503 | [40] = "link down status read firmware update", | ||
504 | [41] = "link down status read unknown reason", | ||
505 | [42] = "link down ecd incomplete", | ||
506 | [43] = "link down epd incomplete", | ||
507 | [44] = "sysfs adapter recovery", | ||
508 | [45] = "sysfs port recovery", | ||
509 | [46] = "sysfs unit recovery", | ||
510 | [47] = "port boxed abort", | ||
511 | [48] = "unit boxed abort", | ||
512 | [49] = "port boxed ct", | ||
513 | [50] = "port boxed close physical", | ||
514 | [51] = "port boxed open unit", | ||
515 | [52] = "port boxed close unit", | ||
516 | [53] = "port boxed fcp", | ||
517 | [54] = "unit boxed fcp", | ||
518 | [55] = "port access denied ct", | ||
519 | [56] = "port access denied els", | ||
520 | [57] = "port access denied open port", | ||
521 | [58] = "port access denied close physical", | ||
522 | [59] = "unit access denied open unit", | ||
523 | [60] = "shared unit access denied open unit", | ||
524 | [61] = "unit access denied fcp", | ||
525 | [62] = "request timeout", | ||
526 | [63] = "adisc link test reject or timeout", | ||
527 | [64] = "adisc link test d_id changed", | ||
528 | [65] = "adisc link test failed", | ||
529 | [66] = "recovery out of memory", | ||
530 | [67] = "adapter recovery repeated after state change", | ||
531 | [68] = "port recovery repeated after state change", | ||
532 | [69] = "unit recovery repeated after state change", | ||
533 | [70] = "port recovery follow-up after successful adapter recovery", | ||
534 | [71] = "adapter recovery escalation after failed adapter recovery", | ||
535 | [72] = "port recovery follow-up after successful physical port " | ||
536 | "recovery", | ||
537 | [73] = "adapter recovery escalation after failed physical port " | ||
538 | "recovery", | ||
539 | [74] = "unit recovery follow-up after successful port recovery", | ||
540 | [75] = "physical port recovery escalation after failed port " | ||
541 | "recovery", | ||
542 | [76] = "port recovery escalation after failed unit recovery", | ||
543 | [77] = "recovery opening nameserver port", | ||
544 | [78] = "duplicate request id", | ||
545 | [79] = "link down", | ||
546 | [80] = "exclusive read-only unit access unsupported", | ||
547 | [81] = "shared read-write unit access unsupported", | ||
548 | [82] = "incoming rscn", | ||
549 | [83] = "incoming plogi", | ||
550 | [84] = "incoming logo", | ||
551 | [85] = "online", | ||
552 | [86] = "offline", | ||
553 | [87] = "ccw device gone", | ||
554 | [88] = "ccw device no path", | ||
555 | [89] = "ccw device operational", | ||
556 | [90] = "ccw device shutdown", | ||
557 | [91] = "sysfs port addition", | ||
558 | [92] = "sysfs port removal", | ||
559 | [93] = "sysfs adapter recovery", | ||
560 | [94] = "sysfs unit addition", | ||
561 | [95] = "sysfs unit removal", | ||
562 | [96] = "sysfs port recovery", | ||
563 | [97] = "sysfs unit recovery", | ||
564 | [98] = "sequence number mismatch", | ||
565 | [99] = "link up", | ||
566 | [100] = "error state", | ||
567 | [101] = "status read physical port closed", | ||
568 | [102] = "link up status read", | ||
569 | [103] = "too many failed status read buffers", | ||
570 | [104] = "port handle not valid abort", | ||
571 | [105] = "lun handle not valid abort", | ||
572 | [106] = "port handle not valid ct", | ||
573 | [107] = "port handle not valid close port", | ||
574 | [108] = "port handle not valid close physical port", | ||
575 | [109] = "port handle not valid open unit", | ||
576 | [110] = "port handle not valid close unit", | ||
577 | [111] = "lun handle not valid close unit", | ||
578 | [112] = "port handle not valid fcp", | ||
579 | [113] = "lun handle not valid fcp", | ||
580 | [114] = "handle mismatch fcp", | ||
581 | [115] = "lun not valid fcp", | ||
582 | [116] = "qdio send failed", | ||
583 | [117] = "version mismatch", | ||
584 | [118] = "incompatible qtcb type", | ||
585 | [119] = "unknown protocol status", | ||
586 | [120] = "unknown fsf command", | ||
587 | [121] = "no recommendation for status qualifier", | ||
588 | [122] = "status read physical port closed in error", | ||
589 | [123] = "fc service class not supported ct", | ||
590 | [124] = "fc service class not supported els", | ||
591 | [125] = "need newer zfcp", | ||
592 | [126] = "need newer microcode", | ||
593 | [127] = "arbitrated loop not supported", | ||
594 | [128] = "unknown topology", | ||
595 | [129] = "qtcb size mismatch", | ||
596 | [130] = "unknown fsf status ecd", | ||
597 | [131] = "fcp request too big", | ||
598 | [132] = "fc service class not supported fcp", | ||
599 | [133] = "data direction not valid fcp", | ||
600 | [134] = "command length not valid fcp", | ||
601 | [135] = "status read act update", | ||
602 | [136] = "status read cfdc update", | ||
603 | [137] = "hbaapi port open", | ||
604 | [138] = "hbaapi unit open", | ||
605 | [139] = "hbaapi unit shutdown", | ||
606 | [140] = "qdio error", | ||
607 | [141] = "scsi host reset", | ||
608 | [142] = "dismissing fsf request for recovery action", | ||
609 | [143] = "recovery action timed out", | ||
610 | [144] = "recovery action gone", | ||
611 | [145] = "recovery action being processed", | ||
612 | [146] = "recovery action ready for next step", | ||
613 | }; | ||
614 | |||
615 | static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view, | ||
616 | char *buf, const char *_rec) | ||
617 | { | ||
618 | struct zfcp_rec_dbf_record *r = (struct zfcp_rec_dbf_record *)_rec; | ||
619 | char *p = buf; | ||
620 | |||
621 | zfcp_dbf_outs(&p, "tag", zfcp_rec_dbf_tags[r->id]); | ||
622 | zfcp_dbf_outs(&p, "hint", zfcp_rec_dbf_ids[r->id2]); | ||
623 | zfcp_dbf_out(&p, "id", "%d", r->id2); | ||
624 | switch (r->id) { | ||
625 | case ZFCP_REC_DBF_ID_THREAD: | ||
626 | zfcp_dbf_out(&p, "total", "%d", r->u.thread.total); | ||
627 | zfcp_dbf_out(&p, "ready", "%d", r->u.thread.ready); | ||
628 | zfcp_dbf_out(&p, "running", "%d", r->u.thread.running); | ||
629 | break; | ||
630 | case ZFCP_REC_DBF_ID_TARGET: | ||
631 | zfcp_dbf_out(&p, "reference", "0x%016Lx", r->u.target.ref); | ||
632 | zfcp_dbf_out(&p, "status", "0x%08x", r->u.target.status); | ||
633 | zfcp_dbf_out(&p, "erp_count", "%d", r->u.target.erp_count); | ||
634 | zfcp_dbf_out(&p, "d_id", "0x%06x", r->u.target.d_id); | ||
635 | zfcp_dbf_out(&p, "wwpn", "0x%016Lx", r->u.target.wwpn); | ||
636 | zfcp_dbf_out(&p, "fcp_lun", "0x%016Lx", r->u.target.fcp_lun); | ||
637 | break; | ||
638 | case ZFCP_REC_DBF_ID_TRIGGER: | ||
639 | zfcp_dbf_out(&p, "reference", "0x%016Lx", r->u.trigger.ref); | ||
640 | zfcp_dbf_out(&p, "erp_action", "0x%016Lx", r->u.trigger.action); | ||
641 | zfcp_dbf_out(&p, "requested", "%d", r->u.trigger.want); | ||
642 | zfcp_dbf_out(&p, "executed", "%d", r->u.trigger.need); | ||
643 | zfcp_dbf_out(&p, "wwpn", "0x%016Lx", r->u.trigger.wwpn); | ||
644 | zfcp_dbf_out(&p, "fcp_lun", "0x%016Lx", r->u.trigger.fcp_lun); | ||
645 | zfcp_dbf_out(&p, "adapter_status", "0x%08x", r->u.trigger.as); | ||
646 | zfcp_dbf_out(&p, "port_status", "0x%08x", r->u.trigger.ps); | ||
647 | zfcp_dbf_out(&p, "unit_status", "0x%08x", r->u.trigger.us); | ||
648 | break; | ||
649 | case ZFCP_REC_DBF_ID_ACTION: | ||
650 | zfcp_dbf_out(&p, "erp_action", "0x%016Lx", r->u.action.action); | ||
651 | zfcp_dbf_out(&p, "fsf_req", "0x%016Lx", r->u.action.fsf_req); | ||
652 | zfcp_dbf_out(&p, "status", "0x%08Lx", r->u.action.status); | ||
653 | zfcp_dbf_out(&p, "step", "0x%08Lx", r->u.action.step); | ||
654 | break; | ||
655 | } | ||
656 | p += sprintf(p, "\n"); | ||
657 | return p - buf; | ||
658 | } | ||
659 | |||
660 | static struct debug_view zfcp_rec_dbf_view = { | ||
661 | "structured", | ||
662 | NULL, | ||
663 | &zfcp_dbf_view_header, | ||
664 | &zfcp_rec_dbf_view_format, | ||
665 | NULL, | ||
666 | NULL | ||
667 | }; | ||
668 | |||
669 | /** | ||
670 | * zfcp_rec_dbf_event_thread - trace event related to recovery thread operation | ||
671 | * @id2: identifier for event | ||
672 | * @adapter: adapter | ||
673 | * @lock: non-zero value indicates that erp_lock has not yet been acquired | ||
674 | */ | ||
675 | void zfcp_rec_dbf_event_thread(u8 id2, struct zfcp_adapter *adapter, int lock) | ||
676 | { | ||
677 | struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; | ||
678 | unsigned long flags = 0; | ||
679 | struct list_head *entry; | ||
680 | unsigned ready = 0, running = 0, total; | ||
681 | |||
682 | if (lock) | ||
683 | read_lock_irqsave(&adapter->erp_lock, flags); | ||
684 | list_for_each(entry, &adapter->erp_ready_head) | ||
685 | ready++; | ||
686 | list_for_each(entry, &adapter->erp_running_head) | ||
687 | running++; | ||
688 | total = adapter->erp_total_count; | ||
689 | if (lock) | ||
690 | read_unlock_irqrestore(&adapter->erp_lock, flags); | ||
691 | |||
692 | spin_lock_irqsave(&adapter->rec_dbf_lock, flags); | ||
693 | memset(r, 0, sizeof(*r)); | ||
694 | r->id = ZFCP_REC_DBF_ID_THREAD; | ||
695 | r->id2 = id2; | ||
696 | r->u.thread.total = total; | ||
697 | r->u.thread.ready = ready; | ||
698 | r->u.thread.running = running; | ||
699 | debug_event(adapter->rec_dbf, 5, r, sizeof(*r)); | ||
700 | spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); | ||
701 | } | ||
702 | |||
703 | static void zfcp_rec_dbf_event_target(u8 id2, void *ref, | ||
704 | struct zfcp_adapter *adapter, | ||
705 | atomic_t *status, atomic_t *erp_count, | ||
706 | u64 wwpn, u32 d_id, u64 fcp_lun) | ||
707 | { | ||
708 | struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; | ||
709 | unsigned long flags; | ||
710 | |||
711 | spin_lock_irqsave(&adapter->rec_dbf_lock, flags); | ||
712 | memset(r, 0, sizeof(*r)); | ||
713 | r->id = ZFCP_REC_DBF_ID_TARGET; | ||
714 | r->id2 = id2; | ||
715 | r->u.target.ref = (unsigned long)ref; | ||
716 | r->u.target.status = atomic_read(status); | ||
717 | r->u.target.wwpn = wwpn; | ||
718 | r->u.target.d_id = d_id; | ||
719 | r->u.target.fcp_lun = fcp_lun; | ||
720 | r->u.target.erp_count = atomic_read(erp_count); | ||
721 | debug_event(adapter->rec_dbf, 3, r, sizeof(*r)); | ||
722 | spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); | ||
723 | } | ||
724 | |||
725 | /** | ||
726 | * zfcp_rec_dbf_event_adapter - trace event for adapter state change | ||
727 | * @id: identifier for trigger of state change | ||
728 | * @ref: additional reference (e.g. request) | ||
729 | * @adapter: adapter | ||
730 | */ | ||
731 | void zfcp_rec_dbf_event_adapter(u8 id, void *ref, struct zfcp_adapter *adapter) | ||
732 | { | ||
733 | zfcp_rec_dbf_event_target(id, ref, adapter, &adapter->status, | ||
734 | &adapter->erp_counter, 0, 0, 0); | ||
735 | } | ||
736 | |||
737 | /** | ||
738 | * zfcp_rec_dbf_event_port - trace event for port state change | ||
739 | * @id: identifier for trigger of state change | ||
740 | * @ref: additional reference (e.g. request) | ||
741 | * @port: port | ||
742 | */ | ||
743 | void zfcp_rec_dbf_event_port(u8 id, void *ref, struct zfcp_port *port) | ||
478 | { | 744 | { |
479 | struct zfcp_send_ct *send_ct = (struct zfcp_send_ct *)fsf_req->data; | ||
480 | struct zfcp_port *port = send_ct->port; | ||
481 | struct zfcp_adapter *adapter = port->adapter; | 745 | struct zfcp_adapter *adapter = port->adapter; |
482 | struct ct_hdr *header = (struct ct_hdr *)buffer; | 746 | |
483 | struct zfcp_san_dbf_record *rec = &adapter->san_dbf_buf; | 747 | zfcp_rec_dbf_event_target(id, ref, adapter, &port->status, |
484 | struct zfcp_san_dbf_record_ct *ct = &rec->type.ct; | 748 | &port->erp_counter, port->wwpn, port->d_id, |
749 | 0); | ||
750 | } | ||
751 | |||
752 | /** | ||
753 | * zfcp_rec_dbf_event_unit - trace event for unit state change | ||
754 | * @id: identifier for trigger of state change | ||
755 | * @ref: additional reference (e.g. request) | ||
756 | * @unit: unit | ||
757 | */ | ||
758 | void zfcp_rec_dbf_event_unit(u8 id, void *ref, struct zfcp_unit *unit) | ||
759 | { | ||
760 | struct zfcp_port *port = unit->port; | ||
761 | struct zfcp_adapter *adapter = port->adapter; | ||
762 | |||
763 | zfcp_rec_dbf_event_target(id, ref, adapter, &unit->status, | ||
764 | &unit->erp_counter, port->wwpn, port->d_id, | ||
765 | unit->fcp_lun); | ||
766 | } | ||
767 | |||
768 | /** | ||
769 | * zfcp_rec_dbf_event_trigger - trace event for triggered error recovery | ||
770 | * @id2: identifier for error recovery trigger | ||
771 | * @ref: additional reference (e.g. request) | ||
772 | * @want: originally requested error recovery action | ||
773 | * @need: error recovery action actually initiated | ||
774 | * @action: address of error recovery action struct | ||
775 | * @adapter: adapter | ||
776 | * @port: port | ||
777 | * @unit: unit | ||
778 | */ | ||
779 | void zfcp_rec_dbf_event_trigger(u8 id2, void *ref, u8 want, u8 need, | ||
780 | void *action, struct zfcp_adapter *adapter, | ||
781 | struct zfcp_port *port, struct zfcp_unit *unit) | ||
782 | { | ||
783 | struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; | ||
485 | unsigned long flags; | 784 | unsigned long flags; |
486 | 785 | ||
487 | spin_lock_irqsave(&adapter->san_dbf_lock, flags); | 786 | spin_lock_irqsave(&adapter->rec_dbf_lock, flags); |
488 | memset(rec, 0, sizeof(struct zfcp_san_dbf_record)); | 787 | memset(r, 0, sizeof(*r)); |
489 | strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE); | 788 | r->id = ZFCP_REC_DBF_ID_TRIGGER; |
490 | rec->fsf_reqid = (unsigned long)fsf_req; | 789 | r->id2 = id2; |
491 | rec->fsf_seqno = fsf_req->seq_no; | 790 | r->u.trigger.ref = (unsigned long)ref; |
492 | rec->s_id = s_id; | 791 | r->u.trigger.want = want; |
493 | rec->d_id = d_id; | 792 | r->u.trigger.need = need; |
494 | if (strncmp(tag, "octc", ZFCP_DBF_TAG_SIZE) == 0) { | 793 | r->u.trigger.action = (unsigned long)action; |
495 | ct->type.request.cmd_req_code = header->cmd_rsp_code; | 794 | r->u.trigger.as = atomic_read(&adapter->status); |
496 | ct->type.request.revision = header->revision; | 795 | if (port) { |
497 | ct->type.request.gs_type = header->gs_type; | 796 | r->u.trigger.ps = atomic_read(&port->status); |
498 | ct->type.request.gs_subtype = header->gs_subtype; | 797 | r->u.trigger.wwpn = port->wwpn; |
499 | ct->type.request.options = header->options; | ||
500 | ct->type.request.max_res_size = header->max_res_size; | ||
501 | } else if (strncmp(tag, "rctc", ZFCP_DBF_TAG_SIZE) == 0) { | ||
502 | ct->type.response.cmd_rsp_code = header->cmd_rsp_code; | ||
503 | ct->type.response.revision = header->revision; | ||
504 | ct->type.response.reason_code = header->reason_code; | ||
505 | ct->type.response.reason_code_expl = header->reason_code_expl; | ||
506 | ct->type.response.vendor_unique = header->vendor_unique; | ||
507 | } | 798 | } |
508 | ct->payload_size = | 799 | if (unit) { |
509 | min(buflen - (int)sizeof(struct ct_hdr), ZFCP_DBF_CT_PAYLOAD); | 800 | r->u.trigger.us = atomic_read(&unit->status); |
510 | memcpy(ct->payload, buffer + sizeof(struct ct_hdr), ct->payload_size); | 801 | r->u.trigger.fcp_lun = unit->fcp_lun; |
511 | debug_event(adapter->san_dbf, 3, | 802 | } |
512 | rec, sizeof(struct zfcp_san_dbf_record)); | 803 | debug_event(adapter->rec_dbf, action ? 1 : 4, r, sizeof(*r)); |
513 | spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); | 804 | spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); |
514 | } | 805 | } |
515 | 806 | ||
807 | /** | ||
808 | * zfcp_rec_dbf_event_action - trace event showing progress of recovery action | ||
809 | * @id2: identifier | ||
810 | * @erp_action: error recovery action struct pointer | ||
811 | */ | ||
812 | void zfcp_rec_dbf_event_action(u8 id2, struct zfcp_erp_action *erp_action) | ||
813 | { | ||
814 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
815 | struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; | ||
816 | unsigned long flags; | ||
817 | |||
818 | spin_lock_irqsave(&adapter->rec_dbf_lock, flags); | ||
819 | memset(r, 0, sizeof(*r)); | ||
820 | r->id = ZFCP_REC_DBF_ID_ACTION; | ||
821 | r->id2 = id2; | ||
822 | r->u.action.action = (unsigned long)erp_action; | ||
823 | r->u.action.status = erp_action->status; | ||
824 | r->u.action.step = erp_action->step; | ||
825 | r->u.action.fsf_req = (unsigned long)erp_action->fsf_req; | ||
826 | debug_event(adapter->rec_dbf, 4, r, sizeof(*r)); | ||
827 | spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); | ||
828 | } | ||
829 | |||
830 | /** | ||
831 | * zfcp_san_dbf_event_ct_request - trace event for issued CT request | ||
832 | * @fsf_req: request containing issued CT data | ||
833 | */ | ||
516 | void zfcp_san_dbf_event_ct_request(struct zfcp_fsf_req *fsf_req) | 834 | void zfcp_san_dbf_event_ct_request(struct zfcp_fsf_req *fsf_req) |
517 | { | 835 | { |
518 | struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data; | 836 | struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data; |
519 | struct zfcp_port *port = ct->port; | 837 | struct zfcp_port *port = ct->port; |
520 | struct zfcp_adapter *adapter = port->adapter; | 838 | struct zfcp_adapter *adapter = port->adapter; |
839 | struct ct_hdr *hdr = zfcp_sg_to_address(ct->req); | ||
840 | struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf; | ||
841 | struct zfcp_san_dbf_record_ct_request *oct = &r->u.ct_req; | ||
842 | unsigned long flags; | ||
521 | 843 | ||
522 | _zfcp_san_dbf_event_common_ct("octc", fsf_req, | 844 | spin_lock_irqsave(&adapter->san_dbf_lock, flags); |
523 | fc_host_port_id(adapter->scsi_host), | 845 | memset(r, 0, sizeof(*r)); |
524 | port->d_id, zfcp_sg_to_address(ct->req), | 846 | strncpy(r->tag, "octc", ZFCP_DBF_TAG_SIZE); |
525 | ct->req->length); | 847 | r->fsf_reqid = (unsigned long)fsf_req; |
848 | r->fsf_seqno = fsf_req->seq_no; | ||
849 | r->s_id = fc_host_port_id(adapter->scsi_host); | ||
850 | r->d_id = port->d_id; | ||
851 | oct->cmd_req_code = hdr->cmd_rsp_code; | ||
852 | oct->revision = hdr->revision; | ||
853 | oct->gs_type = hdr->gs_type; | ||
854 | oct->gs_subtype = hdr->gs_subtype; | ||
855 | oct->options = hdr->options; | ||
856 | oct->max_res_size = hdr->max_res_size; | ||
857 | oct->len = min((int)ct->req->length - (int)sizeof(struct ct_hdr), | ||
858 | ZFCP_DBF_CT_PAYLOAD); | ||
859 | memcpy(oct->payload, (void *)hdr + sizeof(struct ct_hdr), oct->len); | ||
860 | debug_event(adapter->san_dbf, 3, r, sizeof(*r)); | ||
861 | spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); | ||
526 | } | 862 | } |
527 | 863 | ||
864 | /** | ||
865 | * zfcp_san_dbf_event_ct_response - trace event for completion of CT request | ||
866 | * @fsf_req: request containing CT response | ||
867 | */ | ||
528 | void zfcp_san_dbf_event_ct_response(struct zfcp_fsf_req *fsf_req) | 868 | void zfcp_san_dbf_event_ct_response(struct zfcp_fsf_req *fsf_req) |
529 | { | 869 | { |
530 | struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data; | 870 | struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data; |
531 | struct zfcp_port *port = ct->port; | 871 | struct zfcp_port *port = ct->port; |
532 | struct zfcp_adapter *adapter = port->adapter; | 872 | struct zfcp_adapter *adapter = port->adapter; |
873 | struct ct_hdr *hdr = zfcp_sg_to_address(ct->resp); | ||
874 | struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf; | ||
875 | struct zfcp_san_dbf_record_ct_response *rct = &r->u.ct_resp; | ||
876 | unsigned long flags; | ||
533 | 877 | ||
534 | _zfcp_san_dbf_event_common_ct("rctc", fsf_req, port->d_id, | 878 | spin_lock_irqsave(&adapter->san_dbf_lock, flags); |
535 | fc_host_port_id(adapter->scsi_host), | 879 | memset(r, 0, sizeof(*r)); |
536 | zfcp_sg_to_address(ct->resp), | 880 | strncpy(r->tag, "rctc", ZFCP_DBF_TAG_SIZE); |
537 | ct->resp->length); | 881 | r->fsf_reqid = (unsigned long)fsf_req; |
882 | r->fsf_seqno = fsf_req->seq_no; | ||
883 | r->s_id = port->d_id; | ||
884 | r->d_id = fc_host_port_id(adapter->scsi_host); | ||
885 | rct->cmd_rsp_code = hdr->cmd_rsp_code; | ||
886 | rct->revision = hdr->revision; | ||
887 | rct->reason_code = hdr->reason_code; | ||
888 | rct->expl = hdr->reason_code_expl; | ||
889 | rct->vendor_unique = hdr->vendor_unique; | ||
890 | rct->len = min((int)ct->resp->length - (int)sizeof(struct ct_hdr), | ||
891 | ZFCP_DBF_CT_PAYLOAD); | ||
892 | memcpy(rct->payload, (void *)hdr + sizeof(struct ct_hdr), rct->len); | ||
893 | debug_event(adapter->san_dbf, 3, r, sizeof(*r)); | ||
894 | spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); | ||
538 | } | 895 | } |
539 | 896 | ||
540 | static void | 897 | static void zfcp_san_dbf_event_els(const char *tag, int level, |
541 | _zfcp_san_dbf_event_common_els(const char *tag, int level, | 898 | struct zfcp_fsf_req *fsf_req, u32 s_id, |
542 | struct zfcp_fsf_req *fsf_req, u32 s_id, | 899 | u32 d_id, u8 ls_code, void *buffer, |
543 | u32 d_id, u8 ls_code, void *buffer, int buflen) | 900 | int buflen) |
544 | { | 901 | { |
545 | struct zfcp_adapter *adapter = fsf_req->adapter; | 902 | struct zfcp_adapter *adapter = fsf_req->adapter; |
546 | struct zfcp_san_dbf_record *rec = &adapter->san_dbf_buf; | 903 | struct zfcp_san_dbf_record *rec = &adapter->san_dbf_buf; |
547 | struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec; | ||
548 | unsigned long flags; | 904 | unsigned long flags; |
549 | int offset = 0; | ||
550 | 905 | ||
551 | spin_lock_irqsave(&adapter->san_dbf_lock, flags); | 906 | spin_lock_irqsave(&adapter->san_dbf_lock, flags); |
552 | do { | 907 | memset(rec, 0, sizeof(*rec)); |
553 | memset(rec, 0, sizeof(struct zfcp_san_dbf_record)); | 908 | strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE); |
554 | if (offset == 0) { | 909 | rec->fsf_reqid = (unsigned long)fsf_req; |
555 | strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE); | 910 | rec->fsf_seqno = fsf_req->seq_no; |
556 | rec->fsf_reqid = (unsigned long)fsf_req; | 911 | rec->s_id = s_id; |
557 | rec->fsf_seqno = fsf_req->seq_no; | 912 | rec->d_id = d_id; |
558 | rec->s_id = s_id; | 913 | rec->u.els.ls_code = ls_code; |
559 | rec->d_id = d_id; | 914 | debug_event(adapter->san_dbf, level, rec, sizeof(*rec)); |
560 | rec->type.els.ls_code = ls_code; | 915 | zfcp_dbf_hexdump(adapter->san_dbf, rec, sizeof(*rec), level, |
561 | buflen = min(buflen, ZFCP_DBF_ELS_MAX_PAYLOAD); | 916 | buffer, min(buflen, ZFCP_DBF_ELS_MAX_PAYLOAD)); |
562 | rec->type.els.payload_size = buflen; | ||
563 | memcpy(rec->type.els.payload, | ||
564 | buffer, min(buflen, ZFCP_DBF_ELS_PAYLOAD)); | ||
565 | offset += min(buflen, ZFCP_DBF_ELS_PAYLOAD); | ||
566 | } else { | ||
567 | strncpy(dump->tag, "dump", ZFCP_DBF_TAG_SIZE); | ||
568 | dump->total_size = buflen; | ||
569 | dump->offset = offset; | ||
570 | dump->size = min(buflen - offset, | ||
571 | (int)sizeof(struct zfcp_san_dbf_record) | ||
572 | - (int)sizeof(struct zfcp_dbf_dump)); | ||
573 | memcpy(dump->data, buffer + offset, dump->size); | ||
574 | offset += dump->size; | ||
575 | } | ||
576 | debug_event(adapter->san_dbf, level, | ||
577 | rec, sizeof(struct zfcp_san_dbf_record)); | ||
578 | } while (offset < buflen); | ||
579 | spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); | 917 | spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); |
580 | } | 918 | } |
581 | 919 | ||
920 | /** | ||
921 | * zfcp_san_dbf_event_els_request - trace event for issued ELS | ||
922 | * @fsf_req: request containing issued ELS | ||
923 | */ | ||
582 | void zfcp_san_dbf_event_els_request(struct zfcp_fsf_req *fsf_req) | 924 | void zfcp_san_dbf_event_els_request(struct zfcp_fsf_req *fsf_req) |
583 | { | 925 | { |
584 | struct zfcp_send_els *els = (struct zfcp_send_els *)fsf_req->data; | 926 | struct zfcp_send_els *els = (struct zfcp_send_els *)fsf_req->data; |
585 | 927 | ||
586 | _zfcp_san_dbf_event_common_els("oels", 2, fsf_req, | 928 | zfcp_san_dbf_event_els("oels", 2, fsf_req, |
587 | fc_host_port_id(els->adapter->scsi_host), | 929 | fc_host_port_id(els->adapter->scsi_host), |
588 | els->d_id, | 930 | els->d_id, *(u8 *) zfcp_sg_to_address(els->req), |
589 | *(u8 *) zfcp_sg_to_address(els->req), | 931 | zfcp_sg_to_address(els->req), els->req->length); |
590 | zfcp_sg_to_address(els->req), | ||
591 | els->req->length); | ||
592 | } | 932 | } |
593 | 933 | ||
934 | /** | ||
935 | * zfcp_san_dbf_event_els_response - trace event for completed ELS | ||
936 | * @fsf_req: request containing ELS response | ||
937 | */ | ||
594 | void zfcp_san_dbf_event_els_response(struct zfcp_fsf_req *fsf_req) | 938 | void zfcp_san_dbf_event_els_response(struct zfcp_fsf_req *fsf_req) |
595 | { | 939 | { |
596 | struct zfcp_send_els *els = (struct zfcp_send_els *)fsf_req->data; | 940 | struct zfcp_send_els *els = (struct zfcp_send_els *)fsf_req->data; |
597 | 941 | ||
598 | _zfcp_san_dbf_event_common_els("rels", 2, fsf_req, els->d_id, | 942 | zfcp_san_dbf_event_els("rels", 2, fsf_req, els->d_id, |
599 | fc_host_port_id(els->adapter->scsi_host), | 943 | fc_host_port_id(els->adapter->scsi_host), |
600 | *(u8 *) zfcp_sg_to_address(els->req), | 944 | *(u8 *)zfcp_sg_to_address(els->req), |
601 | zfcp_sg_to_address(els->resp), | 945 | zfcp_sg_to_address(els->resp), |
602 | els->resp->length); | 946 | els->resp->length); |
603 | } | 947 | } |
604 | 948 | ||
949 | /** | ||
950 | * zfcp_san_dbf_event_incoming_els - trace event for incomig ELS | ||
951 | * @fsf_req: request containing unsolicited status buffer with incoming ELS | ||
952 | */ | ||
605 | void zfcp_san_dbf_event_incoming_els(struct zfcp_fsf_req *fsf_req) | 953 | void zfcp_san_dbf_event_incoming_els(struct zfcp_fsf_req *fsf_req) |
606 | { | 954 | { |
607 | struct zfcp_adapter *adapter = fsf_req->adapter; | 955 | struct zfcp_adapter *adapter = fsf_req->adapter; |
608 | struct fsf_status_read_buffer *status_buffer = | 956 | struct fsf_status_read_buffer *buf = |
609 | (struct fsf_status_read_buffer *)fsf_req->data; | 957 | (struct fsf_status_read_buffer *)fsf_req->data; |
610 | int length = (int)status_buffer->length - | 958 | int length = (int)buf->length - |
611 | (int)((void *)&status_buffer->payload - (void *)status_buffer); | 959 | (int)((void *)&buf->payload - (void *)buf); |
612 | 960 | ||
613 | _zfcp_san_dbf_event_common_els("iels", 1, fsf_req, status_buffer->d_id, | 961 | zfcp_san_dbf_event_els("iels", 1, fsf_req, buf->d_id, |
614 | fc_host_port_id(adapter->scsi_host), | 962 | fc_host_port_id(adapter->scsi_host), |
615 | *(u8 *) status_buffer->payload, | 963 | *(u8 *)buf->payload, (void *)buf->payload, |
616 | (void *)status_buffer->payload, length); | 964 | length); |
617 | } | 965 | } |
618 | 966 | ||
619 | static int | 967 | static int zfcp_san_dbf_view_format(debug_info_t *id, struct debug_view *view, |
620 | zfcp_san_dbf_view_format(debug_info_t * id, struct debug_view *view, | 968 | char *out_buf, const char *in_buf) |
621 | char *out_buf, const char *in_buf) | ||
622 | { | 969 | { |
623 | struct zfcp_san_dbf_record *rec = (struct zfcp_san_dbf_record *)in_buf; | 970 | struct zfcp_san_dbf_record *r = (struct zfcp_san_dbf_record *)in_buf; |
624 | char *buffer = NULL; | 971 | char *buffer = NULL; |
625 | int buflen = 0, total = 0; | 972 | int buflen = 0, total = 0; |
626 | int len = 0; | 973 | char *p = out_buf; |
627 | 974 | ||
628 | if (strncmp(rec->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) | 975 | if (strncmp(r->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) |
629 | return 0; | 976 | return 0; |
630 | 977 | ||
631 | len += zfcp_dbf_tag(out_buf + len, "tag", rec->tag); | 978 | zfcp_dbf_tag(&p, "tag", r->tag); |
632 | len += zfcp_dbf_view(out_buf + len, "fsf_reqid", "0x%0Lx", | 979 | zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid); |
633 | rec->fsf_reqid); | 980 | zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno); |
634 | len += zfcp_dbf_view(out_buf + len, "fsf_seqno", "0x%08x", | 981 | zfcp_dbf_out(&p, "s_id", "0x%06x", r->s_id); |
635 | rec->fsf_seqno); | 982 | zfcp_dbf_out(&p, "d_id", "0x%06x", r->d_id); |
636 | len += zfcp_dbf_view(out_buf + len, "s_id", "0x%06x", rec->s_id); | 983 | |
637 | len += zfcp_dbf_view(out_buf + len, "d_id", "0x%06x", rec->d_id); | 984 | if (strncmp(r->tag, "octc", ZFCP_DBF_TAG_SIZE) == 0) { |
638 | 985 | struct zfcp_san_dbf_record_ct_request *ct = &r->u.ct_req; | |
639 | if (strncmp(rec->tag, "octc", ZFCP_DBF_TAG_SIZE) == 0) { | 986 | zfcp_dbf_out(&p, "cmd_req_code", "0x%04x", ct->cmd_req_code); |
640 | len += zfcp_dbf_view(out_buf + len, "cmd_req_code", "0x%04x", | 987 | zfcp_dbf_out(&p, "revision", "0x%02x", ct->revision); |
641 | rec->type.ct.type.request.cmd_req_code); | 988 | zfcp_dbf_out(&p, "gs_type", "0x%02x", ct->gs_type); |
642 | len += zfcp_dbf_view(out_buf + len, "revision", "0x%02x", | 989 | zfcp_dbf_out(&p, "gs_subtype", "0x%02x", ct->gs_subtype); |
643 | rec->type.ct.type.request.revision); | 990 | zfcp_dbf_out(&p, "options", "0x%02x", ct->options); |
644 | len += zfcp_dbf_view(out_buf + len, "gs_type", "0x%02x", | 991 | zfcp_dbf_out(&p, "max_res_size", "0x%04x", ct->max_res_size); |
645 | rec->type.ct.type.request.gs_type); | 992 | total = ct->len; |
646 | len += zfcp_dbf_view(out_buf + len, "gs_subtype", "0x%02x", | 993 | buffer = ct->payload; |
647 | rec->type.ct.type.request.gs_subtype); | ||
648 | len += zfcp_dbf_view(out_buf + len, "options", "0x%02x", | ||
649 | rec->type.ct.type.request.options); | ||
650 | len += zfcp_dbf_view(out_buf + len, "max_res_size", "0x%04x", | ||
651 | rec->type.ct.type.request.max_res_size); | ||
652 | total = rec->type.ct.payload_size; | ||
653 | buffer = rec->type.ct.payload; | ||
654 | buflen = min(total, ZFCP_DBF_CT_PAYLOAD); | 994 | buflen = min(total, ZFCP_DBF_CT_PAYLOAD); |
655 | } else if (strncmp(rec->tag, "rctc", ZFCP_DBF_TAG_SIZE) == 0) { | 995 | } else if (strncmp(r->tag, "rctc", ZFCP_DBF_TAG_SIZE) == 0) { |
656 | len += zfcp_dbf_view(out_buf + len, "cmd_rsp_code", "0x%04x", | 996 | struct zfcp_san_dbf_record_ct_response *ct = &r->u.ct_resp; |
657 | rec->type.ct.type.response.cmd_rsp_code); | 997 | zfcp_dbf_out(&p, "cmd_rsp_code", "0x%04x", ct->cmd_rsp_code); |
658 | len += zfcp_dbf_view(out_buf + len, "revision", "0x%02x", | 998 | zfcp_dbf_out(&p, "revision", "0x%02x", ct->revision); |
659 | rec->type.ct.type.response.revision); | 999 | zfcp_dbf_out(&p, "reason_code", "0x%02x", ct->reason_code); |
660 | len += zfcp_dbf_view(out_buf + len, "reason_code", "0x%02x", | 1000 | zfcp_dbf_out(&p, "reason_code_expl", "0x%02x", ct->expl); |
661 | rec->type.ct.type.response.reason_code); | 1001 | zfcp_dbf_out(&p, "vendor_unique", "0x%02x", ct->vendor_unique); |
662 | len += | 1002 | total = ct->len; |
663 | zfcp_dbf_view(out_buf + len, "reason_code_expl", "0x%02x", | 1003 | buffer = ct->payload; |
664 | rec->type.ct.type.response.reason_code_expl); | ||
665 | len += | ||
666 | zfcp_dbf_view(out_buf + len, "vendor_unique", "0x%02x", | ||
667 | rec->type.ct.type.response.vendor_unique); | ||
668 | total = rec->type.ct.payload_size; | ||
669 | buffer = rec->type.ct.payload; | ||
670 | buflen = min(total, ZFCP_DBF_CT_PAYLOAD); | 1004 | buflen = min(total, ZFCP_DBF_CT_PAYLOAD); |
671 | } else if (strncmp(rec->tag, "oels", ZFCP_DBF_TAG_SIZE) == 0 || | 1005 | } else if (strncmp(r->tag, "oels", ZFCP_DBF_TAG_SIZE) == 0 || |
672 | strncmp(rec->tag, "rels", ZFCP_DBF_TAG_SIZE) == 0 || | 1006 | strncmp(r->tag, "rels", ZFCP_DBF_TAG_SIZE) == 0 || |
673 | strncmp(rec->tag, "iels", ZFCP_DBF_TAG_SIZE) == 0) { | 1007 | strncmp(r->tag, "iels", ZFCP_DBF_TAG_SIZE) == 0) { |
674 | len += zfcp_dbf_view(out_buf + len, "ls_code", "0x%02x", | 1008 | struct zfcp_san_dbf_record_els *els = &r->u.els; |
675 | rec->type.els.ls_code); | 1009 | zfcp_dbf_out(&p, "ls_code", "0x%02x", els->ls_code); |
676 | total = rec->type.els.payload_size; | 1010 | total = els->len; |
677 | buffer = rec->type.els.payload; | 1011 | buffer = els->payload; |
678 | buflen = min(total, ZFCP_DBF_ELS_PAYLOAD); | 1012 | buflen = min(total, ZFCP_DBF_ELS_PAYLOAD); |
679 | } | 1013 | } |
680 | 1014 | ||
681 | len += zfcp_dbf_view_dump(out_buf + len, "payload", | 1015 | zfcp_dbf_outd(&p, "payload", buffer, buflen, 0, total); |
682 | buffer, buflen, 0, total); | ||
683 | |||
684 | if (buflen == total) | 1016 | if (buflen == total) |
685 | len += sprintf(out_buf + len, "\n"); | 1017 | p += sprintf(p, "\n"); |
686 | 1018 | ||
687 | return len; | 1019 | return p - out_buf; |
688 | } | 1020 | } |
689 | 1021 | ||
690 | static struct debug_view zfcp_san_dbf_view = { | 1022 | static struct debug_view zfcp_san_dbf_view = { |
@@ -696,12 +1028,11 @@ static struct debug_view zfcp_san_dbf_view = { | |||
696 | NULL | 1028 | NULL |
697 | }; | 1029 | }; |
698 | 1030 | ||
699 | static void | 1031 | static void zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level, |
700 | _zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level, | 1032 | struct zfcp_adapter *adapter, |
701 | struct zfcp_adapter *adapter, | 1033 | struct scsi_cmnd *scsi_cmnd, |
702 | struct scsi_cmnd *scsi_cmnd, | 1034 | struct zfcp_fsf_req *fsf_req, |
703 | struct zfcp_fsf_req *fsf_req, | 1035 | unsigned long old_req_id) |
704 | unsigned long old_req_id) | ||
705 | { | 1036 | { |
706 | struct zfcp_scsi_dbf_record *rec = &adapter->scsi_dbf_buf; | 1037 | struct zfcp_scsi_dbf_record *rec = &adapter->scsi_dbf_buf; |
707 | struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec; | 1038 | struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec; |
@@ -712,7 +1043,7 @@ _zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level, | |||
712 | 1043 | ||
713 | spin_lock_irqsave(&adapter->scsi_dbf_lock, flags); | 1044 | spin_lock_irqsave(&adapter->scsi_dbf_lock, flags); |
714 | do { | 1045 | do { |
715 | memset(rec, 0, sizeof(struct zfcp_scsi_dbf_record)); | 1046 | memset(rec, 0, sizeof(*rec)); |
716 | if (offset == 0) { | 1047 | if (offset == 0) { |
717 | strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE); | 1048 | strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE); |
718 | strncpy(rec->tag2, tag2, ZFCP_DBF_TAG_SIZE); | 1049 | strncpy(rec->tag2, tag2, ZFCP_DBF_TAG_SIZE); |
@@ -738,20 +1069,16 @@ _zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level, | |||
738 | fcp_sns_info = | 1069 | fcp_sns_info = |
739 | zfcp_get_fcp_sns_info_ptr(fcp_rsp); | 1070 | zfcp_get_fcp_sns_info_ptr(fcp_rsp); |
740 | 1071 | ||
741 | rec->type.fcp.rsp_validity = | 1072 | rec->rsp_validity = fcp_rsp->validity.value; |
742 | fcp_rsp->validity.value; | 1073 | rec->rsp_scsi_status = fcp_rsp->scsi_status; |
743 | rec->type.fcp.rsp_scsi_status = | 1074 | rec->rsp_resid = fcp_rsp->fcp_resid; |
744 | fcp_rsp->scsi_status; | ||
745 | rec->type.fcp.rsp_resid = fcp_rsp->fcp_resid; | ||
746 | if (fcp_rsp->validity.bits.fcp_rsp_len_valid) | 1075 | if (fcp_rsp->validity.bits.fcp_rsp_len_valid) |
747 | rec->type.fcp.rsp_code = | 1076 | rec->rsp_code = *(fcp_rsp_info + 3); |
748 | *(fcp_rsp_info + 3); | ||
749 | if (fcp_rsp->validity.bits.fcp_sns_len_valid) { | 1077 | if (fcp_rsp->validity.bits.fcp_sns_len_valid) { |
750 | buflen = min((int)fcp_rsp->fcp_sns_len, | 1078 | buflen = min((int)fcp_rsp->fcp_sns_len, |
751 | ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO); | 1079 | ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO); |
752 | rec->type.fcp.sns_info_len = buflen; | 1080 | rec->sns_info_len = buflen; |
753 | memcpy(rec->type.fcp.sns_info, | 1081 | memcpy(rec->sns_info, fcp_sns_info, |
754 | fcp_sns_info, | ||
755 | min(buflen, | 1082 | min(buflen, |
756 | ZFCP_DBF_SCSI_FCP_SNS_INFO)); | 1083 | ZFCP_DBF_SCSI_FCP_SNS_INFO)); |
757 | offset += min(buflen, | 1084 | offset += min(buflen, |
@@ -762,7 +1089,7 @@ _zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level, | |||
762 | rec->fsf_seqno = fsf_req->seq_no; | 1089 | rec->fsf_seqno = fsf_req->seq_no; |
763 | rec->fsf_issued = fsf_req->issued; | 1090 | rec->fsf_issued = fsf_req->issued; |
764 | } | 1091 | } |
765 | rec->type.old_fsf_reqid = old_req_id; | 1092 | rec->old_fsf_reqid = old_req_id; |
766 | } else { | 1093 | } else { |
767 | strncpy(dump->tag, "dump", ZFCP_DBF_TAG_SIZE); | 1094 | strncpy(dump->tag, "dump", ZFCP_DBF_TAG_SIZE); |
768 | dump->total_size = buflen; | 1095 | dump->total_size = buflen; |
@@ -774,108 +1101,101 @@ _zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level, | |||
774 | memcpy(dump->data, fcp_sns_info + offset, dump->size); | 1101 | memcpy(dump->data, fcp_sns_info + offset, dump->size); |
775 | offset += dump->size; | 1102 | offset += dump->size; |
776 | } | 1103 | } |
777 | debug_event(adapter->scsi_dbf, level, | 1104 | debug_event(adapter->scsi_dbf, level, rec, sizeof(*rec)); |
778 | rec, sizeof(struct zfcp_scsi_dbf_record)); | ||
779 | } while (offset < buflen); | 1105 | } while (offset < buflen); |
780 | spin_unlock_irqrestore(&adapter->scsi_dbf_lock, flags); | 1106 | spin_unlock_irqrestore(&adapter->scsi_dbf_lock, flags); |
781 | } | 1107 | } |
782 | 1108 | ||
783 | void | 1109 | /** |
784 | zfcp_scsi_dbf_event_result(const char *tag, int level, | 1110 | * zfcp_scsi_dbf_event_result - trace event for SCSI command completion |
785 | struct zfcp_adapter *adapter, | 1111 | * @tag: tag indicating success or failure of SCSI command |
786 | struct scsi_cmnd *scsi_cmnd, | 1112 | * @level: trace level applicable for this event |
787 | struct zfcp_fsf_req *fsf_req) | 1113 | * @adapter: adapter that has been used to issue the SCSI command |
1114 | * @scsi_cmnd: SCSI command pointer | ||
1115 | * @fsf_req: request used to issue SCSI command (might be NULL) | ||
1116 | */ | ||
1117 | void zfcp_scsi_dbf_event_result(const char *tag, int level, | ||
1118 | struct zfcp_adapter *adapter, | ||
1119 | struct scsi_cmnd *scsi_cmnd, | ||
1120 | struct zfcp_fsf_req *fsf_req) | ||
788 | { | 1121 | { |
789 | _zfcp_scsi_dbf_event_common("rslt", tag, level, | 1122 | zfcp_scsi_dbf_event("rslt", tag, level, adapter, scsi_cmnd, fsf_req, 0); |
790 | adapter, scsi_cmnd, fsf_req, 0); | ||
791 | } | 1123 | } |
792 | 1124 | ||
793 | void | 1125 | /** |
794 | zfcp_scsi_dbf_event_abort(const char *tag, struct zfcp_adapter *adapter, | 1126 | * zfcp_scsi_dbf_event_abort - trace event for SCSI command abort |
795 | struct scsi_cmnd *scsi_cmnd, | 1127 | * @tag: tag indicating success or failure of abort operation |
796 | struct zfcp_fsf_req *new_fsf_req, | 1128 | * @adapter: adapter thas has been used to issue SCSI command to be aborted |
797 | unsigned long old_req_id) | 1129 | * @scsi_cmnd: SCSI command to be aborted |
1130 | * @new_fsf_req: request containing abort (might be NULL) | ||
1131 | * @old_req_id: identifier of request containg SCSI command to be aborted | ||
1132 | */ | ||
1133 | void zfcp_scsi_dbf_event_abort(const char *tag, struct zfcp_adapter *adapter, | ||
1134 | struct scsi_cmnd *scsi_cmnd, | ||
1135 | struct zfcp_fsf_req *new_fsf_req, | ||
1136 | unsigned long old_req_id) | ||
798 | { | 1137 | { |
799 | _zfcp_scsi_dbf_event_common("abrt", tag, 1, | 1138 | zfcp_scsi_dbf_event("abrt", tag, 1, adapter, scsi_cmnd, new_fsf_req, |
800 | adapter, scsi_cmnd, new_fsf_req, old_req_id); | 1139 | old_req_id); |
801 | } | 1140 | } |
802 | 1141 | ||
803 | void | 1142 | /** |
804 | zfcp_scsi_dbf_event_devreset(const char *tag, u8 flag, struct zfcp_unit *unit, | 1143 | * zfcp_scsi_dbf_event_devreset - trace event for Logical Unit or Target Reset |
805 | struct scsi_cmnd *scsi_cmnd) | 1144 | * @tag: tag indicating success or failure of reset operation |
1145 | * @flag: indicates type of reset (Target Reset, Logical Unit Reset) | ||
1146 | * @unit: unit that needs reset | ||
1147 | * @scsi_cmnd: SCSI command which caused this error recovery | ||
1148 | */ | ||
1149 | void zfcp_scsi_dbf_event_devreset(const char *tag, u8 flag, | ||
1150 | struct zfcp_unit *unit, | ||
1151 | struct scsi_cmnd *scsi_cmnd) | ||
806 | { | 1152 | { |
807 | struct zfcp_adapter *adapter = unit->port->adapter; | 1153 | zfcp_scsi_dbf_event(flag == FCP_TARGET_RESET ? "trst" : "lrst", tag, 1, |
808 | 1154 | unit->port->adapter, scsi_cmnd, NULL, 0); | |
809 | _zfcp_scsi_dbf_event_common(flag == FCP_TARGET_RESET ? "trst" : "lrst", | ||
810 | tag, 1, adapter, scsi_cmnd, NULL, 0); | ||
811 | } | 1155 | } |
812 | 1156 | ||
813 | static int | 1157 | static int zfcp_scsi_dbf_view_format(debug_info_t *id, struct debug_view *view, |
814 | zfcp_scsi_dbf_view_format(debug_info_t * id, struct debug_view *view, | 1158 | char *out_buf, const char *in_buf) |
815 | char *out_buf, const char *in_buf) | ||
816 | { | 1159 | { |
817 | struct zfcp_scsi_dbf_record *rec = | 1160 | struct zfcp_scsi_dbf_record *r = (struct zfcp_scsi_dbf_record *)in_buf; |
818 | (struct zfcp_scsi_dbf_record *)in_buf; | 1161 | struct timespec t; |
819 | int len = 0; | 1162 | char *p = out_buf; |
820 | 1163 | ||
821 | if (strncmp(rec->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) | 1164 | if (strncmp(r->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) |
822 | return 0; | 1165 | return 0; |
823 | 1166 | ||
824 | len += zfcp_dbf_tag(out_buf + len, "tag", rec->tag); | 1167 | zfcp_dbf_tag(&p, "tag", r->tag); |
825 | len += zfcp_dbf_tag(out_buf + len, "tag2", rec->tag2); | 1168 | zfcp_dbf_tag(&p, "tag2", r->tag2); |
826 | len += zfcp_dbf_view(out_buf + len, "scsi_id", "0x%08x", rec->scsi_id); | 1169 | zfcp_dbf_out(&p, "scsi_id", "0x%08x", r->scsi_id); |
827 | len += zfcp_dbf_view(out_buf + len, "scsi_lun", "0x%08x", | 1170 | zfcp_dbf_out(&p, "scsi_lun", "0x%08x", r->scsi_lun); |
828 | rec->scsi_lun); | 1171 | zfcp_dbf_out(&p, "scsi_result", "0x%08x", r->scsi_result); |
829 | len += zfcp_dbf_view(out_buf + len, "scsi_result", "0x%08x", | 1172 | zfcp_dbf_out(&p, "scsi_cmnd", "0x%0Lx", r->scsi_cmnd); |
830 | rec->scsi_result); | 1173 | zfcp_dbf_out(&p, "scsi_serial", "0x%016Lx", r->scsi_serial); |
831 | len += zfcp_dbf_view(out_buf + len, "scsi_cmnd", "0x%0Lx", | 1174 | zfcp_dbf_outd(&p, "scsi_opcode", r->scsi_opcode, ZFCP_DBF_SCSI_OPCODE, |
832 | rec->scsi_cmnd); | 1175 | 0, ZFCP_DBF_SCSI_OPCODE); |
833 | len += zfcp_dbf_view(out_buf + len, "scsi_serial", "0x%016Lx", | 1176 | zfcp_dbf_out(&p, "scsi_retries", "0x%02x", r->scsi_retries); |
834 | rec->scsi_serial); | 1177 | zfcp_dbf_out(&p, "scsi_allowed", "0x%02x", r->scsi_allowed); |
835 | len += zfcp_dbf_view_dump(out_buf + len, "scsi_opcode", | 1178 | if (strncmp(r->tag, "abrt", ZFCP_DBF_TAG_SIZE) == 0) |
836 | rec->scsi_opcode, | 1179 | zfcp_dbf_out(&p, "old_fsf_reqid", "0x%0Lx", r->old_fsf_reqid); |
837 | ZFCP_DBF_SCSI_OPCODE, | 1180 | zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid); |
838 | 0, ZFCP_DBF_SCSI_OPCODE); | 1181 | zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno); |
839 | len += zfcp_dbf_view(out_buf + len, "scsi_retries", "0x%02x", | 1182 | zfcp_dbf_timestamp(r->fsf_issued, &t); |
840 | rec->scsi_retries); | 1183 | zfcp_dbf_out(&p, "fsf_issued", "%011lu:%06lu", t.tv_sec, t.tv_nsec); |
841 | len += zfcp_dbf_view(out_buf + len, "scsi_allowed", "0x%02x", | 1184 | |
842 | rec->scsi_allowed); | 1185 | if (strncmp(r->tag, "rslt", ZFCP_DBF_TAG_SIZE) == 0) { |
843 | if (strncmp(rec->tag, "abrt", ZFCP_DBF_TAG_SIZE) == 0) { | 1186 | zfcp_dbf_out(&p, "fcp_rsp_validity", "0x%02x", r->rsp_validity); |
844 | len += zfcp_dbf_view(out_buf + len, "old_fsf_reqid", "0x%0Lx", | 1187 | zfcp_dbf_out(&p, "fcp_rsp_scsi_status", "0x%02x", |
845 | rec->type.old_fsf_reqid); | 1188 | r->rsp_scsi_status); |
846 | } | 1189 | zfcp_dbf_out(&p, "fcp_rsp_resid", "0x%08x", r->rsp_resid); |
847 | len += zfcp_dbf_view(out_buf + len, "fsf_reqid", "0x%0Lx", | 1190 | zfcp_dbf_out(&p, "fcp_rsp_code", "0x%08x", r->rsp_code); |
848 | rec->fsf_reqid); | 1191 | zfcp_dbf_out(&p, "fcp_sns_info_len", "0x%08x", r->sns_info_len); |
849 | len += zfcp_dbf_view(out_buf + len, "fsf_seqno", "0x%08x", | 1192 | zfcp_dbf_outd(&p, "fcp_sns_info", r->sns_info, |
850 | rec->fsf_seqno); | 1193 | min((int)r->sns_info_len, |
851 | len += zfcp_dbf_stck(out_buf + len, "fsf_issued", rec->fsf_issued); | 1194 | ZFCP_DBF_SCSI_FCP_SNS_INFO), 0, |
852 | if (strncmp(rec->tag, "rslt", ZFCP_DBF_TAG_SIZE) == 0) { | 1195 | r->sns_info_len); |
853 | len += | ||
854 | zfcp_dbf_view(out_buf + len, "fcp_rsp_validity", "0x%02x", | ||
855 | rec->type.fcp.rsp_validity); | ||
856 | len += | ||
857 | zfcp_dbf_view(out_buf + len, "fcp_rsp_scsi_status", | ||
858 | "0x%02x", rec->type.fcp.rsp_scsi_status); | ||
859 | len += | ||
860 | zfcp_dbf_view(out_buf + len, "fcp_rsp_resid", "0x%08x", | ||
861 | rec->type.fcp.rsp_resid); | ||
862 | len += | ||
863 | zfcp_dbf_view(out_buf + len, "fcp_rsp_code", "0x%08x", | ||
864 | rec->type.fcp.rsp_code); | ||
865 | len += | ||
866 | zfcp_dbf_view(out_buf + len, "fcp_sns_info_len", "0x%08x", | ||
867 | rec->type.fcp.sns_info_len); | ||
868 | len += | ||
869 | zfcp_dbf_view_dump(out_buf + len, "fcp_sns_info", | ||
870 | rec->type.fcp.sns_info, | ||
871 | min((int)rec->type.fcp.sns_info_len, | ||
872 | ZFCP_DBF_SCSI_FCP_SNS_INFO), 0, | ||
873 | rec->type.fcp.sns_info_len); | ||
874 | } | 1196 | } |
875 | 1197 | p += sprintf(p, "\n"); | |
876 | len += sprintf(out_buf + len, "\n"); | 1198 | return p - out_buf; |
877 | |||
878 | return len; | ||
879 | } | 1199 | } |
880 | 1200 | ||
881 | static struct debug_view zfcp_scsi_dbf_view = { | 1201 | static struct debug_view zfcp_scsi_dbf_view = { |
@@ -897,13 +1217,14 @@ int zfcp_adapter_debug_register(struct zfcp_adapter *adapter) | |||
897 | char dbf_name[DEBUG_MAX_NAME_LEN]; | 1217 | char dbf_name[DEBUG_MAX_NAME_LEN]; |
898 | 1218 | ||
899 | /* debug feature area which records recovery activity */ | 1219 | /* debug feature area which records recovery activity */ |
900 | sprintf(dbf_name, "zfcp_%s_erp", zfcp_get_busid_by_adapter(adapter)); | 1220 | sprintf(dbf_name, "zfcp_%s_rec", zfcp_get_busid_by_adapter(adapter)); |
901 | adapter->erp_dbf = debug_register(dbf_name, dbfsize, 2, | 1221 | adapter->rec_dbf = debug_register(dbf_name, dbfsize, 1, |
902 | sizeof(struct zfcp_erp_dbf_record)); | 1222 | sizeof(struct zfcp_rec_dbf_record)); |
903 | if (!adapter->erp_dbf) | 1223 | if (!adapter->rec_dbf) |
904 | goto failed; | 1224 | goto failed; |
905 | debug_register_view(adapter->erp_dbf, &debug_hex_ascii_view); | 1225 | debug_register_view(adapter->rec_dbf, &debug_hex_ascii_view); |
906 | debug_set_level(adapter->erp_dbf, 3); | 1226 | debug_register_view(adapter->rec_dbf, &zfcp_rec_dbf_view); |
1227 | debug_set_level(adapter->rec_dbf, 3); | ||
907 | 1228 | ||
908 | /* debug feature area which records HBA (FSF and QDIO) conditions */ | 1229 | /* debug feature area which records HBA (FSF and QDIO) conditions */ |
909 | sprintf(dbf_name, "zfcp_%s_hba", zfcp_get_busid_by_adapter(adapter)); | 1230 | sprintf(dbf_name, "zfcp_%s_hba", zfcp_get_busid_by_adapter(adapter)); |
@@ -952,11 +1273,11 @@ void zfcp_adapter_debug_unregister(struct zfcp_adapter *adapter) | |||
952 | debug_unregister(adapter->scsi_dbf); | 1273 | debug_unregister(adapter->scsi_dbf); |
953 | debug_unregister(adapter->san_dbf); | 1274 | debug_unregister(adapter->san_dbf); |
954 | debug_unregister(adapter->hba_dbf); | 1275 | debug_unregister(adapter->hba_dbf); |
955 | debug_unregister(adapter->erp_dbf); | 1276 | debug_unregister(adapter->rec_dbf); |
956 | adapter->scsi_dbf = NULL; | 1277 | adapter->scsi_dbf = NULL; |
957 | adapter->san_dbf = NULL; | 1278 | adapter->san_dbf = NULL; |
958 | adapter->hba_dbf = NULL; | 1279 | adapter->hba_dbf = NULL; |
959 | adapter->erp_dbf = NULL; | 1280 | adapter->rec_dbf = NULL; |
960 | } | 1281 | } |
961 | 1282 | ||
962 | #undef ZFCP_LOG_AREA | 1283 | #undef ZFCP_LOG_AREA |