diff options
author | Roland Dreier <roland@purestorage.com> | 2012-08-15 17:35:25 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-09-17 20:12:58 -0400 |
commit | 9c58b7ddd70dd7bfaac4ca87131f36d10aaba441 (patch) | |
tree | 2796f11c283904cef9b38f543e31fed3fea565c7 /drivers/target/iscsi/iscsi_target_configfs.c | |
parent | 2ed772b7b9df0f459308b3cbececc0136076d09e (diff) |
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>
Diffstat (limited to 'drivers/target/iscsi/iscsi_target_configfs.c')
-rw-r--r-- | drivers/target/iscsi/iscsi_target_configfs.c | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c index 518fd4e86409..f86833fcf33c 100644 --- a/drivers/target/iscsi/iscsi_target_configfs.c +++ b/drivers/target/iscsi/iscsi_target_configfs.c | |||
@@ -1542,21 +1542,6 @@ static int lio_queue_status(struct se_cmd *se_cmd) | |||
1542 | return 0; | 1542 | return 0; |
1543 | } | 1543 | } |
1544 | 1544 | ||
1545 | static u16 lio_set_fabric_sense_len(struct se_cmd *se_cmd, u32 sense_length) | ||
1546 | { | ||
1547 | unsigned char *buffer = se_cmd->sense_buffer; | ||
1548 | /* | ||
1549 | * From RFC-3720 10.4.7. Data Segment - Sense and Response Data Segment | ||
1550 | * 16-bit SenseLength. | ||
1551 | */ | ||
1552 | buffer[0] = ((sense_length >> 8) & 0xff); | ||
1553 | buffer[1] = (sense_length & 0xff); | ||
1554 | /* | ||
1555 | * Return two byte offset into allocated sense_buffer. | ||
1556 | */ | ||
1557 | return 2; | ||
1558 | } | ||
1559 | |||
1560 | static int lio_queue_tm_rsp(struct se_cmd *se_cmd) | 1545 | static int lio_queue_tm_rsp(struct se_cmd *se_cmd) |
1561 | { | 1546 | { |
1562 | struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd); | 1547 | struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd); |
@@ -1740,7 +1725,6 @@ int iscsi_target_register_configfs(void) | |||
1740 | fabric->tf_ops.queue_data_in = &lio_queue_data_in; | 1725 | fabric->tf_ops.queue_data_in = &lio_queue_data_in; |
1741 | fabric->tf_ops.queue_status = &lio_queue_status; | 1726 | fabric->tf_ops.queue_status = &lio_queue_status; |
1742 | fabric->tf_ops.queue_tm_rsp = &lio_queue_tm_rsp; | 1727 | fabric->tf_ops.queue_tm_rsp = &lio_queue_tm_rsp; |
1743 | fabric->tf_ops.set_fabric_sense_len = &lio_set_fabric_sense_len; | ||
1744 | /* | 1728 | /* |
1745 | * Setup function pointers for generic logic in target_core_fabric_configfs.c | 1729 | * Setup function pointers for generic logic in target_core_fabric_configfs.c |
1746 | */ | 1730 | */ |