aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorMartin Peschke <mp3@de.ibm.com>2008-03-31 05:15:27 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-04-07 13:19:09 -0400
commita9c857757ea09b63040bba7ab149557ac2bfb274 (patch)
treefecc9b1736b9f4fccbf53d4ab3004acc77e324a7 /drivers/s390
parentdf29f4ac4d3e8fcc8d8c85b7aeb8cc0df2a3f68a (diff)
[SCSI] zfcp: Simplify zfcp_dbf_tag and related functions in debug trace.
Simplify usage of zfcp_dbf_tag() and calling functions. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c143
1 files changed, 65 insertions, 78 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index 0341fc5e06ce..0ab985c037fe 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -62,16 +62,14 @@ static void zfcp_dbf_timestamp(unsigned long long stck, struct timespec *time)
62 time->tv_nsec = ((stck * 1000) >> 12); 62 time->tv_nsec = ((stck * 1000) >> 12);
63} 63}
64 64
65static int zfcp_dbf_tag(char *out_buf, const char *label, const char *tag) 65static void zfcp_dbf_tag(char **p, const char *label, const char *tag)
66{ 66{
67 int len = 0, i; 67 int i;
68 68
69 len += sprintf(out_buf + len, "%-24s", label); 69 *p += sprintf(*p, "%-24s", label);
70 for (i = 0; i < ZFCP_DBF_TAG_SIZE; i++) 70 for (i = 0; i < ZFCP_DBF_TAG_SIZE; i++)
71 len += sprintf(out_buf + len, "%c", tag[i]); 71 *p += sprintf(*p, "%c", tag[i]);
72 len += sprintf(out_buf + len, "\n"); 72 *p += sprintf(*p, "\n");
73
74 return len;
75} 73}
76 74
77static void zfcp_dbf_outs(char **buf, const char *s1, const char *s2) 75static void zfcp_dbf_outs(char **buf, const char *s1, const char *s2)
@@ -328,61 +326,60 @@ zfcp_hba_dbf_event_qdio(struct zfcp_adapter *adapter, unsigned int status,
328 spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); 326 spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags);
329} 327}
330 328
331static int zfcp_hba_dbf_view_response(char *buf, 329static void zfcp_hba_dbf_view_response(char **p,
332 struct zfcp_hba_dbf_record_response *r) 330 struct zfcp_hba_dbf_record_response *r)
333{ 331{
334 struct timespec t; 332 struct timespec t;
335 char *p = buf;
336 333
337 zfcp_dbf_out(&p, "fsf_command", "0x%08x", r->fsf_command); 334 zfcp_dbf_out(p, "fsf_command", "0x%08x", r->fsf_command);
338 zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid); 335 zfcp_dbf_out(p, "fsf_reqid", "0x%0Lx", r->fsf_reqid);
339 zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno); 336 zfcp_dbf_out(p, "fsf_seqno", "0x%08x", r->fsf_seqno);
340 zfcp_dbf_timestamp(r->fsf_issued, &t); 337 zfcp_dbf_timestamp(r->fsf_issued, &t);
341 zfcp_dbf_out(&p, "fsf_issued", "%011lu:%06lu", t.tv_sec, t.tv_nsec); 338 zfcp_dbf_out(p, "fsf_issued", "%011lu:%06lu", t.tv_sec, t.tv_nsec);
342 zfcp_dbf_out(&p, "fsf_prot_status", "0x%08x", r->fsf_prot_status); 339 zfcp_dbf_out(p, "fsf_prot_status", "0x%08x", r->fsf_prot_status);
343 zfcp_dbf_out(&p, "fsf_status", "0x%08x", r->fsf_status); 340 zfcp_dbf_out(p, "fsf_status", "0x%08x", r->fsf_status);
344 zfcp_dbf_outd(&p, "fsf_prot_status_qual", r->fsf_prot_status_qual, 341 zfcp_dbf_outd(p, "fsf_prot_status_qual", r->fsf_prot_status_qual,
345 FSF_PROT_STATUS_QUAL_SIZE, 0, FSF_PROT_STATUS_QUAL_SIZE); 342 FSF_PROT_STATUS_QUAL_SIZE, 0, FSF_PROT_STATUS_QUAL_SIZE);
346 zfcp_dbf_outd(&p, "fsf_status_qual", r->fsf_status_qual, 343 zfcp_dbf_outd(p, "fsf_status_qual", r->fsf_status_qual,
347 FSF_STATUS_QUALIFIER_SIZE, 0, FSF_STATUS_QUALIFIER_SIZE); 344 FSF_STATUS_QUALIFIER_SIZE, 0, FSF_STATUS_QUALIFIER_SIZE);
348 zfcp_dbf_out(&p, "fsf_req_status", "0x%08x", r->fsf_req_status); 345 zfcp_dbf_out(p, "fsf_req_status", "0x%08x", r->fsf_req_status);
349 zfcp_dbf_out(&p, "sbal_first", "0x%02x", r->sbal_first); 346 zfcp_dbf_out(p, "sbal_first", "0x%02x", r->sbal_first);
350 zfcp_dbf_out(&p, "sbal_curr", "0x%02x", r->sbal_curr); 347 zfcp_dbf_out(p, "sbal_curr", "0x%02x", r->sbal_curr);
351 zfcp_dbf_out(&p, "sbal_last", "0x%02x", r->sbal_last); 348 zfcp_dbf_out(p, "sbal_last", "0x%02x", r->sbal_last);
352 zfcp_dbf_out(&p, "pool", "0x%02x", r->pool); 349 zfcp_dbf_out(p, "pool", "0x%02x", r->pool);
353 350
354 switch (r->fsf_command) { 351 switch (r->fsf_command) {
355 case FSF_QTCB_FCP_CMND: 352 case FSF_QTCB_FCP_CMND:
356 if (r->fsf_req_status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT) 353 if (r->fsf_req_status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT)
357 break; 354 break;
358 zfcp_dbf_out(&p, "scsi_cmnd", "0x%0Lx", 355 zfcp_dbf_out(p, "scsi_cmnd", "0x%0Lx",
359 r->data.send_fcp.scsi_cmnd); 356 r->data.send_fcp.scsi_cmnd);
360 zfcp_dbf_out(&p, "scsi_serial", "0x%016Lx", 357 zfcp_dbf_out(p, "scsi_serial", "0x%016Lx",
361 r->data.send_fcp.scsi_serial); 358 r->data.send_fcp.scsi_serial);
362 break; 359 break;
363 360
364 case FSF_QTCB_OPEN_PORT_WITH_DID: 361 case FSF_QTCB_OPEN_PORT_WITH_DID:
365 case FSF_QTCB_CLOSE_PORT: 362 case FSF_QTCB_CLOSE_PORT:
366 case FSF_QTCB_CLOSE_PHYSICAL_PORT: 363 case FSF_QTCB_CLOSE_PHYSICAL_PORT:
367 zfcp_dbf_out(&p, "wwpn", "0x%016Lx", r->data.port.wwpn); 364 zfcp_dbf_out(p, "wwpn", "0x%016Lx", r->data.port.wwpn);
368 zfcp_dbf_out(&p, "d_id", "0x%06x", r->data.port.d_id); 365 zfcp_dbf_out(p, "d_id", "0x%06x", r->data.port.d_id);
369 zfcp_dbf_out(&p, "port_handle", "0x%08x", 366 zfcp_dbf_out(p, "port_handle", "0x%08x",
370 r->data.port.port_handle); 367 r->data.port.port_handle);
371 break; 368 break;
372 369
373 case FSF_QTCB_OPEN_LUN: 370 case FSF_QTCB_OPEN_LUN:
374 case FSF_QTCB_CLOSE_LUN: 371 case FSF_QTCB_CLOSE_LUN:
375 zfcp_dbf_out(&p, "wwpn", "0x%016Lx", r->data.unit.wwpn); 372 zfcp_dbf_out(p, "wwpn", "0x%016Lx", r->data.unit.wwpn);
376 zfcp_dbf_out(&p, "fcp_lun", "0x%016Lx", r->data.unit.fcp_lun); 373 zfcp_dbf_out(p, "fcp_lun", "0x%016Lx", r->data.unit.fcp_lun);
377 zfcp_dbf_out(&p, "port_handle", "0x%08x", 374 zfcp_dbf_out(p, "port_handle", "0x%08x",
378 r->data.unit.port_handle); 375 r->data.unit.port_handle);
379 zfcp_dbf_out(&p, "lun_handle", "0x%08x", 376 zfcp_dbf_out(p, "lun_handle", "0x%08x",
380 r->data.unit.lun_handle); 377 r->data.unit.lun_handle);
381 break; 378 break;
382 379
383 case FSF_QTCB_SEND_ELS: 380 case FSF_QTCB_SEND_ELS:
384 zfcp_dbf_out(&p, "d_id", "0x%06x", r->data.send_els.d_id); 381 zfcp_dbf_out(p, "d_id", "0x%06x", r->data.send_els.d_id);
385 zfcp_dbf_out(&p, "ls_code", "0x%02x", r->data.send_els.ls_code); 382 zfcp_dbf_out(p, "ls_code", "0x%02x", r->data.send_els.ls_code);
386 break; 383 break;
387 384
388 case FSF_QTCB_ABORT_FCP_CMND: 385 case FSF_QTCB_ABORT_FCP_CMND:
@@ -393,62 +390,52 @@ static int zfcp_hba_dbf_view_response(char *buf,
393 case FSF_QTCB_UPLOAD_CONTROL_FILE: 390 case FSF_QTCB_UPLOAD_CONTROL_FILE:
394 break; 391 break;
395 } 392 }
396 return p - buf;
397} 393}
398 394
399static int zfcp_hba_dbf_view_status(char *buf, 395static void zfcp_hba_dbf_view_status(char **p,
400 struct zfcp_hba_dbf_record_status *r) 396 struct zfcp_hba_dbf_record_status *r)
401{ 397{
402 char *p = buf; 398 zfcp_dbf_out(p, "failed", "0x%02x", r->failed);
403 399 zfcp_dbf_out(p, "status_type", "0x%08x", r->status_type);
404 zfcp_dbf_out(&p, "failed", "0x%02x", r->failed); 400 zfcp_dbf_out(p, "status_subtype", "0x%08x", r->status_subtype);
405 zfcp_dbf_out(&p, "status_type", "0x%08x", r->status_type); 401 zfcp_dbf_outd(p, "queue_designator", (char *)&r->queue_designator,
406 zfcp_dbf_out(&p, "status_subtype", "0x%08x", r->status_subtype);
407 zfcp_dbf_outd(&p, "queue_designator", (char *)&r->queue_designator,
408 sizeof(struct fsf_queue_designator), 0, 402 sizeof(struct fsf_queue_designator), 0,
409 sizeof(struct fsf_queue_designator)); 403 sizeof(struct fsf_queue_designator));
410 zfcp_dbf_outd(&p, "payload", (char *)&r->payload, r->payload_size, 0, 404 zfcp_dbf_outd(p, "payload", (char *)&r->payload, r->payload_size, 0,
411 r->payload_size); 405 r->payload_size);
412 return p - buf;
413} 406}
414 407
415static int zfcp_hba_dbf_view_qdio(char *buf, struct zfcp_hba_dbf_record_qdio *r) 408static void zfcp_hba_dbf_view_qdio(char **p, struct zfcp_hba_dbf_record_qdio *r)
416{ 409{
417 char *p = buf; 410 zfcp_dbf_out(p, "status", "0x%08x", r->status);
418 411 zfcp_dbf_out(p, "qdio_error", "0x%08x", r->qdio_error);
419 zfcp_dbf_out(&p, "status", "0x%08x", r->status); 412 zfcp_dbf_out(p, "siga_error", "0x%08x", r->siga_error);
420 zfcp_dbf_out(&p, "qdio_error", "0x%08x", r->qdio_error); 413 zfcp_dbf_out(p, "sbal_index", "0x%02x", r->sbal_index);
421 zfcp_dbf_out(&p, "siga_error", "0x%08x", r->siga_error); 414 zfcp_dbf_out(p, "sbal_count", "0x%02x", r->sbal_count);
422 zfcp_dbf_out(&p, "sbal_index", "0x%02x", r->sbal_index);
423 zfcp_dbf_out(&p, "sbal_count", "0x%02x", r->sbal_count);
424 return p - buf;
425} 415}
426 416
427static int 417static int zfcp_hba_dbf_view_format(debug_info_t *id, struct debug_view *view,
428zfcp_hba_dbf_view_format(debug_info_t * id, struct debug_view *view, 418 char *out_buf, const char *in_buf)
429 char *out_buf, const char *in_buf)
430{ 419{
431 struct zfcp_hba_dbf_record *rec = (struct zfcp_hba_dbf_record *)in_buf; 420 struct zfcp_hba_dbf_record *r = (struct zfcp_hba_dbf_record *)in_buf;
432 int len = 0; 421 char *p = out_buf;
433 422
434 if (strncmp(rec->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) 423 if (strncmp(r->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0)
435 return 0; 424 return 0;
436 425
437 len += zfcp_dbf_tag(out_buf + len, "tag", rec->tag); 426 zfcp_dbf_tag(&p, "tag", r->tag);
438 if (isalpha(rec->tag2[0])) 427 if (isalpha(r->tag2[0]))
439 len += zfcp_dbf_tag(out_buf + len, "tag2", rec->tag2); 428 zfcp_dbf_tag(&p, "tag2", r->tag2);
440 if (strncmp(rec->tag, "resp", ZFCP_DBF_TAG_SIZE) == 0) 429
441 len += zfcp_hba_dbf_view_response(out_buf + len, 430 if (strncmp(r->tag, "resp", ZFCP_DBF_TAG_SIZE) == 0)
442 &rec->type.response); 431 zfcp_hba_dbf_view_response(&p, &r->type.response);
443 else if (strncmp(rec->tag, "stat", ZFCP_DBF_TAG_SIZE) == 0) 432 else if (strncmp(r->tag, "stat", ZFCP_DBF_TAG_SIZE) == 0)
444 len += zfcp_hba_dbf_view_status(out_buf + len, 433 zfcp_hba_dbf_view_status(&p, &r->type.status);
445 &rec->type.status); 434 else if (strncmp(r->tag, "qdio", ZFCP_DBF_TAG_SIZE) == 0)
446 else if (strncmp(rec->tag, "qdio", ZFCP_DBF_TAG_SIZE) == 0) 435 zfcp_hba_dbf_view_qdio(&p, &r->type.qdio);
447 len += zfcp_hba_dbf_view_qdio(out_buf + len, &rec->type.qdio); 436
448 437 p += sprintf(p, "\n");
449 len += sprintf(out_buf + len, "\n"); 438 return p - out_buf;
450
451 return len;
452} 439}
453 440
454static struct debug_view zfcp_hba_dbf_view = { 441static struct debug_view zfcp_hba_dbf_view = {
@@ -973,7 +960,7 @@ zfcp_san_dbf_view_format(debug_info_t * id, struct debug_view *view,
973 if (strncmp(r->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) 960 if (strncmp(r->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0)
974 return 0; 961 return 0;
975 962
976 p += zfcp_dbf_tag(p, "tag", r->tag); 963 zfcp_dbf_tag(&p, "tag", r->tag);
977 zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid); 964 zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid);
978 zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno); 965 zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno);
979 zfcp_dbf_out(&p, "s_id", "0x%06x", r->s_id); 966 zfcp_dbf_out(&p, "s_id", "0x%06x", r->s_id);
@@ -1160,8 +1147,8 @@ zfcp_scsi_dbf_view_format(debug_info_t * id, struct debug_view *view,
1160 if (strncmp(r->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) 1147 if (strncmp(r->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0)
1161 return 0; 1148 return 0;
1162 1149
1163 p += zfcp_dbf_tag(p, "tag", r->tag); 1150 zfcp_dbf_tag(&p, "tag", r->tag);
1164 p += zfcp_dbf_tag(p, "tag2", r->tag2); 1151 zfcp_dbf_tag(&p, "tag2", r->tag2);
1165 zfcp_dbf_out(&p, "scsi_id", "0x%08x", r->scsi_id); 1152 zfcp_dbf_out(&p, "scsi_id", "0x%08x", r->scsi_id);
1166 zfcp_dbf_out(&p, "scsi_lun", "0x%08x", r->scsi_lun); 1153 zfcp_dbf_out(&p, "scsi_lun", "0x%08x", r->scsi_lun);
1167 zfcp_dbf_out(&p, "scsi_result", "0x%08x", r->scsi_result); 1154 zfcp_dbf_out(&p, "scsi_result", "0x%08x", r->scsi_result);