/* * MAX_COMMAND_SIZE is: * The longest fixed-length SCSI CDB as per the SCSI standard. * fixed-length means: commands that their size can be determined * by their opcode and the CDB does not carry a length specifier, (unlike * the VARIABLE_LENGTH_CMD(0x7f) command). This is actually not exactly * true and the SCSI standard also defines extended commands and * vendor specific commands that can be bigger than 16 bytes. The kernel * will support these using the same infrastructure used for VARLEN CDB's. * So in effect MAX_COMMAND_SIZE means the maximum size command scsi-ml * supports without specifying a cmd_len by ULD's
*/ #define MAX_COMMAND_SIZE 16
/* embedded in scsi_cmnd */ struct scsi_pointer { char *ptr; /* data pointer */ int this_residual; /* left in this buffer */ struct scatterlist *buffer; /* which buffer */ int buffers_residual; /* how many buffers left */
struct scsi_cmnd { struct scsi_device *device; struct list_head eh_entry; /* entry for the host eh_abort_list/eh_cmd_q */ struct delayed_work abort_work;
struct rcu_head rcu;
int eh_eflags; /* Used by error handlr */
int budget_token;
/* * This is set to jiffies as it was when the command was first * allocated. It is used to time how long the command has * been outstanding
*/ unsignedlong jiffies_at_alloc;
/* These elements define the operation we ultimately want to perform */ struct scsi_data_buffer sdb; struct scsi_data_buffer *prot_sdb;
unsigned underflow; /* Return error if less than
this amount is transferred */
unsigned transfersize; /* How much we are guaranteed to transfer with each SCSI transfer (ie, between disconnect / reconnects. Probably == sector
size */ unsigned resid_len; /* residual count */ unsigned sense_len; unsignedchar *sense_buffer; /* obtained by REQUEST SENSE when * CHECK CONDITION is received on original * command (auto-sense). Length must be
* SCSI_SENSE_BUFFERSIZE bytes. */
int flags; /* Command flags */ unsignedlong state; /* Command completion state */
unsignedint extra_len; /* length of alignment and padding */
/* * The fields below can be modified by the LLD but the fields above * must not be modified.
*/
unsignedchar *host_scribble; /* The host adapter is allowed to * call scsi_malloc and get some memory * and hang it here. The host adapter * is also expected to call scsi_free * to release this memory. (The memory * obtained by scsi_malloc is guaranteed
* to be at an address < 16Mb). */
int result; /* Status code from lower level driver */
};
/* Variant of blk_mq_rq_from_pdu() that verifies the type of its argument. */ staticinlinestruct request *scsi_cmd_to_rq(struct scsi_cmnd *scmd)
{ return blk_mq_rq_from_pdu(scmd);
}
/* * Return the driver private allocation behind the command. * Only works if cmd_size is set in the host template.
*/ staticinlinevoid *scsi_cmd_priv(struct scsi_cmnd *cmd)
{ return cmd + 1;
}
/* * The operations below are hints that tell the controller driver how * to handle I/Os with DIF or similar types of protection information.
*/ enum scsi_prot_operations { /* Normal I/O */
SCSI_PROT_NORMAL = 0,
/* * The controller usually does not know anything about the target it * is communicating with. However, when DIX is enabled the controller * must be know target type so it can verify the protection * information passed along with the I/O.
*/ enum scsi_prot_target_type {
SCSI_PROT_DIF_TYPE0 = 0,
SCSI_PROT_DIF_TYPE1,
SCSI_PROT_DIF_TYPE2,
SCSI_PROT_DIF_TYPE3,
};
/** * scsi_msg_to_host_byte() - translate message byte * @cmd: the SCSI command * @msg: the SCSI parallel message byte to translate * * Translate the SCSI parallel message byte to a matching * host byte setting. A message of COMMAND_COMPLETE indicates * a successful command execution, any other message indicate * an error. As the messages themselves only have a meaning * for the SCSI parallel protocol this function translates * them into a matching host byte value for SCSI EH.
*/ staticinlinevoid scsi_msg_to_host_byte(struct scsi_cmnd *cmd, u8 msg)
{ switch (msg) { case COMMAND_COMPLETE: break; case ABORT_TASK_SET:
set_host_byte(cmd, DID_ABORT); break; case TARGET_RESET:
set_host_byte(cmd, DID_RESET); break; default:
set_host_byte(cmd, DID_ERROR); break;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.