Lines Matching +full:port +full:- +full:level
1 // SPDX-License-Identifier: GPL-2.0
31 "log level for each debug feature area "
36 return sizeof(struct zfcp_dbf_pay) + offset - ZFCP_DBF_PAY_MAX_REC; in zfcp_dbf_plen()
43 struct zfcp_dbf_pay *pl = &dbf->pay_buf; in zfcp_dbf_pl_write()
46 spin_lock(&dbf->pay_lock); in zfcp_dbf_pl_write()
48 pl->fsf_req_id = req_id; in zfcp_dbf_pl_write()
49 memcpy(pl->area, area, ZFCP_DBF_TAG_LEN); in zfcp_dbf_pl_write()
53 (u16) (length - offset)); in zfcp_dbf_pl_write()
54 memcpy(pl->data, data + offset, rec_length); in zfcp_dbf_pl_write()
55 debug_event(dbf->pay, 1, pl, zfcp_dbf_plen(rec_length)); in zfcp_dbf_pl_write()
58 pl->counter++; in zfcp_dbf_pl_write()
61 spin_unlock(&dbf->pay_lock); in zfcp_dbf_pl_write()
65 * zfcp_dbf_hba_fsf_res - trace event for fsf responses
67 * @level: trace level to be used for event
70 void zfcp_dbf_hba_fsf_res(char *tag, int level, struct zfcp_fsf_req *req) in zfcp_dbf_hba_fsf_res() argument
72 struct zfcp_dbf *dbf = req->adapter->dbf; in zfcp_dbf_hba_fsf_res()
73 struct fsf_qtcb_prefix *q_pref = &req->qtcb->prefix; in zfcp_dbf_hba_fsf_res()
74 struct fsf_qtcb_header *q_head = &req->qtcb->header; in zfcp_dbf_hba_fsf_res()
75 struct zfcp_dbf_hba *rec = &dbf->hba_buf; in zfcp_dbf_hba_fsf_res()
78 spin_lock_irqsave(&dbf->hba_lock, flags); in zfcp_dbf_hba_fsf_res()
81 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); in zfcp_dbf_hba_fsf_res()
82 rec->id = ZFCP_DBF_HBA_RES; in zfcp_dbf_hba_fsf_res()
83 rec->fsf_req_id = req->req_id; in zfcp_dbf_hba_fsf_res()
84 rec->fsf_req_status = req->status; in zfcp_dbf_hba_fsf_res()
85 rec->fsf_cmd = q_head->fsf_command; in zfcp_dbf_hba_fsf_res()
86 rec->fsf_seq_no = q_pref->req_seq_no; in zfcp_dbf_hba_fsf_res()
87 rec->u.res.req_issued = req->issued; in zfcp_dbf_hba_fsf_res()
88 rec->u.res.prot_status = q_pref->prot_status; in zfcp_dbf_hba_fsf_res()
89 rec->u.res.fsf_status = q_head->fsf_status; in zfcp_dbf_hba_fsf_res()
90 rec->u.res.port_handle = q_head->port_handle; in zfcp_dbf_hba_fsf_res()
91 rec->u.res.lun_handle = q_head->lun_handle; in zfcp_dbf_hba_fsf_res()
93 memcpy(rec->u.res.prot_status_qual, &q_pref->prot_status_qual, in zfcp_dbf_hba_fsf_res()
95 memcpy(rec->u.res.fsf_status_qual, &q_head->fsf_status_qual, in zfcp_dbf_hba_fsf_res()
98 rec->pl_len = q_head->log_length; in zfcp_dbf_hba_fsf_res()
99 zfcp_dbf_pl_write(dbf, (char *)q_pref + q_head->log_start, in zfcp_dbf_hba_fsf_res()
100 rec->pl_len, "fsf_res", req->req_id); in zfcp_dbf_hba_fsf_res()
102 debug_event(dbf->hba, level, rec, sizeof(*rec)); in zfcp_dbf_hba_fsf_res()
103 spin_unlock_irqrestore(&dbf->hba_lock, flags); in zfcp_dbf_hba_fsf_res()
107 * zfcp_dbf_hba_fsf_fces - trace event for fsf responses related to
111 * @wwpn: remote port or ZFCP_DBF_INVALID_WWPN
118 struct zfcp_dbf *dbf = req->adapter->dbf; in zfcp_dbf_hba_fsf_fces()
119 struct fsf_qtcb_prefix *q_pref = &req->qtcb->prefix; in zfcp_dbf_hba_fsf_fces()
120 struct fsf_qtcb_header *q_head = &req->qtcb->header; in zfcp_dbf_hba_fsf_fces()
121 struct zfcp_dbf_hba *rec = &dbf->hba_buf; in zfcp_dbf_hba_fsf_fces()
122 static int const level = 3; in zfcp_dbf_hba_fsf_fces() local
125 if (unlikely(!debug_level_enabled(dbf->hba, level))) in zfcp_dbf_hba_fsf_fces()
128 spin_lock_irqsave(&dbf->hba_lock, flags); in zfcp_dbf_hba_fsf_fces()
131 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); in zfcp_dbf_hba_fsf_fces()
132 rec->id = ZFCP_DBF_HBA_FCES; in zfcp_dbf_hba_fsf_fces()
133 rec->fsf_req_id = req->req_id; in zfcp_dbf_hba_fsf_fces()
134 rec->fsf_req_status = req->status; in zfcp_dbf_hba_fsf_fces()
135 rec->fsf_cmd = q_head->fsf_command; in zfcp_dbf_hba_fsf_fces()
136 rec->fsf_seq_no = q_pref->req_seq_no; in zfcp_dbf_hba_fsf_fces()
137 rec->u.fces.req_issued = req->issued; in zfcp_dbf_hba_fsf_fces()
138 rec->u.fces.fsf_status = q_head->fsf_status; in zfcp_dbf_hba_fsf_fces()
139 rec->u.fces.port_handle = q_head->port_handle; in zfcp_dbf_hba_fsf_fces()
140 rec->u.fces.wwpn = wwpn; in zfcp_dbf_hba_fsf_fces()
141 rec->u.fces.fc_security_old = fc_security_old; in zfcp_dbf_hba_fsf_fces()
142 rec->u.fces.fc_security_new = fc_security_new; in zfcp_dbf_hba_fsf_fces()
144 debug_event(dbf->hba, level, rec, sizeof(*rec)); in zfcp_dbf_hba_fsf_fces()
145 spin_unlock_irqrestore(&dbf->hba_lock, flags); in zfcp_dbf_hba_fsf_fces()
149 * zfcp_dbf_hba_fsf_reqid - trace only the tag and a request ID
151 * @level: trace level
155 void zfcp_dbf_hba_fsf_reqid(const char *const tag, const int level, in zfcp_dbf_hba_fsf_reqid() argument
159 struct zfcp_dbf *const dbf = adapter->dbf; in zfcp_dbf_hba_fsf_reqid()
160 struct zfcp_dbf_hba *const rec = &dbf->hba_buf; in zfcp_dbf_hba_fsf_reqid()
161 struct zfcp_dbf_hba_res *const res = &rec->u.res; in zfcp_dbf_hba_fsf_reqid()
164 if (unlikely(!debug_level_enabled(dbf->hba, level))) in zfcp_dbf_hba_fsf_reqid()
167 spin_lock_irqsave(&dbf->hba_lock, flags); in zfcp_dbf_hba_fsf_reqid()
170 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); in zfcp_dbf_hba_fsf_reqid()
172 rec->id = ZFCP_DBF_HBA_RES; in zfcp_dbf_hba_fsf_reqid()
173 rec->fsf_req_id = req_id; in zfcp_dbf_hba_fsf_reqid()
174 rec->fsf_req_status = ~0u; in zfcp_dbf_hba_fsf_reqid()
175 rec->fsf_cmd = ~0u; in zfcp_dbf_hba_fsf_reqid()
176 rec->fsf_seq_no = ~0u; in zfcp_dbf_hba_fsf_reqid()
178 res->req_issued = ~0ull; in zfcp_dbf_hba_fsf_reqid()
179 res->prot_status = ~0u; in zfcp_dbf_hba_fsf_reqid()
180 memset(res->prot_status_qual, 0xff, sizeof(res->prot_status_qual)); in zfcp_dbf_hba_fsf_reqid()
181 res->fsf_status = ~0u; in zfcp_dbf_hba_fsf_reqid()
182 memset(res->fsf_status_qual, 0xff, sizeof(res->fsf_status_qual)); in zfcp_dbf_hba_fsf_reqid()
183 res->port_handle = ~0u; in zfcp_dbf_hba_fsf_reqid()
184 res->lun_handle = ~0u; in zfcp_dbf_hba_fsf_reqid()
186 debug_event(dbf->hba, level, rec, sizeof(*rec)); in zfcp_dbf_hba_fsf_reqid()
187 spin_unlock_irqrestore(&dbf->hba_lock, flags); in zfcp_dbf_hba_fsf_reqid()
191 * zfcp_dbf_hba_fsf_uss - trace event for an unsolicited status buffer
197 struct zfcp_dbf *dbf = req->adapter->dbf; in zfcp_dbf_hba_fsf_uss()
198 struct fsf_status_read_buffer *srb = req->data; in zfcp_dbf_hba_fsf_uss()
199 struct zfcp_dbf_hba *rec = &dbf->hba_buf; in zfcp_dbf_hba_fsf_uss()
200 static int const level = 2; in zfcp_dbf_hba_fsf_uss() local
203 if (unlikely(!debug_level_enabled(dbf->hba, level))) in zfcp_dbf_hba_fsf_uss()
206 spin_lock_irqsave(&dbf->hba_lock, flags); in zfcp_dbf_hba_fsf_uss()
209 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); in zfcp_dbf_hba_fsf_uss()
210 rec->id = ZFCP_DBF_HBA_USS; in zfcp_dbf_hba_fsf_uss()
211 rec->fsf_req_id = req->req_id; in zfcp_dbf_hba_fsf_uss()
212 rec->fsf_req_status = req->status; in zfcp_dbf_hba_fsf_uss()
213 rec->fsf_cmd = FSF_QTCB_UNSOLICITED_STATUS; in zfcp_dbf_hba_fsf_uss()
218 rec->u.uss.status_type = srb->status_type; in zfcp_dbf_hba_fsf_uss()
219 rec->u.uss.status_subtype = srb->status_subtype; in zfcp_dbf_hba_fsf_uss()
220 rec->u.uss.d_id = ntoh24(srb->d_id); in zfcp_dbf_hba_fsf_uss()
221 rec->u.uss.lun = srb->fcp_lun; in zfcp_dbf_hba_fsf_uss()
222 memcpy(&rec->u.uss.queue_designator, &srb->queue_designator, in zfcp_dbf_hba_fsf_uss()
223 sizeof(rec->u.uss.queue_designator)); in zfcp_dbf_hba_fsf_uss()
226 rec->pl_len = (!srb->length) ? 0 : srb->length - in zfcp_dbf_hba_fsf_uss()
229 if (rec->pl_len) in zfcp_dbf_hba_fsf_uss()
230 zfcp_dbf_pl_write(dbf, srb->payload.data, rec->pl_len, in zfcp_dbf_hba_fsf_uss()
231 "fsf_uss", req->req_id); in zfcp_dbf_hba_fsf_uss()
233 debug_event(dbf->hba, level, rec, sizeof(*rec)); in zfcp_dbf_hba_fsf_uss()
234 spin_unlock_irqrestore(&dbf->hba_lock, flags); in zfcp_dbf_hba_fsf_uss()
238 * zfcp_dbf_hba_bit_err - trace event for bit error conditions
244 struct zfcp_dbf *dbf = req->adapter->dbf; in zfcp_dbf_hba_bit_err()
245 struct zfcp_dbf_hba *rec = &dbf->hba_buf; in zfcp_dbf_hba_bit_err()
246 struct fsf_status_read_buffer *sr_buf = req->data; in zfcp_dbf_hba_bit_err()
247 static int const level = 1; in zfcp_dbf_hba_bit_err() local
250 if (unlikely(!debug_level_enabled(dbf->hba, level))) in zfcp_dbf_hba_bit_err()
253 spin_lock_irqsave(&dbf->hba_lock, flags); in zfcp_dbf_hba_bit_err()
256 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); in zfcp_dbf_hba_bit_err()
257 rec->id = ZFCP_DBF_HBA_BIT; in zfcp_dbf_hba_bit_err()
258 rec->fsf_req_id = req->req_id; in zfcp_dbf_hba_bit_err()
259 rec->fsf_req_status = req->status; in zfcp_dbf_hba_bit_err()
260 rec->fsf_cmd = FSF_QTCB_UNSOLICITED_STATUS; in zfcp_dbf_hba_bit_err()
261 memcpy(&rec->u.be, &sr_buf->payload.bit_error, in zfcp_dbf_hba_bit_err()
264 debug_event(dbf->hba, level, rec, sizeof(*rec)); in zfcp_dbf_hba_bit_err()
265 spin_unlock_irqrestore(&dbf->hba_lock, flags); in zfcp_dbf_hba_bit_err()
269 * zfcp_dbf_hba_def_err - trace event for deferred error messages
278 struct zfcp_dbf *dbf = adapter->dbf; in zfcp_dbf_hba_def_err()
279 struct zfcp_dbf_pay *payload = &dbf->pay_buf; in zfcp_dbf_hba_def_err()
281 static int const level = 1; in zfcp_dbf_hba_def_err() local
284 if (unlikely(!debug_level_enabled(dbf->pay, level))) in zfcp_dbf_hba_def_err()
290 spin_lock_irqsave(&dbf->pay_lock, flags); in zfcp_dbf_hba_def_err()
293 memcpy(payload->area, "def_err", 7); in zfcp_dbf_hba_def_err()
294 payload->fsf_req_id = req_id; in zfcp_dbf_hba_def_err()
295 payload->counter = 0; in zfcp_dbf_hba_def_err()
299 while (payload->counter < scount && (char *)pl[payload->counter]) { in zfcp_dbf_hba_def_err()
300 memcpy(payload->data, (char *)pl[payload->counter], length); in zfcp_dbf_hba_def_err()
301 debug_event(dbf->pay, level, payload, zfcp_dbf_plen(length)); in zfcp_dbf_hba_def_err()
302 payload->counter++; in zfcp_dbf_hba_def_err()
305 spin_unlock_irqrestore(&dbf->pay_lock, flags); in zfcp_dbf_hba_def_err()
310 struct zfcp_port *port, in zfcp_dbf_set_common() argument
313 rec->adapter_status = atomic_read(&adapter->status); in zfcp_dbf_set_common()
314 if (port) { in zfcp_dbf_set_common()
315 rec->port_status = atomic_read(&port->status); in zfcp_dbf_set_common()
316 rec->wwpn = port->wwpn; in zfcp_dbf_set_common()
317 rec->d_id = port->d_id; in zfcp_dbf_set_common()
320 rec->lun_status = atomic_read(&sdev_to_zfcp(sdev)->status); in zfcp_dbf_set_common()
321 rec->lun = zfcp_scsi_dev_lun(sdev); in zfcp_dbf_set_common()
323 rec->lun = ZFCP_DBF_INVALID_LUN; in zfcp_dbf_set_common()
327 * zfcp_dbf_rec_trig - trace event related to triggered recovery
330 * @port: remote port involved in the erp_action
335 * The adapter->erp_lock has to be held.
338 struct zfcp_port *port, struct scsi_device *sdev, in zfcp_dbf_rec_trig() argument
341 struct zfcp_dbf *dbf = adapter->dbf; in zfcp_dbf_rec_trig()
342 struct zfcp_dbf_rec *rec = &dbf->rec_buf; in zfcp_dbf_rec_trig()
343 static int const level = 1; in zfcp_dbf_rec_trig() local
347 lockdep_assert_held(&adapter->erp_lock); in zfcp_dbf_rec_trig()
349 if (unlikely(!debug_level_enabled(dbf->rec, level))) in zfcp_dbf_rec_trig()
352 spin_lock_irqsave(&dbf->rec_lock, flags); in zfcp_dbf_rec_trig()
355 rec->id = ZFCP_DBF_REC_TRIG; in zfcp_dbf_rec_trig()
356 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); in zfcp_dbf_rec_trig()
357 zfcp_dbf_set_common(rec, adapter, port, sdev); in zfcp_dbf_rec_trig()
359 list_for_each(entry, &adapter->erp_ready_head) in zfcp_dbf_rec_trig()
360 rec->u.trig.ready++; in zfcp_dbf_rec_trig()
362 list_for_each(entry, &adapter->erp_running_head) in zfcp_dbf_rec_trig()
363 rec->u.trig.running++; in zfcp_dbf_rec_trig()
365 rec->u.trig.want = want; in zfcp_dbf_rec_trig()
366 rec->u.trig.need = need; in zfcp_dbf_rec_trig()
368 debug_event(dbf->rec, level, rec, sizeof(*rec)); in zfcp_dbf_rec_trig()
369 spin_unlock_irqrestore(&dbf->rec_lock, flags); in zfcp_dbf_rec_trig()
373 * zfcp_dbf_rec_trig_lock - trace event related to triggered recovery with lock
376 * @port: remote port involved in the erp_action
381 * The adapter->erp_lock must not be held.
384 struct zfcp_port *port, struct scsi_device *sdev, in zfcp_dbf_rec_trig_lock() argument
389 read_lock_irqsave(&adapter->erp_lock, flags); in zfcp_dbf_rec_trig_lock()
390 zfcp_dbf_rec_trig(tag, adapter, port, sdev, want, need); in zfcp_dbf_rec_trig_lock()
391 read_unlock_irqrestore(&adapter->erp_lock, flags); in zfcp_dbf_rec_trig_lock()
395 * zfcp_dbf_rec_run_lvl - trace event related to running recovery
396 * @level: trace level to be used for event
400 void zfcp_dbf_rec_run_lvl(int level, char *tag, struct zfcp_erp_action *erp) in zfcp_dbf_rec_run_lvl() argument
402 struct zfcp_dbf *dbf = erp->adapter->dbf; in zfcp_dbf_rec_run_lvl()
403 struct zfcp_dbf_rec *rec = &dbf->rec_buf; in zfcp_dbf_rec_run_lvl()
406 if (!debug_level_enabled(dbf->rec, level)) in zfcp_dbf_rec_run_lvl()
409 spin_lock_irqsave(&dbf->rec_lock, flags); in zfcp_dbf_rec_run_lvl()
412 rec->id = ZFCP_DBF_REC_RUN; in zfcp_dbf_rec_run_lvl()
413 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); in zfcp_dbf_rec_run_lvl()
414 zfcp_dbf_set_common(rec, erp->adapter, erp->port, erp->sdev); in zfcp_dbf_rec_run_lvl()
416 rec->u.run.fsf_req_id = erp->fsf_req_id; in zfcp_dbf_rec_run_lvl()
417 rec->u.run.rec_status = erp->status; in zfcp_dbf_rec_run_lvl()
418 rec->u.run.rec_step = erp->step; in zfcp_dbf_rec_run_lvl()
419 rec->u.run.rec_action = erp->type; in zfcp_dbf_rec_run_lvl()
421 if (erp->sdev) in zfcp_dbf_rec_run_lvl()
422 rec->u.run.rec_count = in zfcp_dbf_rec_run_lvl()
423 atomic_read(&sdev_to_zfcp(erp->sdev)->erp_counter); in zfcp_dbf_rec_run_lvl()
424 else if (erp->port) in zfcp_dbf_rec_run_lvl()
425 rec->u.run.rec_count = atomic_read(&erp->port->erp_counter); in zfcp_dbf_rec_run_lvl()
427 rec->u.run.rec_count = atomic_read(&erp->adapter->erp_counter); in zfcp_dbf_rec_run_lvl()
429 debug_event(dbf->rec, level, rec, sizeof(*rec)); in zfcp_dbf_rec_run_lvl()
430 spin_unlock_irqrestore(&dbf->rec_lock, flags); in zfcp_dbf_rec_run_lvl()
434 * zfcp_dbf_rec_run - trace event related to running recovery
444 * zfcp_dbf_rec_run_wka - trace wka port event with info like running recovery
446 * @wka_port: well known address port
452 struct zfcp_dbf *dbf = wka_port->adapter->dbf; in zfcp_dbf_rec_run_wka()
453 struct zfcp_dbf_rec *rec = &dbf->rec_buf; in zfcp_dbf_rec_run_wka()
454 static int const level = 1; in zfcp_dbf_rec_run_wka() local
457 if (unlikely(!debug_level_enabled(dbf->rec, level))) in zfcp_dbf_rec_run_wka()
460 spin_lock_irqsave(&dbf->rec_lock, flags); in zfcp_dbf_rec_run_wka()
463 rec->id = ZFCP_DBF_REC_RUN; in zfcp_dbf_rec_run_wka()
464 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); in zfcp_dbf_rec_run_wka()
465 rec->port_status = wka_port->status; in zfcp_dbf_rec_run_wka()
466 rec->d_id = wka_port->d_id; in zfcp_dbf_rec_run_wka()
467 rec->lun = ZFCP_DBF_INVALID_LUN; in zfcp_dbf_rec_run_wka()
469 rec->u.run.fsf_req_id = req_id; in zfcp_dbf_rec_run_wka()
470 rec->u.run.rec_status = ~0; in zfcp_dbf_rec_run_wka()
471 rec->u.run.rec_step = ~0; in zfcp_dbf_rec_run_wka()
472 rec->u.run.rec_action = ~0; in zfcp_dbf_rec_run_wka()
473 rec->u.run.rec_count = ~0; in zfcp_dbf_rec_run_wka()
475 debug_event(dbf->rec, level, rec, sizeof(*rec)); in zfcp_dbf_rec_run_wka()
476 spin_unlock_irqrestore(&dbf->rec_lock, flags); in zfcp_dbf_rec_run_wka()
486 struct zfcp_dbf_san *rec = &dbf->san_buf; in zfcp_dbf_san()
489 struct zfcp_dbf_pay *payload = &dbf->pay_buf; in zfcp_dbf_san()
492 spin_lock_irqsave(&dbf->san_lock, flags); in zfcp_dbf_san()
495 rec->id = id; in zfcp_dbf_san()
496 rec->fsf_req_id = req_id; in zfcp_dbf_san()
497 rec->d_id = d_id; in zfcp_dbf_san()
498 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); in zfcp_dbf_san()
499 rec->pl_len = len; /* full length even if we cap pay below */ in zfcp_dbf_san()
502 rec_len = min_t(unsigned int, sg->length, ZFCP_DBF_SAN_MAX_PAYLOAD); in zfcp_dbf_san()
503 memcpy(rec->payload, sg_virt(sg), rec_len); /* part of 1st sg entry */ in zfcp_dbf_san()
505 goto out; /* skip pay record if full content in rec->payload */ in zfcp_dbf_san()
508 * dump data up to cap_len ignoring small duplicate in rec->payload in zfcp_dbf_san()
510 spin_lock(&dbf->pay_lock); in zfcp_dbf_san()
512 memcpy(payload->area, paytag, ZFCP_DBF_TAG_LEN); in zfcp_dbf_san()
513 payload->fsf_req_id = req_id; in zfcp_dbf_san()
514 payload->counter = 0; in zfcp_dbf_san()
518 while (offset < sg->length && pay_sum < cap_len) { in zfcp_dbf_san()
520 (u16)(sg->length - offset)); in zfcp_dbf_san()
522 memcpy(payload->data, sg_virt(sg) + offset, pay_len); in zfcp_dbf_san()
523 debug_event(dbf->pay, ZFCP_DBF_SAN_LEVEL, payload, in zfcp_dbf_san()
525 payload->counter++; in zfcp_dbf_san()
530 spin_unlock(&dbf->pay_lock); in zfcp_dbf_san()
533 debug_event(dbf->san, ZFCP_DBF_SAN_LEVEL, rec, sizeof(*rec)); in zfcp_dbf_san()
534 spin_unlock_irqrestore(&dbf->san_lock, flags); in zfcp_dbf_san()
538 * zfcp_dbf_san_req - trace event for issued SAN request
546 struct zfcp_dbf *dbf = fsf->adapter->dbf; in zfcp_dbf_san_req()
547 struct zfcp_fsf_ct_els *ct_els = fsf->data; in zfcp_dbf_san_req()
550 if (unlikely(!debug_level_enabled(dbf->san, ZFCP_DBF_SAN_LEVEL))) in zfcp_dbf_san_req()
553 length = (u16)zfcp_qdio_real_bytes(ct_els->req); in zfcp_dbf_san_req()
554 zfcp_dbf_san(tag, dbf, "san_req", ct_els->req, ZFCP_DBF_SAN_REQ, in zfcp_dbf_san_req()
555 length, fsf->req_id, d_id, length); in zfcp_dbf_san_req()
562 struct zfcp_fsf_ct_els *ct_els = fsf->data; in zfcp_dbf_san_res_cap_len_if_gpn_ft()
563 struct fc_ct_hdr *reqh = sg_virt(ct_els->req); in zfcp_dbf_san_res_cap_len_if_gpn_ft()
565 struct scatterlist *resp_entry = ct_els->resp; in zfcp_dbf_san_res_cap_len_if_gpn_ft()
571 && ct_els->d_id == FC_FID_DIR_SERV in zfcp_dbf_san_res_cap_len_if_gpn_ft()
572 && reqh->ct_rev == FC_CT_REV in zfcp_dbf_san_res_cap_len_if_gpn_ft()
573 && reqh->ct_in_id[0] == 0 in zfcp_dbf_san_res_cap_len_if_gpn_ft()
574 && reqh->ct_in_id[1] == 0 in zfcp_dbf_san_res_cap_len_if_gpn_ft()
575 && reqh->ct_in_id[2] == 0 in zfcp_dbf_san_res_cap_len_if_gpn_ft()
576 && reqh->ct_fs_type == FC_FST_DIR in zfcp_dbf_san_res_cap_len_if_gpn_ft()
577 && reqh->ct_fs_subtype == FC_NS_SUBTYPE in zfcp_dbf_san_res_cap_len_if_gpn_ft()
578 && reqh->ct_options == 0 in zfcp_dbf_san_res_cap_len_if_gpn_ft()
579 && reqh->_ct_resvd1 == 0 in zfcp_dbf_san_res_cap_len_if_gpn_ft()
580 && reqh->ct_cmd == cpu_to_be16(FC_NS_GPN_FT) in zfcp_dbf_san_res_cap_len_if_gpn_ft()
581 /* reqh->ct_mr_size can vary so do not match but read below */ in zfcp_dbf_san_res_cap_len_if_gpn_ft()
582 && reqh->_ct_resvd2 == 0 in zfcp_dbf_san_res_cap_len_if_gpn_ft()
583 && reqh->ct_reason == 0 in zfcp_dbf_san_res_cap_len_if_gpn_ft()
584 && reqh->ct_explan == 0 in zfcp_dbf_san_res_cap_len_if_gpn_ft()
585 && reqh->ct_vendor == 0 in zfcp_dbf_san_res_cap_len_if_gpn_ft()
586 && reqn->fn_resvd == 0 in zfcp_dbf_san_res_cap_len_if_gpn_ft()
587 && reqn->fn_domain_id_scope == 0 in zfcp_dbf_san_res_cap_len_if_gpn_ft()
588 && reqn->fn_area_id_scope == 0 in zfcp_dbf_san_res_cap_len_if_gpn_ft()
589 && reqn->fn_fc4_type == FC_TYPE_FCP)) in zfcp_dbf_san_res_cap_len_if_gpn_ft()
596 if ((ct_els->status) || in zfcp_dbf_san_res_cap_len_if_gpn_ft()
597 (resph->ct_cmd != cpu_to_be16(FC_FS_ACC))) in zfcp_dbf_san_res_cap_len_if_gpn_ft()
600 max_entries = (be16_to_cpu(reqh->ct_mr_size) * 4 / in zfcp_dbf_san_res_cap_len_if_gpn_ft()
602 + 1 /* zfcp_fc_scan_ports: bytes correct, entries off-by-one in zfcp_dbf_san_res_cap_len_if_gpn_ft()
606 * response, allowing us to skip special handling for it - just skip it in zfcp_dbf_san_res_cap_len_if_gpn_ft()
614 last = acc->fp_flags & FC_NS_FID_LAST; in zfcp_dbf_san_res_cap_len_if_gpn_ft()
621 * zfcp_dbf_san_res - trace event for received SAN request
627 struct zfcp_dbf *dbf = fsf->adapter->dbf; in zfcp_dbf_san_res()
628 struct zfcp_fsf_ct_els *ct_els = fsf->data; in zfcp_dbf_san_res()
631 if (unlikely(!debug_level_enabled(dbf->san, ZFCP_DBF_SAN_LEVEL))) in zfcp_dbf_san_res()
634 length = (u16)zfcp_qdio_real_bytes(ct_els->resp); in zfcp_dbf_san_res()
635 zfcp_dbf_san(tag, dbf, "san_res", ct_els->resp, ZFCP_DBF_SAN_RES, in zfcp_dbf_san_res()
636 length, fsf->req_id, ct_els->d_id, in zfcp_dbf_san_res()
641 * zfcp_dbf_san_in_els - trace event for incoming ELS
647 struct zfcp_dbf *dbf = fsf->adapter->dbf; in zfcp_dbf_san_in_els()
649 (struct fsf_status_read_buffer *) fsf->data; in zfcp_dbf_san_in_els()
653 if (unlikely(!debug_level_enabled(dbf->san, ZFCP_DBF_SAN_LEVEL))) in zfcp_dbf_san_in_els()
656 length = (u16)(srb->length - in zfcp_dbf_san_in_els()
658 sg_init_one(&sg, srb->payload.data, length); in zfcp_dbf_san_in_els()
660 fsf->req_id, ntoh24(srb->d_id), length); in zfcp_dbf_san_in_els()
664 * zfcp_dbf_scsi_common() - Common trace event helper for scsi.
666 * @level: trace level of event.
671 void zfcp_dbf_scsi_common(char *tag, int level, struct scsi_device *sdev, in zfcp_dbf_scsi_common() argument
675 (struct zfcp_adapter *) sdev->host->hostdata[0]; in zfcp_dbf_scsi_common()
676 struct zfcp_dbf *dbf = adapter->dbf; in zfcp_dbf_scsi_common()
677 struct zfcp_dbf_scsi *rec = &dbf->scsi_buf; in zfcp_dbf_scsi_common()
682 spin_lock_irqsave(&dbf->scsi_lock, flags); in zfcp_dbf_scsi_common()
685 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); in zfcp_dbf_scsi_common()
686 rec->id = ZFCP_DBF_SCSI_CMND; in zfcp_dbf_scsi_common()
688 rec->scsi_result = sc->result; in zfcp_dbf_scsi_common()
689 rec->scsi_retries = sc->retries; in zfcp_dbf_scsi_common()
690 rec->scsi_allowed = sc->allowed; in zfcp_dbf_scsi_common()
691 rec->scsi_id = sc->device->id; in zfcp_dbf_scsi_common()
692 rec->scsi_lun = (u32)sc->device->lun; in zfcp_dbf_scsi_common()
693 rec->scsi_lun_64_hi = (u32)(sc->device->lun >> 32); in zfcp_dbf_scsi_common()
694 rec->host_scribble = (u64)sc->host_scribble; in zfcp_dbf_scsi_common()
696 memcpy(rec->scsi_opcode, sc->cmnd, in zfcp_dbf_scsi_common()
697 min_t(int, sc->cmd_len, ZFCP_DBF_SCSI_OPCODE)); in zfcp_dbf_scsi_common()
699 rec->scsi_result = ~0; in zfcp_dbf_scsi_common()
700 rec->scsi_retries = ~0; in zfcp_dbf_scsi_common()
701 rec->scsi_allowed = ~0; in zfcp_dbf_scsi_common()
702 rec->scsi_id = sdev->id; in zfcp_dbf_scsi_common()
703 rec->scsi_lun = (u32)sdev->lun; in zfcp_dbf_scsi_common()
704 rec->scsi_lun_64_hi = (u32)(sdev->lun >> 32); in zfcp_dbf_scsi_common()
705 rec->host_scribble = ~0; in zfcp_dbf_scsi_common()
707 memset(rec->scsi_opcode, 0xff, ZFCP_DBF_SCSI_OPCODE); in zfcp_dbf_scsi_common()
711 rec->fsf_req_id = fsf->req_id; in zfcp_dbf_scsi_common()
712 rec->pl_len = FCP_RESP_WITH_EXT; in zfcp_dbf_scsi_common()
713 fcp_rsp = &(fsf->qtcb->bottom.io.fcp_rsp.iu); in zfcp_dbf_scsi_common()
715 memcpy(&rec->fcp_rsp, fcp_rsp, FCP_RESP_WITH_EXT); in zfcp_dbf_scsi_common()
716 if (fcp_rsp->resp.fr_flags & FCP_RSP_LEN_VAL) { in zfcp_dbf_scsi_common()
718 rec->fcp_rsp_info = fcp_rsp_info->rsp_code; in zfcp_dbf_scsi_common()
719 rec->pl_len += be32_to_cpu(fcp_rsp->ext.fr_rsp_len); in zfcp_dbf_scsi_common()
721 if (fcp_rsp->resp.fr_flags & FCP_SNS_LEN_VAL) { in zfcp_dbf_scsi_common()
722 rec->pl_len += be32_to_cpu(fcp_rsp->ext.fr_sns_len); in zfcp_dbf_scsi_common()
727 if (fcp_rsp->resp.fr_flags != 0) in zfcp_dbf_scsi_common()
733 min_t(u16, max_t(u16, rec->pl_len, in zfcp_dbf_scsi_common()
736 "fcp_riu", fsf->req_id); in zfcp_dbf_scsi_common()
739 debug_event(dbf->scsi, level, rec, sizeof(*rec)); in zfcp_dbf_scsi_common()
740 spin_unlock_irqrestore(&dbf->scsi_lock, flags); in zfcp_dbf_scsi_common()
744 * zfcp_dbf_scsi_eh() - Trace event for special cases of scsi_eh callbacks.
756 struct zfcp_dbf *dbf = adapter->dbf; in zfcp_dbf_scsi_eh()
757 struct zfcp_dbf_scsi *rec = &dbf->scsi_buf; in zfcp_dbf_scsi_eh()
759 static int const level = 1; in zfcp_dbf_scsi_eh() local
761 if (unlikely(!debug_level_enabled(adapter->dbf->scsi, level))) in zfcp_dbf_scsi_eh()
764 spin_lock_irqsave(&dbf->scsi_lock, flags); in zfcp_dbf_scsi_eh()
767 memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); in zfcp_dbf_scsi_eh()
768 rec->id = ZFCP_DBF_SCSI_CMND; in zfcp_dbf_scsi_eh()
769 rec->scsi_result = ret; /* re-use field, int is 4 bytes and fits */ in zfcp_dbf_scsi_eh()
770 rec->scsi_retries = ~0; in zfcp_dbf_scsi_eh()
771 rec->scsi_allowed = ~0; in zfcp_dbf_scsi_eh()
772 rec->fcp_rsp_info = ~0; in zfcp_dbf_scsi_eh()
773 rec->scsi_id = scsi_id; in zfcp_dbf_scsi_eh()
774 rec->scsi_lun = (u32)ZFCP_DBF_INVALID_LUN; in zfcp_dbf_scsi_eh()
775 rec->scsi_lun_64_hi = (u32)(ZFCP_DBF_INVALID_LUN >> 32); in zfcp_dbf_scsi_eh()
776 rec->host_scribble = ~0; in zfcp_dbf_scsi_eh()
777 memset(rec->scsi_opcode, 0xff, ZFCP_DBF_SCSI_OPCODE); in zfcp_dbf_scsi_eh()
779 debug_event(dbf->scsi, level, rec, sizeof(*rec)); in zfcp_dbf_scsi_eh()
780 spin_unlock_irqrestore(&dbf->scsi_lock, flags); in zfcp_dbf_scsi_eh()
802 debug_unregister(dbf->scsi); in zfcp_dbf_unregister()
803 debug_unregister(dbf->san); in zfcp_dbf_unregister()
804 debug_unregister(dbf->hba); in zfcp_dbf_unregister()
805 debug_unregister(dbf->pay); in zfcp_dbf_unregister()
806 debug_unregister(dbf->rec); in zfcp_dbf_unregister()
811 * zfcp_dbf_adapter_register - registers debug feature for an adapter
813 * return: -ENOMEM on error, 0 otherwise
822 return -ENOMEM; in zfcp_dbf_adapter_register()
824 spin_lock_init(&dbf->pay_lock); in zfcp_dbf_adapter_register()
825 spin_lock_init(&dbf->hba_lock); in zfcp_dbf_adapter_register()
826 spin_lock_init(&dbf->san_lock); in zfcp_dbf_adapter_register()
827 spin_lock_init(&dbf->scsi_lock); in zfcp_dbf_adapter_register()
828 spin_lock_init(&dbf->rec_lock); in zfcp_dbf_adapter_register()
831 sprintf(name, "zfcp_%s_rec", dev_name(&adapter->ccw_device->dev)); in zfcp_dbf_adapter_register()
832 dbf->rec = zfcp_dbf_reg(name, dbfsize, sizeof(struct zfcp_dbf_rec)); in zfcp_dbf_adapter_register()
833 if (!dbf->rec) in zfcp_dbf_adapter_register()
837 sprintf(name, "zfcp_%s_hba", dev_name(&adapter->ccw_device->dev)); in zfcp_dbf_adapter_register()
838 dbf->hba = zfcp_dbf_reg(name, dbfsize, sizeof(struct zfcp_dbf_hba)); in zfcp_dbf_adapter_register()
839 if (!dbf->hba) in zfcp_dbf_adapter_register()
843 sprintf(name, "zfcp_%s_pay", dev_name(&adapter->ccw_device->dev)); in zfcp_dbf_adapter_register()
844 dbf->pay = zfcp_dbf_reg(name, dbfsize * 2, sizeof(struct zfcp_dbf_pay)); in zfcp_dbf_adapter_register()
845 if (!dbf->pay) in zfcp_dbf_adapter_register()
849 sprintf(name, "zfcp_%s_san", dev_name(&adapter->ccw_device->dev)); in zfcp_dbf_adapter_register()
850 dbf->san = zfcp_dbf_reg(name, dbfsize, sizeof(struct zfcp_dbf_san)); in zfcp_dbf_adapter_register()
851 if (!dbf->san) in zfcp_dbf_adapter_register()
855 sprintf(name, "zfcp_%s_scsi", dev_name(&adapter->ccw_device->dev)); in zfcp_dbf_adapter_register()
856 dbf->scsi = zfcp_dbf_reg(name, dbfsize, sizeof(struct zfcp_dbf_scsi)); in zfcp_dbf_adapter_register()
857 if (!dbf->scsi) in zfcp_dbf_adapter_register()
860 adapter->dbf = dbf; in zfcp_dbf_adapter_register()
865 return -ENOMEM; in zfcp_dbf_adapter_register()
869 * zfcp_dbf_adapter_unregister - unregisters debug feature for an adapter
874 struct zfcp_dbf *dbf = adapter->dbf; in zfcp_dbf_adapter_unregister()
876 adapter->dbf = NULL; in zfcp_dbf_adapter_unregister()