aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/target/iscsi/iscsi_transport.h21
-rw-r--r--include/target/target_core_base.h23
-rw-r--r--include/target/target_core_configfs.h1
-rw-r--r--include/target/target_core_fabric.h2
-rw-r--r--include/target/target_core_fabric_configfs.h11
-rw-r--r--include/trace/events/target.h214
6 files changed, 250 insertions, 22 deletions
diff --git a/include/target/iscsi/iscsi_transport.h b/include/target/iscsi/iscsi_transport.h
index 23a87d0cd72c..e5d09d242ba3 100644
--- a/include/target/iscsi/iscsi_transport.h
+++ b/include/target/iscsi/iscsi_transport.h
@@ -34,8 +34,6 @@ extern void iscsit_put_transport(struct iscsit_transport *);
34/* 34/*
35 * From iscsi_target.c 35 * From iscsi_target.c
36 */ 36 */
37extern int iscsit_add_reject_from_cmd(u8, int, int, unsigned char *,
38 struct iscsi_cmd *);
39extern int iscsit_setup_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *, 37extern int iscsit_setup_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *,
40 unsigned char *); 38 unsigned char *);
41extern void iscsit_set_unsoliticed_dataout(struct iscsi_cmd *); 39extern void iscsit_set_unsoliticed_dataout(struct iscsi_cmd *);
@@ -45,18 +43,26 @@ extern int iscsit_check_dataout_hdr(struct iscsi_conn *, unsigned char *,
45 struct iscsi_cmd **); 43 struct iscsi_cmd **);
46extern int iscsit_check_dataout_payload(struct iscsi_cmd *, struct iscsi_data *, 44extern int iscsit_check_dataout_payload(struct iscsi_cmd *, struct iscsi_data *,
47 bool); 45 bool);
48extern int iscsit_handle_nop_out(struct iscsi_conn *, struct iscsi_cmd *, 46extern int iscsit_setup_nop_out(struct iscsi_conn *, struct iscsi_cmd *,
49 unsigned char *); 47 struct iscsi_nopout *);
48extern int iscsit_process_nop_out(struct iscsi_conn *, struct iscsi_cmd *,
49 struct iscsi_nopout *);
50extern int iscsit_handle_logout_cmd(struct iscsi_conn *, struct iscsi_cmd *, 50extern int iscsit_handle_logout_cmd(struct iscsi_conn *, struct iscsi_cmd *,
51 unsigned char *); 51 unsigned char *);
52extern int iscsit_handle_task_mgt_cmd(struct iscsi_conn *, struct iscsi_cmd *, 52extern int iscsit_handle_task_mgt_cmd(struct iscsi_conn *, struct iscsi_cmd *,
53 unsigned char *); 53 unsigned char *);
54extern int iscsit_setup_text_cmd(struct iscsi_conn *, struct iscsi_cmd *,
55 struct iscsi_text *);
56extern int iscsit_process_text_cmd(struct iscsi_conn *, struct iscsi_cmd *,
57 struct iscsi_text *);
54extern void iscsit_build_rsp_pdu(struct iscsi_cmd *, struct iscsi_conn *, 58extern void iscsit_build_rsp_pdu(struct iscsi_cmd *, struct iscsi_conn *,
55 bool, struct iscsi_scsi_rsp *); 59 bool, struct iscsi_scsi_rsp *);
56extern void iscsit_build_nopin_rsp(struct iscsi_cmd *, struct iscsi_conn *, 60extern void iscsit_build_nopin_rsp(struct iscsi_cmd *, struct iscsi_conn *,
57 struct iscsi_nopin *, bool); 61 struct iscsi_nopin *, bool);
58extern void iscsit_build_task_mgt_rsp(struct iscsi_cmd *, struct iscsi_conn *, 62extern void iscsit_build_task_mgt_rsp(struct iscsi_cmd *, struct iscsi_conn *,
59 struct iscsi_tm_rsp *); 63 struct iscsi_tm_rsp *);
64extern int iscsit_build_text_rsp(struct iscsi_cmd *, struct iscsi_conn *,
65 struct iscsi_text_rsp *);
60extern void iscsit_build_reject(struct iscsi_cmd *, struct iscsi_conn *, 66extern void iscsit_build_reject(struct iscsi_cmd *, struct iscsi_conn *,
61 struct iscsi_reject *); 67 struct iscsi_reject *);
62extern int iscsit_build_logout_rsp(struct iscsi_cmd *, struct iscsi_conn *, 68extern int iscsit_build_logout_rsp(struct iscsi_cmd *, struct iscsi_conn *,
@@ -67,6 +73,10 @@ extern int iscsit_logout_post_handler(struct iscsi_cmd *, struct iscsi_conn *);
67 */ 73 */
68extern void iscsit_increment_maxcmdsn(struct iscsi_cmd *, struct iscsi_session *); 74extern void iscsit_increment_maxcmdsn(struct iscsi_cmd *, struct iscsi_session *);
69/* 75/*
76 * From iscsi_target_erl0.c
77 */
78extern void iscsit_cause_connection_reinstatement(struct iscsi_conn *, int);
79/*
70 * From iscsi_target_erl1.c 80 * From iscsi_target_erl1.c
71 */ 81 */
72extern void iscsit_stop_dataout_timer(struct iscsi_cmd *); 82extern void iscsit_stop_dataout_timer(struct iscsi_cmd *);
@@ -80,4 +90,5 @@ extern int iscsit_tmr_post_handler(struct iscsi_cmd *, struct iscsi_conn *);
80 * From iscsi_target_util.c 90 * From iscsi_target_util.c
81 */ 91 */
82extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, gfp_t); 92extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, gfp_t);
83extern int iscsit_sequence_cmd(struct iscsi_conn *, struct iscsi_cmd *, __be32); 93extern int iscsit_sequence_cmd(struct iscsi_conn *, struct iscsi_cmd *,
94 unsigned char *, __be32);
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 4ea4f985f394..e34fc904f2e1 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -218,14 +218,11 @@ enum tcm_tmreq_table {
218 218
219/* fabric independent task management response values */ 219/* fabric independent task management response values */
220enum tcm_tmrsp_table { 220enum tcm_tmrsp_table {
221 TMR_FUNCTION_COMPLETE = 0, 221 TMR_FUNCTION_COMPLETE = 1,
222 TMR_TASK_DOES_NOT_EXIST = 1, 222 TMR_TASK_DOES_NOT_EXIST = 2,
223 TMR_LUN_DOES_NOT_EXIST = 2, 223 TMR_LUN_DOES_NOT_EXIST = 3,
224 TMR_TASK_STILL_ALLEGIANT = 3, 224 TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED = 4,
225 TMR_TASK_FAILOVER_NOT_SUPPORTED = 4, 225 TMR_FUNCTION_REJECTED = 5,
226 TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED = 5,
227 TMR_FUNCTION_AUTHORIZATION_FAILED = 6,
228 TMR_FUNCTION_REJECTED = 255,
229}; 226};
230 227
231/* 228/*
@@ -339,8 +336,6 @@ struct t10_pr_registration {
339 /* Used during APTPL metadata reading */ 336 /* Used during APTPL metadata reading */
340#define PR_APTPL_MAX_TPORT_LEN 256 337#define PR_APTPL_MAX_TPORT_LEN 256
341 unsigned char pr_tport[PR_APTPL_MAX_TPORT_LEN]; 338 unsigned char pr_tport[PR_APTPL_MAX_TPORT_LEN];
342 /* For writing out live meta data */
343 unsigned char *pr_aptpl_buf;
344 u16 pr_aptpl_rpti; 339 u16 pr_aptpl_rpti;
345 u16 pr_reg_tpgt; 340 u16 pr_reg_tpgt;
346 /* Reservation effects all target ports */ 341 /* Reservation effects all target ports */
@@ -374,9 +369,7 @@ struct t10_reservation {
374 /* Activate Persistence across Target Power Loss enabled 369 /* Activate Persistence across Target Power Loss enabled
375 * for SCSI device */ 370 * for SCSI device */
376 int pr_aptpl_active; 371 int pr_aptpl_active;
377 /* Used by struct t10_reservation->pr_aptpl_buf_len */
378#define PR_APTPL_BUF_LEN 8192 372#define PR_APTPL_BUF_LEN 8192
379 u32 pr_aptpl_buf_len;
380 u32 pr_generation; 373 u32 pr_generation;
381 spinlock_t registration_lock; 374 spinlock_t registration_lock;
382 spinlock_t aptpl_reg_lock; 375 spinlock_t aptpl_reg_lock;
@@ -424,8 +417,6 @@ struct se_cmd {
424 int sam_task_attr; 417 int sam_task_attr;
425 /* Transport protocol dependent state, see transport_state_table */ 418 /* Transport protocol dependent state, see transport_state_table */
426 enum transport_state_table t_state; 419 enum transport_state_table t_state;
427 /* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */
428 unsigned check_release:1;
429 unsigned cmd_wait_set:1; 420 unsigned cmd_wait_set:1;
430 unsigned unknown_data_length:1; 421 unsigned unknown_data_length:1;
431 /* See se_cmd_flags_table */ 422 /* See se_cmd_flags_table */
@@ -458,7 +449,6 @@ struct se_cmd {
458 unsigned char *t_task_cdb; 449 unsigned char *t_task_cdb;
459 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; 450 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
460 unsigned long long t_task_lba; 451 unsigned long long t_task_lba;
461 atomic_t t_fe_count;
462 unsigned int transport_state; 452 unsigned int transport_state;
463#define CMD_T_ABORTED (1 << 0) 453#define CMD_T_ABORTED (1 << 0)
464#define CMD_T_ACTIVE (1 << 1) 454#define CMD_T_ACTIVE (1 << 1)
@@ -802,11 +792,12 @@ struct se_portal_group {
802 struct target_core_fabric_ops *se_tpg_tfo; 792 struct target_core_fabric_ops *se_tpg_tfo;
803 struct se_wwn *se_tpg_wwn; 793 struct se_wwn *se_tpg_wwn;
804 struct config_group tpg_group; 794 struct config_group tpg_group;
805 struct config_group *tpg_default_groups[6]; 795 struct config_group *tpg_default_groups[7];
806 struct config_group tpg_lun_group; 796 struct config_group tpg_lun_group;
807 struct config_group tpg_np_group; 797 struct config_group tpg_np_group;
808 struct config_group tpg_acl_group; 798 struct config_group tpg_acl_group;
809 struct config_group tpg_attrib_group; 799 struct config_group tpg_attrib_group;
800 struct config_group tpg_auth_group;
810 struct config_group tpg_param_group; 801 struct config_group tpg_param_group;
811}; 802};
812 803
diff --git a/include/target/target_core_configfs.h b/include/target/target_core_configfs.h
index 612509592ffd..713c5004f4ae 100644
--- a/include/target/target_core_configfs.h
+++ b/include/target/target_core_configfs.h
@@ -23,6 +23,7 @@ struct target_fabric_configfs_template {
23 struct config_item_type tfc_tpg_np_cit; 23 struct config_item_type tfc_tpg_np_cit;
24 struct config_item_type tfc_tpg_np_base_cit; 24 struct config_item_type tfc_tpg_np_base_cit;
25 struct config_item_type tfc_tpg_attrib_cit; 25 struct config_item_type tfc_tpg_attrib_cit;
26 struct config_item_type tfc_tpg_auth_cit;
26 struct config_item_type tfc_tpg_param_cit; 27 struct config_item_type tfc_tpg_param_cit;
27 struct config_item_type tfc_tpg_nacl_cit; 28 struct config_item_type tfc_tpg_nacl_cit;
28 struct config_item_type tfc_tpg_nacl_base_cit; 29 struct config_item_type tfc_tpg_nacl_base_cit;
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 1dcce9cc99b9..7a16178424f9 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -61,7 +61,7 @@ struct target_core_fabric_ops {
61 int (*get_cmd_state)(struct se_cmd *); 61 int (*get_cmd_state)(struct se_cmd *);
62 int (*queue_data_in)(struct se_cmd *); 62 int (*queue_data_in)(struct se_cmd *);
63 int (*queue_status)(struct se_cmd *); 63 int (*queue_status)(struct se_cmd *);
64 int (*queue_tm_rsp)(struct se_cmd *); 64 void (*queue_tm_rsp)(struct se_cmd *);
65 /* 65 /*
66 * fabric module calls for target_core_fabric_configfs.c 66 * fabric module calls for target_core_fabric_configfs.c
67 */ 67 */
diff --git a/include/target/target_core_fabric_configfs.h b/include/target/target_core_fabric_configfs.h
index a26fb7586a09..b32a14905cfa 100644
--- a/include/target/target_core_fabric_configfs.h
+++ b/include/target/target_core_fabric_configfs.h
@@ -62,6 +62,17 @@ static struct target_fabric_tpg_attrib_attribute _fabric##_tpg_attrib_##_name =
62 _fabric##_tpg_attrib_show_##_name, \ 62 _fabric##_tpg_attrib_show_##_name, \
63 _fabric##_tpg_attrib_store_##_name); 63 _fabric##_tpg_attrib_store_##_name);
64 64
65CONFIGFS_EATTR_STRUCT(target_fabric_tpg_auth, se_portal_group);
66#define TF_TPG_AUTH_ATTR(_fabric, _name, _mode) \
67static struct target_fabric_tpg_auth_attribute _fabric##_tpg_auth_##_name = \
68 __CONFIGFS_EATTR(_name, _mode, \
69 _fabric##_tpg_auth_show_##_name, \
70 _fabric##_tpg_auth_store_##_name);
71
72#define TF_TPG_AUTH_ATTR_RO(_fabric, _name) \
73static struct target_fabric_tpg_auth_attribute _fabric##_tpg_auth_##_name = \
74 __CONFIGFS_EATTR_RO(_name, \
75 _fabric##_tpg_auth_show_##_name);
65 76
66CONFIGFS_EATTR_STRUCT(target_fabric_tpg_param, se_portal_group); 77CONFIGFS_EATTR_STRUCT(target_fabric_tpg_param, se_portal_group);
67#define TF_TPG_PARAM_ATTR(_fabric, _name, _mode) \ 78#define TF_TPG_PARAM_ATTR(_fabric, _name, _mode) \
diff --git a/include/trace/events/target.h b/include/trace/events/target.h
new file mode 100644
index 000000000000..aef8fc354025
--- /dev/null
+++ b/include/trace/events/target.h
@@ -0,0 +1,214 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM target
3
4#if !defined(_TRACE_TARGET_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_TARGET_H
6
7#include <linux/tracepoint.h>
8#include <linux/trace_seq.h>
9#include <scsi/scsi.h>
10#include <scsi/scsi_tcq.h>
11#include <target/target_core_base.h>
12
13/* cribbed verbatim from <trace/event/scsi.h> */
14#define scsi_opcode_name(opcode) { opcode, #opcode }
15#define show_opcode_name(val) \
16 __print_symbolic(val, \
17 scsi_opcode_name(TEST_UNIT_READY), \
18 scsi_opcode_name(REZERO_UNIT), \
19 scsi_opcode_name(REQUEST_SENSE), \
20 scsi_opcode_name(FORMAT_UNIT), \
21 scsi_opcode_name(READ_BLOCK_LIMITS), \
22 scsi_opcode_name(REASSIGN_BLOCKS), \
23 scsi_opcode_name(INITIALIZE_ELEMENT_STATUS), \
24 scsi_opcode_name(READ_6), \
25 scsi_opcode_name(WRITE_6), \
26 scsi_opcode_name(SEEK_6), \
27 scsi_opcode_name(READ_REVERSE), \
28 scsi_opcode_name(WRITE_FILEMARKS), \
29 scsi_opcode_name(SPACE), \
30 scsi_opcode_name(INQUIRY), \
31 scsi_opcode_name(RECOVER_BUFFERED_DATA), \
32 scsi_opcode_name(MODE_SELECT), \
33 scsi_opcode_name(RESERVE), \
34 scsi_opcode_name(RELEASE), \
35 scsi_opcode_name(COPY), \
36 scsi_opcode_name(ERASE), \
37 scsi_opcode_name(MODE_SENSE), \
38 scsi_opcode_name(START_STOP), \
39 scsi_opcode_name(RECEIVE_DIAGNOSTIC), \
40 scsi_opcode_name(SEND_DIAGNOSTIC), \
41 scsi_opcode_name(ALLOW_MEDIUM_REMOVAL), \
42 scsi_opcode_name(SET_WINDOW), \
43 scsi_opcode_name(READ_CAPACITY), \
44 scsi_opcode_name(READ_10), \
45 scsi_opcode_name(WRITE_10), \
46 scsi_opcode_name(SEEK_10), \
47 scsi_opcode_name(POSITION_TO_ELEMENT), \
48 scsi_opcode_name(WRITE_VERIFY), \
49 scsi_opcode_name(VERIFY), \
50 scsi_opcode_name(SEARCH_HIGH), \
51 scsi_opcode_name(SEARCH_EQUAL), \
52 scsi_opcode_name(SEARCH_LOW), \
53 scsi_opcode_name(SET_LIMITS), \
54 scsi_opcode_name(PRE_FETCH), \
55 scsi_opcode_name(READ_POSITION), \
56 scsi_opcode_name(SYNCHRONIZE_CACHE), \
57 scsi_opcode_name(LOCK_UNLOCK_CACHE), \
58 scsi_opcode_name(READ_DEFECT_DATA), \
59 scsi_opcode_name(MEDIUM_SCAN), \
60 scsi_opcode_name(COMPARE), \
61 scsi_opcode_name(COPY_VERIFY), \
62 scsi_opcode_name(WRITE_BUFFER), \
63 scsi_opcode_name(READ_BUFFER), \
64 scsi_opcode_name(UPDATE_BLOCK), \
65 scsi_opcode_name(READ_LONG), \
66 scsi_opcode_name(WRITE_LONG), \
67 scsi_opcode_name(CHANGE_DEFINITION), \
68 scsi_opcode_name(WRITE_SAME), \
69 scsi_opcode_name(UNMAP), \
70 scsi_opcode_name(READ_TOC), \
71 scsi_opcode_name(LOG_SELECT), \
72 scsi_opcode_name(LOG_SENSE), \
73 scsi_opcode_name(XDWRITEREAD_10), \
74 scsi_opcode_name(MODE_SELECT_10), \
75 scsi_opcode_name(RESERVE_10), \
76 scsi_opcode_name(RELEASE_10), \
77 scsi_opcode_name(MODE_SENSE_10), \
78 scsi_opcode_name(PERSISTENT_RESERVE_IN), \
79 scsi_opcode_name(PERSISTENT_RESERVE_OUT), \
80 scsi_opcode_name(VARIABLE_LENGTH_CMD), \
81 scsi_opcode_name(REPORT_LUNS), \
82 scsi_opcode_name(MAINTENANCE_IN), \
83 scsi_opcode_name(MAINTENANCE_OUT), \
84 scsi_opcode_name(MOVE_MEDIUM), \
85 scsi_opcode_name(EXCHANGE_MEDIUM), \
86 scsi_opcode_name(READ_12), \
87 scsi_opcode_name(WRITE_12), \
88 scsi_opcode_name(WRITE_VERIFY_12), \
89 scsi_opcode_name(SEARCH_HIGH_12), \
90 scsi_opcode_name(SEARCH_EQUAL_12), \
91 scsi_opcode_name(SEARCH_LOW_12), \
92 scsi_opcode_name(READ_ELEMENT_STATUS), \
93 scsi_opcode_name(SEND_VOLUME_TAG), \
94 scsi_opcode_name(WRITE_LONG_2), \
95 scsi_opcode_name(READ_16), \
96 scsi_opcode_name(WRITE_16), \
97 scsi_opcode_name(VERIFY_16), \
98 scsi_opcode_name(WRITE_SAME_16), \
99 scsi_opcode_name(SERVICE_ACTION_IN), \
100 scsi_opcode_name(SAI_READ_CAPACITY_16), \
101 scsi_opcode_name(SAI_GET_LBA_STATUS), \
102 scsi_opcode_name(MI_REPORT_TARGET_PGS), \
103 scsi_opcode_name(MO_SET_TARGET_PGS), \
104 scsi_opcode_name(READ_32), \
105 scsi_opcode_name(WRITE_32), \
106 scsi_opcode_name(WRITE_SAME_32), \
107 scsi_opcode_name(ATA_16), \
108 scsi_opcode_name(ATA_12))
109
110#define show_task_attribute_name(val) \
111 __print_symbolic(val, \
112 { MSG_SIMPLE_TAG, "SIMPLE" }, \
113 { MSG_HEAD_TAG, "HEAD" }, \
114 { MSG_ORDERED_TAG, "ORDERED" }, \
115 { MSG_ACA_TAG, "ACA" } )
116
117#define show_scsi_status_name(val) \
118 __print_symbolic(val, \
119 { SAM_STAT_GOOD, "GOOD" }, \
120 { SAM_STAT_CHECK_CONDITION, "CHECK CONDITION" }, \
121 { SAM_STAT_CONDITION_MET, "CONDITION MET" }, \
122 { SAM_STAT_BUSY, "BUSY" }, \
123 { SAM_STAT_INTERMEDIATE, "INTERMEDIATE" }, \
124 { SAM_STAT_INTERMEDIATE_CONDITION_MET, "INTERMEDIATE CONDITION MET" }, \
125 { SAM_STAT_RESERVATION_CONFLICT, "RESERVATION CONFLICT" }, \
126 { SAM_STAT_COMMAND_TERMINATED, "COMMAND TERMINATED" }, \
127 { SAM_STAT_TASK_SET_FULL, "TASK SET FULL" }, \
128 { SAM_STAT_ACA_ACTIVE, "ACA ACTIVE" }, \
129 { SAM_STAT_TASK_ABORTED, "TASK ABORTED" } )
130
131TRACE_EVENT(target_sequencer_start,
132
133 TP_PROTO(struct se_cmd *cmd),
134
135 TP_ARGS(cmd),
136
137 TP_STRUCT__entry(
138 __field( unsigned int, unpacked_lun )
139 __field( unsigned int, opcode )
140 __field( unsigned int, data_length )
141 __field( unsigned int, task_attribute )
142 __array( unsigned char, cdb, TCM_MAX_COMMAND_SIZE )
143 __string( initiator, cmd->se_sess->se_node_acl->initiatorname )
144 ),
145
146 TP_fast_assign(
147 __entry->unpacked_lun = cmd->se_lun->unpacked_lun;
148 __entry->opcode = cmd->t_task_cdb[0];
149 __entry->data_length = cmd->data_length;
150 __entry->task_attribute = cmd->sam_task_attr;
151 memcpy(__entry->cdb, cmd->t_task_cdb, TCM_MAX_COMMAND_SIZE);
152 __assign_str(initiator, cmd->se_sess->se_node_acl->initiatorname);
153 ),
154
155 TP_printk("%s -> LUN %03u %s data_length %6u CDB %s (TA:%s C:%02x)",
156 __get_str(initiator), __entry->unpacked_lun,
157 show_opcode_name(__entry->opcode),
158 __entry->data_length, __print_hex(__entry->cdb, 16),
159 show_task_attribute_name(__entry->task_attribute),
160 scsi_command_size(__entry->cdb) <= 16 ?
161 __entry->cdb[scsi_command_size(__entry->cdb) - 1] :
162 __entry->cdb[1]
163 )
164);
165
166TRACE_EVENT(target_cmd_complete,
167
168 TP_PROTO(struct se_cmd *cmd),
169
170 TP_ARGS(cmd),
171
172 TP_STRUCT__entry(
173 __field( unsigned int, unpacked_lun )
174 __field( unsigned int, opcode )
175 __field( unsigned int, data_length )
176 __field( unsigned int, task_attribute )
177 __field( unsigned char, scsi_status )
178 __field( unsigned char, sense_length )
179 __array( unsigned char, cdb, TCM_MAX_COMMAND_SIZE )
180 __array( unsigned char, sense_data, 18 )
181 __string(initiator, cmd->se_sess->se_node_acl->initiatorname)
182 ),
183
184 TP_fast_assign(
185 __entry->unpacked_lun = cmd->se_lun->unpacked_lun;
186 __entry->opcode = cmd->t_task_cdb[0];
187 __entry->data_length = cmd->data_length;
188 __entry->task_attribute = cmd->sam_task_attr;
189 __entry->scsi_status = cmd->scsi_status;
190 __entry->sense_length = cmd->scsi_status == SAM_STAT_CHECK_CONDITION ?
191 min(18, ((u8 *) cmd->sense_buffer)[SPC_ADD_SENSE_LEN_OFFSET] + 8) : 0;
192 memcpy(__entry->cdb, cmd->t_task_cdb, TCM_MAX_COMMAND_SIZE);
193 memcpy(__entry->sense_data, cmd->sense_buffer, __entry->sense_length);
194 __assign_str(initiator, cmd->se_sess->se_node_acl->initiatorname);
195 ),
196
197 TP_printk("%s <- LUN %03u status %s (sense len %d%s%s) %s data_length %6u CDB %s (TA:%s C:%02x)",
198 __get_str(initiator), __entry->unpacked_lun,
199 show_scsi_status_name(__entry->scsi_status),
200 __entry->sense_length, __entry->sense_length ? " / " : "",
201 __print_hex(__entry->sense_data, __entry->sense_length),
202 show_opcode_name(__entry->opcode),
203 __entry->data_length, __print_hex(__entry->cdb, 16),
204 show_task_attribute_name(__entry->task_attribute),
205 scsi_command_size(__entry->cdb) <= 16 ?
206 __entry->cdb[scsi_command_size(__entry->cdb) - 1] :
207 __entry->cdb[1]
208 )
209);
210
211#endif /* _TRACE_TARGET_H */
212
213/* This part must be outside protection */
214#include <trace/define_trace.h>