From 2e261af84cdb6a6008a9c361443e35ea646ec683 Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Tue, 18 Aug 2009 15:43:09 +0200 Subject: [SCSI] zfcp: Only collect FSF/HBA debug data for matching trace levels The default trace level is to only trace failed FSF commands. Thus it is not necessary to collect trace data for most FSF commands, since it will be thrown away later. Restructure the FSF/HBA trace infrastructure to first check the trace level in a inline function and only do the expensive data collection for matching trace levels. Reviewed-by: Swen Schillig Signed-off-by: Christof Schmitt Signed-off-by: James Bottomley --- drivers/s390/scsi/zfcp_dbf.h | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'drivers/s390/scsi/zfcp_dbf.h') diff --git a/drivers/s390/scsi/zfcp_dbf.h b/drivers/s390/scsi/zfcp_dbf.h index c2d5ef18b73..bceaff44903 100644 --- a/drivers/s390/scsi/zfcp_dbf.h +++ b/drivers/s390/scsi/zfcp_dbf.h @@ -239,6 +239,59 @@ struct zfcp_dbf { struct zfcp_scsi_dbf_record scsi_dbf_buf; }; +static inline +void zfcp_hba_dbf_event_fsf_resp(const char *tag2, int level, + struct zfcp_fsf_req *req, struct zfcp_dbf *dbf) +{ + if (level <= dbf->hba_dbf->level) + _zfcp_hba_dbf_event_fsf_response(tag2, level, req, dbf); +} + +/** + * zfcp_hba_dbf_event_fsf_response - trace event for request completion + * @fsf_req: request that has been completed + */ +static inline void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *req) +{ + struct zfcp_dbf *dbf = req->adapter->dbf; + struct fsf_qtcb *qtcb = req->qtcb; + + if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) && + (qtcb->prefix.prot_status != FSF_PROT_FSF_STATUS_PRESENTED)) { + zfcp_hba_dbf_event_fsf_resp("perr", 1, req, dbf); + + } else if (qtcb->header.fsf_status != FSF_GOOD) { + zfcp_hba_dbf_event_fsf_resp("ferr", 1, req, dbf); + + } else if ((req->fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) || + (req->fsf_command == FSF_QTCB_OPEN_LUN)) { + zfcp_hba_dbf_event_fsf_resp("open", 4, req, dbf); + + } else if (qtcb->header.log_length) { + zfcp_hba_dbf_event_fsf_resp("qtcb", 5, req, dbf); + + } else { + zfcp_hba_dbf_event_fsf_resp("norm", 6, req, dbf); + } + } + +/** + * zfcp_hba_dbf_event_fsf_unsol - trace event for an unsolicited status buffer + * @tag: tag indicating which kind of unsolicited status has been received + * @adapter: adapter that has issued the unsolicited status buffer + * @status_buffer: buffer containing payload of unsolicited status + */ +static inline +void zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter, + struct fsf_status_read_buffer *buf) +{ + struct zfcp_dbf *dbf = adapter->dbf; + int level = 2; + + if (level <= dbf->hba_dbf->level) + _zfcp_hba_dbf_event_fsf_unsol(tag, level, adapter, buf); +} + static inline void zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level, struct zfcp_adapter *adapter, struct scsi_cmnd *scmd, -- cgit v1.2.3