#undef TRACE_SYSTEM
#define TRACE_SYSTEM …
#if !defined(_TRACE_TARGET_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_TARGET_H
#include <linux/tracepoint.h>
#include <linux/trace_seq.h>
#include <scsi/scsi_proto.h>
#include <scsi/scsi_tcq.h>
#include <target/target_core_base.h>
#define scsi_opcode_name(opcode) …
#define show_opcode_name(val) …
#define show_task_attribute_name(val) …
#define show_scsi_status_name(val) …
TRACE_EVENT(target_sequencer_start,
TP_PROTO(struct se_cmd *cmd),
TP_ARGS(cmd),
TP_STRUCT__entry(
__field( unsigned int, unpacked_lun )
__field( unsigned long long, tag )
__field( unsigned int, opcode )
__field( unsigned int, data_length )
__field( unsigned int, task_attribute )
__field( unsigned char, control )
__array( unsigned char, cdb, TCM_MAX_COMMAND_SIZE )
__string( initiator, cmd->se_sess->se_node_acl->initiatorname )
),
TP_fast_assign(
__entry->unpacked_lun = cmd->orig_fe_lun;
__entry->tag = cmd->tag;
__entry->opcode = cmd->t_task_cdb[0];
__entry->data_length = cmd->data_length;
__entry->task_attribute = cmd->sam_task_attr;
__entry->control = scsi_command_control(cmd->t_task_cdb);
memcpy(__entry->cdb, cmd->t_task_cdb, TCM_MAX_COMMAND_SIZE);
__assign_str(initiator);
),
TP_printk("%s -> LUN %03u tag %#llx %s data_length %6u CDB %s (TA:%s C:%02x)",
__get_str(initiator), __entry->unpacked_lun,
__entry->tag, show_opcode_name(__entry->opcode),
__entry->data_length, __print_hex(__entry->cdb, 16),
show_task_attribute_name(__entry->task_attribute),
__entry->control
)
);
TRACE_EVENT(target_cmd_complete,
TP_PROTO(struct se_cmd *cmd),
TP_ARGS(cmd),
TP_STRUCT__entry(
__field( unsigned int, unpacked_lun )
__field( unsigned long long, tag )
__field( unsigned int, opcode )
__field( unsigned int, data_length )
__field( unsigned int, task_attribute )
__field( unsigned char, control )
__field( unsigned char, scsi_status )
__field( unsigned char, sense_length )
__array( unsigned char, cdb, TCM_MAX_COMMAND_SIZE )
__array( unsigned char, sense_data, 18 )
__string(initiator, cmd->se_sess->se_node_acl->initiatorname)
),
TP_fast_assign(
__entry->unpacked_lun = cmd->orig_fe_lun;
__entry->tag = cmd->tag;
__entry->opcode = cmd->t_task_cdb[0];
__entry->data_length = cmd->data_length;
__entry->task_attribute = cmd->sam_task_attr;
__entry->control = scsi_command_control(cmd->t_task_cdb);
__entry->scsi_status = cmd->scsi_status;
__entry->sense_length = cmd->scsi_status == SAM_STAT_CHECK_CONDITION ?
min(18, ((u8 *) cmd->sense_buffer)[SPC_ADD_SENSE_LEN_OFFSET] + 8) : 0;
memcpy(__entry->cdb, cmd->t_task_cdb, TCM_MAX_COMMAND_SIZE);
memcpy(__entry->sense_data, cmd->sense_buffer, __entry->sense_length);
__assign_str(initiator);
),
TP_printk("%s <- LUN %03u tag %#llx status %s (sense len %d%s%s) %s data_length %6u CDB %s (TA:%s C:%02x)",
__get_str(initiator), __entry->unpacked_lun,
__entry->tag,
show_scsi_status_name(__entry->scsi_status),
__entry->sense_length, __entry->sense_length ? " / " : "",
__print_hex(__entry->sense_data, __entry->sense_length),
show_opcode_name(__entry->opcode),
__entry->data_length, __print_hex(__entry->cdb, 16),
show_task_attribute_name(__entry->task_attribute),
__entry->control
)
);
#endif
#include <trace/define_trace.h>