aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/scsi')
-rw-r--r--drivers/s390/scsi/zfcp_aux.c4
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c217
-rw-r--r--drivers/s390/scsi/zfcp_dbf.h17
-rw-r--r--drivers/s390/scsi/zfcp_def.h15
-rw-r--r--drivers/s390/scsi/zfcp_fsf.h3
5 files changed, 143 insertions, 113 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index fa2460b42298..870fe79bc7ea 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -502,10 +502,6 @@ int zfcp_adapter_enqueue(struct ccw_device *ccw_device)
502 502
503 spin_lock_init(&adapter->req_list_lock); 503 spin_lock_init(&adapter->req_list_lock);
504 504
505 spin_lock_init(&adapter->hba_dbf_lock);
506 spin_lock_init(&adapter->san_dbf_lock);
507 spin_lock_init(&adapter->scsi_dbf_lock);
508 spin_lock_init(&adapter->rec_dbf_lock);
509 spin_lock_init(&adapter->req_q_lock); 505 spin_lock_init(&adapter->req_q_lock);
510 spin_lock_init(&adapter->qdio_stat_lock); 506 spin_lock_init(&adapter->qdio_stat_lock);
511 507
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index b99b87ce5a39..995e6128b6c9 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, 2008 6 * Copyright IBM Corporation 2002, 2009
7 */ 7 */
8 8
9#define KMSG_COMPONENT "zfcp" 9#define KMSG_COMPONENT "zfcp"
@@ -11,6 +11,7 @@
11 11
12#include <linux/ctype.h> 12#include <linux/ctype.h>
13#include <asm/debug.h> 13#include <asm/debug.h>
14#include "zfcp_dbf.h"
14#include "zfcp_ext.h" 15#include "zfcp_ext.h"
15 16
16static u32 dbfsize = 4; 17static u32 dbfsize = 4;
@@ -126,6 +127,7 @@ static int zfcp_dbf_view_header(debug_info_t *id, struct debug_view *view,
126void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req) 127void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
127{ 128{
128 struct zfcp_adapter *adapter = fsf_req->adapter; 129 struct zfcp_adapter *adapter = fsf_req->adapter;
130 struct zfcp_dbf *dbf = adapter->dbf;
129 struct fsf_qtcb *qtcb = fsf_req->qtcb; 131 struct fsf_qtcb *qtcb = fsf_req->qtcb;
130 union fsf_prot_status_qual *prot_status_qual = 132 union fsf_prot_status_qual *prot_status_qual =
131 &qtcb->prefix.prot_status_qual; 133 &qtcb->prefix.prot_status_qual;
@@ -134,12 +136,12 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
134 struct zfcp_port *port; 136 struct zfcp_port *port;
135 struct zfcp_unit *unit; 137 struct zfcp_unit *unit;
136 struct zfcp_send_els *send_els; 138 struct zfcp_send_els *send_els;
137 struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf; 139 struct zfcp_hba_dbf_record *rec = &dbf->hba_dbf_buf;
138 struct zfcp_hba_dbf_record_response *response = &rec->u.response; 140 struct zfcp_hba_dbf_record_response *response = &rec->u.response;
139 int level; 141 int level;
140 unsigned long flags; 142 unsigned long flags;
141 143
142 spin_lock_irqsave(&adapter->hba_dbf_lock, flags); 144 spin_lock_irqsave(&dbf->hba_dbf_lock, flags);
143 memset(rec, 0, sizeof(*rec)); 145 memset(rec, 0, sizeof(*rec));
144 strncpy(rec->tag, "resp", ZFCP_DBF_TAG_SIZE); 146 strncpy(rec->tag, "resp", ZFCP_DBF_TAG_SIZE);
145 147
@@ -224,7 +226,7 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
224 break; 226 break;
225 } 227 }
226 228
227 debug_event(adapter->hba_dbf, level, rec, sizeof(*rec)); 229 debug_event(dbf->hba_dbf, level, rec, sizeof(*rec));
228 230
229 /* have fcp channel microcode fixed to use as little as possible */ 231 /* have fcp channel microcode fixed to use as little as possible */
230 if (fsf_req->fsf_command != FSF_QTCB_FCP_CMND) { 232 if (fsf_req->fsf_command != FSF_QTCB_FCP_CMND) {
@@ -232,11 +234,11 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
232 char *buf = (char *)qtcb + qtcb->header.log_start; 234 char *buf = (char *)qtcb + qtcb->header.log_start;
233 int len = qtcb->header.log_length; 235 int len = qtcb->header.log_length;
234 for (; len && !buf[len - 1]; len--); 236 for (; len && !buf[len - 1]; len--);
235 zfcp_dbf_hexdump(adapter->hba_dbf, rec, sizeof(*rec), level, 237 zfcp_dbf_hexdump(dbf->hba_dbf, rec, sizeof(*rec), level, buf,
236 buf, len); 238 len);
237 } 239 }
238 240
239 spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); 241 spin_unlock_irqrestore(&dbf->hba_dbf_lock, flags);
240} 242}
241 243
242/** 244/**
@@ -248,10 +250,11 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
248void zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter, 250void zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter,
249 struct fsf_status_read_buffer *status_buffer) 251 struct fsf_status_read_buffer *status_buffer)
250{ 252{
251 struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf; 253 struct zfcp_dbf *dbf = adapter->dbf;
254 struct zfcp_hba_dbf_record *rec = &dbf->hba_dbf_buf;
252 unsigned long flags; 255 unsigned long flags;
253 256
254 spin_lock_irqsave(&adapter->hba_dbf_lock, flags); 257 spin_lock_irqsave(&dbf->hba_dbf_lock, flags);
255 memset(rec, 0, sizeof(*rec)); 258 memset(rec, 0, sizeof(*rec));
256 strncpy(rec->tag, "stat", ZFCP_DBF_TAG_SIZE); 259 strncpy(rec->tag, "stat", ZFCP_DBF_TAG_SIZE);
257 strncpy(rec->tag2, tag, ZFCP_DBF_TAG_SIZE); 260 strncpy(rec->tag2, tag, ZFCP_DBF_TAG_SIZE);
@@ -293,8 +296,8 @@ void zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter,
293 &status_buffer->payload, rec->u.status.payload_size); 296 &status_buffer->payload, rec->u.status.payload_size);
294 } 297 }
295 298
296 debug_event(adapter->hba_dbf, 2, rec, sizeof(*rec)); 299 debug_event(dbf->hba_dbf, 2, rec, sizeof(*rec));
297 spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); 300 spin_unlock_irqrestore(&dbf->hba_dbf_lock, flags);
298} 301}
299 302
300/** 303/**
@@ -308,17 +311,18 @@ void zfcp_hba_dbf_event_qdio(struct zfcp_adapter *adapter,
308 unsigned int qdio_error, int sbal_index, 311 unsigned int qdio_error, int sbal_index,
309 int sbal_count) 312 int sbal_count)
310{ 313{
311 struct zfcp_hba_dbf_record *r = &adapter->hba_dbf_buf; 314 struct zfcp_dbf *dbf = adapter->dbf;
315 struct zfcp_hba_dbf_record *r = &dbf->hba_dbf_buf;
312 unsigned long flags; 316 unsigned long flags;
313 317
314 spin_lock_irqsave(&adapter->hba_dbf_lock, flags); 318 spin_lock_irqsave(&dbf->hba_dbf_lock, flags);
315 memset(r, 0, sizeof(*r)); 319 memset(r, 0, sizeof(*r));
316 strncpy(r->tag, "qdio", ZFCP_DBF_TAG_SIZE); 320 strncpy(r->tag, "qdio", ZFCP_DBF_TAG_SIZE);
317 r->u.qdio.qdio_error = qdio_error; 321 r->u.qdio.qdio_error = qdio_error;
318 r->u.qdio.sbal_index = sbal_index; 322 r->u.qdio.sbal_index = sbal_index;
319 r->u.qdio.sbal_count = sbal_count; 323 r->u.qdio.sbal_count = sbal_count;
320 debug_event(adapter->hba_dbf, 0, r, sizeof(*r)); 324 debug_event(dbf->hba_dbf, 0, r, sizeof(*r));
321 spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); 325 spin_unlock_irqrestore(&dbf->hba_dbf_lock, flags);
322} 326}
323 327
324/** 328/**
@@ -329,17 +333,18 @@ void zfcp_hba_dbf_event_qdio(struct zfcp_adapter *adapter,
329void zfcp_hba_dbf_event_berr(struct zfcp_adapter *adapter, 333void zfcp_hba_dbf_event_berr(struct zfcp_adapter *adapter,
330 struct zfcp_fsf_req *req) 334 struct zfcp_fsf_req *req)
331{ 335{
332 struct zfcp_hba_dbf_record *r = &adapter->hba_dbf_buf; 336 struct zfcp_dbf *dbf = adapter->dbf;
337 struct zfcp_hba_dbf_record *r = &dbf->hba_dbf_buf;
333 struct fsf_status_read_buffer *sr_buf = req->data; 338 struct fsf_status_read_buffer *sr_buf = req->data;
334 struct fsf_bit_error_payload *err = &sr_buf->payload.bit_error; 339 struct fsf_bit_error_payload *err = &sr_buf->payload.bit_error;
335 unsigned long flags; 340 unsigned long flags;
336 341
337 spin_lock_irqsave(&adapter->hba_dbf_lock, flags); 342 spin_lock_irqsave(&dbf->hba_dbf_lock, flags);
338 memset(r, 0, sizeof(*r)); 343 memset(r, 0, sizeof(*r));
339 strncpy(r->tag, "berr", ZFCP_DBF_TAG_SIZE); 344 strncpy(r->tag, "berr", ZFCP_DBF_TAG_SIZE);
340 memcpy(&r->u.berr, err, sizeof(struct fsf_bit_error_payload)); 345 memcpy(&r->u.berr, err, sizeof(struct fsf_bit_error_payload));
341 debug_event(adapter->hba_dbf, 0, r, sizeof(*r)); 346 debug_event(dbf->hba_dbf, 0, r, sizeof(*r));
342 spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); 347 spin_unlock_irqrestore(&dbf->hba_dbf_lock, flags);
343} 348}
344static void zfcp_hba_dbf_view_response(char **p, 349static void zfcp_hba_dbf_view_response(char **p,
345 struct zfcp_hba_dbf_record_response *r) 350 struct zfcp_hba_dbf_record_response *r)
@@ -554,7 +559,8 @@ static struct debug_view zfcp_rec_dbf_view = {
554 */ 559 */
555void zfcp_rec_dbf_event_thread(char *id2, struct zfcp_adapter *adapter) 560void zfcp_rec_dbf_event_thread(char *id2, struct zfcp_adapter *adapter)
556{ 561{
557 struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; 562 struct zfcp_dbf *dbf = adapter->dbf;
563 struct zfcp_rec_dbf_record *r = &dbf->rec_dbf_buf;
558 unsigned long flags = 0; 564 unsigned long flags = 0;
559 struct list_head *entry; 565 struct list_head *entry;
560 unsigned ready = 0, running = 0, total; 566 unsigned ready = 0, running = 0, total;
@@ -565,15 +571,15 @@ void zfcp_rec_dbf_event_thread(char *id2, struct zfcp_adapter *adapter)
565 running++; 571 running++;
566 total = adapter->erp_total_count; 572 total = adapter->erp_total_count;
567 573
568 spin_lock_irqsave(&adapter->rec_dbf_lock, flags); 574 spin_lock_irqsave(&dbf->rec_dbf_lock, flags);
569 memset(r, 0, sizeof(*r)); 575 memset(r, 0, sizeof(*r));
570 r->id = ZFCP_REC_DBF_ID_THREAD; 576 r->id = ZFCP_REC_DBF_ID_THREAD;
571 memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE); 577 memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE);
572 r->u.thread.total = total; 578 r->u.thread.total = total;
573 r->u.thread.ready = ready; 579 r->u.thread.ready = ready;
574 r->u.thread.running = running; 580 r->u.thread.running = running;
575 debug_event(adapter->rec_dbf, 6, r, sizeof(*r)); 581 debug_event(dbf->rec_dbf, 6, r, sizeof(*r));
576 spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); 582 spin_unlock_irqrestore(&dbf->rec_dbf_lock, flags);
577} 583}
578 584
579/** 585/**
@@ -596,10 +602,11 @@ static void zfcp_rec_dbf_event_target(char *id2, void *ref,
596 atomic_t *status, atomic_t *erp_count, 602 atomic_t *status, atomic_t *erp_count,
597 u64 wwpn, u32 d_id, u64 fcp_lun) 603 u64 wwpn, u32 d_id, u64 fcp_lun)
598{ 604{
599 struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; 605 struct zfcp_dbf *dbf = adapter->dbf;
606 struct zfcp_rec_dbf_record *r = &dbf->rec_dbf_buf;
600 unsigned long flags; 607 unsigned long flags;
601 608
602 spin_lock_irqsave(&adapter->rec_dbf_lock, flags); 609 spin_lock_irqsave(&dbf->rec_dbf_lock, flags);
603 memset(r, 0, sizeof(*r)); 610 memset(r, 0, sizeof(*r));
604 r->id = ZFCP_REC_DBF_ID_TARGET; 611 r->id = ZFCP_REC_DBF_ID_TARGET;
605 memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE); 612 memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE);
@@ -609,8 +616,8 @@ static void zfcp_rec_dbf_event_target(char *id2, void *ref,
609 r->u.target.d_id = d_id; 616 r->u.target.d_id = d_id;
610 r->u.target.fcp_lun = fcp_lun; 617 r->u.target.fcp_lun = fcp_lun;
611 r->u.target.erp_count = atomic_read(erp_count); 618 r->u.target.erp_count = atomic_read(erp_count);
612 debug_event(adapter->rec_dbf, 3, r, sizeof(*r)); 619 debug_event(dbf->rec_dbf, 3, r, sizeof(*r));
613 spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); 620 spin_unlock_irqrestore(&dbf->rec_dbf_lock, flags);
614} 621}
615 622
616/** 623/**
@@ -672,10 +679,11 @@ void zfcp_rec_dbf_event_trigger(char *id2, void *ref, u8 want, u8 need,
672 void *action, struct zfcp_adapter *adapter, 679 void *action, struct zfcp_adapter *adapter,
673 struct zfcp_port *port, struct zfcp_unit *unit) 680 struct zfcp_port *port, struct zfcp_unit *unit)
674{ 681{
675 struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; 682 struct zfcp_dbf *dbf = adapter->dbf;
683 struct zfcp_rec_dbf_record *r = &dbf->rec_dbf_buf;
676 unsigned long flags; 684 unsigned long flags;
677 685
678 spin_lock_irqsave(&adapter->rec_dbf_lock, flags); 686 spin_lock_irqsave(&dbf->rec_dbf_lock, flags);
679 memset(r, 0, sizeof(*r)); 687 memset(r, 0, sizeof(*r));
680 r->id = ZFCP_REC_DBF_ID_TRIGGER; 688 r->id = ZFCP_REC_DBF_ID_TRIGGER;
681 memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE); 689 memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE);
@@ -692,8 +700,8 @@ void zfcp_rec_dbf_event_trigger(char *id2, void *ref, u8 want, u8 need,
692 r->u.trigger.us = atomic_read(&unit->status); 700 r->u.trigger.us = atomic_read(&unit->status);
693 r->u.trigger.fcp_lun = unit->fcp_lun; 701 r->u.trigger.fcp_lun = unit->fcp_lun;
694 } 702 }
695 debug_event(adapter->rec_dbf, action ? 1 : 4, r, sizeof(*r)); 703 debug_event(dbf->rec_dbf, action ? 1 : 4, r, sizeof(*r));
696 spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); 704 spin_unlock_irqrestore(&dbf->rec_dbf_lock, flags);
697} 705}
698 706
699/** 707/**
@@ -704,10 +712,11 @@ void zfcp_rec_dbf_event_trigger(char *id2, void *ref, u8 want, u8 need,
704void zfcp_rec_dbf_event_action(char *id2, struct zfcp_erp_action *erp_action) 712void zfcp_rec_dbf_event_action(char *id2, struct zfcp_erp_action *erp_action)
705{ 713{
706 struct zfcp_adapter *adapter = erp_action->adapter; 714 struct zfcp_adapter *adapter = erp_action->adapter;
707 struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; 715 struct zfcp_dbf *dbf = adapter->dbf;
716 struct zfcp_rec_dbf_record *r = &dbf->rec_dbf_buf;
708 unsigned long flags; 717 unsigned long flags;
709 718
710 spin_lock_irqsave(&adapter->rec_dbf_lock, flags); 719 spin_lock_irqsave(&dbf->rec_dbf_lock, flags);
711 memset(r, 0, sizeof(*r)); 720 memset(r, 0, sizeof(*r));
712 r->id = ZFCP_REC_DBF_ID_ACTION; 721 r->id = ZFCP_REC_DBF_ID_ACTION;
713 memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE); 722 memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE);
@@ -715,8 +724,8 @@ void zfcp_rec_dbf_event_action(char *id2, struct zfcp_erp_action *erp_action)
715 r->u.action.status = erp_action->status; 724 r->u.action.status = erp_action->status;
716 r->u.action.step = erp_action->step; 725 r->u.action.step = erp_action->step;
717 r->u.action.fsf_req = (unsigned long)erp_action->fsf_req; 726 r->u.action.fsf_req = (unsigned long)erp_action->fsf_req;
718 debug_event(adapter->rec_dbf, 5, r, sizeof(*r)); 727 debug_event(dbf->rec_dbf, 5, r, sizeof(*r));
719 spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); 728 spin_unlock_irqrestore(&dbf->rec_dbf_lock, flags);
720} 729}
721 730
722/** 731/**
@@ -728,13 +737,14 @@ void zfcp_san_dbf_event_ct_request(struct zfcp_fsf_req *fsf_req)
728 struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data; 737 struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data;
729 struct zfcp_wka_port *wka_port = ct->wka_port; 738 struct zfcp_wka_port *wka_port = ct->wka_port;
730 struct zfcp_adapter *adapter = wka_port->adapter; 739 struct zfcp_adapter *adapter = wka_port->adapter;
740 struct zfcp_dbf *dbf = adapter->dbf;
731 struct ct_hdr *hdr = sg_virt(ct->req); 741 struct ct_hdr *hdr = sg_virt(ct->req);
732 struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf; 742 struct zfcp_san_dbf_record *r = &dbf->san_dbf_buf;
733 struct zfcp_san_dbf_record_ct_request *oct = &r->u.ct_req; 743 struct zfcp_san_dbf_record_ct_request *oct = &r->u.ct_req;
734 int level = 3; 744 int level = 3;
735 unsigned long flags; 745 unsigned long flags;
736 746
737 spin_lock_irqsave(&adapter->san_dbf_lock, flags); 747 spin_lock_irqsave(&dbf->san_dbf_lock, flags);
738 memset(r, 0, sizeof(*r)); 748 memset(r, 0, sizeof(*r));
739 strncpy(r->tag, "octc", ZFCP_DBF_TAG_SIZE); 749 strncpy(r->tag, "octc", ZFCP_DBF_TAG_SIZE);
740 r->fsf_reqid = fsf_req->req_id; 750 r->fsf_reqid = fsf_req->req_id;
@@ -749,10 +759,10 @@ void zfcp_san_dbf_event_ct_request(struct zfcp_fsf_req *fsf_req)
749 oct->max_res_size = hdr->max_res_size; 759 oct->max_res_size = hdr->max_res_size;
750 oct->len = min((int)ct->req->length - (int)sizeof(struct ct_hdr), 760 oct->len = min((int)ct->req->length - (int)sizeof(struct ct_hdr),
751 ZFCP_DBF_SAN_MAX_PAYLOAD); 761 ZFCP_DBF_SAN_MAX_PAYLOAD);
752 debug_event(adapter->san_dbf, level, r, sizeof(*r)); 762 debug_event(dbf->san_dbf, level, r, sizeof(*r));
753 zfcp_dbf_hexdump(adapter->san_dbf, r, sizeof(*r), level, 763 zfcp_dbf_hexdump(dbf->san_dbf, r, sizeof(*r), level,
754 (void *)hdr + sizeof(struct ct_hdr), oct->len); 764 (void *)hdr + sizeof(struct ct_hdr), oct->len);
755 spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); 765 spin_unlock_irqrestore(&dbf->san_dbf_lock, flags);
756} 766}
757 767
758/** 768/**
@@ -765,12 +775,13 @@ void zfcp_san_dbf_event_ct_response(struct zfcp_fsf_req *fsf_req)
765 struct zfcp_wka_port *wka_port = ct->wka_port; 775 struct zfcp_wka_port *wka_port = ct->wka_port;
766 struct zfcp_adapter *adapter = wka_port->adapter; 776 struct zfcp_adapter *adapter = wka_port->adapter;
767 struct ct_hdr *hdr = sg_virt(ct->resp); 777 struct ct_hdr *hdr = sg_virt(ct->resp);
768 struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf; 778 struct zfcp_dbf *dbf = adapter->dbf;
779 struct zfcp_san_dbf_record *r = &dbf->san_dbf_buf;
769 struct zfcp_san_dbf_record_ct_response *rct = &r->u.ct_resp; 780 struct zfcp_san_dbf_record_ct_response *rct = &r->u.ct_resp;
770 int level = 3; 781 int level = 3;
771 unsigned long flags; 782 unsigned long flags;
772 783
773 spin_lock_irqsave(&adapter->san_dbf_lock, flags); 784 spin_lock_irqsave(&dbf->san_dbf_lock, flags);
774 memset(r, 0, sizeof(*r)); 785 memset(r, 0, sizeof(*r));
775 strncpy(r->tag, "rctc", ZFCP_DBF_TAG_SIZE); 786 strncpy(r->tag, "rctc", ZFCP_DBF_TAG_SIZE);
776 r->fsf_reqid = fsf_req->req_id; 787 r->fsf_reqid = fsf_req->req_id;
@@ -785,10 +796,10 @@ void zfcp_san_dbf_event_ct_response(struct zfcp_fsf_req *fsf_req)
785 rct->max_res_size = hdr->max_res_size; 796 rct->max_res_size = hdr->max_res_size;
786 rct->len = min((int)ct->resp->length - (int)sizeof(struct ct_hdr), 797 rct->len = min((int)ct->resp->length - (int)sizeof(struct ct_hdr),
787 ZFCP_DBF_SAN_MAX_PAYLOAD); 798 ZFCP_DBF_SAN_MAX_PAYLOAD);
788 debug_event(adapter->san_dbf, level, r, sizeof(*r)); 799 debug_event(dbf->san_dbf, level, r, sizeof(*r));
789 zfcp_dbf_hexdump(adapter->san_dbf, r, sizeof(*r), level, 800 zfcp_dbf_hexdump(dbf->san_dbf, r, sizeof(*r), level,
790 (void *)hdr + sizeof(struct ct_hdr), rct->len); 801 (void *)hdr + sizeof(struct ct_hdr), rct->len);
791 spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); 802 spin_unlock_irqrestore(&dbf->san_dbf_lock, flags);
792} 803}
793 804
794static void zfcp_san_dbf_event_els(const char *tag, int level, 805static void zfcp_san_dbf_event_els(const char *tag, int level,
@@ -797,10 +808,11 @@ static void zfcp_san_dbf_event_els(const char *tag, int level,
797 int buflen) 808 int buflen)
798{ 809{
799 struct zfcp_adapter *adapter = fsf_req->adapter; 810 struct zfcp_adapter *adapter = fsf_req->adapter;
800 struct zfcp_san_dbf_record *rec = &adapter->san_dbf_buf; 811 struct zfcp_dbf *dbf = adapter->dbf;
812 struct zfcp_san_dbf_record *rec = &dbf->san_dbf_buf;
801 unsigned long flags; 813 unsigned long flags;
802 814
803 spin_lock_irqsave(&adapter->san_dbf_lock, flags); 815 spin_lock_irqsave(&dbf->san_dbf_lock, flags);
804 memset(rec, 0, sizeof(*rec)); 816 memset(rec, 0, sizeof(*rec));
805 strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE); 817 strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE);
806 rec->fsf_reqid = fsf_req->req_id; 818 rec->fsf_reqid = fsf_req->req_id;
@@ -808,10 +820,10 @@ static void zfcp_san_dbf_event_els(const char *tag, int level,
808 rec->s_id = s_id; 820 rec->s_id = s_id;
809 rec->d_id = d_id; 821 rec->d_id = d_id;
810 rec->u.els.ls_code = ls_code; 822 rec->u.els.ls_code = ls_code;
811 debug_event(adapter->san_dbf, level, rec, sizeof(*rec)); 823 debug_event(dbf->san_dbf, level, rec, sizeof(*rec));
812 zfcp_dbf_hexdump(adapter->san_dbf, rec, sizeof(*rec), level, 824 zfcp_dbf_hexdump(dbf->san_dbf, rec, sizeof(*rec), level,
813 buffer, min(buflen, ZFCP_DBF_SAN_MAX_PAYLOAD)); 825 buffer, min(buflen, ZFCP_DBF_SAN_MAX_PAYLOAD));
814 spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); 826 spin_unlock_irqrestore(&dbf->san_dbf_lock, flags);
815} 827}
816 828
817/** 829/**
@@ -915,14 +927,15 @@ static void zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level,
915 struct zfcp_fsf_req *fsf_req, 927 struct zfcp_fsf_req *fsf_req,
916 unsigned long old_req_id) 928 unsigned long old_req_id)
917{ 929{
918 struct zfcp_scsi_dbf_record *rec = &adapter->scsi_dbf_buf; 930 struct zfcp_dbf *dbf = adapter->dbf;
931 struct zfcp_scsi_dbf_record *rec = &dbf->scsi_dbf_buf;
919 struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec; 932 struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec;
920 unsigned long flags; 933 unsigned long flags;
921 struct fcp_rsp_iu *fcp_rsp; 934 struct fcp_rsp_iu *fcp_rsp;
922 char *fcp_rsp_info = NULL, *fcp_sns_info = NULL; 935 char *fcp_rsp_info = NULL, *fcp_sns_info = NULL;
923 int offset = 0, buflen = 0; 936 int offset = 0, buflen = 0;
924 937
925 spin_lock_irqsave(&adapter->scsi_dbf_lock, flags); 938 spin_lock_irqsave(&dbf->scsi_dbf_lock, flags);
926 do { 939 do {
927 memset(rec, 0, sizeof(*rec)); 940 memset(rec, 0, sizeof(*rec));
928 if (offset == 0) { 941 if (offset == 0) {
@@ -981,9 +994,9 @@ static void zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level,
981 memcpy(dump->data, fcp_sns_info + offset, dump->size); 994 memcpy(dump->data, fcp_sns_info + offset, dump->size);
982 offset += dump->size; 995 offset += dump->size;
983 } 996 }
984 debug_event(adapter->scsi_dbf, level, rec, sizeof(*rec)); 997 debug_event(dbf->scsi_dbf, level, rec, sizeof(*rec));
985 } while (offset < buflen); 998 } while (offset < buflen);
986 spin_unlock_irqrestore(&adapter->scsi_dbf_lock, flags); 999 spin_unlock_irqrestore(&dbf->scsi_dbf_lock, flags);
987} 1000}
988 1001
989/** 1002/**
@@ -1087,6 +1100,22 @@ static struct debug_view zfcp_scsi_dbf_view = {
1087 NULL 1100 NULL
1088}; 1101};
1089 1102
1103static debug_info_t *zfcp_dbf_reg(const char *name, int level,
1104 struct debug_view *view, int size)
1105{
1106 struct debug_info *d;
1107
1108 d = debug_register(name, dbfsize, level, size);
1109 if (!d)
1110 return NULL;
1111
1112 debug_register_view(d, &debug_hex_ascii_view);
1113 debug_register_view(d, view);
1114 debug_set_level(d, level);
1115
1116 return d;
1117}
1118
1090/** 1119/**
1091 * zfcp_adapter_debug_register - registers debug feature for an adapter 1120 * zfcp_adapter_debug_register - registers debug feature for an adapter
1092 * @adapter: pointer to adapter for which debug features should be registered 1121 * @adapter: pointer to adapter for which debug features should be registered
@@ -1095,52 +1124,56 @@ static struct debug_view zfcp_scsi_dbf_view = {
1095int zfcp_adapter_debug_register(struct zfcp_adapter *adapter) 1124int zfcp_adapter_debug_register(struct zfcp_adapter *adapter)
1096{ 1125{
1097 char dbf_name[DEBUG_MAX_NAME_LEN]; 1126 char dbf_name[DEBUG_MAX_NAME_LEN];
1127 struct zfcp_dbf *dbf;
1128
1129 dbf = kmalloc(sizeof(struct zfcp_dbf), GFP_KERNEL);
1130 if (!dbf)
1131 return -ENOMEM;
1132
1133 spin_lock_init(&dbf->hba_dbf_lock);
1134 spin_lock_init(&dbf->san_dbf_lock);
1135 spin_lock_init(&dbf->scsi_dbf_lock);
1136 spin_lock_init(&dbf->rec_dbf_lock);
1098 1137
1099 /* debug feature area which records recovery activity */ 1138 /* debug feature area which records recovery activity */
1100 sprintf(dbf_name, "zfcp_%s_rec", dev_name(&adapter->ccw_device->dev)); 1139 sprintf(dbf_name, "zfcp_%s_rec", dev_name(&adapter->ccw_device->dev));
1101 adapter->rec_dbf = debug_register(dbf_name, dbfsize, 1, 1140 dbf->rec_dbf = zfcp_dbf_reg(dbf_name, 3, &zfcp_rec_dbf_view,
1102 sizeof(struct zfcp_rec_dbf_record)); 1141 sizeof(struct zfcp_rec_dbf_record));
1103 if (!adapter->rec_dbf) 1142 if (!dbf->rec_dbf)
1104 goto failed; 1143 goto fail_rec;
1105 debug_register_view(adapter->rec_dbf, &debug_hex_ascii_view);
1106 debug_register_view(adapter->rec_dbf, &zfcp_rec_dbf_view);
1107 debug_set_level(adapter->rec_dbf, 3);
1108 1144
1109 /* debug feature area which records HBA (FSF and QDIO) conditions */ 1145 /* debug feature area which records HBA (FSF and QDIO) conditions */
1110 sprintf(dbf_name, "zfcp_%s_hba", dev_name(&adapter->ccw_device->dev)); 1146 sprintf(dbf_name, "zfcp_%s_hba", dev_name(&adapter->ccw_device->dev));
1111 adapter->hba_dbf = debug_register(dbf_name, dbfsize, 1, 1147 dbf->hba_dbf = zfcp_dbf_reg(dbf_name, 3, &zfcp_hba_dbf_view,
1112 sizeof(struct zfcp_hba_dbf_record)); 1148 sizeof(struct zfcp_hba_dbf_record));
1113 if (!adapter->hba_dbf) 1149 if (!dbf->hba_dbf)
1114 goto failed; 1150 goto fail_hba;
1115 debug_register_view(adapter->hba_dbf, &debug_hex_ascii_view);
1116 debug_register_view(adapter->hba_dbf, &zfcp_hba_dbf_view);
1117 debug_set_level(adapter->hba_dbf, 3);
1118 1151
1119 /* debug feature area which records SAN command failures and recovery */ 1152 /* debug feature area which records SAN command failures and recovery */
1120 sprintf(dbf_name, "zfcp_%s_san", dev_name(&adapter->ccw_device->dev)); 1153 sprintf(dbf_name, "zfcp_%s_san", dev_name(&adapter->ccw_device->dev));
1121 adapter->san_dbf = debug_register(dbf_name, dbfsize, 1, 1154 dbf->san_dbf = zfcp_dbf_reg(dbf_name, 6, &zfcp_san_dbf_view,
1122 sizeof(struct zfcp_san_dbf_record)); 1155 sizeof(struct zfcp_san_dbf_record));
1123 if (!adapter->san_dbf) 1156 if (!dbf->san_dbf)
1124 goto failed; 1157 goto fail_san;
1125 debug_register_view(adapter->san_dbf, &debug_hex_ascii_view);
1126 debug_register_view(adapter->san_dbf, &zfcp_san_dbf_view);
1127 debug_set_level(adapter->san_dbf, 6);
1128 1158
1129 /* debug feature area which records SCSI command failures and recovery */ 1159 /* debug feature area which records SCSI command failures and recovery */
1130 sprintf(dbf_name, "zfcp_%s_scsi", dev_name(&adapter->ccw_device->dev)); 1160 sprintf(dbf_name, "zfcp_%s_scsi", dev_name(&adapter->ccw_device->dev));
1131 adapter->scsi_dbf = debug_register(dbf_name, dbfsize, 1, 1161 dbf->scsi_dbf = zfcp_dbf_reg(dbf_name, 3, &zfcp_scsi_dbf_view,
1132 sizeof(struct zfcp_scsi_dbf_record)); 1162 sizeof(struct zfcp_scsi_dbf_record));
1133 if (!adapter->scsi_dbf) 1163 if (!dbf->scsi_dbf)
1134 goto failed; 1164 goto fail_scsi;
1135 debug_register_view(adapter->scsi_dbf, &debug_hex_ascii_view);
1136 debug_register_view(adapter->scsi_dbf, &zfcp_scsi_dbf_view);
1137 debug_set_level(adapter->scsi_dbf, 3);
1138 1165
1166 adapter->dbf = dbf;
1139 return 0; 1167 return 0;
1140 1168
1141 failed: 1169fail_scsi:
1142 zfcp_adapter_debug_unregister(adapter); 1170 debug_unregister(dbf->san_dbf);
1143 1171fail_san:
1172 debug_unregister(dbf->hba_dbf);
1173fail_hba:
1174 debug_unregister(dbf->rec_dbf);
1175fail_rec:
1176 kfree(dbf);
1144 return -ENOMEM; 1177 return -ENOMEM;
1145} 1178}
1146 1179
@@ -1150,12 +1183,10 @@ int zfcp_adapter_debug_register(struct zfcp_adapter *adapter)
1150 */ 1183 */
1151void zfcp_adapter_debug_unregister(struct zfcp_adapter *adapter) 1184void zfcp_adapter_debug_unregister(struct zfcp_adapter *adapter)
1152{ 1185{
1153 debug_unregister(adapter->scsi_dbf); 1186 debug_unregister(adapter->dbf->scsi_dbf);
1154 debug_unregister(adapter->san_dbf); 1187 debug_unregister(adapter->dbf->san_dbf);
1155 debug_unregister(adapter->hba_dbf); 1188 debug_unregister(adapter->dbf->hba_dbf);
1156 debug_unregister(adapter->rec_dbf); 1189 debug_unregister(adapter->dbf->rec_dbf);
1157 adapter->scsi_dbf = NULL; 1190 kfree(adapter->dbf);
1158 adapter->san_dbf = NULL; 1191 adapter->dbf = NULL;
1159 adapter->hba_dbf = NULL;
1160 adapter->rec_dbf = NULL;
1161} 1192}
diff --git a/drivers/s390/scsi/zfcp_dbf.h b/drivers/s390/scsi/zfcp_dbf.h
index a573f7344dd6..4cfd68fe8a26 100644
--- a/drivers/s390/scsi/zfcp_dbf.h
+++ b/drivers/s390/scsi/zfcp_dbf.h
@@ -2,7 +2,7 @@
2 * This file is part of the zfcp device driver for 2 * This file is part of the zfcp device driver for
3 * FCP adapters for IBM System z9 and zSeries. 3 * FCP adapters for IBM System z9 and zSeries.
4 * 4 *
5 * Copyright IBM Corp. 2008, 2008 5 * Copyright IBM Corp. 2008, 2009
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -222,4 +222,19 @@ struct zfcp_scsi_dbf_record {
222 u8 sns_info[ZFCP_DBF_SCSI_FCP_SNS_INFO]; 222 u8 sns_info[ZFCP_DBF_SCSI_FCP_SNS_INFO];
223} __attribute__ ((packed)); 223} __attribute__ ((packed));
224 224
225struct zfcp_dbf {
226 debug_info_t *rec_dbf;
227 debug_info_t *hba_dbf;
228 debug_info_t *san_dbf;
229 debug_info_t *scsi_dbf;
230 spinlock_t rec_dbf_lock;
231 spinlock_t hba_dbf_lock;
232 spinlock_t san_dbf_lock;
233 spinlock_t scsi_dbf_lock;
234 struct zfcp_rec_dbf_record rec_dbf_buf;
235 struct zfcp_hba_dbf_record hba_dbf_buf;
236 struct zfcp_san_dbf_record san_dbf_buf;
237 struct zfcp_scsi_dbf_record scsi_dbf_buf;
238};
239
225#endif /* ZFCP_DBF_H */ 240#endif /* ZFCP_DBF_H */
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 49d0532bca1c..601f5a575def 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -37,10 +37,8 @@
37#include <asm/debug.h> 37#include <asm/debug.h>
38#include <asm/ebcdic.h> 38#include <asm/ebcdic.h>
39#include <asm/sysinfo.h> 39#include <asm/sysinfo.h>
40#include "zfcp_dbf.h"
41#include "zfcp_fsf.h" 40#include "zfcp_fsf.h"
42 41
43
44/********************* GENERAL DEFINES *********************************/ 42/********************* GENERAL DEFINES *********************************/
45 43
46#define REQUEST_LIST_SIZE 128 44#define REQUEST_LIST_SIZE 128
@@ -468,18 +466,7 @@ struct zfcp_adapter {
468 u32 erp_low_mem_count; /* nr of erp actions waiting 466 u32 erp_low_mem_count; /* nr of erp actions waiting
469 for memory */ 467 for memory */
470 struct zfcp_wka_ports *gs; /* generic services */ 468 struct zfcp_wka_ports *gs; /* generic services */
471 debug_info_t *rec_dbf; 469 struct zfcp_dbf *dbf; /* debug traces */
472 debug_info_t *hba_dbf;
473 debug_info_t *san_dbf; /* debug feature areas */
474 debug_info_t *scsi_dbf;
475 spinlock_t rec_dbf_lock;
476 spinlock_t hba_dbf_lock;
477 spinlock_t san_dbf_lock;
478 spinlock_t scsi_dbf_lock;
479 struct zfcp_rec_dbf_record rec_dbf_buf;
480 struct zfcp_hba_dbf_record hba_dbf_buf;
481 struct zfcp_san_dbf_record san_dbf_buf;
482 struct zfcp_scsi_dbf_record scsi_dbf_buf;
483 struct zfcp_adapter_mempool pool; /* Adapter memory pools */ 470 struct zfcp_adapter_mempool pool; /* Adapter memory pools */
484 struct qdio_initialize qdio_init_data; /* for qdio_establish */ 471 struct qdio_initialize qdio_init_data; /* for qdio_establish */
485 struct fc_host_statistics *fc_stats; 472 struct fc_host_statistics *fc_stats;
diff --git a/drivers/s390/scsi/zfcp_fsf.h b/drivers/s390/scsi/zfcp_fsf.h
index df7f232faba8..dcc7c1dbcf58 100644
--- a/drivers/s390/scsi/zfcp_fsf.h
+++ b/drivers/s390/scsi/zfcp_fsf.h
@@ -3,13 +3,14 @@
3 * 3 *
4 * Interface to the FSF support functions. 4 * Interface to the FSF support functions.
5 * 5 *
6 * Copyright IBM Corporation 2002, 2008 6 * Copyright IBM Corporation 2002, 2009
7 */ 7 */
8 8
9#ifndef FSF_H 9#ifndef FSF_H
10#define FSF_H 10#define FSF_H
11 11
12#include <linux/pfn.h> 12#include <linux/pfn.h>
13#include <linux/scatterlist.h>
13 14
14#define FSF_QTCB_CURRENT_VERSION 0x00000001 15#define FSF_QTCB_CURRENT_VERSION 0x00000001
15 16