aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorSwen Schillig <swen@vnet.ibm.com>2010-12-02 09:16:15 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-12-21 13:24:46 -0500
commit250a1352b95e1db3216e5c5d4f4365bea5122f4a (patch)
tree24191a5b1a22662f1bdeb3c5f8420d59a8233a42 /drivers/s390
parenta54ca0f62f953898b05549391ac2a8a4dad6482b (diff)
[SCSI] zfcp: Redesign of the debug tracing for SCSI records.
This patch is the continuation to redesign the zfcp tracing to a more straight-forward and easy to extend scheme. This patch deals with all trace records of the zfcp SCSI area. Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c232
-rw-r--r--drivers/s390/scsi/zfcp_dbf.h129
-rw-r--r--drivers/s390/scsi/zfcp_ext.h4
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c2
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c30
5 files changed, 132 insertions, 265 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index b57a47b64b8..f9bd094c6e6 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Debug traces for zfcp. 4 * Debug traces for zfcp.
5 * 5 *
6 * Copyright IBM Corporation 2002, 2009 6 * Copyright IBM Corporation 2002, 2010
7 */ 7 */
8 8
9#define KMSG_COMPONENT "zfcp" 9#define KMSG_COMPONENT "zfcp"
@@ -52,70 +52,6 @@ void zfcp_dbf_pl_write(struct zfcp_dbf *dbf, void *data, u16 length, char *area,
52 spin_unlock(&dbf->pay_lock); 52 spin_unlock(&dbf->pay_lock);
53} 53}
54 54
55static void zfcp_dbf_tag(char **p, const char *label, const char *tag)
56{
57 int i;
58
59 *p += sprintf(*p, "%-24s", label);
60 for (i = 0; i < ZFCP_DBF_TAG_SIZE; i++)
61 *p += sprintf(*p, "%c", tag[i]);
62 *p += sprintf(*p, "\n");
63}
64
65static void zfcp_dbf_out(char **buf, const char *s, const char *format, ...)
66{
67 va_list arg;
68
69 *buf += sprintf(*buf, "%-24s", s);
70 va_start(arg, format);
71 *buf += vsprintf(*buf, format, arg);
72 va_end(arg);
73 *buf += sprintf(*buf, "\n");
74}
75
76static void zfcp_dbf_outd(char **p, const char *label, char *buffer,
77 int buflen, int offset, int total_size)
78{
79 if (!offset)
80 *p += sprintf(*p, "%-24s ", label);
81 while (buflen--) {
82 if (offset > 0) {
83 if ((offset % 32) == 0)
84 *p += sprintf(*p, "\n%-24c ", ' ');
85 else if ((offset % 4) == 0)
86 *p += sprintf(*p, " ");
87 }
88 *p += sprintf(*p, "%02x", *buffer++);
89 if (++offset == total_size) {
90 *p += sprintf(*p, "\n");
91 break;
92 }
93 }
94 if (!total_size)
95 *p += sprintf(*p, "\n");
96}
97
98static int zfcp_dbf_view_header(debug_info_t *id, struct debug_view *view,
99 int area, debug_entry_t *entry, char *out_buf)
100{
101 struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)DEBUG_DATA(entry);
102 struct timespec t;
103 char *p = out_buf;
104
105 if (strncmp(dump->tag, "dump", ZFCP_DBF_TAG_SIZE) != 0) {
106 stck_to_timespec(entry->id.stck, &t);
107 zfcp_dbf_out(&p, "timestamp", "%011lu:%06lu",
108 t.tv_sec, t.tv_nsec);
109 zfcp_dbf_out(&p, "cpu", "%02i", entry->id.fields.cpuid);
110 } else {
111 zfcp_dbf_outd(&p, "", dump->data, dump->size, dump->offset,
112 dump->total_size);
113 if ((dump->offset + dump->size) == dump->total_size)
114 p += sprintf(p, "\n");
115 }
116 return p - out_buf;
117}
118
119/** 55/**
120 * zfcp_dbf_hba_fsf_res - trace event for fsf responses 56 * zfcp_dbf_hba_fsf_res - trace event for fsf responses
121 * @tag: tag indicating which kind of unsolicited status has been received 57 * @tag: tag indicating which kind of unsolicited status has been received
@@ -393,131 +329,57 @@ void zfcp_dbf_san_in_els(char *tag, struct zfcp_fsf_req *fsf)
393 fsf->req_id, ntoh24(srb->d_id)); 329 fsf->req_id, ntoh24(srb->d_id));
394} 330}
395 331
396void _zfcp_dbf_scsi(const char *tag, const char *tag2, int level, 332/**
397 struct zfcp_dbf *dbf, struct scsi_cmnd *scsi_cmnd, 333 * zfcp_dbf_scsi - trace event for scsi commands
398 struct zfcp_fsf_req *fsf_req, unsigned long old_req_id) 334 * @tag: identifier for event
335 * @sc: pointer to struct scsi_cmnd
336 * @fsf: pointer to struct zfcp_fsf_req
337 */
338void zfcp_dbf_scsi(char *tag, struct scsi_cmnd *sc, struct zfcp_fsf_req *fsf)
399{ 339{
400 struct zfcp_dbf_scsi_record *rec = &dbf->scsi_buf; 340 struct zfcp_adapter *adapter =
401 struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec; 341 (struct zfcp_adapter *) sc->device->host->hostdata[0];
402 unsigned long flags; 342 struct zfcp_dbf *dbf = adapter->dbf;
343 struct zfcp_dbf_scsi *rec = &dbf->scsi_buf;
403 struct fcp_resp_with_ext *fcp_rsp; 344 struct fcp_resp_with_ext *fcp_rsp;
404 struct fcp_resp_rsp_info *fcp_rsp_info = NULL; 345 struct fcp_resp_rsp_info *fcp_rsp_info;
405 char *fcp_sns_info = NULL; 346 unsigned long flags;
406 int offset = 0, buflen = 0;
407 347
408 spin_lock_irqsave(&dbf->scsi_lock, flags); 348 spin_lock_irqsave(&dbf->scsi_lock, flags);
409 do { 349 memset(rec, 0, sizeof(*rec));
410 memset(rec, 0, sizeof(*rec));
411 if (offset == 0) {
412 strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE);
413 strncpy(rec->tag2, tag2, ZFCP_DBF_TAG_SIZE);
414 if (scsi_cmnd != NULL) {
415 if (scsi_cmnd->device) {
416 rec->scsi_id = scsi_cmnd->device->id;
417 rec->scsi_lun = scsi_cmnd->device->lun;
418 }
419 rec->scsi_result = scsi_cmnd->result;
420 rec->scsi_cmnd = (unsigned long)scsi_cmnd;
421 memcpy(rec->scsi_opcode, scsi_cmnd->cmnd,
422 min((int)scsi_cmnd->cmd_len,
423 ZFCP_DBF_SCSI_OPCODE));
424 rec->scsi_retries = scsi_cmnd->retries;
425 rec->scsi_allowed = scsi_cmnd->allowed;
426 }
427 if (fsf_req != NULL) {
428 fcp_rsp = (struct fcp_resp_with_ext *)
429 &(fsf_req->qtcb->bottom.io.fcp_rsp);
430 fcp_rsp_info = (struct fcp_resp_rsp_info *)
431 &fcp_rsp[1];
432 fcp_sns_info = (char *) &fcp_rsp[1];
433 if (fcp_rsp->resp.fr_flags & FCP_RSP_LEN_VAL)
434 fcp_sns_info += fcp_rsp->ext.fr_sns_len;
435
436 rec->rsp_validity = fcp_rsp->resp.fr_flags;
437 rec->rsp_scsi_status = fcp_rsp->resp.fr_status;
438 rec->rsp_resid = fcp_rsp->ext.fr_resid;
439 if (fcp_rsp->resp.fr_flags & FCP_RSP_LEN_VAL)
440 rec->rsp_code = fcp_rsp_info->rsp_code;
441 if (fcp_rsp->resp.fr_flags & FCP_SNS_LEN_VAL) {
442 buflen = min(fcp_rsp->ext.fr_sns_len,
443 (u32)ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO);
444 rec->sns_info_len = buflen;
445 memcpy(rec->sns_info, fcp_sns_info,
446 min(buflen,
447 ZFCP_DBF_SCSI_FCP_SNS_INFO));
448 offset += min(buflen,
449 ZFCP_DBF_SCSI_FCP_SNS_INFO);
450 }
451
452 rec->fsf_reqid = fsf_req->req_id;
453 rec->fsf_seqno = fsf_req->seq_no;
454 rec->fsf_issued = fsf_req->issued;
455 }
456 rec->old_fsf_reqid = old_req_id;
457 } else {
458 strncpy(dump->tag, "dump", ZFCP_DBF_TAG_SIZE);
459 dump->total_size = buflen;
460 dump->offset = offset;
461 dump->size = min(buflen - offset,
462 (int)sizeof(struct
463 zfcp_dbf_scsi_record) -
464 (int)sizeof(struct zfcp_dbf_dump));
465 memcpy(dump->data, fcp_sns_info + offset, dump->size);
466 offset += dump->size;
467 }
468 debug_event(dbf->scsi, level, rec, sizeof(*rec));
469 } while (offset < buflen);
470 spin_unlock_irqrestore(&dbf->scsi_lock, flags);
471}
472 350
473static int zfcp_dbf_scsi_view_format(debug_info_t *id, struct debug_view *view, 351 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
474 char *out_buf, const char *in_buf) 352 rec->id = ZFCP_DBF_SCSI_CMND;
475{ 353 rec->scsi_result = sc->result;
476 struct zfcp_dbf_scsi_record *r = (struct zfcp_dbf_scsi_record *)in_buf; 354 rec->scsi_retries = sc->retries;
477 struct timespec t; 355 rec->scsi_allowed = sc->allowed;
478 char *p = out_buf; 356 rec->scsi_id = sc->device->id;
479 357 rec->scsi_lun = sc->device->lun;
480 if (strncmp(r->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) 358 rec->host_scribble = (unsigned long)sc->host_scribble;
481 return 0; 359
482 360 memcpy(rec->scsi_opcode, sc->cmnd,
483 zfcp_dbf_tag(&p, "tag", r->tag); 361 min((int)sc->cmd_len, ZFCP_DBF_SCSI_OPCODE));
484 zfcp_dbf_tag(&p, "tag2", r->tag2); 362
485 zfcp_dbf_out(&p, "scsi_id", "0x%08x", r->scsi_id); 363 if (fsf) {
486 zfcp_dbf_out(&p, "scsi_lun", "0x%08x", r->scsi_lun); 364 rec->fsf_req_id = fsf->req_id;
487 zfcp_dbf_out(&p, "scsi_result", "0x%08x", r->scsi_result); 365 fcp_rsp = (struct fcp_resp_with_ext *)
488 zfcp_dbf_out(&p, "scsi_cmnd", "0x%0Lx", r->scsi_cmnd); 366 &(fsf->qtcb->bottom.io.fcp_rsp);
489 zfcp_dbf_outd(&p, "scsi_opcode", r->scsi_opcode, ZFCP_DBF_SCSI_OPCODE, 367 memcpy(&rec->fcp_rsp, fcp_rsp, FCP_RESP_WITH_EXT);
490 0, ZFCP_DBF_SCSI_OPCODE); 368 if (fcp_rsp->resp.fr_flags & FCP_RSP_LEN_VAL) {
491 zfcp_dbf_out(&p, "scsi_retries", "0x%02x", r->scsi_retries); 369 fcp_rsp_info = (struct fcp_resp_rsp_info *) &fcp_rsp[1];
492 zfcp_dbf_out(&p, "scsi_allowed", "0x%02x", r->scsi_allowed); 370 rec->fcp_rsp_info = fcp_rsp_info->rsp_code;
493 if (strncmp(r->tag, "abrt", ZFCP_DBF_TAG_SIZE) == 0) 371 }
494 zfcp_dbf_out(&p, "old_fsf_reqid", "0x%0Lx", r->old_fsf_reqid); 372 if (fcp_rsp->resp.fr_flags & FCP_SNS_LEN_VAL) {
495 zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid); 373 rec->pl_len = min((u16)SCSI_SENSE_BUFFERSIZE,
496 zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno); 374 (u16)ZFCP_DBF_PAY_MAX_REC);
497 stck_to_timespec(r->fsf_issued, &t); 375 zfcp_dbf_pl_write(dbf, sc->sense_buffer, rec->pl_len,
498 zfcp_dbf_out(&p, "fsf_issued", "%011lu:%06lu", t.tv_sec, t.tv_nsec); 376 "fcp_sns", fsf->req_id);
499 377 }
500 if (strncmp(r->tag, "rslt", ZFCP_DBF_TAG_SIZE) == 0) {
501 zfcp_dbf_out(&p, "fcp_rsp_validity", "0x%02x", r->rsp_validity);
502 zfcp_dbf_out(&p, "fcp_rsp_scsi_status", "0x%02x",
503 r->rsp_scsi_status);
504 zfcp_dbf_out(&p, "fcp_rsp_resid", "0x%08x", r->rsp_resid);
505 zfcp_dbf_out(&p, "fcp_rsp_code", "0x%08x", r->rsp_code);
506 zfcp_dbf_out(&p, "fcp_sns_info_len", "0x%08x", r->sns_info_len);
507 zfcp_dbf_outd(&p, "fcp_sns_info", r->sns_info,
508 min((int)r->sns_info_len,
509 ZFCP_DBF_SCSI_FCP_SNS_INFO), 0,
510 r->sns_info_len);
511 } 378 }
512 p += sprintf(p, "\n");
513 return p - out_buf;
514}
515 379
516static struct debug_view zfcp_dbf_scsi_view = { 380 debug_event(adapter->dbf->scsi, 1, rec, sizeof(*rec));
517 .name = "structured", 381 spin_unlock_irqrestore(&dbf->scsi_lock, flags);
518 .header_proc = zfcp_dbf_view_header, 382}
519 .format_proc = zfcp_dbf_scsi_view_format,
520};
521 383
522static debug_info_t *zfcp_dbf_reg(const char *name, int level, 384static debug_info_t *zfcp_dbf_reg(const char *name, int level,
523 struct debug_view *view, int size) 385 struct debug_view *view, int size)
@@ -584,8 +446,8 @@ int zfcp_dbf_adapter_register(struct zfcp_adapter *adapter)
584 446
585 /* debug feature area which records SCSI command failures and recovery */ 447 /* debug feature area which records SCSI command failures and recovery */
586 sprintf(dbf_name, "zfcp_%s_scsi", dev_name(&adapter->ccw_device->dev)); 448 sprintf(dbf_name, "zfcp_%s_scsi", dev_name(&adapter->ccw_device->dev));
587 dbf->scsi = zfcp_dbf_reg(dbf_name, 3, &zfcp_dbf_scsi_view, 449 dbf->scsi = zfcp_dbf_reg(dbf_name, 3, NULL,
588 sizeof(struct zfcp_dbf_scsi_record)); 450 sizeof(struct zfcp_dbf_scsi));
589 if (!dbf->scsi) 451 if (!dbf->scsi)
590 goto err_out; 452 goto err_out;
591 453
diff --git a/drivers/s390/scsi/zfcp_dbf.h b/drivers/s390/scsi/zfcp_dbf.h
index 5dc0b414cf2..2cee8197dd0 100644
--- a/drivers/s390/scsi/zfcp_dbf.h
+++ b/drivers/s390/scsi/zfcp_dbf.h
@@ -19,14 +19,6 @@
19 19
20#define ZFCP_DBF_INVALID_LUN 0xFFFFFFFFFFFFFFFFull 20#define ZFCP_DBF_INVALID_LUN 0xFFFFFFFFFFFFFFFFull
21 21
22struct zfcp_dbf_dump {
23 u8 tag[ZFCP_DBF_TAG_SIZE];
24 u32 total_size; /* size of total dump data */
25 u32 offset; /* how much data has being already dumped */
26 u32 size; /* how much data comes with this record */
27 u8 data[]; /* dump data */
28} __attribute__ ((packed));
29
30/** 22/**
31 * struct zfcp_dbf_rec_trigger - trace record for triggered recovery action 23 * struct zfcp_dbf_rec_trigger - trace record for triggered recovery action
32 * @ready: number of ready recovery actions 24 * @ready: number of ready recovery actions
@@ -193,6 +185,47 @@ struct zfcp_dbf_hba {
193} __packed; 185} __packed;
194 186
195/** 187/**
188 * enum zfcp_dbf_scsi_id - scsi trace record identifier
189 * @ZFCP_DBF_SCSI_CMND: scsi command trace record
190 */
191enum zfcp_dbf_scsi_id {
192 ZFCP_DBF_SCSI_CMND = 1,
193};
194
195/**
196 * struct zfcp_dbf_scsi - common trace record for SCSI records
197 * @id: unique number of recovery record type
198 * @tag: identifier string specifying the location of initiation
199 * @scsi_id: scsi device id
200 * @scsi_lun: scsi device logical unit number
201 * @scsi_result: scsi result
202 * @scsi_retries: current retry number of scsi request
203 * @scsi_allowed: allowed retries
204 * @fcp_rsp_info: FCP response info
205 * @scsi_opcode: scsi opcode
206 * @fsf_req_id: request id of fsf request
207 * @host_scribble: LLD specific data attached to SCSI request
208 * @pl_len: length of paload stored as zfcp_dbf_pay
209 * @fsf_rsp: response for fsf request
210 */
211struct zfcp_dbf_scsi {
212 u8 id;
213 char tag[ZFCP_DBF_TAG_LEN];
214 u32 scsi_id;
215 u32 scsi_lun;
216 u32 scsi_result;
217 u8 scsi_retries;
218 u8 scsi_allowed;
219 u8 fcp_rsp_info;
220#define ZFCP_DBF_SCSI_OPCODE 16
221 u8 scsi_opcode[ZFCP_DBF_SCSI_OPCODE];
222 u64 fsf_req_id;
223 u64 host_scribble;
224 u16 pl_len;
225 struct fcp_resp_with_ext fcp_rsp;
226} __packed;
227
228/**
196 * struct zfcp_dbf_pay - trace record for unformatted payload information 229 * struct zfcp_dbf_pay - trace record for unformatted payload information
197 * @area: area this record is originated from 230 * @area: area this record is originated from
198 * @counter: ascending record number 231 * @counter: ascending record number
@@ -207,31 +240,6 @@ struct zfcp_dbf_pay {
207 char data[ZFCP_DBF_PAY_MAX_REC]; 240 char data[ZFCP_DBF_PAY_MAX_REC];
208} __packed; 241} __packed;
209 242
210struct zfcp_dbf_scsi_record {
211 u8 tag[ZFCP_DBF_TAG_SIZE];
212 u8 tag2[ZFCP_DBF_TAG_SIZE];
213 u32 scsi_id;
214 u32 scsi_lun;
215 u32 scsi_result;
216 u64 scsi_cmnd;
217#define ZFCP_DBF_SCSI_OPCODE 16
218 u8 scsi_opcode[ZFCP_DBF_SCSI_OPCODE];
219 u8 scsi_retries;
220 u8 scsi_allowed;
221 u64 fsf_reqid;
222 u32 fsf_seqno;
223 u64 fsf_issued;
224 u64 old_fsf_reqid;
225 u8 rsp_validity;
226 u8 rsp_scsi_status;
227 u32 rsp_resid;
228 u8 rsp_code;
229#define ZFCP_DBF_SCSI_FCP_SNS_INFO 16
230#define ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO 256
231 u32 sns_info_len;
232 u8 sns_info[ZFCP_DBF_SCSI_FCP_SNS_INFO];
233} __attribute__ ((packed));
234
235struct zfcp_dbf { 243struct zfcp_dbf {
236 debug_info_t *pay; 244 debug_info_t *pay;
237 debug_info_t *rec; 245 debug_info_t *rec;
@@ -246,7 +254,7 @@ struct zfcp_dbf {
246 struct zfcp_dbf_rec rec_buf; 254 struct zfcp_dbf_rec rec_buf;
247 struct zfcp_dbf_hba hba_buf; 255 struct zfcp_dbf_hba hba_buf;
248 struct zfcp_dbf_san san_buf; 256 struct zfcp_dbf_san san_buf;
249 struct zfcp_dbf_scsi_record scsi_buf; 257 struct zfcp_dbf_scsi scsi_buf;
250 struct zfcp_dbf_pay pay_buf; 258 struct zfcp_dbf_pay pay_buf;
251 struct zfcp_adapter *adapter; 259 struct zfcp_adapter *adapter;
252}; 260};
@@ -260,7 +268,7 @@ void zfcp_dbf_hba_fsf_resp(char *tag, int level, struct zfcp_fsf_req *req)
260 268
261/** 269/**
262 * zfcp_dbf_hba_fsf_response - trace event for request completion 270 * zfcp_dbf_hba_fsf_response - trace event for request completion
263 * @fsf_req: request that has been completed 271 * @req: request that has been completed
264 */ 272 */
265static inline 273static inline
266void zfcp_dbf_hba_fsf_response(struct zfcp_fsf_req *req) 274void zfcp_dbf_hba_fsf_response(struct zfcp_fsf_req *req)
@@ -287,57 +295,53 @@ void zfcp_dbf_hba_fsf_response(struct zfcp_fsf_req *req)
287} 295}
288 296
289static inline 297static inline
290void zfcp_dbf_scsi(const char *tag, const char *tag2, int level, 298void _zfcp_dbf_scsi(char *tag, int level, struct scsi_cmnd *scmd,
291 struct zfcp_dbf *dbf, struct scsi_cmnd *scmd, 299 struct zfcp_fsf_req *req)
292 struct zfcp_fsf_req *req, unsigned long old_id)
293{ 300{
294 if (level <= dbf->scsi->level) 301 struct zfcp_adapter *adapter = (struct zfcp_adapter *)
295 _zfcp_dbf_scsi(tag, tag2, level, dbf, scmd, req, old_id); 302 scmd->device->host->hostdata[0];
303
304 if (level <= adapter->dbf->scsi->level)
305 zfcp_dbf_scsi(tag, scmd, req);
296} 306}
297 307
298/** 308/**
299 * zfcp_dbf_scsi_result - trace event for SCSI command completion 309 * zfcp_dbf_scsi_result - trace event for SCSI command completion
300 * @dbf: adapter dbf trace
301 * @scmd: SCSI command pointer 310 * @scmd: SCSI command pointer
302 * @req: FSF request used to issue SCSI command 311 * @req: FSF request used to issue SCSI command
303 */ 312 */
304static inline 313static inline
305void zfcp_dbf_scsi_result(struct zfcp_dbf *dbf, struct scsi_cmnd *scmd, 314void zfcp_dbf_scsi_result(struct scsi_cmnd *scmd, struct zfcp_fsf_req *req)
306 struct zfcp_fsf_req *req)
307{ 315{
308 if (scmd->result != 0) 316 if (scmd->result != 0)
309 zfcp_dbf_scsi("rslt", "erro", 3, dbf, scmd, req, 0); 317 _zfcp_dbf_scsi("rsl_err", 3, scmd, req);
310 else if (scmd->retries > 0) 318 else if (scmd->retries > 0)
311 zfcp_dbf_scsi("rslt", "retr", 4, dbf, scmd, req, 0); 319 _zfcp_dbf_scsi("rsl_ret", 4, scmd, req);
312 else 320 else
313 zfcp_dbf_scsi("rslt", "norm", 6, dbf, scmd, req, 0); 321 _zfcp_dbf_scsi("rsl_nor", 6, scmd, req);
314} 322}
315 323
316/** 324/**
317 * zfcp_dbf_scsi_fail_send - trace event for failure to send SCSI command 325 * zfcp_dbf_scsi_fail_send - trace event for failure to send SCSI command
318 * @dbf: adapter dbf trace
319 * @scmd: SCSI command pointer 326 * @scmd: SCSI command pointer
320 */ 327 */
321static inline 328static inline
322void zfcp_dbf_scsi_fail_send(struct zfcp_dbf *dbf, struct scsi_cmnd *scmd) 329void zfcp_dbf_scsi_fail_send(struct scsi_cmnd *scmd)
323{ 330{
324 zfcp_dbf_scsi("rslt", "fail", 4, dbf, scmd, NULL, 0); 331 _zfcp_dbf_scsi("rsl_fai", 4, scmd, NULL);
325} 332}
326 333
327/** 334/**
328 * zfcp_dbf_scsi_abort - trace event for SCSI command abort 335 * zfcp_dbf_scsi_abort - trace event for SCSI command abort
329 * @tag: tag indicating success or failure of abort operation 336 * @tag: tag indicating success or failure of abort operation
330 * @adapter: adapter thas has been used to issue SCSI command to be aborted
331 * @scmd: SCSI command to be aborted 337 * @scmd: SCSI command to be aborted
332 * @new_req: request containing abort (might be NULL) 338 * @fsf_req: request containing abort (might be NULL)
333 * @old_id: identifier of request containg SCSI command to be aborted
334 */ 339 */
335static inline 340static inline
336void zfcp_dbf_scsi_abort(const char *tag, struct zfcp_dbf *dbf, 341void zfcp_dbf_scsi_abort(char *tag, struct scsi_cmnd *scmd,
337 struct scsi_cmnd *scmd, struct zfcp_fsf_req *new_req, 342 struct zfcp_fsf_req *fsf_req)
338 unsigned long old_id)
339{ 343{
340 zfcp_dbf_scsi("abrt", tag, 1, dbf, scmd, new_req, old_id); 344 _zfcp_dbf_scsi(tag, 1, scmd, fsf_req);
341} 345}
342 346
343/** 347/**
@@ -347,12 +351,17 @@ void zfcp_dbf_scsi_abort(const char *tag, struct zfcp_dbf *dbf,
347 * @flag: indicates type of reset (Target Reset, Logical Unit Reset) 351 * @flag: indicates type of reset (Target Reset, Logical Unit Reset)
348 */ 352 */
349static inline 353static inline
350void zfcp_dbf_scsi_devreset(const char *tag, struct scsi_cmnd *scmnd, u8 flag) 354void zfcp_dbf_scsi_devreset(char *tag, struct scsi_cmnd *scmnd, u8 flag)
351{ 355{
352 struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scmnd->device); 356 char tmp_tag[ZFCP_DBF_TAG_LEN];
357
358 if (flag == FCP_TMF_TGT_RESET)
359 memcpy(tmp_tag, "tr_", 3);
360 else
361 memcpy(tmp_tag, "lr_", 3);
353 362
354 zfcp_dbf_scsi(flag == FCP_TMF_TGT_RESET ? "trst" : "lrst", tag, 1, 363 memcpy(&tmp_tag[3], tag, 4);
355 zfcp_sdev->port->adapter->dbf, scmnd, NULL, 0); 364 _zfcp_dbf_scsi(tmp_tag, 1, scmnd, NULL);
356} 365}
357 366
358#endif /* ZFCP_DBF_H */ 367#endif /* ZFCP_DBF_H */
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
index 00875de2cb9..b68a546275a 100644
--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h
@@ -56,9 +56,7 @@ extern void zfcp_dbf_hba_berr(struct zfcp_dbf *, struct zfcp_fsf_req *);
56extern void zfcp_dbf_san_req(char *, struct zfcp_fsf_req *, u32); 56extern void zfcp_dbf_san_req(char *, struct zfcp_fsf_req *, u32);
57extern void zfcp_dbf_san_res(char *, struct zfcp_fsf_req *); 57extern void zfcp_dbf_san_res(char *, struct zfcp_fsf_req *);
58extern void zfcp_dbf_san_in_els(char *, struct zfcp_fsf_req *); 58extern void zfcp_dbf_san_in_els(char *, struct zfcp_fsf_req *);
59extern void _zfcp_dbf_scsi(const char *, const char *, int, struct zfcp_dbf *, 59extern void zfcp_dbf_scsi(char *, struct scsi_cmnd *, struct zfcp_fsf_req *);
60 struct scsi_cmnd *, struct zfcp_fsf_req *,
61 unsigned long);
62 60
63/* zfcp_erp.c */ 61/* zfcp_erp.c */
64extern void zfcp_erp_set_adapter_status(struct zfcp_adapter *, u32); 62extern void zfcp_erp_set_adapter_status(struct zfcp_adapter *, u32);
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 9881ba947f1..5bb118e01f3 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -2105,7 +2105,7 @@ static void zfcp_fsf_fcp_cmnd_handler(struct zfcp_fsf_req *req)
2105 2105
2106skip_fsfstatus: 2106skip_fsfstatus:
2107 zfcp_fsf_req_trace(req, scpnt); 2107 zfcp_fsf_req_trace(req, scpnt);
2108 zfcp_dbf_scsi_result(req->adapter->dbf, scpnt, req); 2108 zfcp_dbf_scsi_result(scpnt, req);
2109 2109
2110 scpnt->host_scribble = NULL; 2110 scpnt->host_scribble = NULL;
2111 (scpnt->scsi_done) (scpnt); 2111 (scpnt->scsi_done) (scpnt);
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 63529ed801e..8c5c1c89c09 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -68,11 +68,8 @@ static int zfcp_scsi_slave_configure(struct scsi_device *sdp)
68 68
69static void zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result) 69static void zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result)
70{ 70{
71 struct zfcp_adapter *adapter =
72 (struct zfcp_adapter *) scpnt->device->host->hostdata[0];
73
74 set_host_byte(scpnt, result); 71 set_host_byte(scpnt, result);
75 zfcp_dbf_scsi_fail_send(adapter->dbf, scpnt); 72 zfcp_dbf_scsi_fail_send(scpnt);
76 scpnt->scsi_done(scpnt); 73 scpnt->scsi_done(scpnt);
77} 74}
78 75
@@ -80,7 +77,6 @@ static
80int zfcp_scsi_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scpnt) 77int zfcp_scsi_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scpnt)
81{ 78{
82 struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device); 79 struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);
83 struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;
84 struct fc_rport *rport = starget_to_rport(scsi_target(scpnt->device)); 80 struct fc_rport *rport = starget_to_rport(scsi_target(scpnt->device));
85 int status, scsi_result, ret; 81 int status, scsi_result, ret;
86 82
@@ -91,7 +87,7 @@ int zfcp_scsi_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scpnt)
91 scsi_result = fc_remote_port_chkready(rport); 87 scsi_result = fc_remote_port_chkready(rport);
92 if (unlikely(scsi_result)) { 88 if (unlikely(scsi_result)) {
93 scpnt->result = scsi_result; 89 scpnt->result = scsi_result;
94 zfcp_dbf_scsi_fail_send(adapter->dbf, scpnt); 90 zfcp_dbf_scsi_fail_send(scpnt);
95 scpnt->scsi_done(scpnt); 91 scpnt->scsi_done(scpnt);
96 return 0; 92 return 0;
97 } 93 }
@@ -182,8 +178,7 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
182 old_req = zfcp_reqlist_find(adapter->req_list, old_reqid); 178 old_req = zfcp_reqlist_find(adapter->req_list, old_reqid);
183 if (!old_req) { 179 if (!old_req) {
184 write_unlock_irqrestore(&adapter->abort_lock, flags); 180 write_unlock_irqrestore(&adapter->abort_lock, flags);
185 zfcp_dbf_scsi_abort("lte1", adapter->dbf, scpnt, NULL, 181 zfcp_dbf_scsi_abort("abrt_or", scpnt, NULL);
186 old_reqid);
187 return FAILED; /* completion could be in progress */ 182 return FAILED; /* completion could be in progress */
188 } 183 }
189 old_req->data = NULL; 184 old_req->data = NULL;
@@ -198,29 +193,32 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
198 193
199 zfcp_erp_wait(adapter); 194 zfcp_erp_wait(adapter);
200 ret = fc_block_scsi_eh(scpnt); 195 ret = fc_block_scsi_eh(scpnt);
201 if (ret) 196 if (ret) {
197 zfcp_dbf_scsi_abort("abrt_bl", scpnt, NULL);
202 return ret; 198 return ret;
199 }
203 if (!(atomic_read(&adapter->status) & 200 if (!(atomic_read(&adapter->status) &
204 ZFCP_STATUS_COMMON_RUNNING)) { 201 ZFCP_STATUS_COMMON_RUNNING)) {
205 zfcp_dbf_scsi_abort("nres", adapter->dbf, scpnt, NULL, 202 zfcp_dbf_scsi_abort("abrt_ru", scpnt, NULL);
206 old_reqid);
207 return SUCCESS; 203 return SUCCESS;
208 } 204 }
209 } 205 }
210 if (!abrt_req) 206 if (!abrt_req) {
207 zfcp_dbf_scsi_abort("abrt_ar", scpnt, NULL);
211 return FAILED; 208 return FAILED;
209 }
212 210
213 wait_for_completion(&abrt_req->completion); 211 wait_for_completion(&abrt_req->completion);
214 212
215 if (abrt_req->status & ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED) 213 if (abrt_req->status & ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED)
216 dbf_tag = "okay"; 214 dbf_tag = "abrt_ok";
217 else if (abrt_req->status & ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED) 215 else if (abrt_req->status & ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED)
218 dbf_tag = "lte2"; 216 dbf_tag = "abrt_nn";
219 else { 217 else {
220 dbf_tag = "fail"; 218 dbf_tag = "abrt_fa";
221 retval = FAILED; 219 retval = FAILED;
222 } 220 }
223 zfcp_dbf_scsi_abort(dbf_tag, adapter->dbf, scpnt, abrt_req, old_reqid); 221 zfcp_dbf_scsi_abort(dbf_tag, scpnt, abrt_req);
224 zfcp_fsf_req_free(abrt_req); 222 zfcp_fsf_req_free(abrt_req);
225 return retval; 223 return retval;
226} 224}