aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_dbf.h
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2009-08-18 09:43:09 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-09-05 09:49:10 -0400
commit2e261af84cdb6a6008a9c361443e35ea646ec683 (patch)
treea17d7de8aa4d57de11117ba194e7b1ac22b59c56 /drivers/s390/scsi/zfcp_dbf.h
parentdcd20e2316cdc333dfdee09649dbe3642eb30e75 (diff)
[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 <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/s390/scsi/zfcp_dbf.h')
-rw-r--r--drivers/s390/scsi/zfcp_dbf.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.h b/drivers/s390/scsi/zfcp_dbf.h
index c2d5ef18b73a..bceaff449033 100644
--- a/drivers/s390/scsi/zfcp_dbf.h
+++ b/drivers/s390/scsi/zfcp_dbf.h
@@ -240,6 +240,59 @@ struct zfcp_dbf {
240}; 240};
241 241
242static inline 242static inline
243void zfcp_hba_dbf_event_fsf_resp(const char *tag2, int level,
244 struct zfcp_fsf_req *req, struct zfcp_dbf *dbf)
245{
246 if (level <= dbf->hba_dbf->level)
247 _zfcp_hba_dbf_event_fsf_response(tag2, level, req, dbf);
248}
249
250/**
251 * zfcp_hba_dbf_event_fsf_response - trace event for request completion
252 * @fsf_req: request that has been completed
253 */
254static inline void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *req)
255{
256 struct zfcp_dbf *dbf = req->adapter->dbf;
257 struct fsf_qtcb *qtcb = req->qtcb;
258
259 if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) &&
260 (qtcb->prefix.prot_status != FSF_PROT_FSF_STATUS_PRESENTED)) {
261 zfcp_hba_dbf_event_fsf_resp("perr", 1, req, dbf);
262
263 } else if (qtcb->header.fsf_status != FSF_GOOD) {
264 zfcp_hba_dbf_event_fsf_resp("ferr", 1, req, dbf);
265
266 } else if ((req->fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) ||
267 (req->fsf_command == FSF_QTCB_OPEN_LUN)) {
268 zfcp_hba_dbf_event_fsf_resp("open", 4, req, dbf);
269
270 } else if (qtcb->header.log_length) {
271 zfcp_hba_dbf_event_fsf_resp("qtcb", 5, req, dbf);
272
273 } else {
274 zfcp_hba_dbf_event_fsf_resp("norm", 6, req, dbf);
275 }
276 }
277
278/**
279 * zfcp_hba_dbf_event_fsf_unsol - trace event for an unsolicited status buffer
280 * @tag: tag indicating which kind of unsolicited status has been received
281 * @adapter: adapter that has issued the unsolicited status buffer
282 * @status_buffer: buffer containing payload of unsolicited status
283 */
284static inline
285void zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter,
286 struct fsf_status_read_buffer *buf)
287{
288 struct zfcp_dbf *dbf = adapter->dbf;
289 int level = 2;
290
291 if (level <= dbf->hba_dbf->level)
292 _zfcp_hba_dbf_event_fsf_unsol(tag, level, adapter, buf);
293}
294
295static inline
243void zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level, 296void zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level,
244 struct zfcp_adapter *adapter, struct scsi_cmnd *scmd, 297 struct zfcp_adapter *adapter, struct scsi_cmnd *scmd,
245 struct zfcp_fsf_req *req, unsigned long old_id) 298 struct zfcp_fsf_req *req, unsigned long old_id)