Commit a54ca0f6 authored by Swen Schillig's avatar Swen Schillig Committed by James Bottomley

[SCSI] zfcp: Redesign of the debug tracing for HBA 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 HBA area.
Signed-off-by: default avatarSwen Schillig <swen@vnet.ibm.com>
Signed-off-by: default avatarChristof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 2c55b750
This diff is collapsed.
/* /*
* This file is part of the zfcp device driver for * zfcp device driver
* FCP adapters for IBM System z9 and zSeries. * debug feature declarations
* *
* Copyright IBM Corp. 2008, 2009 * Copyright IBM Corp. 2008, 2010
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef ZFCP_DBF_H #ifndef ZFCP_DBF_H
...@@ -136,73 +122,90 @@ struct zfcp_dbf_san { ...@@ -136,73 +122,90 @@ struct zfcp_dbf_san {
char payload[ZFCP_DBF_SAN_MAX_PAYLOAD]; char payload[ZFCP_DBF_SAN_MAX_PAYLOAD];
} __packed; } __packed;
struct zfcp_dbf_hba_record_response { /**
u32 fsf_command; * struct zfcp_dbf_hba_res - trace record for hba responses
u64 fsf_reqid; * @req_issued: timestamp when request was issued
u32 fsf_seqno; * @prot_status: protocol status
u64 fsf_issued; * @prot_status_qual: protocol status qualifier
u32 fsf_prot_status; * @fsf_status: fsf status
* @fsf_status_qual: fsf status qualifier
*/
struct zfcp_dbf_hba_res {
u64 req_issued;
u32 prot_status;
u8 prot_status_qual[FSF_PROT_STATUS_QUAL_SIZE];
u32 fsf_status; u32 fsf_status;
u8 fsf_prot_status_qual[FSF_PROT_STATUS_QUAL_SIZE]; u8 fsf_status_qual[FSF_STATUS_QUALIFIER_SIZE];
u8 fsf_status_qual[FSF_STATUS_QUALIFIER_SIZE]; } __packed;
u32 fsf_req_status;
u8 sbal_first;
u8 sbal_last;
u8 sbal_response;
u8 pool;
u64 erp_action;
union {
struct {
u64 cmnd;
u32 data_dir;
} fcp;
struct {
u64 wwpn;
u32 d_id;
u32 port_handle;
} port;
struct {
u64 wwpn;
u64 fcp_lun;
u32 port_handle;
u32 lun_handle;
} unit;
struct {
u32 d_id;
} els;
} u;
} __attribute__ ((packed));
struct zfcp_dbf_hba_record_status { /**
u8 failed; * struct zfcp_dbf_hba_uss - trace record for unsolicited status
* @status_type: type of unsolicited status
* @status_subtype: subtype of unsolicited status
* @d_id: destination ID
* @lun: logical unit number
* @queue_designator: queue designator
*/
struct zfcp_dbf_hba_uss {
u32 status_type; u32 status_type;
u32 status_subtype; u32 status_subtype;
struct fsf_queue_designator u32 d_id;
queue_designator; u64 lun;
u32 payload_size; u64 queue_designator;
#define ZFCP_DBF_UNSOL_PAYLOAD 80 } __packed;
#define ZFCP_DBF_UNSOL_PAYLOAD_SENSE_DATA_AVAIL 32
#define ZFCP_DBF_UNSOL_PAYLOAD_BIT_ERROR_THRESHOLD 56
#define ZFCP_DBF_UNSOL_PAYLOAD_FEATURE_UPDATE_ALERT 2 * sizeof(u32)
u8 payload[ZFCP_DBF_UNSOL_PAYLOAD];
} __attribute__ ((packed));
struct zfcp_dbf_hba_record_qdio { /**
u32 qdio_error; * enum zfcp_dbf_hba_id - HBA trace record identifier
u8 sbal_index; * @ZFCP_DBF_HBA_RES: response trace record
u8 sbal_count; * @ZFCP_DBF_HBA_USS: unsolicited status trace record
} __attribute__ ((packed)); * @ZFCP_DBF_HBA_BIT: bit error trace record
*/
enum zfcp_dbf_hba_id {
ZFCP_DBF_HBA_RES = 1,
ZFCP_DBF_HBA_USS = 2,
ZFCP_DBF_HBA_BIT = 3,
};
struct zfcp_dbf_hba_record { /**
u8 tag[ZFCP_DBF_TAG_SIZE]; * struct zfcp_dbf_hba - common trace record for HBA records
u8 tag2[ZFCP_DBF_TAG_SIZE]; * @id: unique number of recovery record type
* @tag: identifier string specifying the location of initiation
* @fsf_req_id: request id for fsf requests
* @fsf_req_status: status of fsf request
* @fsf_cmd: fsf command
* @fsf_seq_no: fsf sequence number
* @pl_len: length of payload stored as zfcp_dbf_pay
* @u: record type specific data
*/
struct zfcp_dbf_hba {
u8 id;
char tag[ZFCP_DBF_TAG_LEN];
u64 fsf_req_id;
u32 fsf_req_status;
u32 fsf_cmd;
u32 fsf_seq_no;
u16 pl_len;
union { union {
struct zfcp_dbf_hba_record_response response; struct zfcp_dbf_hba_res res;
struct zfcp_dbf_hba_record_status status; struct zfcp_dbf_hba_uss uss;
struct zfcp_dbf_hba_record_qdio qdio; struct fsf_bit_error_payload be;
struct fsf_bit_error_payload berr;
} u; } u;
} __attribute__ ((packed)); } __packed;
/**
* struct zfcp_dbf_pay - trace record for unformatted payload information
* @area: area this record is originated from
* @counter: ascending record number
* @fsf_req_id: request id of fsf request
* @data: unformatted data
*/
struct zfcp_dbf_pay {
char area[ZFCP_DBF_TAG_LEN];
char counter;
u64 fsf_req_id;
#define ZFCP_DBF_PAY_MAX_REC 0x100
char data[ZFCP_DBF_PAY_MAX_REC];
} __packed;
struct zfcp_dbf_scsi_record { struct zfcp_dbf_scsi_record {
u8 tag[ZFCP_DBF_TAG_SIZE]; u8 tag[ZFCP_DBF_TAG_SIZE];
...@@ -230,71 +233,57 @@ struct zfcp_dbf_scsi_record { ...@@ -230,71 +233,57 @@ struct zfcp_dbf_scsi_record {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct zfcp_dbf { struct zfcp_dbf {
debug_info_t *pay;
debug_info_t *rec; debug_info_t *rec;
debug_info_t *hba; debug_info_t *hba;
debug_info_t *san; debug_info_t *san;
debug_info_t *scsi; debug_info_t *scsi;
spinlock_t pay_lock;
spinlock_t rec_lock; spinlock_t rec_lock;
spinlock_t hba_lock; spinlock_t hba_lock;
spinlock_t san_lock; spinlock_t san_lock;
spinlock_t scsi_lock; spinlock_t scsi_lock;
struct zfcp_dbf_rec rec_buf; struct zfcp_dbf_rec rec_buf;
struct zfcp_dbf_hba_record hba_buf; struct zfcp_dbf_hba hba_buf;
struct zfcp_dbf_san san_buf; struct zfcp_dbf_san san_buf;
struct zfcp_dbf_scsi_record scsi_buf; struct zfcp_dbf_scsi_record scsi_buf;
struct zfcp_dbf_pay pay_buf;
struct zfcp_adapter *adapter; struct zfcp_adapter *adapter;
}; };
static inline static inline
void zfcp_dbf_hba_fsf_resp(const char *tag2, int level, void zfcp_dbf_hba_fsf_resp(char *tag, int level, struct zfcp_fsf_req *req)
struct zfcp_fsf_req *req, struct zfcp_dbf *dbf)
{ {
if (level <= dbf->hba->level) if (level <= req->adapter->dbf->hba->level)
_zfcp_dbf_hba_fsf_response(tag2, level, req, dbf); zfcp_dbf_hba_fsf_res(tag, req);
} }
/** /**
* zfcp_dbf_hba_fsf_response - trace event for request completion * zfcp_dbf_hba_fsf_response - trace event for request completion
* @fsf_req: request that has been completed * @fsf_req: request that has been completed
*/ */
static inline void zfcp_dbf_hba_fsf_response(struct zfcp_fsf_req *req) static inline
void zfcp_dbf_hba_fsf_response(struct zfcp_fsf_req *req)
{ {
struct zfcp_dbf *dbf = req->adapter->dbf;
struct fsf_qtcb *qtcb = req->qtcb; struct fsf_qtcb *qtcb = req->qtcb;
if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) && if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) &&
(qtcb->prefix.prot_status != FSF_PROT_FSF_STATUS_PRESENTED)) { (qtcb->prefix.prot_status != FSF_PROT_FSF_STATUS_PRESENTED)) {
zfcp_dbf_hba_fsf_resp("perr", 1, req, dbf); zfcp_dbf_hba_fsf_resp("fs_perr", 1, req);
} else if (qtcb->header.fsf_status != FSF_GOOD) { } else if (qtcb->header.fsf_status != FSF_GOOD) {
zfcp_dbf_hba_fsf_resp("ferr", 1, req, dbf); zfcp_dbf_hba_fsf_resp("fs_ferr", 1, req);
} else if ((req->fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) || } else if ((req->fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) ||
(req->fsf_command == FSF_QTCB_OPEN_LUN)) { (req->fsf_command == FSF_QTCB_OPEN_LUN)) {
zfcp_dbf_hba_fsf_resp("open", 4, req, dbf); zfcp_dbf_hba_fsf_resp("fs_open", 4, req);
} else if (qtcb->header.log_length) { } else if (qtcb->header.log_length) {
zfcp_dbf_hba_fsf_resp("qtcb", 5, req, dbf); zfcp_dbf_hba_fsf_resp("fs_qtcb", 5, req);
} else { } else {
zfcp_dbf_hba_fsf_resp("norm", 6, req, dbf); zfcp_dbf_hba_fsf_resp("fs_norm", 6, req);
} }
}
/**
* zfcp_dbf_hba_fsf_unsol - trace event for an unsolicited status buffer
* @tag: tag indicating which kind of unsolicited status has been received
* @dbf: reference to dbf structure
* @status_buffer: buffer containing payload of unsolicited status
*/
static inline
void zfcp_dbf_hba_fsf_unsol(const char *tag, struct zfcp_dbf *dbf,
struct fsf_status_read_buffer *buf)
{
int level = 2;
if (level <= dbf->hba->level)
_zfcp_dbf_hba_fsf_unsol(tag, level, dbf, buf);
} }
static inline static inline
......
...@@ -49,11 +49,9 @@ extern void zfcp_dbf_adapter_unregister(struct zfcp_dbf *); ...@@ -49,11 +49,9 @@ extern void zfcp_dbf_adapter_unregister(struct zfcp_dbf *);
extern void zfcp_dbf_rec_trig(char *, struct zfcp_adapter *, extern void zfcp_dbf_rec_trig(char *, struct zfcp_adapter *,
struct zfcp_port *, struct scsi_device *, u8, u8); struct zfcp_port *, struct scsi_device *, u8, u8);
extern void zfcp_dbf_rec_run(char *, struct zfcp_erp_action *); extern void zfcp_dbf_rec_run(char *, struct zfcp_erp_action *);
extern void _zfcp_dbf_hba_fsf_response(const char *, int, struct zfcp_fsf_req *, extern void zfcp_dbf_hba_fsf_uss(char *, struct zfcp_fsf_req *);
struct zfcp_dbf *); extern void zfcp_dbf_hba_fsf_res(char *, struct zfcp_fsf_req *);
extern void _zfcp_dbf_hba_fsf_unsol(const char *, int level, struct zfcp_dbf *, extern void zfcp_dbf_hba_bit_err(char *, struct zfcp_fsf_req *);
struct fsf_status_read_buffer *);
extern void zfcp_dbf_hba_qdio(struct zfcp_dbf *, unsigned int, int, int);
extern void zfcp_dbf_hba_berr(struct zfcp_dbf *, struct zfcp_fsf_req *); extern void zfcp_dbf_hba_berr(struct zfcp_dbf *, struct zfcp_fsf_req *);
extern void zfcp_dbf_san_req(char *, struct zfcp_fsf_req *, u32); extern void zfcp_dbf_san_req(char *, struct zfcp_fsf_req *, u32);
extern void zfcp_dbf_san_res(char *, struct zfcp_fsf_req *); extern void zfcp_dbf_san_res(char *, struct zfcp_fsf_req *);
...@@ -141,6 +139,8 @@ extern int zfcp_qdio_sbals_from_sg(struct zfcp_qdio *, struct zfcp_qdio_req *, ...@@ -141,6 +139,8 @@ extern int zfcp_qdio_sbals_from_sg(struct zfcp_qdio *, struct zfcp_qdio_req *,
extern int zfcp_qdio_open(struct zfcp_qdio *); extern int zfcp_qdio_open(struct zfcp_qdio *);
extern void zfcp_qdio_close(struct zfcp_qdio *); extern void zfcp_qdio_close(struct zfcp_qdio *);
extern void zfcp_qdio_siosl(struct zfcp_adapter *); extern void zfcp_qdio_siosl(struct zfcp_adapter *);
extern struct zfcp_fsf_req *zfcp_fsf_get_req(struct zfcp_qdio *,
struct qdio_buffer *);
/* zfcp_scsi.c */ /* zfcp_scsi.c */
extern struct zfcp_data zfcp_data; extern struct zfcp_data zfcp_data;
......
...@@ -211,13 +211,13 @@ static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req) ...@@ -211,13 +211,13 @@ static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req)
struct fsf_status_read_buffer *sr_buf = req->data; struct fsf_status_read_buffer *sr_buf = req->data;
if (req->status & ZFCP_STATUS_FSFREQ_DISMISSED) { if (req->status & ZFCP_STATUS_FSFREQ_DISMISSED) {
zfcp_dbf_hba_fsf_unsol("dism", adapter->dbf, sr_buf); zfcp_dbf_hba_fsf_uss("fssrh_1", req);
mempool_free(sr_buf, adapter->pool.status_read_data); mempool_free(sr_buf, adapter->pool.status_read_data);
zfcp_fsf_req_free(req); zfcp_fsf_req_free(req);
return; return;
} }
zfcp_dbf_hba_fsf_unsol("read", adapter->dbf, sr_buf); zfcp_dbf_hba_fsf_uss("fssrh_2", req);
switch (sr_buf->status_type) { switch (sr_buf->status_type) {
case FSF_STATUS_READ_PORT_CLOSED: case FSF_STATUS_READ_PORT_CLOSED:
...@@ -232,7 +232,7 @@ static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req) ...@@ -232,7 +232,7 @@ static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req)
dev_warn(&adapter->ccw_device->dev, dev_warn(&adapter->ccw_device->dev,
"The error threshold for checksum statistics " "The error threshold for checksum statistics "
"has been exceeded\n"); "has been exceeded\n");
zfcp_dbf_hba_berr(adapter->dbf, req); zfcp_dbf_hba_bit_err("fssrh_3", req);
break; break;
case FSF_STATUS_READ_LINK_DOWN: case FSF_STATUS_READ_LINK_DOWN:
zfcp_fsf_status_read_link_down(req); zfcp_fsf_status_read_link_down(req);
...@@ -754,10 +754,11 @@ int zfcp_fsf_status_read(struct zfcp_qdio *qdio) ...@@ -754,10 +754,11 @@ int zfcp_fsf_status_read(struct zfcp_qdio *qdio)
goto out; goto out;
failed_req_send: failed_req_send:
req->data = NULL;
mempool_free(sr_buf, adapter->pool.status_read_data); mempool_free(sr_buf, adapter->pool.status_read_data);
failed_buf: failed_buf:
zfcp_dbf_hba_fsf_uss("fssr__1", req);
zfcp_fsf_req_free(req); zfcp_fsf_req_free(req);
zfcp_dbf_hba_fsf_unsol("fail", adapter->dbf, NULL);
out: out:
spin_unlock_irq(&qdio->req_q_lock); spin_unlock_irq(&qdio->req_q_lock);
return retval; return retval;
...@@ -2420,3 +2421,12 @@ void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx) ...@@ -2420,3 +2421,12 @@ void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx)
break; break;
} }
} }
struct zfcp_fsf_req *zfcp_fsf_get_req(struct zfcp_qdio *qdio,
struct qdio_buffer *sbal)
{
struct qdio_buffer_element *sbale = &sbal->element[0];
u64 req_id = (unsigned long) sbale->addr;
return zfcp_reqlist_find(qdio->adapter->req_list, req_id);
}
...@@ -74,7 +74,6 @@ static void zfcp_qdio_int_req(struct ccw_device *cdev, unsigned int qdio_err, ...@@ -74,7 +74,6 @@ static void zfcp_qdio_int_req(struct ccw_device *cdev, unsigned int qdio_err,
struct zfcp_qdio *qdio = (struct zfcp_qdio *) parm; struct zfcp_qdio *qdio = (struct zfcp_qdio *) parm;
if (unlikely(qdio_err)) { if (unlikely(qdio_err)) {
zfcp_dbf_hba_qdio(qdio->adapter->dbf, qdio_err, idx, count);
zfcp_qdio_handler_error(qdio, "qdireq1", qdio_err); zfcp_qdio_handler_error(qdio, "qdireq1", qdio_err);
return; return;
} }
...@@ -97,7 +96,6 @@ static void zfcp_qdio_int_resp(struct ccw_device *cdev, unsigned int qdio_err, ...@@ -97,7 +96,6 @@ static void zfcp_qdio_int_resp(struct ccw_device *cdev, unsigned int qdio_err,
int sbal_idx, sbal_no; int sbal_idx, sbal_no;
if (unlikely(qdio_err)) { if (unlikely(qdio_err)) {
zfcp_dbf_hba_qdio(qdio->adapter->dbf, qdio_err, idx, count);
zfcp_qdio_handler_error(qdio, "qdires1", qdio_err); zfcp_qdio_handler_error(qdio, "qdires1", qdio_err);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment