aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_spc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-12 19:11:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-12 19:11:45 -0400
commit48efe453e6b29561f78a1df55c7f58375259cb8c (patch)
tree53d6ac1f2010b102c15b264b13fc4c98ba634d48 /drivers/target/target_core_spc.c
parentac4de9543aca59f2b763746647577302fbedd57e (diff)
parent2999ee7fda3f670effbfa746164c525f9d1be4b8 (diff)
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target updates from Nicholas Bellinger: "Lots of activity again this round for I/O performance optimizations (per-cpu IDA pre-allocation for vhost + iscsi/target), and the addition of new fabric independent features to target-core (COMPARE_AND_WRITE + EXTENDED_COPY). The main highlights include: - Support for iscsi-target login multiplexing across individual network portals - Generic Per-cpu IDA logic (kent + akpm + clameter) - Conversion of vhost to use per-cpu IDA pre-allocation for descriptors, SGLs and userspace page pointer list - Conversion of iscsi-target + iser-target to use per-cpu IDA pre-allocation for descriptors - Add support for generic COMPARE_AND_WRITE (AtomicTestandSet) emulation for virtual backend drivers - Add support for generic EXTENDED_COPY (CopyOffload) emulation for virtual backend drivers. - Add support for fast memory registration mode to iser-target (Vu) The patches to add COMPARE_AND_WRITE and EXTENDED_COPY support are of particular significance, which make us the first and only open source target to support the full set of VAAI primitives. Currently Linux clients are lacking upstream support to actually utilize these primitives. However, with server side support now in place for folks like MKP + ZAB working on the client, this logic once reserved for the highest end of storage arrays, can now be run in VMs on their laptops" * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (50 commits) target/iscsi: Bump versions to v4.1.0 target: Update copyright ownership/year information to 2013 iscsi-target: Bump default TCP listen backlog to 256 target: Fix >= v3.9+ regression in PR APTPL + ALUA metadata write-out iscsi-target; Bump default CmdSN Depth to 64 iscsi-target: Remove unnecessary wait_for_completion in iscsi_get_thread_set iscsi-target: Add thread_set->ts_activate_sem + use common deallocate iscsi-target: Fix race with thread_pre_handler flush_signals + ISCSI_THREAD_SET_DIE target: remove unused including <linux/version.h> iser-target: introduce fast memory registration mode (FRWR) iser-target: generalize rdma memory registration and cleanup iser-target: move rdma wr processing to a shared function target: Enable global EXTENDED_COPY setup/release target: Add Third Party Copy (3PC) bit in INQUIRY response target: Enable EXTENDED_COPY setup in spc_parse_cdb target: Add support for EXTENDED_COPY copy offload emulation target: Avoid non-existent tg_pt_gp_mem in target_alua_state_check target: Add global device list for EXTENDED_COPY target: Make helpers non static for EXTENDED_COPY command setup target: Make spc_parse_naa_6h_vendor_specific non static ...
Diffstat (limited to 'drivers/target/target_core_spc.c')
-rw-r--r--drivers/target/target_core_spc.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
index 9fabbf7214cd..074539558a54 100644
--- a/drivers/target/target_core_spc.c
+++ b/drivers/target/target_core_spc.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * SCSI Primary Commands (SPC) parsing and emulation. 2 * SCSI Primary Commands (SPC) parsing and emulation.
3 * 3 *
4 * (c) Copyright 2002-2012 RisingTide Systems LLC. 4 * (c) Copyright 2002-2013 Datera, Inc.
5 * 5 *
6 * Nicholas A. Bellinger <nab@kernel.org> 6 * Nicholas A. Bellinger <nab@kernel.org>
7 * 7 *
@@ -35,7 +35,7 @@
35#include "target_core_alua.h" 35#include "target_core_alua.h"
36#include "target_core_pr.h" 36#include "target_core_pr.h"
37#include "target_core_ua.h" 37#include "target_core_ua.h"
38 38#include "target_core_xcopy.h"
39 39
40static void spc_fill_alua_data(struct se_port *port, unsigned char *buf) 40static void spc_fill_alua_data(struct se_port *port, unsigned char *buf)
41{ 41{
@@ -95,6 +95,12 @@ spc_emulate_inquiry_std(struct se_cmd *cmd, unsigned char *buf)
95 */ 95 */
96 spc_fill_alua_data(lun->lun_sep, buf); 96 spc_fill_alua_data(lun->lun_sep, buf);
97 97
98 /*
99 * Set Third-Party Copy (3PC) bit to indicate support for EXTENDED_COPY
100 */
101 if (dev->dev_attrib.emulate_3pc)
102 buf[5] |= 0x8;
103
98 buf[7] = 0x2; /* CmdQue=1 */ 104 buf[7] = 0x2; /* CmdQue=1 */
99 105
100 memcpy(&buf[8], "LIO-ORG ", 8); 106 memcpy(&buf[8], "LIO-ORG ", 8);
@@ -129,8 +135,8 @@ spc_emulate_evpd_80(struct se_cmd *cmd, unsigned char *buf)
129 return 0; 135 return 0;
130} 136}
131 137
132static void spc_parse_naa_6h_vendor_specific(struct se_device *dev, 138void spc_parse_naa_6h_vendor_specific(struct se_device *dev,
133 unsigned char *buf) 139 unsigned char *buf)
134{ 140{
135 unsigned char *p = &dev->t10_wwn.unit_serial[0]; 141 unsigned char *p = &dev->t10_wwn.unit_serial[0];
136 int cnt; 142 int cnt;
@@ -460,6 +466,11 @@ spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf)
460 466
461 /* Set WSNZ to 1 */ 467 /* Set WSNZ to 1 */
462 buf[4] = 0x01; 468 buf[4] = 0x01;
469 /*
470 * Set MAXIMUM COMPARE AND WRITE LENGTH
471 */
472 if (dev->dev_attrib.emulate_caw)
473 buf[5] = 0x01;
463 474
464 /* 475 /*
465 * Set OPTIMAL TRANSFER LENGTH GRANULARITY 476 * Set OPTIMAL TRANSFER LENGTH GRANULARITY
@@ -1250,8 +1261,14 @@ spc_parse_cdb(struct se_cmd *cmd, unsigned int *size)
1250 *size = (cdb[6] << 24) | (cdb[7] << 16) | (cdb[8] << 8) | cdb[9]; 1261 *size = (cdb[6] << 24) | (cdb[7] << 16) | (cdb[8] << 8) | cdb[9];
1251 break; 1262 break;
1252 case EXTENDED_COPY: 1263 case EXTENDED_COPY:
1253 case READ_ATTRIBUTE: 1264 *size = get_unaligned_be32(&cdb[10]);
1265 cmd->execute_cmd = target_do_xcopy;
1266 break;
1254 case RECEIVE_COPY_RESULTS: 1267 case RECEIVE_COPY_RESULTS:
1268 *size = get_unaligned_be32(&cdb[10]);
1269 cmd->execute_cmd = target_do_receive_copy_results;
1270 break;
1271 case READ_ATTRIBUTE:
1255 case WRITE_ATTRIBUTE: 1272 case WRITE_ATTRIBUTE:
1256 *size = (cdb[10] << 24) | (cdb[11] << 16) | 1273 *size = (cdb[10] << 24) | (cdb[11] << 16) |
1257 (cdb[12] << 8) | cdb[13]; 1274 (cdb[12] << 8) | cdb[13];