aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/ftrace_event.h3
-rw-r--r--include/scsi/Kbuild1
-rw-r--r--include/scsi/fc/fc_fcp.h1
-rw-r--r--include/scsi/fc_encode.h18
-rw-r--r--include/scsi/libfc.h29
-rw-r--r--include/scsi/libfcoe.h10
-rw-r--r--include/scsi/scsi.h3
-rw-r--r--include/scsi/scsi_transport_fc.h2
-rw-r--r--include/trace/events/scsi.h345
-rw-r--r--include/trace/ftrace.h3
10 files changed, 380 insertions, 35 deletions
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index c0f4b364c71..c3c5aaaae53 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -25,6 +25,9 @@ const char *ftrace_print_flags_seq(struct trace_seq *p, const char *delim,
25const char *ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val, 25const char *ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val,
26 const struct trace_print_flags *symbol_array); 26 const struct trace_print_flags *symbol_array);
27 27
28const char *ftrace_print_hex_seq(struct trace_seq *p,
29 const unsigned char *buf, int len);
30
28/* 31/*
29 * The trace entry - the most basic unit of tracing. This is what 32 * The trace entry - the most basic unit of tracing. This is what
30 * is printed in the end as a single line in the trace output, such as: 33 * is printed in the end as a single line in the trace output, such as:
diff --git a/include/scsi/Kbuild b/include/scsi/Kbuild
index b3a0ee6b2f1..f2b94918994 100644
--- a/include/scsi/Kbuild
+++ b/include/scsi/Kbuild
@@ -1,4 +1,3 @@
1header-y += scsi.h
2header-y += scsi_netlink.h 1header-y += scsi_netlink.h
3header-y += scsi_netlink_fc.h 2header-y += scsi_netlink_fc.h
4header-y += scsi_bsg_fc.h 3header-y += scsi_bsg_fc.h
diff --git a/include/scsi/fc/fc_fcp.h b/include/scsi/fc/fc_fcp.h
index 747e2c7d88d..8e9b222251c 100644
--- a/include/scsi/fc/fc_fcp.h
+++ b/include/scsi/fc/fc_fcp.h
@@ -76,6 +76,7 @@ struct fcp_cmnd32 {
76#define FCP_PTA_HEADQ 1 /* head of queue task attribute */ 76#define FCP_PTA_HEADQ 1 /* head of queue task attribute */
77#define FCP_PTA_ORDERED 2 /* ordered task attribute */ 77#define FCP_PTA_ORDERED 2 /* ordered task attribute */
78#define FCP_PTA_ACA 4 /* auto. contigent allegiance */ 78#define FCP_PTA_ACA 4 /* auto. contigent allegiance */
79#define FCP_PTA_MASK 7 /* mask for task attribute field */
79#define FCP_PRI_SHIFT 3 /* priority field starts in bit 3 */ 80#define FCP_PRI_SHIFT 3 /* priority field starts in bit 3 */
80#define FCP_PRI_RESVD_MASK 0x80 /* reserved bits in priority field */ 81#define FCP_PRI_RESVD_MASK 0x80 /* reserved bits in priority field */
81 82
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index 8eb0a0fc0a7..9b4867c9c2d 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -74,7 +74,7 @@ static inline void fc_adisc_fill(struct fc_lport *lport, struct fc_frame *fp)
74 adisc->adisc_cmd = ELS_ADISC; 74 adisc->adisc_cmd = ELS_ADISC;
75 put_unaligned_be64(lport->wwpn, &adisc->adisc_wwpn); 75 put_unaligned_be64(lport->wwpn, &adisc->adisc_wwpn);
76 put_unaligned_be64(lport->wwnn, &adisc->adisc_wwnn); 76 put_unaligned_be64(lport->wwnn, &adisc->adisc_wwnn);
77 hton24(adisc->adisc_port_id, fc_host_port_id(lport->host)); 77 hton24(adisc->adisc_port_id, lport->port_id);
78} 78}
79 79
80/** 80/**
@@ -127,15 +127,13 @@ static inline int fc_ct_fill(struct fc_lport *lport,
127 127
128 case FC_NS_RFT_ID: 128 case FC_NS_RFT_ID:
129 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft)); 129 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft));
130 hton24(ct->payload.rft.fid.fp_fid, 130 hton24(ct->payload.rft.fid.fp_fid, lport->port_id);
131 fc_host_port_id(lport->host));
132 ct->payload.rft.fts = lport->fcts; 131 ct->payload.rft.fts = lport->fcts;
133 break; 132 break;
134 133
135 case FC_NS_RFF_ID: 134 case FC_NS_RFF_ID:
136 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id)); 135 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id));
137 hton24(ct->payload.rff.fr_fid.fp_fid, 136 hton24(ct->payload.rff.fr_fid.fp_fid, lport->port_id);
138 fc_host_port_id(lport->host));
139 ct->payload.rff.fr_type = FC_TYPE_FCP; 137 ct->payload.rff.fr_type = FC_TYPE_FCP;
140 if (lport->service_params & FCP_SPPF_INIT_FCN) 138 if (lport->service_params & FCP_SPPF_INIT_FCN)
141 ct->payload.rff.fr_feat = FCP_FEAT_INIT; 139 ct->payload.rff.fr_feat = FCP_FEAT_INIT;
@@ -145,16 +143,14 @@ static inline int fc_ct_fill(struct fc_lport *lport,
145 143
146 case FC_NS_RNN_ID: 144 case FC_NS_RNN_ID:
147 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id)); 145 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id));
148 hton24(ct->payload.rn.fr_fid.fp_fid, 146 hton24(ct->payload.rn.fr_fid.fp_fid, lport->port_id);
149 fc_host_port_id(lport->host));
150 put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn); 147 put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn);
151 break; 148 break;
152 149
153 case FC_NS_RSPN_ID: 150 case FC_NS_RSPN_ID:
154 len = strnlen(fc_host_symbolic_name(lport->host), 255); 151 len = strnlen(fc_host_symbolic_name(lport->host), 255);
155 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len); 152 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len);
156 hton24(ct->payload.spn.fr_fid.fp_fid, 153 hton24(ct->payload.spn.fr_fid.fp_fid, lport->port_id);
157 fc_host_port_id(lport->host));
158 strncpy(ct->payload.spn.fr_name, 154 strncpy(ct->payload.spn.fr_name,
159 fc_host_symbolic_name(lport->host), len); 155 fc_host_symbolic_name(lport->host), len);
160 ct->payload.spn.fr_name_len = len; 156 ct->payload.spn.fr_name_len = len;
@@ -268,7 +264,7 @@ static inline void fc_logo_fill(struct fc_lport *lport, struct fc_frame *fp)
268 logo = fc_frame_payload_get(fp, sizeof(*logo)); 264 logo = fc_frame_payload_get(fp, sizeof(*logo));
269 memset(logo, 0, sizeof(*logo)); 265 memset(logo, 0, sizeof(*logo));
270 logo->fl_cmd = ELS_LOGO; 266 logo->fl_cmd = ELS_LOGO;
271 hton24(logo->fl_n_port_id, fc_host_port_id(lport->host)); 267 hton24(logo->fl_n_port_id, lport->port_id);
272 logo->fl_n_port_wwn = htonll(lport->wwpn); 268 logo->fl_n_port_wwn = htonll(lport->wwpn);
273} 269}
274 270
@@ -295,7 +291,7 @@ static inline void fc_rec_fill(struct fc_lport *lport, struct fc_frame *fp)
295 rec = fc_frame_payload_get(fp, sizeof(*rec)); 291 rec = fc_frame_payload_get(fp, sizeof(*rec));
296 memset(rec, 0, sizeof(*rec)); 292 memset(rec, 0, sizeof(*rec));
297 rec->rec_cmd = ELS_REC; 293 rec->rec_cmd = ELS_REC;
298 hton24(rec->rec_s_id, fc_host_port_id(lport->host)); 294 hton24(rec->rec_s_id, lport->port_id);
299 rec->rec_ox_id = htons(ep->oxid); 295 rec->rec_ox_id = htons(ep->oxid);
300 rec->rec_rx_id = htons(ep->rxid); 296 rec->rec_rx_id = htons(ep->rxid);
301} 297}
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 4b912eee33e..7495c0ba67e 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -47,13 +47,18 @@
47#define ntohll(x) be64_to_cpu(x) 47#define ntohll(x) be64_to_cpu(x)
48#define htonll(x) cpu_to_be64(x) 48#define htonll(x) cpu_to_be64(x)
49 49
50#define ntoh24(p) (((p)[0] << 16) | ((p)[1] << 8) | ((p)[2]))
51 50
52#define hton24(p, v) do { \ 51static inline u32 ntoh24(const u8 *p)
53 p[0] = (((v) >> 16) & 0xFF); \ 52{
54 p[1] = (((v) >> 8) & 0xFF); \ 53 return (p[0] << 16) | (p[1] << 8) | p[2];
55 p[2] = ((v) & 0xFF); \ 54}
56 } while (0) 55
56static inline void hton24(u8 *p, u32 v)
57{
58 p[0] = (v >> 16) & 0xff;
59 p[1] = (v >> 8) & 0xff;
60 p[2] = v & 0xff;
61}
57 62
58/** 63/**
59 * enum fc_lport_state - Local port states 64 * enum fc_lport_state - Local port states
@@ -775,6 +780,7 @@ struct fc_disc {
775 * @dev_stats: FCoE device stats (TODO: libfc should not be 780 * @dev_stats: FCoE device stats (TODO: libfc should not be
776 * FCoE aware) 781 * FCoE aware)
777 * @retry_count: Number of retries in the current state 782 * @retry_count: Number of retries in the current state
783 * @port_id: FC Port ID
778 * @wwpn: World Wide Port Name 784 * @wwpn: World Wide Port Name
779 * @wwnn: World Wide Node Name 785 * @wwnn: World Wide Node Name
780 * @service_params: Common service parameters 786 * @service_params: Common service parameters
@@ -821,6 +827,7 @@ struct fc_lport {
821 u8 retry_count; 827 u8 retry_count;
822 828
823 /* Fabric information */ 829 /* Fabric information */
830 u32 port_id;
824 u64 wwpn; 831 u64 wwpn;
825 u64 wwnn; 832 u64 wwnn;
826 unsigned int service_params; 833 unsigned int service_params;
@@ -918,15 +925,6 @@ static inline void fc_lport_free_stats(struct fc_lport *lport)
918} 925}
919 926
920/** 927/**
921 * fc_lport_get_stats() - Get a local port's statistics
922 * @lport: The local port whose statistics are to be retreived
923 */
924static inline struct fcoe_dev_stats *fc_lport_get_stats(struct fc_lport *lport)
925{
926 return per_cpu_ptr(lport->dev_stats, smp_processor_id());
927}
928
929/**
930 * lport_priv() - Return the private data from a local port 928 * lport_priv() - Return the private data from a local port
931 * @lport: The local port whose private data is to be retreived 929 * @lport: The local port whose private data is to be retreived
932 */ 930 */
@@ -1053,7 +1051,6 @@ void fc_exch_mgr_reset(struct fc_lport *, u32 s_id, u32 d_id);
1053 * Functions for fc_functions_template 1051 * Functions for fc_functions_template
1054 */ 1052 */
1055void fc_get_host_speed(struct Scsi_Host *); 1053void fc_get_host_speed(struct Scsi_Host *);
1056void fc_get_host_port_type(struct Scsi_Host *);
1057void fc_get_host_port_state(struct Scsi_Host *); 1054void fc_get_host_port_state(struct Scsi_Host *);
1058void fc_set_rport_loss_tmo(struct fc_rport *, u32 timeout); 1055void fc_set_rport_loss_tmo(struct fc_rport *, u32 timeout);
1059struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *); 1056struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *);
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index c603f4a7e7f..ec13f51531f 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -29,6 +29,8 @@
29#include <scsi/fc/fc_fcoe.h> 29#include <scsi/fc/fc_fcoe.h>
30#include <scsi/libfc.h> 30#include <scsi/libfc.h>
31 31
32#define FCOE_MAX_CMD_LEN 16 /* Supported CDB length */
33
32/* 34/*
33 * FIP tunable parameters. 35 * FIP tunable parameters.
34 */ 36 */
@@ -65,14 +67,12 @@ enum fip_state {
65 * @port_ka_time: time of next port keep-alive. 67 * @port_ka_time: time of next port keep-alive.
66 * @ctlr_ka_time: time of next controller keep-alive. 68 * @ctlr_ka_time: time of next controller keep-alive.
67 * @timer: timer struct used for all delayed events. 69 * @timer: timer struct used for all delayed events.
68 * @link_work: &work_struct for doing FCF selection. 70 * @timer_work: &work_struct for doing keep-alives and resets.
69 * @recv_work: &work_struct for receiving FIP frames. 71 * @recv_work: &work_struct for receiving FIP frames.
70 * @fip_recv_list: list of received FIP frames. 72 * @fip_recv_list: list of received FIP frames.
71 * @user_mfs: configured maximum FC frame size, including FC header. 73 * @user_mfs: configured maximum FC frame size, including FC header.
72 * @flogi_oxid: exchange ID of most recent fabric login. 74 * @flogi_oxid: exchange ID of most recent fabric login.
73 * @flogi_count: number of FLOGI attempts in AUTO mode. 75 * @flogi_count: number of FLOGI attempts in AUTO mode.
74 * @link: current link status for libfc.
75 * @last_link: last link state reported to libfc.
76 * @map_dest: use the FC_MAP mode for destination MAC addresses. 76 * @map_dest: use the FC_MAP mode for destination MAC addresses.
77 * @spma: supports SPMA server-provided MACs mode 77 * @spma: supports SPMA server-provided MACs mode
78 * @send_ctlr_ka: need to send controller keep alive 78 * @send_ctlr_ka: need to send controller keep alive
@@ -100,14 +100,12 @@ struct fcoe_ctlr {
100 unsigned long port_ka_time; 100 unsigned long port_ka_time;
101 unsigned long ctlr_ka_time; 101 unsigned long ctlr_ka_time;
102 struct timer_list timer; 102 struct timer_list timer;
103 struct work_struct link_work; 103 struct work_struct timer_work;
104 struct work_struct recv_work; 104 struct work_struct recv_work;
105 struct sk_buff_head fip_recv_list; 105 struct sk_buff_head fip_recv_list;
106 u16 user_mfs; 106 u16 user_mfs;
107 u16 flogi_oxid; 107 u16 flogi_oxid;
108 u8 flogi_count; 108 u8 flogi_count;
109 u8 link;
110 u8 last_link;
111 u8 reset_req; 109 u8 reset_req;
112 u8 map_dest; 110 u8 map_dest;
113 u8 spma; 111 u8 spma;
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 8b4deca996a..9ae5c613131 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -114,6 +114,7 @@ struct scsi_cmnd;
114#define READ_12 0xa8 114#define READ_12 0xa8
115#define WRITE_12 0xaa 115#define WRITE_12 0xaa
116#define WRITE_VERIFY_12 0xae 116#define WRITE_VERIFY_12 0xae
117#define VERIFY_12 0xaf
117#define SEARCH_HIGH_12 0xb0 118#define SEARCH_HIGH_12 0xb0
118#define SEARCH_EQUAL_12 0xb1 119#define SEARCH_EQUAL_12 0xb1
119#define SEARCH_LOW_12 0xb2 120#define SEARCH_LOW_12 0xb2
@@ -134,6 +135,7 @@ struct scsi_cmnd;
134#define MO_SET_TARGET_PGS 0x0a 135#define MO_SET_TARGET_PGS 0x0a
135/* values for variable length command */ 136/* values for variable length command */
136#define READ_32 0x09 137#define READ_32 0x09
138#define VERIFY_32 0x0a
137#define WRITE_32 0x0b 139#define WRITE_32 0x0b
138#define WRITE_SAME_32 0x0d 140#define WRITE_SAME_32 0x0d
139 141
@@ -423,6 +425,7 @@ static inline int scsi_is_wlun(unsigned int lun)
423#define ADD_TO_MLQUEUE 0x2006 425#define ADD_TO_MLQUEUE 0x2006
424#define TIMEOUT_ERROR 0x2007 426#define TIMEOUT_ERROR 0x2007
425#define SCSI_RETURN_NOT_HANDLED 0x2008 427#define SCSI_RETURN_NOT_HANDLED 0x2008
428#define FAST_IO_FAIL 0x2009
426 429
427/* 430/*
428 * Midlevel queue return values. 431 * Midlevel queue return values.
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 8e86a94faf0..87d81b3ce56 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -807,6 +807,6 @@ void fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,
807struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel, 807struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel,
808 struct fc_vport_identifiers *); 808 struct fc_vport_identifiers *);
809int fc_vport_terminate(struct fc_vport *vport); 809int fc_vport_terminate(struct fc_vport *vport);
810void fc_block_scsi_eh(struct scsi_cmnd *cmnd); 810int fc_block_scsi_eh(struct scsi_cmnd *cmnd);
811 811
812#endif /* SCSI_TRANSPORT_FC_H */ 812#endif /* SCSI_TRANSPORT_FC_H */
diff --git a/include/trace/events/scsi.h b/include/trace/events/scsi.h
new file mode 100644
index 00000000000..25fbefdf2f2
--- /dev/null
+++ b/include/trace/events/scsi.h
@@ -0,0 +1,345 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM scsi
3
4#if !defined(_TRACE_SCSI_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_SCSI_H
6
7#include <scsi/scsi_cmnd.h>
8#include <scsi/scsi_host.h>
9#include <linux/tracepoint.h>
10#include <linux/trace_seq.h>
11
12#define scsi_opcode_name(opcode) { opcode, #opcode }
13#define show_opcode_name(val) \
14 __print_symbolic(val, \
15 scsi_opcode_name(TEST_UNIT_READY), \
16 scsi_opcode_name(REZERO_UNIT), \
17 scsi_opcode_name(REQUEST_SENSE), \
18 scsi_opcode_name(FORMAT_UNIT), \
19 scsi_opcode_name(READ_BLOCK_LIMITS), \
20 scsi_opcode_name(REASSIGN_BLOCKS), \
21 scsi_opcode_name(INITIALIZE_ELEMENT_STATUS), \
22 scsi_opcode_name(READ_6), \
23 scsi_opcode_name(WRITE_6), \
24 scsi_opcode_name(SEEK_6), \
25 scsi_opcode_name(READ_REVERSE), \
26 scsi_opcode_name(WRITE_FILEMARKS), \
27 scsi_opcode_name(SPACE), \
28 scsi_opcode_name(INQUIRY), \
29 scsi_opcode_name(RECOVER_BUFFERED_DATA), \
30 scsi_opcode_name(MODE_SELECT), \
31 scsi_opcode_name(RESERVE), \
32 scsi_opcode_name(RELEASE), \
33 scsi_opcode_name(COPY), \
34 scsi_opcode_name(ERASE), \
35 scsi_opcode_name(MODE_SENSE), \
36 scsi_opcode_name(START_STOP), \
37 scsi_opcode_name(RECEIVE_DIAGNOSTIC), \
38 scsi_opcode_name(SEND_DIAGNOSTIC), \
39 scsi_opcode_name(ALLOW_MEDIUM_REMOVAL), \
40 scsi_opcode_name(SET_WINDOW), \
41 scsi_opcode_name(READ_CAPACITY), \
42 scsi_opcode_name(READ_10), \
43 scsi_opcode_name(WRITE_10), \
44 scsi_opcode_name(SEEK_10), \
45 scsi_opcode_name(POSITION_TO_ELEMENT), \
46 scsi_opcode_name(WRITE_VERIFY), \
47 scsi_opcode_name(VERIFY), \
48 scsi_opcode_name(SEARCH_HIGH), \
49 scsi_opcode_name(SEARCH_EQUAL), \
50 scsi_opcode_name(SEARCH_LOW), \
51 scsi_opcode_name(SET_LIMITS), \
52 scsi_opcode_name(PRE_FETCH), \
53 scsi_opcode_name(READ_POSITION), \
54 scsi_opcode_name(SYNCHRONIZE_CACHE), \
55 scsi_opcode_name(LOCK_UNLOCK_CACHE), \
56 scsi_opcode_name(READ_DEFECT_DATA), \
57 scsi_opcode_name(MEDIUM_SCAN), \
58 scsi_opcode_name(COMPARE), \
59 scsi_opcode_name(COPY_VERIFY), \
60 scsi_opcode_name(WRITE_BUFFER), \
61 scsi_opcode_name(READ_BUFFER), \
62 scsi_opcode_name(UPDATE_BLOCK), \
63 scsi_opcode_name(READ_LONG), \
64 scsi_opcode_name(WRITE_LONG), \
65 scsi_opcode_name(CHANGE_DEFINITION), \
66 scsi_opcode_name(WRITE_SAME), \
67 scsi_opcode_name(UNMAP), \
68 scsi_opcode_name(READ_TOC), \
69 scsi_opcode_name(LOG_SELECT), \
70 scsi_opcode_name(LOG_SENSE), \
71 scsi_opcode_name(XDWRITEREAD_10), \
72 scsi_opcode_name(MODE_SELECT_10), \
73 scsi_opcode_name(RESERVE_10), \
74 scsi_opcode_name(RELEASE_10), \
75 scsi_opcode_name(MODE_SENSE_10), \
76 scsi_opcode_name(PERSISTENT_RESERVE_IN), \
77 scsi_opcode_name(PERSISTENT_RESERVE_OUT), \
78 scsi_opcode_name(VARIABLE_LENGTH_CMD), \
79 scsi_opcode_name(REPORT_LUNS), \
80 scsi_opcode_name(MAINTENANCE_IN), \
81 scsi_opcode_name(MAINTENANCE_OUT), \
82 scsi_opcode_name(MOVE_MEDIUM), \
83 scsi_opcode_name(EXCHANGE_MEDIUM), \
84 scsi_opcode_name(READ_12), \
85 scsi_opcode_name(WRITE_12), \
86 scsi_opcode_name(WRITE_VERIFY_12), \
87 scsi_opcode_name(SEARCH_HIGH_12), \
88 scsi_opcode_name(SEARCH_EQUAL_12), \
89 scsi_opcode_name(SEARCH_LOW_12), \
90 scsi_opcode_name(READ_ELEMENT_STATUS), \
91 scsi_opcode_name(SEND_VOLUME_TAG), \
92 scsi_opcode_name(WRITE_LONG_2), \
93 scsi_opcode_name(READ_16), \
94 scsi_opcode_name(WRITE_16), \
95 scsi_opcode_name(VERIFY_16), \
96 scsi_opcode_name(WRITE_SAME_16), \
97 scsi_opcode_name(SERVICE_ACTION_IN), \
98 scsi_opcode_name(SAI_READ_CAPACITY_16), \
99 scsi_opcode_name(SAI_GET_LBA_STATUS), \
100 scsi_opcode_name(MI_REPORT_TARGET_PGS), \
101 scsi_opcode_name(MO_SET_TARGET_PGS), \
102 scsi_opcode_name(READ_32), \
103 scsi_opcode_name(WRITE_32), \
104 scsi_opcode_name(WRITE_SAME_32), \
105 scsi_opcode_name(ATA_16), \
106 scsi_opcode_name(ATA_12))
107
108#define scsi_hostbyte_name(result) { result, #result }
109#define show_hostbyte_name(val) \
110 __print_symbolic(val, \
111 scsi_hostbyte_name(DID_OK), \
112 scsi_hostbyte_name(DID_NO_CONNECT), \
113 scsi_hostbyte_name(DID_BUS_BUSY), \
114 scsi_hostbyte_name(DID_TIME_OUT), \
115 scsi_hostbyte_name(DID_BAD_TARGET), \
116 scsi_hostbyte_name(DID_ABORT), \
117 scsi_hostbyte_name(DID_PARITY), \
118 scsi_hostbyte_name(DID_ERROR), \
119 scsi_hostbyte_name(DID_RESET), \
120 scsi_hostbyte_name(DID_BAD_INTR), \
121 scsi_hostbyte_name(DID_PASSTHROUGH), \
122 scsi_hostbyte_name(DID_SOFT_ERROR), \
123 scsi_hostbyte_name(DID_IMM_RETRY), \
124 scsi_hostbyte_name(DID_REQUEUE), \
125 scsi_hostbyte_name(DID_TRANSPORT_DISRUPTED), \
126 scsi_hostbyte_name(DID_TRANSPORT_FAILFAST))
127
128#define scsi_driverbyte_name(result) { result, #result }
129#define show_driverbyte_name(val) \
130 __print_symbolic(val, \
131 scsi_driverbyte_name(DRIVER_OK), \
132 scsi_driverbyte_name(DRIVER_BUSY), \
133 scsi_driverbyte_name(DRIVER_SOFT), \
134 scsi_driverbyte_name(DRIVER_MEDIA), \
135 scsi_driverbyte_name(DRIVER_ERROR), \
136 scsi_driverbyte_name(DRIVER_INVALID), \
137 scsi_driverbyte_name(DRIVER_TIMEOUT), \
138 scsi_driverbyte_name(DRIVER_HARD), \
139 scsi_driverbyte_name(DRIVER_SENSE))
140
141#define scsi_msgbyte_name(result) { result, #result }
142#define show_msgbyte_name(val) \
143 __print_symbolic(val, \
144 scsi_msgbyte_name(COMMAND_COMPLETE), \
145 scsi_msgbyte_name(EXTENDED_MESSAGE), \
146 scsi_msgbyte_name(SAVE_POINTERS), \
147 scsi_msgbyte_name(RESTORE_POINTERS), \
148 scsi_msgbyte_name(DISCONNECT), \
149 scsi_msgbyte_name(INITIATOR_ERROR), \
150 scsi_msgbyte_name(ABORT_TASK_SET), \
151 scsi_msgbyte_name(MESSAGE_REJECT), \
152 scsi_msgbyte_name(NOP), \
153 scsi_msgbyte_name(MSG_PARITY_ERROR), \
154 scsi_msgbyte_name(LINKED_CMD_COMPLETE), \
155 scsi_msgbyte_name(LINKED_FLG_CMD_COMPLETE), \
156 scsi_msgbyte_name(TARGET_RESET), \
157 scsi_msgbyte_name(ABORT_TASK), \
158 scsi_msgbyte_name(CLEAR_TASK_SET), \
159 scsi_msgbyte_name(INITIATE_RECOVERY), \
160 scsi_msgbyte_name(RELEASE_RECOVERY), \
161 scsi_msgbyte_name(CLEAR_ACA), \
162 scsi_msgbyte_name(LOGICAL_UNIT_RESET), \
163 scsi_msgbyte_name(SIMPLE_QUEUE_TAG), \
164 scsi_msgbyte_name(HEAD_OF_QUEUE_TAG), \
165 scsi_msgbyte_name(ORDERED_QUEUE_TAG), \
166 scsi_msgbyte_name(IGNORE_WIDE_RESIDUE), \
167 scsi_msgbyte_name(ACA), \
168 scsi_msgbyte_name(QAS_REQUEST), \
169 scsi_msgbyte_name(BUS_DEVICE_RESET), \
170 scsi_msgbyte_name(ABORT))
171
172#define scsi_statusbyte_name(result) { result, #result }
173#define show_statusbyte_name(val) \
174 __print_symbolic(val, \
175 scsi_statusbyte_name(SAM_STAT_GOOD), \
176 scsi_statusbyte_name(SAM_STAT_CHECK_CONDITION), \
177 scsi_statusbyte_name(SAM_STAT_CONDITION_MET), \
178 scsi_statusbyte_name(SAM_STAT_BUSY), \
179 scsi_statusbyte_name(SAM_STAT_INTERMEDIATE), \
180 scsi_statusbyte_name(SAM_STAT_INTERMEDIATE_CONDITION_MET), \
181 scsi_statusbyte_name(SAM_STAT_RESERVATION_CONFLICT), \
182 scsi_statusbyte_name(SAM_STAT_COMMAND_TERMINATED), \
183 scsi_statusbyte_name(SAM_STAT_TASK_SET_FULL), \
184 scsi_statusbyte_name(SAM_STAT_ACA_ACTIVE), \
185 scsi_statusbyte_name(SAM_STAT_TASK_ABORTED))
186
187const char *scsi_trace_parse_cdb(struct trace_seq*, unsigned char*, int);
188#define __parse_cdb(cdb, len) scsi_trace_parse_cdb(p, cdb, len)
189
190TRACE_EVENT(scsi_dispatch_cmd_start,
191
192 TP_PROTO(struct scsi_cmnd *cmd),
193
194 TP_ARGS(cmd),
195
196 TP_STRUCT__entry(
197 __field( unsigned int, host_no )
198 __field( unsigned int, channel )
199 __field( unsigned int, id )
200 __field( unsigned int, lun )
201 __field( unsigned int, opcode )
202 __field( unsigned int, cmd_len )
203 __field( unsigned int, data_sglen )
204 __field( unsigned int, prot_sglen )
205 __dynamic_array(unsigned char, cmnd, cmd->cmd_len)
206 ),
207
208 TP_fast_assign(
209 __entry->host_no = cmd->device->host->host_no;
210 __entry->channel = cmd->device->channel;
211 __entry->id = cmd->device->id;
212 __entry->lun = cmd->device->lun;
213 __entry->opcode = cmd->cmnd[0];
214 __entry->cmd_len = cmd->cmd_len;
215 __entry->data_sglen = scsi_sg_count(cmd);
216 __entry->prot_sglen = scsi_prot_sg_count(cmd);
217 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len);
218 ),
219
220 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u" \
221 " cmnd=(%s %s raw=%s)",
222 __entry->host_no, __entry->channel, __entry->id,
223 __entry->lun, __entry->data_sglen, __entry->prot_sglen,
224 show_opcode_name(__entry->opcode),
225 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len),
226 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len))
227);
228
229TRACE_EVENT(scsi_dispatch_cmd_error,
230
231 TP_PROTO(struct scsi_cmnd *cmd, int rtn),
232
233 TP_ARGS(cmd, rtn),
234
235 TP_STRUCT__entry(
236 __field( unsigned int, host_no )
237 __field( unsigned int, channel )
238 __field( unsigned int, id )
239 __field( unsigned int, lun )
240 __field( int, rtn )
241 __field( unsigned int, opcode )
242 __field( unsigned int, cmd_len )
243 __field( unsigned int, data_sglen )
244 __field( unsigned int, prot_sglen )
245 __dynamic_array(unsigned char, cmnd, cmd->cmd_len)
246 ),
247
248 TP_fast_assign(
249 __entry->host_no = cmd->device->host->host_no;
250 __entry->channel = cmd->device->channel;
251 __entry->id = cmd->device->id;
252 __entry->lun = cmd->device->lun;
253 __entry->rtn = rtn;
254 __entry->opcode = cmd->cmnd[0];
255 __entry->cmd_len = cmd->cmd_len;
256 __entry->data_sglen = scsi_sg_count(cmd);
257 __entry->prot_sglen = scsi_prot_sg_count(cmd);
258 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len);
259 ),
260
261 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u" \
262 " cmnd=(%s %s raw=%s) rtn=%d",
263 __entry->host_no, __entry->channel, __entry->id,
264 __entry->lun, __entry->data_sglen, __entry->prot_sglen,
265 show_opcode_name(__entry->opcode),
266 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len),
267 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len),
268 __entry->rtn)
269);
270
271DECLARE_EVENT_CLASS(scsi_cmd_done_timeout_template,
272
273 TP_PROTO(struct scsi_cmnd *cmd),
274
275 TP_ARGS(cmd),
276
277 TP_STRUCT__entry(
278 __field( unsigned int, host_no )
279 __field( unsigned int, channel )
280 __field( unsigned int, id )
281 __field( unsigned int, lun )
282 __field( int, result )
283 __field( unsigned int, opcode )
284 __field( unsigned int, cmd_len )
285 __field( unsigned int, data_sglen )
286 __field( unsigned int, prot_sglen )
287 __dynamic_array(unsigned char, cmnd, cmd->cmd_len)
288 ),
289
290 TP_fast_assign(
291 __entry->host_no = cmd->device->host->host_no;
292 __entry->channel = cmd->device->channel;
293 __entry->id = cmd->device->id;
294 __entry->lun = cmd->device->lun;
295 __entry->result = cmd->result;
296 __entry->opcode = cmd->cmnd[0];
297 __entry->cmd_len = cmd->cmd_len;
298 __entry->data_sglen = scsi_sg_count(cmd);
299 __entry->prot_sglen = scsi_prot_sg_count(cmd);
300 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len);
301 ),
302
303 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u " \
304 "prot_sgl=%u cmnd=(%s %s raw=%s) result=(driver=%s host=%s " \
305 "message=%s status=%s)",
306 __entry->host_no, __entry->channel, __entry->id,
307 __entry->lun, __entry->data_sglen, __entry->prot_sglen,
308 show_opcode_name(__entry->opcode),
309 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len),
310 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len),
311 show_driverbyte_name(((__entry->result) >> 24) & 0xff),
312 show_hostbyte_name(((__entry->result) >> 16) & 0xff),
313 show_msgbyte_name(((__entry->result) >> 8) & 0xff),
314 show_statusbyte_name(__entry->result & 0xff))
315);
316
317DEFINE_EVENT(scsi_cmd_done_timeout_template, scsi_dispatch_cmd_done,
318 TP_PROTO(struct scsi_cmnd *cmd),
319 TP_ARGS(cmd));
320
321DEFINE_EVENT(scsi_cmd_done_timeout_template, scsi_dispatch_cmd_timeout,
322 TP_PROTO(struct scsi_cmnd *cmd),
323 TP_ARGS(cmd));
324
325TRACE_EVENT(scsi_eh_wakeup,
326
327 TP_PROTO(struct Scsi_Host *shost),
328
329 TP_ARGS(shost),
330
331 TP_STRUCT__entry(
332 __field( unsigned int, host_no )
333 ),
334
335 TP_fast_assign(
336 __entry->host_no = shost->host_no;
337 ),
338
339 TP_printk("host_no=%u", __entry->host_no)
340);
341
342#endif /* _TRACE_SCSI_H */
343
344/* This part must be outside protection */
345#include <trace/define_trace.h>
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index ea6f9d4a20e..c48320b3dab 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -198,6 +198,9 @@
198 ftrace_print_symbols_seq(p, value, symbols); \ 198 ftrace_print_symbols_seq(p, value, symbols); \
199 }) 199 })
200 200
201#undef __print_hex
202#define __print_hex(buf, buf_len) ftrace_print_hex_seq(p, buf, buf_len)
203
201#undef DECLARE_EVENT_CLASS 204#undef DECLARE_EVENT_CLASS
202#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 205#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
203static notrace enum print_line_t \ 206static notrace enum print_line_t \