svn commit: r268697 - in stable/10/sys/cam: ctl scsi
Alexander Motin
mav at FreeBSD.org
Tue Jul 15 17:18:52 UTC 2014
Author: mav
Date: Tue Jul 15 17:18:50 2014
New Revision: 268697
URL: http://svnweb.freebsd.org/changeset/base/268697
Log:
MFC r268418:
Enable TAS feature: notify initiator if its command was aborted by other.
That should make operation more kind to multi-initiator environment.
Without this, other initiators may find out that something bad happened
to their commands only via command timeout.
Modified:
stable/10/sys/cam/ctl/ctl.c
stable/10/sys/cam/ctl/ctl_error.c
stable/10/sys/cam/ctl/ctl_error.h
stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
stable/10/sys/cam/ctl/ctl_io.h
stable/10/sys/cam/ctl/scsi_ctl.c
stable/10/sys/cam/scsi/scsi_all.h
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/cam/ctl/ctl.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl.c Tue Jul 15 17:17:52 2014 (r268696)
+++ stable/10/sys/cam/ctl/ctl.c Tue Jul 15 17:18:50 2014 (r268697)
@@ -282,8 +282,10 @@ static struct scsi_control_page control_
/*rlec*/0,
/*queue_flags*/0,
/*eca_and_aen*/0,
- /*reserved*/0,
- /*aen_holdoff_period*/{0, 0}
+ /*flags4*/SCP_TAS,
+ /*aen_holdoff_period*/{0, 0},
+ /*busy_timeout_period*/{0, 0},
+ /*extended_selftest_completion_time*/{0, 0}
};
static struct scsi_control_page control_page_changeable = {
@@ -292,8 +294,10 @@ static struct scsi_control_page control_
/*rlec*/SCP_DSENSE,
/*queue_flags*/0,
/*eca_and_aen*/0,
- /*reserved*/0,
- /*aen_holdoff_period*/{0, 0}
+ /*flags4*/0,
+ /*aen_holdoff_period*/{0, 0},
+ /*busy_timeout_period*/{0, 0},
+ /*extended_selftest_completion_time*/{0, 0}
};
@@ -7578,7 +7582,7 @@ ctl_report_supported_tmf(struct ctl_scsi
ctsio->kern_rel_offset = 0;
data = (struct scsi_report_supported_tmf_data *)ctsio->kern_data_ptr;
- data->byte1 |= RST_ATS | RST_ATSS | RST_LURS | RST_TRS;
+ data->byte1 |= RST_ATS | RST_ATSS | RST_CTSS | RST_LURS | RST_TRS;
data->byte2 |= RST_ITNRS;
ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED;
@@ -11795,7 +11799,7 @@ ctl_lun_reset(struct ctl_lun *lun, union
#endif
for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL;
xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) {
- xio->io_hdr.flags |= CTL_FLAG_ABORT;
+ xio->io_hdr.flags |= CTL_FLAG_ABORT | CTL_FLAG_ABORT_STATUS;
}
/*
@@ -11848,8 +11852,13 @@ ctl_abort_tasks_lun(struct ctl_lun *lun,
for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL;
xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) {
- if ((targ_port == xio->io_hdr.nexus.targ_port) &&
- (init_id == xio->io_hdr.nexus.initid.id)) {
+ if ((targ_port == UINT32_MAX ||
+ targ_port == xio->io_hdr.nexus.targ_port) &&
+ (init_id == UINT32_MAX ||
+ init_id == xio->io_hdr.nexus.initid.id)) {
+ if (targ_port != xio->io_hdr.nexus.targ_port ||
+ init_id != xio->io_hdr.nexus.initid.id)
+ xio->io_hdr.flags |= CTL_FLAG_ABORT_STATUS;
xio->io_hdr.flags |= CTL_FLAG_ABORT;
found = 1;
if (!other_sc && !(lun->flags & CTL_LUN_PRIMARY_SC)) {
@@ -11891,9 +11900,14 @@ ctl_abort_task_set(union ctl_io *io)
mtx_lock(&lun->lun_lock);
mtx_unlock(&softc->ctl_lock);
- ctl_abort_tasks_lun(lun, io->io_hdr.nexus.targ_port,
- io->io_hdr.nexus.initid.id,
- (io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) != 0);
+ if (io->taskio.task_action == CTL_TASK_ABORT_TASK_SET) {
+ ctl_abort_tasks_lun(lun, io->io_hdr.nexus.targ_port,
+ io->io_hdr.nexus.initid.id,
+ (io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) != 0);
+ } else { /* CTL_TASK_CLEAR_TASK_SET */
+ ctl_abort_tasks_lun(lun, UINT32_MAX, UINT32_MAX,
+ (io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) != 0);
+ }
mtx_unlock(&lun->lun_lock);
return (0);
}
@@ -12113,12 +12127,11 @@ ctl_run_task(union ctl_io *io)
retval = ctl_abort_task(io);
break;
case CTL_TASK_ABORT_TASK_SET:
+ case CTL_TASK_CLEAR_TASK_SET:
retval = ctl_abort_task_set(io);
break;
case CTL_TASK_CLEAR_ACA:
break;
- case CTL_TASK_CLEAR_TASK_SET:
- break;
case CTL_TASK_I_T_NEXUS_RESET:
retval = ctl_i_t_nexus_reset(io);
break;
@@ -13476,7 +13489,7 @@ ctl_process_done(union ctl_io *io)
* whatever it needs to do to clean up its state.
*/
if (io->io_hdr.flags & CTL_FLAG_ABORT)
- io->io_hdr.status = CTL_CMD_ABORTED;
+ ctl_set_task_aborted(&io->scsiio);
/*
* We print out status for every task management command. For SCSI
Modified: stable/10/sys/cam/ctl/ctl_error.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl_error.c Tue Jul 15 17:17:52 2014 (r268696)
+++ stable/10/sys/cam/ctl/ctl_error.c Tue Jul 15 17:18:50 2014 (r268697)
@@ -795,6 +795,18 @@ ctl_set_busy(struct ctl_scsiio *ctsio)
}
void
+ctl_set_task_aborted(struct ctl_scsiio *ctsio)
+{
+ struct scsi_sense_data *sense;
+
+ sense = &ctsio->sense_data;
+ memset(sense, 0, sizeof(*sense));
+ ctsio->scsi_status = SCSI_STATUS_TASK_ABORTED;
+ ctsio->sense_len = 0;
+ ctsio->io_hdr.status = CTL_CMD_ABORTED;
+}
+
+void
ctl_set_success(struct ctl_scsiio *ctsio)
{
struct scsi_sense_data *sense;
Modified: stable/10/sys/cam/ctl/ctl_error.h
==============================================================================
--- stable/10/sys/cam/ctl/ctl_error.h Tue Jul 15 17:17:52 2014 (r268696)
+++ stable/10/sys/cam/ctl/ctl_error.h Tue Jul 15 17:18:50 2014 (r268697)
@@ -80,6 +80,7 @@ void ctl_set_data_phase_error(struct ctl
void ctl_set_reservation_conflict(struct ctl_scsiio *ctsio);
void ctl_set_queue_full(struct ctl_scsiio *ctsio);
void ctl_set_busy(struct ctl_scsiio *ctsio);
+void ctl_set_task_aborted(struct ctl_scsiio *ctsio);
void ctl_set_success(struct ctl_scsiio *ctsio);
#endif /* _CTL_ERROR_H_ */
Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Tue Jul 15 17:17:52 2014 (r268696)
+++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Tue Jul 15 17:18:50 2014 (r268697)
@@ -2706,7 +2706,8 @@ cfiscsi_scsi_command_done(union ctl_io *
* Do not return status for aborted commands.
* There are exceptions, but none supported by CTL yet.
*/
- if (io->io_hdr.status == CTL_CMD_ABORTED) {
+ if (io->io_hdr.status == CTL_CMD_ABORTED &&
+ (io->io_hdr.flags & CTL_FLAG_ABORT_STATUS) == 0) {
ctl_free_io(io);
icl_pdu_free(request);
return;
Modified: stable/10/sys/cam/ctl/ctl_io.h
==============================================================================
--- stable/10/sys/cam/ctl/ctl_io.h Tue Jul 15 17:17:52 2014 (r268696)
+++ stable/10/sys/cam/ctl/ctl_io.h Tue Jul 15 17:18:50 2014 (r268697)
@@ -96,6 +96,7 @@ typedef enum {
CTL_FLAG_CONTROL_DEV = 0x00000080, /* processor device */
CTL_FLAG_ALLOCATED = 0x00000100, /* data space allocated */
CTL_FLAG_BLOCKED = 0x00000200, /* on the blocked queue */
+ CTL_FLAG_ABORT_STATUS = 0x00000400, /* return TASK ABORTED status */
CTL_FLAG_ABORT = 0x00000800, /* this I/O should be aborted */
CTL_FLAG_DMA_INPROG = 0x00001000, /* DMA in progress */
CTL_FLAG_NO_DATASYNC = 0x00002000, /* don't cache flush data */
Modified: stable/10/sys/cam/ctl/scsi_ctl.c
==============================================================================
--- stable/10/sys/cam/ctl/scsi_ctl.c Tue Jul 15 17:17:52 2014 (r268696)
+++ stable/10/sys/cam/ctl/scsi_ctl.c Tue Jul 15 17:18:50 2014 (r268697)
@@ -805,7 +805,8 @@ ctlfestart(struct cam_periph *periph, un
scsi_status = SCSI_STATUS_BUSY;
csio->sense_len = 0;
} else if ((io->io_hdr.status & CTL_STATUS_MASK) ==
- CTL_CMD_ABORTED) {
+ CTL_CMD_ABORTED &&
+ (io->io_hdr.flags & CTL_FLAG_ABORT_STATUS) == 0) {
io->io_hdr.flags &= ~CTL_FLAG_STATUS_QUEUED;
/*
Modified: stable/10/sys/cam/scsi/scsi_all.h
==============================================================================
--- stable/10/sys/cam/scsi/scsi_all.h Tue Jul 15 17:17:52 2014 (r268696)
+++ stable/10/sys/cam/scsi/scsi_all.h Tue Jul 15 17:18:50 2014 (r268697)
@@ -475,15 +475,24 @@ struct scsi_control_page {
#define SCP_QUEUE_ALG_MASK 0xF0
#define SCP_QUEUE_ALG_RESTRICTED 0x00
#define SCP_QUEUE_ALG_UNRESTRICTED 0x10
+#define SCP_NUAR 0x08 /*No UA on release*/
#define SCP_QUEUE_ERR 0x02 /*Queued I/O aborted for CACs*/
#define SCP_QUEUE_DQUE 0x01 /*Queued I/O disabled*/
u_int8_t eca_and_aen;
#define SCP_EECA 0x80 /*Enable Extended CA*/
+#define SCP_RAC 0x40 /*Report a check*/
+#define SCP_SWP 0x08 /*Software Write Protect*/
#define SCP_RAENP 0x04 /*Ready AEN Permission*/
#define SCP_UAAENP 0x02 /*UA AEN Permission*/
#define SCP_EAENP 0x01 /*Error AEN Permission*/
- u_int8_t reserved;
+ u_int8_t flags4;
+#define SCP_ATO 0x80 /*Application tag owner*/
+#define SCP_TAS 0x40 /*Task aborted status*/
+#define SCP_ATMPE 0x20 /*Application tag mode page*/
+#define SCP_RWWP 0x10 /*Reject write without prot*/
u_int8_t aen_holdoff_period[2];
+ u_int8_t busy_timeout_period[2];
+ u_int8_t extended_selftest_completion_time[2];
};
struct scsi_cache_page {
More information about the svn-src-stable
mailing list