4 * Debug traces for zfcp.
6 * Copyright IBM Corp. 2002, 2017
9 #define KMSG_COMPONENT "zfcp"
10 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
12 #include <linux/module.h>
13 #include <linux/ctype.h>
14 #include <linux/slab.h>
15 #include <asm/debug.h>
20 static u32 dbfsize = 4;
22 module_param(dbfsize, uint, 0400);
23 MODULE_PARM_DESC(dbfsize,
24 "number of pages for each debug feature area (default 4)");
26 static inline unsigned int zfcp_dbf_plen(unsigned int offset)
28 return sizeof(struct zfcp_dbf_pay) + offset - ZFCP_DBF_PAY_MAX_REC;
32 void zfcp_dbf_pl_write(struct zfcp_dbf *dbf, void *data, u16 length, char *area,
35 struct zfcp_dbf_pay *pl = &dbf->pay_buf;
36 u16 offset = 0, rec_length;
38 spin_lock(&dbf->pay_lock);
39 memset(pl, 0, sizeof(*pl));
40 pl->fsf_req_id = req_id;
41 memcpy(pl->area, area, ZFCP_DBF_TAG_LEN);
43 while (offset < length) {
44 rec_length = min((u16) ZFCP_DBF_PAY_MAX_REC,
45 (u16) (length - offset));
46 memcpy(pl->data, data + offset, rec_length);
47 debug_event(dbf->pay, 1, pl, zfcp_dbf_plen(rec_length));
53 spin_unlock(&dbf->pay_lock);
57 * zfcp_dbf_hba_fsf_res - trace event for fsf responses
58 * @tag: tag indicating which kind of unsolicited status has been received
59 * @req: request for which a response was received
61 void zfcp_dbf_hba_fsf_res(char *tag, int level, struct zfcp_fsf_req *req)
63 struct zfcp_dbf *dbf = req->adapter->dbf;
64 struct fsf_qtcb_prefix *q_pref = &req->qtcb->prefix;
65 struct fsf_qtcb_header *q_head = &req->qtcb->header;
66 struct zfcp_dbf_hba *rec = &dbf->hba_buf;
69 spin_lock_irqsave(&dbf->hba_lock, flags);
70 memset(rec, 0, sizeof(*rec));
72 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
73 rec->id = ZFCP_DBF_HBA_RES;
74 rec->fsf_req_id = req->req_id;
75 rec->fsf_req_status = req->status;
76 rec->fsf_cmd = req->fsf_command;
77 rec->fsf_seq_no = req->seq_no;
78 rec->u.res.req_issued = req->issued;
79 rec->u.res.prot_status = q_pref->prot_status;
80 rec->u.res.fsf_status = q_head->fsf_status;
81 rec->u.res.port_handle = q_head->port_handle;
82 rec->u.res.lun_handle = q_head->lun_handle;
84 memcpy(rec->u.res.prot_status_qual, &q_pref->prot_status_qual,
85 FSF_PROT_STATUS_QUAL_SIZE);
86 memcpy(rec->u.res.fsf_status_qual, &q_head->fsf_status_qual,
87 FSF_STATUS_QUALIFIER_SIZE);
89 if (req->fsf_command != FSF_QTCB_FCP_CMND) {
90 rec->pl_len = q_head->log_length;
91 zfcp_dbf_pl_write(dbf, (char *)q_pref + q_head->log_start,
92 rec->pl_len, "fsf_res", req->req_id);
95 debug_event(dbf->hba, level, rec, sizeof(*rec));
96 spin_unlock_irqrestore(&dbf->hba_lock, flags);
100 * zfcp_dbf_hba_fsf_uss - trace event for an unsolicited status buffer
101 * @tag: tag indicating which kind of unsolicited status has been received
102 * @req: request providing the unsolicited status
104 void zfcp_dbf_hba_fsf_uss(char *tag, struct zfcp_fsf_req *req)
106 struct zfcp_dbf *dbf = req->adapter->dbf;
107 struct fsf_status_read_buffer *srb = req->data;
108 struct zfcp_dbf_hba *rec = &dbf->hba_buf;
111 spin_lock_irqsave(&dbf->hba_lock, flags);
112 memset(rec, 0, sizeof(*rec));
114 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
115 rec->id = ZFCP_DBF_HBA_USS;
116 rec->fsf_req_id = req->req_id;
117 rec->fsf_req_status = req->status;
118 rec->fsf_cmd = req->fsf_command;
123 rec->u.uss.status_type = srb->status_type;
124 rec->u.uss.status_subtype = srb->status_subtype;
125 rec->u.uss.d_id = ntoh24(srb->d_id);
126 rec->u.uss.lun = srb->fcp_lun;
127 memcpy(&rec->u.uss.queue_designator, &srb->queue_designator,
128 sizeof(rec->u.uss.queue_designator));
130 /* status read buffer payload length */
131 rec->pl_len = (!srb->length) ? 0 : srb->length -
132 offsetof(struct fsf_status_read_buffer, payload);
135 zfcp_dbf_pl_write(dbf, srb->payload.data, rec->pl_len,
136 "fsf_uss", req->req_id);
138 debug_event(dbf->hba, 2, rec, sizeof(*rec));
139 spin_unlock_irqrestore(&dbf->hba_lock, flags);
143 * zfcp_dbf_hba_bit_err - trace event for bit error conditions
144 * @tag: tag indicating which kind of unsolicited status has been received
145 * @req: request which caused the bit_error condition
147 void zfcp_dbf_hba_bit_err(char *tag, struct zfcp_fsf_req *req)
149 struct zfcp_dbf *dbf = req->adapter->dbf;
150 struct zfcp_dbf_hba *rec = &dbf->hba_buf;
151 struct fsf_status_read_buffer *sr_buf = req->data;
154 spin_lock_irqsave(&dbf->hba_lock, flags);
155 memset(rec, 0, sizeof(*rec));
157 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
158 rec->id = ZFCP_DBF_HBA_BIT;
159 rec->fsf_req_id = req->req_id;
160 rec->fsf_req_status = req->status;
161 rec->fsf_cmd = req->fsf_command;
162 memcpy(&rec->u.be, &sr_buf->payload.bit_error,
163 sizeof(struct fsf_bit_error_payload));
165 debug_event(dbf->hba, 1, rec, sizeof(*rec));
166 spin_unlock_irqrestore(&dbf->hba_lock, flags);
170 * zfcp_dbf_hba_def_err - trace event for deferred error messages
171 * @adapter: pointer to struct zfcp_adapter
172 * @req_id: request id which caused the deferred error message
173 * @scount: number of sbals incl. the signaling sbal
174 * @pl: array of all involved sbals
176 void zfcp_dbf_hba_def_err(struct zfcp_adapter *adapter, u64 req_id, u16 scount,
179 struct zfcp_dbf *dbf = adapter->dbf;
180 struct zfcp_dbf_pay *payload = &dbf->pay_buf;
187 spin_lock_irqsave(&dbf->pay_lock, flags);
188 memset(payload, 0, sizeof(*payload));
190 memcpy(payload->area, "def_err", 7);
191 payload->fsf_req_id = req_id;
192 payload->counter = 0;
193 length = min((u16)sizeof(struct qdio_buffer),
194 (u16)ZFCP_DBF_PAY_MAX_REC);
196 while (payload->counter < scount && (char *)pl[payload->counter]) {
197 memcpy(payload->data, (char *)pl[payload->counter], length);
198 debug_event(dbf->pay, 1, payload, zfcp_dbf_plen(length));
202 spin_unlock_irqrestore(&dbf->pay_lock, flags);
206 * zfcp_dbf_hba_basic - trace event for basic adapter events
207 * @adapter: pointer to struct zfcp_adapter
209 void zfcp_dbf_hba_basic(char *tag, struct zfcp_adapter *adapter)
211 struct zfcp_dbf *dbf = adapter->dbf;
212 struct zfcp_dbf_hba *rec = &dbf->hba_buf;
215 spin_lock_irqsave(&dbf->hba_lock, flags);
216 memset(rec, 0, sizeof(*rec));
218 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
219 rec->id = ZFCP_DBF_HBA_BASIC;
221 debug_event(dbf->hba, 1, rec, sizeof(*rec));
222 spin_unlock_irqrestore(&dbf->hba_lock, flags);
225 static void zfcp_dbf_set_common(struct zfcp_dbf_rec *rec,
226 struct zfcp_adapter *adapter,
227 struct zfcp_port *port,
228 struct scsi_device *sdev)
230 rec->adapter_status = atomic_read(&adapter->status);
232 rec->port_status = atomic_read(&port->status);
233 rec->wwpn = port->wwpn;
234 rec->d_id = port->d_id;
237 rec->lun_status = atomic_read(&sdev_to_zfcp(sdev)->status);
238 rec->lun = zfcp_scsi_dev_lun(sdev);
240 rec->lun = ZFCP_DBF_INVALID_LUN;
244 * zfcp_dbf_rec_trig - trace event related to triggered recovery
245 * @tag: identifier for event
246 * @adapter: adapter on which the erp_action should run
247 * @port: remote port involved in the erp_action
248 * @sdev: scsi device involved in the erp_action
249 * @want: wanted erp_action
250 * @need: required erp_action
252 * The adapter->erp_lock has to be held.
254 void zfcp_dbf_rec_trig(char *tag, struct zfcp_adapter *adapter,
255 struct zfcp_port *port, struct scsi_device *sdev,
258 struct zfcp_dbf *dbf = adapter->dbf;
259 struct zfcp_dbf_rec *rec = &dbf->rec_buf;
260 struct list_head *entry;
263 spin_lock_irqsave(&dbf->rec_lock, flags);
264 memset(rec, 0, sizeof(*rec));
266 rec->id = ZFCP_DBF_REC_TRIG;
267 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
268 zfcp_dbf_set_common(rec, adapter, port, sdev);
270 list_for_each(entry, &adapter->erp_ready_head)
273 list_for_each(entry, &adapter->erp_running_head)
274 rec->u.trig.running++;
276 rec->u.trig.want = want;
277 rec->u.trig.need = need;
279 debug_event(dbf->rec, 1, rec, sizeof(*rec));
280 spin_unlock_irqrestore(&dbf->rec_lock, flags);
285 * zfcp_dbf_rec_run_lvl - trace event related to running recovery
286 * @level: trace level to be used for event
287 * @tag: identifier for event
288 * @erp: erp_action running
290 void zfcp_dbf_rec_run_lvl(int level, char *tag, struct zfcp_erp_action *erp)
292 struct zfcp_dbf *dbf = erp->adapter->dbf;
293 struct zfcp_dbf_rec *rec = &dbf->rec_buf;
296 spin_lock_irqsave(&dbf->rec_lock, flags);
297 memset(rec, 0, sizeof(*rec));
299 rec->id = ZFCP_DBF_REC_RUN;
300 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
301 zfcp_dbf_set_common(rec, erp->adapter, erp->port, erp->sdev);
303 rec->u.run.fsf_req_id = erp->fsf_req_id;
304 rec->u.run.rec_status = erp->status;
305 rec->u.run.rec_step = erp->step;
306 rec->u.run.rec_action = erp->action;
309 rec->u.run.rec_count =
310 atomic_read(&sdev_to_zfcp(erp->sdev)->erp_counter);
312 rec->u.run.rec_count = atomic_read(&erp->port->erp_counter);
314 rec->u.run.rec_count = atomic_read(&erp->adapter->erp_counter);
316 debug_event(dbf->rec, level, rec, sizeof(*rec));
317 spin_unlock_irqrestore(&dbf->rec_lock, flags);
321 * zfcp_dbf_rec_run - trace event related to running recovery
322 * @tag: identifier for event
323 * @erp: erp_action running
325 void zfcp_dbf_rec_run(char *tag, struct zfcp_erp_action *erp)
327 zfcp_dbf_rec_run_lvl(1, tag, erp);
331 * zfcp_dbf_rec_run_wka - trace wka port event with info like running recovery
332 * @tag: identifier for event
333 * @wka_port: well known address port
334 * @req_id: request ID to correlate with potential HBA trace record
336 void zfcp_dbf_rec_run_wka(char *tag, struct zfcp_fc_wka_port *wka_port,
339 struct zfcp_dbf *dbf = wka_port->adapter->dbf;
340 struct zfcp_dbf_rec *rec = &dbf->rec_buf;
343 spin_lock_irqsave(&dbf->rec_lock, flags);
344 memset(rec, 0, sizeof(*rec));
346 rec->id = ZFCP_DBF_REC_RUN;
347 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
348 rec->port_status = wka_port->status;
349 rec->d_id = wka_port->d_id;
350 rec->lun = ZFCP_DBF_INVALID_LUN;
352 rec->u.run.fsf_req_id = req_id;
353 rec->u.run.rec_status = ~0;
354 rec->u.run.rec_step = ~0;
355 rec->u.run.rec_action = ~0;
356 rec->u.run.rec_count = ~0;
358 debug_event(dbf->rec, 1, rec, sizeof(*rec));
359 spin_unlock_irqrestore(&dbf->rec_lock, flags);
363 void zfcp_dbf_san(char *tag, struct zfcp_dbf *dbf,
364 char *paytag, struct scatterlist *sg, u8 id, u16 len,
365 u64 req_id, u32 d_id, u16 cap_len)
367 struct zfcp_dbf_san *rec = &dbf->san_buf;
370 struct zfcp_dbf_pay *payload = &dbf->pay_buf;
373 spin_lock_irqsave(&dbf->san_lock, flags);
374 memset(rec, 0, sizeof(*rec));
377 rec->fsf_req_id = req_id;
379 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
380 rec->pl_len = len; /* full length even if we cap pay below */
383 rec_len = min_t(unsigned int, sg->length, ZFCP_DBF_SAN_MAX_PAYLOAD);
384 memcpy(rec->payload, sg_virt(sg), rec_len); /* part of 1st sg entry */
386 goto out; /* skip pay record if full content in rec->payload */
388 /* if (len > rec_len):
389 * dump data up to cap_len ignoring small duplicate in rec->payload
391 spin_lock(&dbf->pay_lock);
392 memset(payload, 0, sizeof(*payload));
393 memcpy(payload->area, paytag, ZFCP_DBF_TAG_LEN);
394 payload->fsf_req_id = req_id;
395 payload->counter = 0;
396 for (; sg && pay_sum < cap_len; sg = sg_next(sg)) {
397 u16 pay_len, offset = 0;
399 while (offset < sg->length && pay_sum < cap_len) {
400 pay_len = min((u16)ZFCP_DBF_PAY_MAX_REC,
401 (u16)(sg->length - offset));
402 /* cap_len <= pay_sum < cap_len+ZFCP_DBF_PAY_MAX_REC */
403 memcpy(payload->data, sg_virt(sg) + offset, pay_len);
404 debug_event(dbf->pay, 1, payload,
405 zfcp_dbf_plen(pay_len));
411 spin_unlock(&dbf->pay_lock);
414 debug_event(dbf->san, 1, rec, sizeof(*rec));
415 spin_unlock_irqrestore(&dbf->san_lock, flags);
419 * zfcp_dbf_san_req - trace event for issued SAN request
420 * @tag: indentifier for event
421 * @fsf_req: request containing issued CT data
422 * d_id: destination ID
424 void zfcp_dbf_san_req(char *tag, struct zfcp_fsf_req *fsf, u32 d_id)
426 struct zfcp_dbf *dbf = fsf->adapter->dbf;
427 struct zfcp_fsf_ct_els *ct_els = fsf->data;
430 length = (u16)zfcp_qdio_real_bytes(ct_els->req);
431 zfcp_dbf_san(tag, dbf, "san_req", ct_els->req, ZFCP_DBF_SAN_REQ,
432 length, fsf->req_id, d_id, length);
435 static u16 zfcp_dbf_san_res_cap_len_if_gpn_ft(char *tag,
436 struct zfcp_fsf_req *fsf,
439 struct zfcp_fsf_ct_els *ct_els = fsf->data;
440 struct fc_ct_hdr *reqh = sg_virt(ct_els->req);
441 struct fc_ns_gid_ft *reqn = (struct fc_ns_gid_ft *)(reqh + 1);
442 struct scatterlist *resp_entry = ct_els->resp;
443 struct fc_ct_hdr *resph;
444 struct fc_gpn_ft_resp *acc;
445 int max_entries, x, last = 0;
447 if (!(memcmp(tag, "fsscth2", 7) == 0
448 && ct_els->d_id == FC_FID_DIR_SERV
449 && reqh->ct_rev == FC_CT_REV
450 && reqh->ct_in_id[0] == 0
451 && reqh->ct_in_id[1] == 0
452 && reqh->ct_in_id[2] == 0
453 && reqh->ct_fs_type == FC_FST_DIR
454 && reqh->ct_fs_subtype == FC_NS_SUBTYPE
455 && reqh->ct_options == 0
456 && reqh->_ct_resvd1 == 0
457 && reqh->ct_cmd == FC_NS_GPN_FT
458 /* reqh->ct_mr_size can vary so do not match but read below */
459 && reqh->_ct_resvd2 == 0
460 && reqh->ct_reason == 0
461 && reqh->ct_explan == 0
462 && reqh->ct_vendor == 0
463 && reqn->fn_resvd == 0
464 && reqn->fn_domain_id_scope == 0
465 && reqn->fn_area_id_scope == 0
466 && reqn->fn_fc4_type == FC_TYPE_FCP))
467 return len; /* not GPN_FT response so do not cap */
469 acc = sg_virt(resp_entry);
471 /* cap all but accept CT responses to at least the CT header */
472 resph = (struct fc_ct_hdr *)acc;
473 if ((ct_els->status) ||
474 (resph->ct_cmd != cpu_to_be16(FC_FS_ACC)))
475 return max(FC_CT_HDR_LEN, ZFCP_DBF_SAN_MAX_PAYLOAD);
477 max_entries = (reqh->ct_mr_size * 4 / sizeof(struct fc_gpn_ft_resp))
478 + 1 /* zfcp_fc_scan_ports: bytes correct, entries off-by-one
479 * to account for header as 1st pseudo "entry" */;
481 /* the basic CT_IU preamble is the same size as one entry in the GPN_FT
482 * response, allowing us to skip special handling for it - just skip it
484 for (x = 1; x < max_entries && !last; x++) {
485 if (x % (ZFCP_FC_GPN_FT_ENT_PAGE + 1))
488 acc = sg_virt(++resp_entry);
490 last = acc->fp_flags & FC_NS_FID_LAST;
492 len = min(len, (u16)(x * sizeof(struct fc_gpn_ft_resp)));
493 return len; /* cap after last entry */
497 * zfcp_dbf_san_res - trace event for received SAN request
498 * @tag: indentifier for event
499 * @fsf_req: request containing issued CT data
501 void zfcp_dbf_san_res(char *tag, struct zfcp_fsf_req *fsf)
503 struct zfcp_dbf *dbf = fsf->adapter->dbf;
504 struct zfcp_fsf_ct_els *ct_els = fsf->data;
507 length = (u16)zfcp_qdio_real_bytes(ct_els->resp);
508 zfcp_dbf_san(tag, dbf, "san_res", ct_els->resp, ZFCP_DBF_SAN_RES,
509 length, fsf->req_id, ct_els->d_id,
510 zfcp_dbf_san_res_cap_len_if_gpn_ft(tag, fsf, length));
514 * zfcp_dbf_san_in_els - trace event for incoming ELS
515 * @tag: indentifier for event
516 * @fsf_req: request containing issued CT data
518 void zfcp_dbf_san_in_els(char *tag, struct zfcp_fsf_req *fsf)
520 struct zfcp_dbf *dbf = fsf->adapter->dbf;
521 struct fsf_status_read_buffer *srb =
522 (struct fsf_status_read_buffer *) fsf->data;
524 struct scatterlist sg;
526 length = (u16)(srb->length -
527 offsetof(struct fsf_status_read_buffer, payload));
528 sg_init_one(&sg, srb->payload.data, length);
529 zfcp_dbf_san(tag, dbf, "san_els", &sg, ZFCP_DBF_SAN_ELS, length,
530 fsf->req_id, ntoh24(srb->d_id), length);
534 * zfcp_dbf_scsi - trace event for scsi commands
535 * @tag: identifier for event
536 * @sc: pointer to struct scsi_cmnd
537 * @fsf: pointer to struct zfcp_fsf_req
539 void zfcp_dbf_scsi(char *tag, int level, struct scsi_cmnd *sc,
540 struct zfcp_fsf_req *fsf)
542 struct zfcp_adapter *adapter =
543 (struct zfcp_adapter *) sc->device->host->hostdata[0];
544 struct zfcp_dbf *dbf = adapter->dbf;
545 struct zfcp_dbf_scsi *rec = &dbf->scsi_buf;
546 struct fcp_resp_with_ext *fcp_rsp;
547 struct fcp_resp_rsp_info *fcp_rsp_info;
550 spin_lock_irqsave(&dbf->scsi_lock, flags);
551 memset(rec, 0, sizeof(*rec));
553 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
554 rec->id = ZFCP_DBF_SCSI_CMND;
555 rec->scsi_result = sc->result;
556 rec->scsi_retries = sc->retries;
557 rec->scsi_allowed = sc->allowed;
558 rec->scsi_id = sc->device->id;
559 rec->scsi_lun = sc->device->lun;
560 rec->host_scribble = (unsigned long)sc->host_scribble;
562 memcpy(rec->scsi_opcode, sc->cmnd,
563 min((int)sc->cmd_len, ZFCP_DBF_SCSI_OPCODE));
566 rec->fsf_req_id = fsf->req_id;
567 rec->pl_len = FCP_RESP_WITH_EXT;
568 fcp_rsp = (struct fcp_resp_with_ext *)
569 &(fsf->qtcb->bottom.io.fcp_rsp);
570 /* mandatory parts of FCP_RSP IU in this SCSI record */
571 memcpy(&rec->fcp_rsp, fcp_rsp, FCP_RESP_WITH_EXT);
572 if (fcp_rsp->resp.fr_flags & FCP_RSP_LEN_VAL) {
573 fcp_rsp_info = (struct fcp_resp_rsp_info *) &fcp_rsp[1];
574 rec->fcp_rsp_info = fcp_rsp_info->rsp_code;
575 rec->pl_len += be32_to_cpu(fcp_rsp->ext.fr_rsp_len);
577 if (fcp_rsp->resp.fr_flags & FCP_SNS_LEN_VAL) {
578 rec->pl_len += be32_to_cpu(fcp_rsp->ext.fr_sns_len);
580 /* complete FCP_RSP IU in associated PAYload record
581 * but only if there are optional parts
583 if (fcp_rsp->resp.fr_flags != 0)
586 /* at least one full PAY record
587 * but not beyond hardware response field
589 min_t(u16, max_t(u16, rec->pl_len,
590 ZFCP_DBF_PAY_MAX_REC),
592 "fcp_riu", fsf->req_id);
595 debug_event(dbf->scsi, level, rec, sizeof(*rec));
596 spin_unlock_irqrestore(&dbf->scsi_lock, flags);
599 static debug_info_t *zfcp_dbf_reg(const char *name, int size, int rec_size)
601 struct debug_info *d;
603 d = debug_register(name, size, 1, rec_size);
607 debug_register_view(d, &debug_hex_ascii_view);
608 debug_set_level(d, 3);
613 static void zfcp_dbf_unregister(struct zfcp_dbf *dbf)
618 debug_unregister(dbf->scsi);
619 debug_unregister(dbf->san);
620 debug_unregister(dbf->hba);
621 debug_unregister(dbf->pay);
622 debug_unregister(dbf->rec);
627 * zfcp_adapter_debug_register - registers debug feature for an adapter
628 * @adapter: pointer to adapter for which debug features should be registered
629 * return: -ENOMEM on error, 0 otherwise
631 int zfcp_dbf_adapter_register(struct zfcp_adapter *adapter)
633 char name[DEBUG_MAX_NAME_LEN];
634 struct zfcp_dbf *dbf;
636 dbf = kzalloc(sizeof(struct zfcp_dbf), GFP_KERNEL);
640 spin_lock_init(&dbf->pay_lock);
641 spin_lock_init(&dbf->hba_lock);
642 spin_lock_init(&dbf->san_lock);
643 spin_lock_init(&dbf->scsi_lock);
644 spin_lock_init(&dbf->rec_lock);
646 /* debug feature area which records recovery activity */
647 sprintf(name, "zfcp_%s_rec", dev_name(&adapter->ccw_device->dev));
648 dbf->rec = zfcp_dbf_reg(name, dbfsize, sizeof(struct zfcp_dbf_rec));
652 /* debug feature area which records HBA (FSF and QDIO) conditions */
653 sprintf(name, "zfcp_%s_hba", dev_name(&adapter->ccw_device->dev));
654 dbf->hba = zfcp_dbf_reg(name, dbfsize, sizeof(struct zfcp_dbf_hba));
658 /* debug feature area which records payload info */
659 sprintf(name, "zfcp_%s_pay", dev_name(&adapter->ccw_device->dev));
660 dbf->pay = zfcp_dbf_reg(name, dbfsize * 2, sizeof(struct zfcp_dbf_pay));
664 /* debug feature area which records SAN command failures and recovery */
665 sprintf(name, "zfcp_%s_san", dev_name(&adapter->ccw_device->dev));
666 dbf->san = zfcp_dbf_reg(name, dbfsize, sizeof(struct zfcp_dbf_san));
670 /* debug feature area which records SCSI command failures and recovery */
671 sprintf(name, "zfcp_%s_scsi", dev_name(&adapter->ccw_device->dev));
672 dbf->scsi = zfcp_dbf_reg(name, dbfsize, sizeof(struct zfcp_dbf_scsi));
680 zfcp_dbf_unregister(dbf);
685 * zfcp_adapter_debug_unregister - unregisters debug feature for an adapter
686 * @adapter: pointer to adapter for which debug features should be unregistered
688 void zfcp_dbf_adapter_unregister(struct zfcp_adapter *adapter)
690 struct zfcp_dbf *dbf = adapter->dbf;
693 zfcp_dbf_unregister(dbf);