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