Add partial support for QUERY TMF to CAM and isp(4).

This change allows to decode respective functions in isp(4) in target mode
and pass them through CAM to CTL.  Unfortunately neither CAM nor isp(4)
support returning response info for those task management functions now.

On the other side I just have no initiator to test this functionality.
This commit is contained in:
Alexander Motin 2015-10-23 18:34:18 +00:00
parent 4c620fe5c4
commit c98d2b1f1e
6 changed files with 41 additions and 10 deletions

View File

@ -1459,24 +1459,31 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb)
CTL_TASK_ABORT_TASK_SET;
break;
case MSG_TARGET_RESET:
io->taskio.task_action =
CTL_TASK_TARGET_RESET;
io->taskio.task_action = CTL_TASK_TARGET_RESET;
break;
case MSG_ABORT_TASK:
io->taskio.task_action =
CTL_TASK_ABORT_TASK;
io->taskio.task_action = CTL_TASK_ABORT_TASK;
break;
case MSG_LOGICAL_UNIT_RESET:
io->taskio.task_action =
CTL_TASK_LUN_RESET;
io->taskio.task_action = CTL_TASK_LUN_RESET;
break;
case MSG_CLEAR_TASK_SET:
io->taskio.task_action =
CTL_TASK_CLEAR_TASK_SET;
CTL_TASK_CLEAR_TASK_SET;
break;
case MSG_CLEAR_ACA:
io->taskio.task_action = CTL_TASK_CLEAR_ACA;
break;
case MSG_QUERY_TASK:
io->taskio.task_action = CTL_TASK_QUERY_TASK;
break;
case MSG_QUERY_TASK_SET:
io->taskio.task_action =
CTL_TASK_CLEAR_ACA;
CTL_TASK_QUERY_TASK_SET;
break;
case MSG_QUERY_ASYNC_EVENT:
io->taskio.task_action =
CTL_TASK_QUERY_ASYNC_EVENT;
break;
case MSG_NOOP:
send_ctl_io = 0;

View File

@ -68,3 +68,9 @@
#define MSG_EXT_PPR_QAS_REQ 0x04
#define MSG_EXT_PPR_DT_REQ 0x02
#define MSG_EXT_PPR_IU_REQ 0x01
/* Fake messages not defined for SPI, but needed for other transports */
#define MSG_QUERY_TASK 0x100
#define MSG_QUERY_TASK_SET 0x101
#define MSG_QUERY_ASYNC_EVENT 0x102

View File

@ -3484,6 +3484,12 @@ isp_handle_platform_target_tmf(ispsoftc_t *isp, isp_notify_t *notify)
case NT_TARGET_RESET:
inot->arg = MSG_TARGET_RESET;
break;
case NT_QUERY_TASK_SET:
inot->arg = MSG_QUERY_TASK_SET;
break;
case NT_QUERY_ASYNC_EVENT:
inot->arg = MSG_QUERY_ASYNC_EVENT;
break;
default:
isp_prt(isp, ISP_LOGWARN, "%s: unknown TMF code 0x%x for chan %d lun %#jx", __func__, notify->nt_ncode, notify->nt_channel, (uintmax_t)lun);
goto bad;
@ -5877,6 +5883,8 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
case NT_CLEAR_TASK_SET:
case NT_LUN_RESET:
case NT_TARGET_RESET:
case NT_QUERY_TASK_SET:
case NT_QUERY_ASYNC_EVENT:
/*
* These are task management functions.
*/

View File

@ -97,8 +97,10 @@ typedef struct {
#define FCP_CMND_TMF_CLEAR_ACA 0x40
#define FCP_CMND_TMF_TGT_RESET 0x20
#define FCP_CMND_TMF_LUN_RESET 0x10
#define FCP_CMND_TMF_QUERY_ASYNC_EVENT 0x08
#define FCP_CMND_TMF_CLEAR_TASK_SET 0x04
#define FCP_CMND_TMF_ABORT_TASK_SET 0x02
#define FCP_CMND_TMF_QUERY_TASK_SET 0x01
/*
* Basic CT IU Header

View File

@ -1024,12 +1024,18 @@ isp_got_tmf_24xx(ispsoftc_t *isp, at7_entry_t *aep)
notify.nt_sid = sid;
notify.nt_did = did;
notify.nt_channel = chan;
if (aep->at_cmnd.fcp_cmnd_task_management & FCP_CMND_TMF_ABORT_TASK_SET) {
if (aep->at_cmnd.fcp_cmnd_task_management & FCP_CMND_TMF_QUERY_TASK_SET) {
isp_prt(isp, ISP_LOGINFO, f1, "QUERY TASK SET", sid, notify.nt_lun, aep->at_rxid);
notify.nt_ncode = NT_QUERY_TASK_SET;
} else if (aep->at_cmnd.fcp_cmnd_task_management & FCP_CMND_TMF_ABORT_TASK_SET) {
isp_prt(isp, ISP_LOGINFO, f1, "ABORT TASK SET", sid, notify.nt_lun, aep->at_rxid);
notify.nt_ncode = NT_ABORT_TASK_SET;
} else if (aep->at_cmnd.fcp_cmnd_task_management & FCP_CMND_TMF_CLEAR_TASK_SET) {
isp_prt(isp, ISP_LOGINFO, f1, "CLEAR TASK SET", sid, notify.nt_lun, aep->at_rxid);
notify.nt_ncode = NT_CLEAR_TASK_SET;
} else if (aep->at_cmnd.fcp_cmnd_task_management & FCP_CMND_TMF_QUERY_ASYNC_EVENT) {
isp_prt(isp, ISP_LOGINFO, f1, "QUERY ASYNC EVENT", sid, notify.nt_lun, aep->at_rxid);
notify.nt_ncode = NT_QUERY_ASYNC_EVENT;
} else if (aep->at_cmnd.fcp_cmnd_task_management & FCP_CMND_TMF_LUN_RESET) {
isp_prt(isp, ISP_LOGINFO, f1, "LUN RESET", sid, notify.nt_lun, aep->at_rxid);
notify.nt_ncode = NT_LUN_RESET;

View File

@ -51,7 +51,9 @@ typedef enum {
NT_LOGOUT,
NT_GLOBAL_LOGOUT,
NT_CHANGED,
NT_HBA_RESET
NT_HBA_RESET,
NT_QUERY_TASK_SET,
NT_QUERY_ASYNC_EVENT
} isp_ncode_t;
typedef struct isp_notify {