From 0123a9ec6a4fea20d5afea90c9b47fb73fb1bc34 Mon Sep 17 00:00:00 2001 From: Nicholas Bellinger Date: Tue, 20 Aug 2013 14:24:09 -0700 Subject: target: Add MAXIMUM COMPARE AND WRITE LENGTH in Block Limits VPD This patch adds the MAXIMUM COMPARE AND WRITE LENGTH bit, currently hardcoded to a single logical block (NoLB=1) within the Block Limits VPD in spc_emulate_evpd_b0(). Also add emulate_caw device attribute in configfs (enabled by default) to allow the exposure of this bit to be disabled, if necessary. Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Martin Petersen Cc: Chris Mason Cc: James Bottomley Cc: Nicholas Bellinger Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_spc.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/target/target_core_spc.c') diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 4cb667d720a7..ed7077a67d7b 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c @@ -457,6 +457,11 @@ spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf) /* Set WSNZ to 1 */ buf[4] = 0x01; + /* + * Set MAXIMUM COMPARE AND WRITE LENGTH + */ + if (dev->dev_attrib.emulate_caw) + buf[5] = 0x01; /* * Set OPTIMAL TRANSFER LENGTH GRANULARITY -- cgit v1.2.3 From 68366026a57645f90146796c95214087da5f1f6d Mon Sep 17 00:00:00 2001 From: Nicholas Bellinger Date: Tue, 20 Aug 2013 17:02:21 -0700 Subject: target: Make spc_parse_naa_6h_vendor_specific non static This patch makes spc_parse_naa_6h_vendor_specific() available to other target code, which is required by EXTENDED_COPY when comparing the received NAA WWN device identifer for locating the associated se_device backend. Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Martin Petersen Cc: Chris Mason Cc: Roland Dreier Cc: Zach Brown Cc: James Bottomley Cc: Nicholas Bellinger Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_spc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/target/target_core_spc.c') diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index ed7077a67d7b..bd16a93a7a3f 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c @@ -126,8 +126,8 @@ spc_emulate_evpd_80(struct se_cmd *cmd, unsigned char *buf) return 0; } -static void spc_parse_naa_6h_vendor_specific(struct se_device *dev, - unsigned char *buf) +void spc_parse_naa_6h_vendor_specific(struct se_device *dev, + unsigned char *buf) { unsigned char *p = &dev->t10_wwn.unit_serial[0]; int cnt; -- cgit v1.2.3 From 04b1b7954649767f2ab9bf08cf2457e21d5c7167 Mon Sep 17 00:00:00 2001 From: Nicholas Bellinger Date: Thu, 22 Aug 2013 12:29:59 -0700 Subject: target: Enable EXTENDED_COPY setup in spc_parse_cdb Setup up the se_cmd->execute_cmd() pointers for EXTENDED_COPY and RECEIVE_COPY_RESULTS handling within spc_parse_cdb() Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Martin Petersen Cc: Chris Mason Cc: Roland Dreier Cc: Zach Brown Cc: James Bottomley Cc: Nicholas Bellinger Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_spc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'drivers/target/target_core_spc.c') diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index bd16a93a7a3f..894e83bc223d 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c @@ -35,7 +35,7 @@ #include "target_core_alua.h" #include "target_core_pr.h" #include "target_core_ua.h" - +#include "target_core_xcopy.h" static void spc_fill_alua_data(struct se_port *port, unsigned char *buf) { @@ -1252,8 +1252,14 @@ spc_parse_cdb(struct se_cmd *cmd, unsigned int *size) *size = (cdb[6] << 24) | (cdb[7] << 16) | (cdb[8] << 8) | cdb[9]; break; case EXTENDED_COPY: - case READ_ATTRIBUTE: + *size = get_unaligned_be32(&cdb[10]); + cmd->execute_cmd = target_do_xcopy; + break; case RECEIVE_COPY_RESULTS: + *size = get_unaligned_be32(&cdb[10]); + cmd->execute_cmd = target_do_receive_copy_results; + break; + case READ_ATTRIBUTE: case WRITE_ATTRIBUTE: *size = (cdb[10] << 24) | (cdb[11] << 16) | (cdb[12] << 8) | cdb[13]; -- cgit v1.2.3 From d397a445f43c7ae9b35260f236a08d5b5760de3d Mon Sep 17 00:00:00 2001 From: Nicholas Bellinger Date: Thu, 22 Aug 2013 14:17:20 -0700 Subject: target: Add Third Party Copy (3PC) bit in INQUIRY response This patch adds the Third Party Copy (3PC) bit to signal support for EXTENDED_COPY within standard inquiry response data. Also add emulate_3pc device attribute in configfs (enabled by default) to allow the exposure of this bit to be disabled, if necessary. Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Martin Petersen Cc: Chris Mason Cc: Roland Dreier Cc: Zach Brown Cc: James Bottomley Cc: Nicholas Bellinger Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_spc.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'drivers/target/target_core_spc.c') diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 894e83bc223d..566dd2794679 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c @@ -95,6 +95,12 @@ spc_emulate_inquiry_std(struct se_cmd *cmd, unsigned char *buf) */ spc_fill_alua_data(lun->lun_sep, buf); + /* + * Set Third-Party Copy (3PC) bit to indicate support for EXTENDED_COPY + */ + if (dev->dev_attrib.emulate_3pc) + buf[5] |= 0x8; + buf[7] = 0x2; /* CmdQue=1 */ snprintf(&buf[8], 8, "LIO-ORG"); -- cgit v1.2.3 From 4c76251e8e8f704ed7eace603a8041458a1ed16f Mon Sep 17 00:00:00 2001 From: Nicholas Bellinger Date: Thu, 5 Sep 2013 15:29:12 -0700 Subject: target: Update copyright ownership/year information to 2013 Update copyright ownership/year information for target-core, loopback, iscsi-target, tcm_qla2xx, vhost and iser-target. Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_spc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/target/target_core_spc.c') diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 566dd2794679..6144b69f7d64 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c @@ -1,7 +1,7 @@ /* * SCSI Primary Commands (SPC) parsing and emulation. * - * (c) Copyright 2002-2012 RisingTide Systems LLC. + * (c) Copyright 2002-2013 Datera, Inc. * * Nicholas A. Bellinger * -- cgit v1.2.3