target: Simplify fabric sense data length handling
Every fabric driver has to supply a se_tfo->set_fabric_sense_len() method, just so iSCSI can return an offset of 2. However, every fabric driver is already allocating a sense buffer and passing it into the target core, either via transport_init_se_cmd() or target_submit_cmd(). So instead of having iSCSI pass the start of its sense buffer into the core and then later tell the core to skip the first 2 bytes, it seems easier for iSCSI just to do the offset of 2 when it passes the sense buffer into the core. Then we can drop the se_tfo->set_fabric_sense_len() everywhere, and just add a couple of lines of code to iSCSI to set the sense data length to the beginning of the buffer right before it sends it over the network. (nab: Remove .set_fabric_sense_len usage from tcm_qla2xxx_npiv_ops + change transport_get_sense_buffer to follow v3.6-rc6 code w/o ->set_fabric_sense_len usage) Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
This commit is contained in:
Родитель
2ed772b7b9
Коммит
9c58b7ddd7
|
@ -402,7 +402,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
|
|||
buf += " .queue_data_in = " + fabric_mod_name + "_queue_data_in,\n"
|
||||
buf += " .queue_status = " + fabric_mod_name + "_queue_status,\n"
|
||||
buf += " .queue_tm_rsp = " + fabric_mod_name + "_queue_tm_rsp,\n"
|
||||
buf += " .set_fabric_sense_len = " + fabric_mod_name + "_set_fabric_sense_len,\n"
|
||||
buf += " .is_state_remove = " + fabric_mod_name + "_is_state_remove,\n"
|
||||
buf += " /*\n"
|
||||
buf += " * Setup function pointers for generic logic in target_core_fabric_configfs.c\n"
|
||||
|
@ -905,13 +904,6 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
|
|||
buf += "}\n\n"
|
||||
bufi += "int " + fabric_mod_name + "_queue_tm_rsp(struct se_cmd *);\n"
|
||||
|
||||
if re.search('set_fabric_sense_len\)\(', fo):
|
||||
buf += "u16 " + fabric_mod_name + "_set_fabric_sense_len(struct se_cmd *se_cmd, u32 sense_length)\n"
|
||||
buf += "{\n"
|
||||
buf += " return 0;\n"
|
||||
buf += "}\n\n"
|
||||
bufi += "u16 " + fabric_mod_name + "_set_fabric_sense_len(struct se_cmd *, u32);\n"
|
||||
|
||||
if re.search('is_state_remove\)\(', fo):
|
||||
buf += "int " + fabric_mod_name + "_is_state_remove(struct se_cmd *se_cmd)\n"
|
||||
buf += "{\n"
|
||||
|
|
|
@ -3564,11 +3564,6 @@ static int srpt_get_tcm_cmd_state(struct se_cmd *se_cmd)
|
|||
return srpt_get_cmd_state(ioctx);
|
||||
}
|
||||
|
||||
static u16 srpt_set_fabric_sense_len(struct se_cmd *cmd, u32 sense_length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* srpt_parse_i_port_id() - Parse an initiator port ID.
|
||||
* @name: ASCII representation of a 128-bit initiator port ID.
|
||||
|
@ -3948,7 +3943,6 @@ static struct target_core_fabric_ops srpt_template = {
|
|||
.queue_data_in = srpt_queue_response,
|
||||
.queue_status = srpt_queue_status,
|
||||
.queue_tm_rsp = srpt_queue_response,
|
||||
.set_fabric_sense_len = srpt_set_fabric_sense_len,
|
||||
/*
|
||||
* Setup function pointers for generic logic in
|
||||
* target_core_fabric_configfs.c
|
||||
|
|
|
@ -735,12 +735,6 @@ static int tcm_qla2xxx_queue_tm_rsp(struct se_cmd *se_cmd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static u16 tcm_qla2xxx_set_fabric_sense_len(struct se_cmd *se_cmd,
|
||||
u32 sense_length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Local pointer to allocated TCM configfs fabric module */
|
||||
struct target_fabric_configfs *tcm_qla2xxx_fabric_configfs;
|
||||
struct target_fabric_configfs *tcm_qla2xxx_npiv_fabric_configfs;
|
||||
|
@ -1686,7 +1680,6 @@ static struct target_core_fabric_ops tcm_qla2xxx_ops = {
|
|||
.queue_data_in = tcm_qla2xxx_queue_data_in,
|
||||
.queue_status = tcm_qla2xxx_queue_status,
|
||||
.queue_tm_rsp = tcm_qla2xxx_queue_tm_rsp,
|
||||
.set_fabric_sense_len = tcm_qla2xxx_set_fabric_sense_len,
|
||||
/*
|
||||
* Setup function pointers for generic logic in
|
||||
* target_core_fabric_configfs.c
|
||||
|
@ -1734,7 +1727,6 @@ static struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = {
|
|||
.queue_data_in = tcm_qla2xxx_queue_data_in,
|
||||
.queue_status = tcm_qla2xxx_queue_status,
|
||||
.queue_tm_rsp = tcm_qla2xxx_queue_tm_rsp,
|
||||
.set_fabric_sense_len = tcm_qla2xxx_set_fabric_sense_len,
|
||||
/*
|
||||
* Setup function pointers for generic logic in
|
||||
* target_core_fabric_configfs.c
|
||||
|
|
|
@ -953,7 +953,7 @@ done:
|
|||
*/
|
||||
transport_init_se_cmd(&cmd->se_cmd, &lio_target_fabric_configfs->tf_ops,
|
||||
conn->sess->se_sess, hdr->data_length, cmd->data_direction,
|
||||
sam_task_attr, &cmd->sense_buffer[0]);
|
||||
sam_task_attr, cmd->sense_buffer + 2);
|
||||
|
||||
pr_debug("Got SCSI Command, ITT: 0x%08x, CmdSN: 0x%08x,"
|
||||
" ExpXferLen: %u, Length: %u, CID: %hu\n", hdr->itt,
|
||||
|
@ -1700,7 +1700,7 @@ static int iscsit_handle_task_mgt_cmd(
|
|||
transport_init_se_cmd(&cmd->se_cmd,
|
||||
&lio_target_fabric_configfs->tf_ops,
|
||||
conn->sess->se_sess, 0, DMA_NONE,
|
||||
MSG_SIMPLE_TAG, &cmd->sense_buffer[0]);
|
||||
MSG_SIMPLE_TAG, cmd->sense_buffer + 2);
|
||||
|
||||
switch (function) {
|
||||
case ISCSI_TM_FUNC_ABORT_TASK:
|
||||
|
@ -3092,15 +3092,18 @@ static int iscsit_send_status(
|
|||
if (cmd->se_cmd.sense_buffer &&
|
||||
((cmd->se_cmd.se_cmd_flags & SCF_TRANSPORT_TASK_SENSE) ||
|
||||
(cmd->se_cmd.se_cmd_flags & SCF_EMULATED_TASK_SENSE))) {
|
||||
put_unaligned_be16(cmd->se_cmd.scsi_sense_length, cmd->sense_buffer);
|
||||
cmd->se_cmd.scsi_sense_length += sizeof (__be16);
|
||||
|
||||
padding = -(cmd->se_cmd.scsi_sense_length) & 3;
|
||||
hton24(hdr->dlength, cmd->se_cmd.scsi_sense_length);
|
||||
iov[iov_count].iov_base = cmd->se_cmd.sense_buffer;
|
||||
iov[iov_count].iov_base = cmd->sense_buffer;
|
||||
iov[iov_count++].iov_len =
|
||||
(cmd->se_cmd.scsi_sense_length + padding);
|
||||
tx_size += cmd->se_cmd.scsi_sense_length;
|
||||
|
||||
if (padding) {
|
||||
memset(cmd->se_cmd.sense_buffer +
|
||||
memset(cmd->sense_buffer +
|
||||
cmd->se_cmd.scsi_sense_length, 0, padding);
|
||||
tx_size += padding;
|
||||
pr_debug("Adding %u bytes of padding to"
|
||||
|
@ -3109,7 +3112,7 @@ static int iscsit_send_status(
|
|||
|
||||
if (conn->conn_ops->DataDigest) {
|
||||
iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
|
||||
cmd->se_cmd.sense_buffer,
|
||||
cmd->sense_buffer,
|
||||
(cmd->se_cmd.scsi_sense_length + padding),
|
||||
0, NULL, (u8 *)&cmd->data_crc);
|
||||
|
||||
|
|
|
@ -1542,21 +1542,6 @@ static int lio_queue_status(struct se_cmd *se_cmd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static u16 lio_set_fabric_sense_len(struct se_cmd *se_cmd, u32 sense_length)
|
||||
{
|
||||
unsigned char *buffer = se_cmd->sense_buffer;
|
||||
/*
|
||||
* From RFC-3720 10.4.7. Data Segment - Sense and Response Data Segment
|
||||
* 16-bit SenseLength.
|
||||
*/
|
||||
buffer[0] = ((sense_length >> 8) & 0xff);
|
||||
buffer[1] = (sense_length & 0xff);
|
||||
/*
|
||||
* Return two byte offset into allocated sense_buffer.
|
||||
*/
|
||||
return 2;
|
||||
}
|
||||
|
||||
static int lio_queue_tm_rsp(struct se_cmd *se_cmd)
|
||||
{
|
||||
struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
|
||||
|
@ -1740,7 +1725,6 @@ int iscsi_target_register_configfs(void)
|
|||
fabric->tf_ops.queue_data_in = &lio_queue_data_in;
|
||||
fabric->tf_ops.queue_status = &lio_queue_status;
|
||||
fabric->tf_ops.queue_tm_rsp = &lio_queue_tm_rsp;
|
||||
fabric->tf_ops.set_fabric_sense_len = &lio_set_fabric_sense_len;
|
||||
/*
|
||||
* Setup function pointers for generic logic in target_core_fabric_configfs.c
|
||||
*/
|
||||
|
|
|
@ -846,11 +846,6 @@ static int tcm_loop_queue_tm_rsp(struct se_cmd *se_cmd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static u16 tcm_loop_set_fabric_sense_len(struct se_cmd *se_cmd, u32 sense_length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *tcm_loop_dump_proto_id(struct tcm_loop_hba *tl_hba)
|
||||
{
|
||||
switch (tl_hba->tl_proto_id) {
|
||||
|
@ -1368,7 +1363,6 @@ static int tcm_loop_register_configfs(void)
|
|||
fabric->tf_ops.queue_data_in = &tcm_loop_queue_data_in;
|
||||
fabric->tf_ops.queue_status = &tcm_loop_queue_status;
|
||||
fabric->tf_ops.queue_tm_rsp = &tcm_loop_queue_tm_rsp;
|
||||
fabric->tf_ops.set_fabric_sense_len = &tcm_loop_set_fabric_sense_len;
|
||||
|
||||
/*
|
||||
* Setup function pointers for generic logic in target_core_fabric_configfs.c
|
||||
|
|
|
@ -1847,11 +1847,6 @@ static int sbp_queue_tm_rsp(struct se_cmd *se_cmd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static u16 sbp_set_fabric_sense_len(struct se_cmd *se_cmd, u32 sense_length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sbp_check_stop_free(struct se_cmd *se_cmd)
|
||||
{
|
||||
struct sbp_target_request *req = container_of(se_cmd,
|
||||
|
@ -2529,7 +2524,6 @@ static struct target_core_fabric_ops sbp_ops = {
|
|||
.queue_data_in = sbp_queue_data_in,
|
||||
.queue_status = sbp_queue_status,
|
||||
.queue_tm_rsp = sbp_queue_tm_rsp,
|
||||
.set_fabric_sense_len = sbp_set_fabric_sense_len,
|
||||
.check_stop_free = sbp_check_stop_free,
|
||||
|
||||
.fabric_make_wwn = sbp_make_tport,
|
||||
|
|
|
@ -457,10 +457,6 @@ static int target_fabric_tf_ops_check(
|
|||
pr_err("Missing tfo->queue_tm_rsp()\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!tfo->set_fabric_sense_len) {
|
||||
pr_err("Missing tfo->set_fabric_sense_len()\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
/*
|
||||
* We at least require tfo->fabric_make_wwn(), tfo->fabric_drop_wwn()
|
||||
* tfo->fabric_make_tpg() and tfo->fabric_drop_tpg() in
|
||||
|
|
|
@ -567,9 +567,7 @@ static void target_complete_failure_work(struct work_struct *work)
|
|||
*/
|
||||
static unsigned char *transport_get_sense_buffer(struct se_cmd *cmd)
|
||||
{
|
||||
unsigned char *buffer = cmd->sense_buffer;
|
||||
struct se_device *dev = cmd->se_dev;
|
||||
u32 offset = 0;
|
||||
|
||||
WARN_ON(!cmd->se_lun);
|
||||
|
||||
|
@ -579,14 +577,11 @@ static unsigned char *transport_get_sense_buffer(struct se_cmd *cmd)
|
|||
if (cmd->se_cmd_flags & SCF_SENT_CHECK_CONDITION)
|
||||
return NULL;
|
||||
|
||||
offset = cmd->se_tfo->set_fabric_sense_len(cmd, TRANSPORT_SENSE_BUFFER);
|
||||
|
||||
/* Automatically padded */
|
||||
cmd->scsi_sense_length = TRANSPORT_SENSE_BUFFER + offset;
|
||||
cmd->scsi_sense_length = TRANSPORT_SENSE_BUFFER;
|
||||
|
||||
pr_debug("HBA_[%u]_PLUG[%s]: Requesting sense for SAM STATUS: 0x%02x\n",
|
||||
dev->se_hba->hba_id, dev->transport->name, cmd->scsi_status);
|
||||
return &buffer[offset];
|
||||
return cmd->sense_buffer;
|
||||
}
|
||||
|
||||
void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status)
|
||||
|
@ -2804,7 +2799,6 @@ int transport_send_check_condition_and_sense(
|
|||
{
|
||||
unsigned char *buffer = cmd->sense_buffer;
|
||||
unsigned long flags;
|
||||
int offset;
|
||||
u8 asc = 0, ascq = 0;
|
||||
|
||||
spin_lock_irqsave(&cmd->t_state_lock, flags);
|
||||
|
@ -2820,14 +2814,7 @@ int transport_send_check_condition_and_sense(
|
|||
|
||||
if (!from_transport)
|
||||
cmd->se_cmd_flags |= SCF_EMULATED_TASK_SENSE;
|
||||
/*
|
||||
* Data Segment and SenseLength of the fabric response PDU.
|
||||
*
|
||||
* TRANSPORT_SENSE_BUFFER is now set to SCSI_SENSE_BUFFERSIZE
|
||||
* from include/scsi/scsi_cmnd.h
|
||||
*/
|
||||
offset = cmd->se_tfo->set_fabric_sense_len(cmd,
|
||||
TRANSPORT_SENSE_BUFFER);
|
||||
|
||||
/*
|
||||
* Actual SENSE DATA, see SPC-3 7.23.2 SPC_SENSE_KEY_OFFSET uses
|
||||
* SENSE KEY values from include/scsi/scsi.h
|
||||
|
@ -2835,151 +2822,151 @@ int transport_send_check_condition_and_sense(
|
|||
switch (reason) {
|
||||
case TCM_NON_EXISTENT_LUN:
|
||||
/* CURRENT ERROR */
|
||||
buffer[offset] = 0x70;
|
||||
buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
buffer[0] = 0x70;
|
||||
buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
/* ILLEGAL REQUEST */
|
||||
buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
|
||||
buffer[SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
|
||||
/* LOGICAL UNIT NOT SUPPORTED */
|
||||
buffer[offset+SPC_ASC_KEY_OFFSET] = 0x25;
|
||||
buffer[SPC_ASC_KEY_OFFSET] = 0x25;
|
||||
break;
|
||||
case TCM_UNSUPPORTED_SCSI_OPCODE:
|
||||
case TCM_SECTOR_COUNT_TOO_MANY:
|
||||
/* CURRENT ERROR */
|
||||
buffer[offset] = 0x70;
|
||||
buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
buffer[0] = 0x70;
|
||||
buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
/* ILLEGAL REQUEST */
|
||||
buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
|
||||
buffer[SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
|
||||
/* INVALID COMMAND OPERATION CODE */
|
||||
buffer[offset+SPC_ASC_KEY_OFFSET] = 0x20;
|
||||
buffer[SPC_ASC_KEY_OFFSET] = 0x20;
|
||||
break;
|
||||
case TCM_UNKNOWN_MODE_PAGE:
|
||||
/* CURRENT ERROR */
|
||||
buffer[offset] = 0x70;
|
||||
buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
buffer[0] = 0x70;
|
||||
buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
/* ILLEGAL REQUEST */
|
||||
buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
|
||||
buffer[SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
|
||||
/* INVALID FIELD IN CDB */
|
||||
buffer[offset+SPC_ASC_KEY_OFFSET] = 0x24;
|
||||
buffer[SPC_ASC_KEY_OFFSET] = 0x24;
|
||||
break;
|
||||
case TCM_CHECK_CONDITION_ABORT_CMD:
|
||||
/* CURRENT ERROR */
|
||||
buffer[offset] = 0x70;
|
||||
buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
buffer[0] = 0x70;
|
||||
buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
/* ABORTED COMMAND */
|
||||
buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND;
|
||||
buffer[SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND;
|
||||
/* BUS DEVICE RESET FUNCTION OCCURRED */
|
||||
buffer[offset+SPC_ASC_KEY_OFFSET] = 0x29;
|
||||
buffer[offset+SPC_ASCQ_KEY_OFFSET] = 0x03;
|
||||
buffer[SPC_ASC_KEY_OFFSET] = 0x29;
|
||||
buffer[SPC_ASCQ_KEY_OFFSET] = 0x03;
|
||||
break;
|
||||
case TCM_INCORRECT_AMOUNT_OF_DATA:
|
||||
/* CURRENT ERROR */
|
||||
buffer[offset] = 0x70;
|
||||
buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
buffer[0] = 0x70;
|
||||
buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
/* ABORTED COMMAND */
|
||||
buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND;
|
||||
buffer[SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND;
|
||||
/* WRITE ERROR */
|
||||
buffer[offset+SPC_ASC_KEY_OFFSET] = 0x0c;
|
||||
buffer[SPC_ASC_KEY_OFFSET] = 0x0c;
|
||||
/* NOT ENOUGH UNSOLICITED DATA */
|
||||
buffer[offset+SPC_ASCQ_KEY_OFFSET] = 0x0d;
|
||||
buffer[SPC_ASCQ_KEY_OFFSET] = 0x0d;
|
||||
break;
|
||||
case TCM_INVALID_CDB_FIELD:
|
||||
/* CURRENT ERROR */
|
||||
buffer[offset] = 0x70;
|
||||
buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
buffer[0] = 0x70;
|
||||
buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
/* ILLEGAL REQUEST */
|
||||
buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
|
||||
buffer[SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
|
||||
/* INVALID FIELD IN CDB */
|
||||
buffer[offset+SPC_ASC_KEY_OFFSET] = 0x24;
|
||||
buffer[SPC_ASC_KEY_OFFSET] = 0x24;
|
||||
break;
|
||||
case TCM_INVALID_PARAMETER_LIST:
|
||||
/* CURRENT ERROR */
|
||||
buffer[offset] = 0x70;
|
||||
buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
buffer[0] = 0x70;
|
||||
buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
/* ILLEGAL REQUEST */
|
||||
buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
|
||||
buffer[SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
|
||||
/* INVALID FIELD IN PARAMETER LIST */
|
||||
buffer[offset+SPC_ASC_KEY_OFFSET] = 0x26;
|
||||
buffer[SPC_ASC_KEY_OFFSET] = 0x26;
|
||||
break;
|
||||
case TCM_UNEXPECTED_UNSOLICITED_DATA:
|
||||
/* CURRENT ERROR */
|
||||
buffer[offset] = 0x70;
|
||||
buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
buffer[0] = 0x70;
|
||||
buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
/* ABORTED COMMAND */
|
||||
buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND;
|
||||
buffer[SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND;
|
||||
/* WRITE ERROR */
|
||||
buffer[offset+SPC_ASC_KEY_OFFSET] = 0x0c;
|
||||
buffer[SPC_ASC_KEY_OFFSET] = 0x0c;
|
||||
/* UNEXPECTED_UNSOLICITED_DATA */
|
||||
buffer[offset+SPC_ASCQ_KEY_OFFSET] = 0x0c;
|
||||
buffer[SPC_ASCQ_KEY_OFFSET] = 0x0c;
|
||||
break;
|
||||
case TCM_SERVICE_CRC_ERROR:
|
||||
/* CURRENT ERROR */
|
||||
buffer[offset] = 0x70;
|
||||
buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
buffer[0] = 0x70;
|
||||
buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
/* ABORTED COMMAND */
|
||||
buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND;
|
||||
buffer[SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND;
|
||||
/* PROTOCOL SERVICE CRC ERROR */
|
||||
buffer[offset+SPC_ASC_KEY_OFFSET] = 0x47;
|
||||
buffer[SPC_ASC_KEY_OFFSET] = 0x47;
|
||||
/* N/A */
|
||||
buffer[offset+SPC_ASCQ_KEY_OFFSET] = 0x05;
|
||||
buffer[SPC_ASCQ_KEY_OFFSET] = 0x05;
|
||||
break;
|
||||
case TCM_SNACK_REJECTED:
|
||||
/* CURRENT ERROR */
|
||||
buffer[offset] = 0x70;
|
||||
buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
buffer[0] = 0x70;
|
||||
buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
/* ABORTED COMMAND */
|
||||
buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND;
|
||||
buffer[SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND;
|
||||
/* READ ERROR */
|
||||
buffer[offset+SPC_ASC_KEY_OFFSET] = 0x11;
|
||||
buffer[SPC_ASC_KEY_OFFSET] = 0x11;
|
||||
/* FAILED RETRANSMISSION REQUEST */
|
||||
buffer[offset+SPC_ASCQ_KEY_OFFSET] = 0x13;
|
||||
buffer[SPC_ASCQ_KEY_OFFSET] = 0x13;
|
||||
break;
|
||||
case TCM_WRITE_PROTECTED:
|
||||
/* CURRENT ERROR */
|
||||
buffer[offset] = 0x70;
|
||||
buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
buffer[0] = 0x70;
|
||||
buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
/* DATA PROTECT */
|
||||
buffer[offset+SPC_SENSE_KEY_OFFSET] = DATA_PROTECT;
|
||||
buffer[SPC_SENSE_KEY_OFFSET] = DATA_PROTECT;
|
||||
/* WRITE PROTECTED */
|
||||
buffer[offset+SPC_ASC_KEY_OFFSET] = 0x27;
|
||||
buffer[SPC_ASC_KEY_OFFSET] = 0x27;
|
||||
break;
|
||||
case TCM_ADDRESS_OUT_OF_RANGE:
|
||||
/* CURRENT ERROR */
|
||||
buffer[offset] = 0x70;
|
||||
buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
buffer[0] = 0x70;
|
||||
buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
/* ILLEGAL REQUEST */
|
||||
buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
|
||||
buffer[SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
|
||||
/* LOGICAL BLOCK ADDRESS OUT OF RANGE */
|
||||
buffer[offset+SPC_ASC_KEY_OFFSET] = 0x21;
|
||||
buffer[SPC_ASC_KEY_OFFSET] = 0x21;
|
||||
break;
|
||||
case TCM_CHECK_CONDITION_UNIT_ATTENTION:
|
||||
/* CURRENT ERROR */
|
||||
buffer[offset] = 0x70;
|
||||
buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
buffer[0] = 0x70;
|
||||
buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
/* UNIT ATTENTION */
|
||||
buffer[offset+SPC_SENSE_KEY_OFFSET] = UNIT_ATTENTION;
|
||||
buffer[SPC_SENSE_KEY_OFFSET] = UNIT_ATTENTION;
|
||||
core_scsi3_ua_for_check_condition(cmd, &asc, &ascq);
|
||||
buffer[offset+SPC_ASC_KEY_OFFSET] = asc;
|
||||
buffer[offset+SPC_ASCQ_KEY_OFFSET] = ascq;
|
||||
buffer[SPC_ASC_KEY_OFFSET] = asc;
|
||||
buffer[SPC_ASCQ_KEY_OFFSET] = ascq;
|
||||
break;
|
||||
case TCM_CHECK_CONDITION_NOT_READY:
|
||||
/* CURRENT ERROR */
|
||||
buffer[offset] = 0x70;
|
||||
buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
buffer[0] = 0x70;
|
||||
buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
/* Not Ready */
|
||||
buffer[offset+SPC_SENSE_KEY_OFFSET] = NOT_READY;
|
||||
buffer[SPC_SENSE_KEY_OFFSET] = NOT_READY;
|
||||
transport_get_sense_codes(cmd, &asc, &ascq);
|
||||
buffer[offset+SPC_ASC_KEY_OFFSET] = asc;
|
||||
buffer[offset+SPC_ASCQ_KEY_OFFSET] = ascq;
|
||||
buffer[SPC_ASC_KEY_OFFSET] = asc;
|
||||
buffer[SPC_ASCQ_KEY_OFFSET] = ascq;
|
||||
break;
|
||||
case TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE:
|
||||
default:
|
||||
/* CURRENT ERROR */
|
||||
buffer[offset] = 0x70;
|
||||
buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
buffer[0] = 0x70;
|
||||
buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;
|
||||
/* ILLEGAL REQUEST */
|
||||
buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
|
||||
buffer[SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
|
||||
/* LOGICAL UNIT COMMUNICATION FAILURE */
|
||||
buffer[offset+SPC_ASC_KEY_OFFSET] = 0x80;
|
||||
buffer[SPC_ASC_KEY_OFFSET] = 0x80;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
|
@ -2990,7 +2977,7 @@ int transport_send_check_condition_and_sense(
|
|||
* Automatically padded, this value is encoded in the fabric's
|
||||
* data_length response PDU containing the SCSI defined sense data.
|
||||
*/
|
||||
cmd->scsi_sense_length = TRANSPORT_SENSE_BUFFER + offset;
|
||||
cmd->scsi_sense_length = TRANSPORT_SENSE_BUFFER;
|
||||
|
||||
after_reason:
|
||||
return cmd->se_tfo->queue_status(cmd);
|
||||
|
|
|
@ -495,11 +495,6 @@ static void ft_set_default_node_attr(struct se_node_acl *se_nacl)
|
|||
{
|
||||
}
|
||||
|
||||
static u16 ft_set_fabric_sense_len(struct se_cmd *se_cmd, u32 sense_len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 ft_tpg_get_inst_index(struct se_portal_group *se_tpg)
|
||||
{
|
||||
struct ft_tpg *tpg = se_tpg->se_tpg_fabric_ptr;
|
||||
|
@ -537,7 +532,6 @@ static struct target_core_fabric_ops ft_fabric_ops = {
|
|||
.queue_data_in = ft_queue_data_in,
|
||||
.queue_status = ft_queue_status,
|
||||
.queue_tm_rsp = ft_queue_tm_resp,
|
||||
.set_fabric_sense_len = ft_set_fabric_sense_len,
|
||||
/*
|
||||
* Setup function pointers for generic logic in
|
||||
* target_core_fabric_configfs.c
|
||||
|
|
|
@ -1475,11 +1475,6 @@ static int usbg_queue_tm_rsp(struct se_cmd *se_cmd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static u16 usbg_set_fabric_sense_len(struct se_cmd *se_cmd, u32 sense_length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *usbg_check_wwn(const char *name)
|
||||
{
|
||||
const char *n;
|
||||
|
@ -1905,7 +1900,6 @@ static struct target_core_fabric_ops usbg_ops = {
|
|||
.queue_data_in = usbg_send_read_response,
|
||||
.queue_status = usbg_send_status_response,
|
||||
.queue_tm_rsp = usbg_queue_tm_rsp,
|
||||
.set_fabric_sense_len = usbg_set_fabric_sense_len,
|
||||
.check_stop_free = usbg_check_stop_free,
|
||||
|
||||
.fabric_make_wwn = usbg_make_tport,
|
||||
|
|
|
@ -330,12 +330,6 @@ static int tcm_vhost_queue_tm_rsp(struct se_cmd *se_cmd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static u16 tcm_vhost_set_fabric_sense_len(struct se_cmd *se_cmd,
|
||||
u32 sense_length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void vhost_scsi_free_cmd(struct tcm_vhost_cmd *tv_cmd)
|
||||
{
|
||||
struct se_cmd *se_cmd = &tv_cmd->tvc_se_cmd;
|
||||
|
@ -1526,7 +1520,6 @@ static struct target_core_fabric_ops tcm_vhost_ops = {
|
|||
.queue_data_in = tcm_vhost_queue_data_in,
|
||||
.queue_status = tcm_vhost_queue_status,
|
||||
.queue_tm_rsp = tcm_vhost_queue_tm_rsp,
|
||||
.set_fabric_sense_len = tcm_vhost_set_fabric_sense_len,
|
||||
/*
|
||||
* Setup callers for generic logic in target_core_fabric_configfs.c
|
||||
*/
|
||||
|
|
|
@ -62,7 +62,6 @@ struct target_core_fabric_ops {
|
|||
int (*queue_data_in)(struct se_cmd *);
|
||||
int (*queue_status)(struct se_cmd *);
|
||||
int (*queue_tm_rsp)(struct se_cmd *);
|
||||
u16 (*set_fabric_sense_len)(struct se_cmd *, u32);
|
||||
/*
|
||||
* fabric module calls for target_core_fabric_configfs.c
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче