root/include/trace/events/target.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0 */
   2 #undef TRACE_SYSTEM
   3 #define TRACE_SYSTEM target
   4 
   5 #if !defined(_TRACE_TARGET_H) || defined(TRACE_HEADER_MULTI_READ)
   6 #define _TRACE_TARGET_H
   7 
   8 #include <linux/tracepoint.h>
   9 #include <linux/trace_seq.h>
  10 #include <scsi/scsi_proto.h>
  11 #include <scsi/scsi_tcq.h>
  12 #include <target/target_core_base.h>
  13 
  14 /* cribbed verbatim from <trace/event/scsi.h> */
  15 #define scsi_opcode_name(opcode)        { opcode, #opcode }
  16 #define show_opcode_name(val)                                   \
  17         __print_symbolic(val,                                   \
  18                 scsi_opcode_name(TEST_UNIT_READY),              \
  19                 scsi_opcode_name(REZERO_UNIT),                  \
  20                 scsi_opcode_name(REQUEST_SENSE),                \
  21                 scsi_opcode_name(FORMAT_UNIT),                  \
  22                 scsi_opcode_name(READ_BLOCK_LIMITS),            \
  23                 scsi_opcode_name(REASSIGN_BLOCKS),              \
  24                 scsi_opcode_name(INITIALIZE_ELEMENT_STATUS),    \
  25                 scsi_opcode_name(READ_6),                       \
  26                 scsi_opcode_name(WRITE_6),                      \
  27                 scsi_opcode_name(SEEK_6),                       \
  28                 scsi_opcode_name(READ_REVERSE),                 \
  29                 scsi_opcode_name(WRITE_FILEMARKS),              \
  30                 scsi_opcode_name(SPACE),                        \
  31                 scsi_opcode_name(INQUIRY),                      \
  32                 scsi_opcode_name(RECOVER_BUFFERED_DATA),        \
  33                 scsi_opcode_name(MODE_SELECT),                  \
  34                 scsi_opcode_name(RESERVE),                      \
  35                 scsi_opcode_name(RELEASE),                      \
  36                 scsi_opcode_name(COPY),                         \
  37                 scsi_opcode_name(ERASE),                        \
  38                 scsi_opcode_name(MODE_SENSE),                   \
  39                 scsi_opcode_name(START_STOP),                   \
  40                 scsi_opcode_name(RECEIVE_DIAGNOSTIC),           \
  41                 scsi_opcode_name(SEND_DIAGNOSTIC),              \
  42                 scsi_opcode_name(ALLOW_MEDIUM_REMOVAL),         \
  43                 scsi_opcode_name(SET_WINDOW),                   \
  44                 scsi_opcode_name(READ_CAPACITY),                \
  45                 scsi_opcode_name(READ_10),                      \
  46                 scsi_opcode_name(WRITE_10),                     \
  47                 scsi_opcode_name(SEEK_10),                      \
  48                 scsi_opcode_name(POSITION_TO_ELEMENT),          \
  49                 scsi_opcode_name(WRITE_VERIFY),                 \
  50                 scsi_opcode_name(VERIFY),                       \
  51                 scsi_opcode_name(SEARCH_HIGH),                  \
  52                 scsi_opcode_name(SEARCH_EQUAL),                 \
  53                 scsi_opcode_name(SEARCH_LOW),                   \
  54                 scsi_opcode_name(SET_LIMITS),                   \
  55                 scsi_opcode_name(PRE_FETCH),                    \
  56                 scsi_opcode_name(READ_POSITION),                \
  57                 scsi_opcode_name(SYNCHRONIZE_CACHE),            \
  58                 scsi_opcode_name(LOCK_UNLOCK_CACHE),            \
  59                 scsi_opcode_name(READ_DEFECT_DATA),             \
  60                 scsi_opcode_name(MEDIUM_SCAN),                  \
  61                 scsi_opcode_name(COMPARE),                      \
  62                 scsi_opcode_name(COPY_VERIFY),                  \
  63                 scsi_opcode_name(WRITE_BUFFER),                 \
  64                 scsi_opcode_name(READ_BUFFER),                  \
  65                 scsi_opcode_name(UPDATE_BLOCK),                 \
  66                 scsi_opcode_name(READ_LONG),                    \
  67                 scsi_opcode_name(WRITE_LONG),                   \
  68                 scsi_opcode_name(CHANGE_DEFINITION),            \
  69                 scsi_opcode_name(WRITE_SAME),                   \
  70                 scsi_opcode_name(UNMAP),                        \
  71                 scsi_opcode_name(READ_TOC),                     \
  72                 scsi_opcode_name(LOG_SELECT),                   \
  73                 scsi_opcode_name(LOG_SENSE),                    \
  74                 scsi_opcode_name(XDWRITEREAD_10),               \
  75                 scsi_opcode_name(MODE_SELECT_10),               \
  76                 scsi_opcode_name(RESERVE_10),                   \
  77                 scsi_opcode_name(RELEASE_10),                   \
  78                 scsi_opcode_name(MODE_SENSE_10),                \
  79                 scsi_opcode_name(PERSISTENT_RESERVE_IN),        \
  80                 scsi_opcode_name(PERSISTENT_RESERVE_OUT),       \
  81                 scsi_opcode_name(VARIABLE_LENGTH_CMD),          \
  82                 scsi_opcode_name(REPORT_LUNS),                  \
  83                 scsi_opcode_name(MAINTENANCE_IN),               \
  84                 scsi_opcode_name(MAINTENANCE_OUT),              \
  85                 scsi_opcode_name(MOVE_MEDIUM),                  \
  86                 scsi_opcode_name(EXCHANGE_MEDIUM),              \
  87                 scsi_opcode_name(READ_12),                      \
  88                 scsi_opcode_name(WRITE_12),                     \
  89                 scsi_opcode_name(WRITE_VERIFY_12),              \
  90                 scsi_opcode_name(SEARCH_HIGH_12),               \
  91                 scsi_opcode_name(SEARCH_EQUAL_12),              \
  92                 scsi_opcode_name(SEARCH_LOW_12),                \
  93                 scsi_opcode_name(READ_ELEMENT_STATUS),          \
  94                 scsi_opcode_name(SEND_VOLUME_TAG),              \
  95                 scsi_opcode_name(WRITE_LONG_2),                 \
  96                 scsi_opcode_name(READ_16),                      \
  97                 scsi_opcode_name(WRITE_16),                     \
  98                 scsi_opcode_name(VERIFY_16),                    \
  99                 scsi_opcode_name(WRITE_SAME_16),                \
 100                 scsi_opcode_name(SERVICE_ACTION_IN_16),         \
 101                 scsi_opcode_name(SAI_READ_CAPACITY_16),         \
 102                 scsi_opcode_name(SAI_GET_LBA_STATUS),           \
 103                 scsi_opcode_name(MI_REPORT_TARGET_PGS),         \
 104                 scsi_opcode_name(MO_SET_TARGET_PGS),            \
 105                 scsi_opcode_name(READ_32),                      \
 106                 scsi_opcode_name(WRITE_32),                     \
 107                 scsi_opcode_name(WRITE_SAME_32),                \
 108                 scsi_opcode_name(ATA_16),                       \
 109                 scsi_opcode_name(ATA_12))
 110 
 111 #define show_task_attribute_name(val)                           \
 112         __print_symbolic(val,                                   \
 113                 { TCM_SIMPLE_TAG,       "SIMPLE"        },      \
 114                 { TCM_HEAD_TAG,         "HEAD"          },      \
 115                 { TCM_ORDERED_TAG,      "ORDERED"       },      \
 116                 { TCM_ACA_TAG,          "ACA"           } )
 117 
 118 #define show_scsi_status_name(val)                              \
 119         __print_symbolic(val,                                   \
 120                 { SAM_STAT_GOOD,        "GOOD" },               \
 121                 { SAM_STAT_CHECK_CONDITION, "CHECK CONDITION" }, \
 122                 { SAM_STAT_CONDITION_MET, "CONDITION MET" },    \
 123                 { SAM_STAT_BUSY,        "BUSY" },               \
 124                 { SAM_STAT_INTERMEDIATE, "INTERMEDIATE" },      \
 125                 { SAM_STAT_INTERMEDIATE_CONDITION_MET, "INTERMEDIATE CONDITION MET" }, \
 126                 { SAM_STAT_RESERVATION_CONFLICT, "RESERVATION CONFLICT" }, \
 127                 { SAM_STAT_COMMAND_TERMINATED, "COMMAND TERMINATED" }, \
 128                 { SAM_STAT_TASK_SET_FULL, "TASK SET FULL" },    \
 129                 { SAM_STAT_ACA_ACTIVE, "ACA ACTIVE" },          \
 130                 { SAM_STAT_TASK_ABORTED, "TASK ABORTED" } )
 131 
 132 TRACE_EVENT(target_sequencer_start,
 133 
 134         TP_PROTO(struct se_cmd *cmd),
 135 
 136         TP_ARGS(cmd),
 137 
 138         TP_STRUCT__entry(
 139                 __field( unsigned int,  unpacked_lun    )
 140                 __field( unsigned int,  opcode          )
 141                 __field( unsigned int,  data_length     )
 142                 __field( unsigned int,  task_attribute  )
 143                 __array( unsigned char, cdb, TCM_MAX_COMMAND_SIZE       )
 144                 __string( initiator,    cmd->se_sess->se_node_acl->initiatorname        )
 145         ),
 146 
 147         TP_fast_assign(
 148                 __entry->unpacked_lun   = cmd->orig_fe_lun;
 149                 __entry->opcode         = cmd->t_task_cdb[0];
 150                 __entry->data_length    = cmd->data_length;
 151                 __entry->task_attribute = cmd->sam_task_attr;
 152                 memcpy(__entry->cdb, cmd->t_task_cdb, TCM_MAX_COMMAND_SIZE);
 153                 __assign_str(initiator, cmd->se_sess->se_node_acl->initiatorname);
 154         ),
 155 
 156         TP_printk("%s -> LUN %03u %s data_length %6u  CDB %s  (TA:%s C:%02x)",
 157                   __get_str(initiator), __entry->unpacked_lun,
 158                   show_opcode_name(__entry->opcode),
 159                   __entry->data_length, __print_hex(__entry->cdb, 16),
 160                   show_task_attribute_name(__entry->task_attribute),
 161                   scsi_command_size(__entry->cdb) <= 16 ?
 162                         __entry->cdb[scsi_command_size(__entry->cdb) - 1] :
 163                         __entry->cdb[1]
 164         )
 165 );
 166 
 167 TRACE_EVENT(target_cmd_complete,
 168 
 169         TP_PROTO(struct se_cmd *cmd),
 170 
 171         TP_ARGS(cmd),
 172 
 173         TP_STRUCT__entry(
 174                 __field( unsigned int,  unpacked_lun    )
 175                 __field( unsigned int,  opcode          )
 176                 __field( unsigned int,  data_length     )
 177                 __field( unsigned int,  task_attribute  )
 178                 __field( unsigned char, scsi_status     )
 179                 __field( unsigned char, sense_length    )
 180                 __array( unsigned char, cdb, TCM_MAX_COMMAND_SIZE       )
 181                 __array( unsigned char, sense_data, 18  )
 182                 __string(initiator,     cmd->se_sess->se_node_acl->initiatorname)
 183         ),
 184 
 185         TP_fast_assign(
 186                 __entry->unpacked_lun   = cmd->orig_fe_lun;
 187                 __entry->opcode         = cmd->t_task_cdb[0];
 188                 __entry->data_length    = cmd->data_length;
 189                 __entry->task_attribute = cmd->sam_task_attr;
 190                 __entry->scsi_status    = cmd->scsi_status;
 191                 __entry->sense_length   = cmd->scsi_status == SAM_STAT_CHECK_CONDITION ?
 192                         min(18, ((u8 *) cmd->sense_buffer)[SPC_ADD_SENSE_LEN_OFFSET] + 8) : 0;
 193                 memcpy(__entry->cdb, cmd->t_task_cdb, TCM_MAX_COMMAND_SIZE);
 194                 memcpy(__entry->sense_data, cmd->sense_buffer, __entry->sense_length);
 195                 __assign_str(initiator, cmd->se_sess->se_node_acl->initiatorname);
 196         ),
 197 
 198         TP_printk("%s <- LUN %03u status %s (sense len %d%s%s)  %s data_length %6u  CDB %s  (TA:%s C:%02x)",
 199                   __get_str(initiator), __entry->unpacked_lun,
 200                   show_scsi_status_name(__entry->scsi_status),
 201                   __entry->sense_length, __entry->sense_length ? " / " : "",
 202                   __print_hex(__entry->sense_data, __entry->sense_length),
 203                   show_opcode_name(__entry->opcode),
 204                   __entry->data_length, __print_hex(__entry->cdb, 16),
 205                   show_task_attribute_name(__entry->task_attribute),
 206                   scsi_command_size(__entry->cdb) <= 16 ?
 207                         __entry->cdb[scsi_command_size(__entry->cdb) - 1] :
 208                         __entry->cdb[1]
 209         )
 210 );
 211 
 212 #endif /*  _TRACE_TARGET_H */
 213 
 214 /* This part must be outside protection */
 215 #include <trace/define_trace.h>

/* [<][>][^][v][top][bottom][index][help] */