xref: /linux/drivers/scsi/sd_trace.h (revision 811f35ff59b6f99ae272d6f5b96bc9e974f88196)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2022 Western Digital Corporation or its affiliates.
4  */
5 #undef TRACE_SYSTEM
6 #define TRACE_SYSTEM sd
7 
8 #undef TRACE_INCLUDE_FILE
9 #define TRACE_INCLUDE_FILE sd_trace
10 
11 #if !defined(_SD_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
12 #include <scsi/scsi_cmnd.h>
13 #include <scsi/scsi_host.h>
14 #include <linux/tracepoint.h>
15 
16 TRACE_EVENT(scsi_prepare_zone_append,
17 
18 	    TP_PROTO(struct scsi_cmnd *cmnd, sector_t lba,
19 		     unsigned int wp_offset),
20 
21 	    TP_ARGS(cmnd, lba, wp_offset),
22 
23 	    TP_STRUCT__entry(
24 		     __field( unsigned int, host_no )
25 		     __field( unsigned int, channel )
26 		     __field( unsigned int, id )
27 		     __field( unsigned int, lun )
28 		     __field( sector_t,     lba )
29 		     __field( unsigned int, wp_offset )
30 	    ),
31 
32 	    TP_fast_assign(
33 		__entry->host_no	= cmnd->device->host->host_no;
34 		__entry->channel	= cmnd->device->channel;
35 		__entry->id		= cmnd->device->id;
36 		__entry->lun		= cmnd->device->lun;
37 		__entry->lba		= lba;
38 		__entry->wp_offset	= wp_offset;
39 	    ),
40 
41 	    TP_printk("host_no=%u, channel=%u id=%u lun=%u lba=%llu wp_offset=%u",
42 		      __entry->host_no, __entry->channel, __entry->id,
43 		      __entry->lun, __entry->lba, __entry->wp_offset)
44 );
45 
46 TRACE_EVENT(scsi_zone_wp_update,
47 
48 	    TP_PROTO(struct scsi_cmnd *cmnd, sector_t rq_sector,
49 		     unsigned int wp_offset, unsigned int good_bytes),
50 
51 	    TP_ARGS(cmnd, rq_sector, wp_offset, good_bytes),
52 
53 	    TP_STRUCT__entry(
54 		     __field( unsigned int, host_no )
55 		     __field( unsigned int, channel )
56 		     __field( unsigned int, id )
57 		     __field( unsigned int, lun )
58 		     __field( sector_t,     rq_sector )
59 		     __field( unsigned int, wp_offset )
60 		     __field( unsigned int, good_bytes )
61 	    ),
62 
63 	    TP_fast_assign(
64 		__entry->host_no	= cmnd->device->host->host_no;
65 		__entry->channel	= cmnd->device->channel;
66 		__entry->id		= cmnd->device->id;
67 		__entry->lun		= cmnd->device->lun;
68 		__entry->rq_sector	= rq_sector;
69 		__entry->wp_offset	= wp_offset;
70 		__entry->good_bytes	= good_bytes;
71 	    ),
72 
73 	    TP_printk("host_no=%u, channel=%u id=%u lun=%u rq_sector=%llu" \
74 		      " wp_offset=%u good_bytes=%u",
75 		      __entry->host_no, __entry->channel, __entry->id,
76 		      __entry->lun, __entry->rq_sector, __entry->wp_offset,
77 		      __entry->good_bytes)
78 );
79 #endif /* _SD_TRACE_H */
80 
81 /* This part must be outside protection */
82 #undef TRACE_INCLUDE_PATH
83 #define TRACE_INCLUDE_PATH ../../drivers/scsi
84 #include <trace/define_trace.h>
85