aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/ctl/ctl_tpc.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2015-09-17 14:22:52 +0000
committerAlexander Motin <mav@FreeBSD.org>2015-09-17 14:22:52 +0000
commit042e9bdc41c4983754743f9af88692fc9706f7bc (patch)
treedbba4127017d865fa242cf39d570dd5bae8ed62c /sys/cam/ctl/ctl_tpc.c
parent7f7bb97a0f9b8d1726f2fb7db3895068f2e128ea (diff)
downloadsrc-042e9bdc41c4983754743f9af88692fc9706f7bc.tar.gz
src-042e9bdc41c4983754743f9af88692fc9706f7bc.zip
Report number of failed XCOPY segment.
Notes
Notes: svn path=/head/; revision=287913
Diffstat (limited to 'sys/cam/ctl/ctl_tpc.c')
-rw-r--r--sys/cam/ctl/ctl_tpc.c40
1 files changed, 32 insertions, 8 deletions
diff --git a/sys/cam/ctl/ctl_tpc.c b/sys/cam/ctl/ctl_tpc.c
index 887fe59da092..0b8879df20b5 100644
--- a/sys/cam/ctl/ctl_tpc.c
+++ b/sys/cam/ctl/ctl_tpc.c
@@ -820,7 +820,9 @@ tpc_process_b2b(struct tpc_list *list)
off_t srclba, dstlba, numbytes, donebytes, roundbytes;
int numlba;
uint32_t srcblock, dstblock, pb, pbo, adj;
+ uint8_t csi[4];
+ scsi_ulto4b(list->curseg, csi);
if (list->stage == 1) {
while ((tior = TAILQ_FIRST(&list->allio)) != NULL) {
TAILQ_REMOVE(&list->allio, tior, links);
@@ -834,7 +836,9 @@ tpc_process_b2b(struct tpc_list *list)
} else if (list->error) {
ctl_set_sense(list->ctsio, /*current_error*/ 1,
/*sense_key*/ SSD_KEY_COPY_ABORTED,
- /*asc*/ 0x0d, /*ascq*/ 0x01, SSD_ELEM_NONE);
+ /*asc*/ 0x0d, /*ascq*/ 0x01,
+ SSD_ELEM_COMMAND, csi, sizeof(csi),
+ SSD_ELEM_NONE);
return (CTL_RETVAL_ERROR);
}
list->cursectors += list->segsectors;
@@ -849,7 +853,9 @@ tpc_process_b2b(struct tpc_list *list)
if (sl >= CTL_MAX_LUNS || dl >= CTL_MAX_LUNS) {
ctl_set_sense(list->ctsio, /*current_error*/ 1,
/*sense_key*/ SSD_KEY_COPY_ABORTED,
- /*asc*/ 0x08, /*ascq*/ 0x04, SSD_ELEM_NONE);
+ /*asc*/ 0x08, /*ascq*/ 0x04,
+ SSD_ELEM_COMMAND, csi, sizeof(csi),
+ SSD_ELEM_NONE);
return (CTL_RETVAL_ERROR);
}
if (pbo > 0)
@@ -878,7 +884,9 @@ tpc_process_b2b(struct tpc_list *list)
if (numbytes % srcblock != 0 || numbytes % dstblock != 0) {
ctl_set_sense(list->ctsio, /*current_error*/ 1,
/*sense_key*/ SSD_KEY_COPY_ABORTED,
- /*asc*/ 0x26, /*ascq*/ 0x0A, SSD_ELEM_NONE);
+ /*asc*/ 0x26, /*ascq*/ 0x0A,
+ SSD_ELEM_COMMAND, csi, sizeof(csi),
+ SSD_ELEM_NONE);
return (CTL_RETVAL_ERROR);
}
@@ -962,7 +970,9 @@ tpc_process_verify(struct tpc_list *list)
struct scsi_ec_segment_verify *seg;
struct tpc_io *tio;
uint64_t sl;
+ uint8_t csi[4];
+ scsi_ulto4b(list->curseg, csi);
if (list->stage == 1) {
while ((tio = TAILQ_FIRST(&list->allio)) != NULL) {
TAILQ_REMOVE(&list->allio, tio, links);
@@ -975,7 +985,9 @@ tpc_process_verify(struct tpc_list *list)
} else if (list->error) {
ctl_set_sense(list->ctsio, /*current_error*/ 1,
/*sense_key*/ SSD_KEY_COPY_ABORTED,
- /*asc*/ 0x0d, /*ascq*/ 0x01, SSD_ELEM_NONE);
+ /*asc*/ 0x0d, /*ascq*/ 0x01,
+ SSD_ELEM_COMMAND, csi, sizeof(csi),
+ SSD_ELEM_NONE);
return (CTL_RETVAL_ERROR);
} else
return (CTL_RETVAL_COMPLETE);
@@ -987,7 +999,9 @@ tpc_process_verify(struct tpc_list *list)
if (sl >= CTL_MAX_LUNS) {
ctl_set_sense(list->ctsio, /*current_error*/ 1,
/*sense_key*/ SSD_KEY_COPY_ABORTED,
- /*asc*/ 0x08, /*ascq*/ 0x04, SSD_ELEM_NONE);
+ /*asc*/ 0x08, /*ascq*/ 0x04,
+ SSD_ELEM_COMMAND, csi, sizeof(csi),
+ SSD_ELEM_NONE);
return (CTL_RETVAL_ERROR);
}
@@ -1019,7 +1033,9 @@ tpc_process_register_key(struct tpc_list *list)
struct tpc_io *tio;
uint64_t dl;
int datalen;
+ uint8_t csi[4];
+ scsi_ulto4b(list->curseg, csi);
if (list->stage == 1) {
while ((tio = TAILQ_FIRST(&list->allio)) != NULL) {
TAILQ_REMOVE(&list->allio, tio, links);
@@ -1033,7 +1049,9 @@ tpc_process_register_key(struct tpc_list *list)
} else if (list->error) {
ctl_set_sense(list->ctsio, /*current_error*/ 1,
/*sense_key*/ SSD_KEY_COPY_ABORTED,
- /*asc*/ 0x0d, /*ascq*/ 0x01, SSD_ELEM_NONE);
+ /*asc*/ 0x0d, /*ascq*/ 0x01,
+ SSD_ELEM_COMMAND, csi, sizeof(csi),
+ SSD_ELEM_NONE);
return (CTL_RETVAL_ERROR);
} else
return (CTL_RETVAL_COMPLETE);
@@ -1045,7 +1063,9 @@ tpc_process_register_key(struct tpc_list *list)
if (dl >= CTL_MAX_LUNS) {
ctl_set_sense(list->ctsio, /*current_error*/ 1,
/*sense_key*/ SSD_KEY_COPY_ABORTED,
- /*asc*/ 0x08, /*ascq*/ 0x04, SSD_ELEM_NONE);
+ /*asc*/ 0x08, /*ascq*/ 0x04,
+ SSD_ELEM_COMMAND, csi, sizeof(csi),
+ SSD_ELEM_NONE);
return (CTL_RETVAL_ERROR);
}
@@ -1346,6 +1366,7 @@ tpc_process(struct tpc_list *list)
struct scsi_ec_segment *seg;
struct ctl_scsiio *ctsio = list->ctsio;
int retval = CTL_RETVAL_COMPLETE;
+ uint8_t csi[4];
if (list->service_action == EC_WUT) {
if (list->token != NULL)
@@ -1373,9 +1394,12 @@ tpc_process(struct tpc_list *list)
retval = tpc_process_register_key(list);
break;
default:
+ scsi_ulto4b(list->curseg, csi);
ctl_set_sense(ctsio, /*current_error*/ 1,
/*sense_key*/ SSD_KEY_COPY_ABORTED,
- /*asc*/ 0x26, /*ascq*/ 0x09, SSD_ELEM_NONE);
+ /*asc*/ 0x26, /*ascq*/ 0x09,
+ SSD_ELEM_COMMAND, csi, sizeof(csi),
+ SSD_ELEM_NONE);
goto done;
}
if (retval == CTL_RETVAL_QUEUED)