aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/ctl/ctl_frontend_iscsi.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2015-09-14 08:01:05 +0000
committerAlexander Motin <mav@FreeBSD.org>2015-09-14 08:01:05 +0000
commitceff31dc0cf803923c8d4b51dc42f73f5c5b9446 (patch)
tree511853fbcd868027993dea1c3029b5500f6a326f /sys/cam/ctl/ctl_frontend_iscsi.c
parent6e17d3a7fc00a4e3da8efcc44c7461a99e4743d8 (diff)
downloadsrc-ceff31dc0cf803923c8d4b51dc42f73f5c5b9446.tar.gz
src-ceff31dc0cf803923c8d4b51dc42f73f5c5b9446.zip
Implement QUERY TASK, QUERY TASK SET and QUERY ASYNC EVENT.
Now we support most of SAM-5 task management.
Notes
Notes: svn path=/head/; revision=287774
Diffstat (limited to 'sys/cam/ctl/ctl_frontend_iscsi.c')
-rw-r--r--sys/cam/ctl/ctl_frontend_iscsi.c44
1 files changed, 34 insertions, 10 deletions
diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c
index 099827ed9007..f993691a799e 100644
--- a/sys/cam/ctl/ctl_frontend_iscsi.c
+++ b/sys/cam/ctl/ctl_frontend_iscsi.c
@@ -663,12 +663,31 @@ cfiscsi_pdu_handle_task_request(struct icl_pdu *request)
#endif
io->taskio.task_action = CTL_TASK_TARGET_RESET;
break;
+ case BHSTMR_FUNCTION_QUERY_TASK:
+#if 0
+ CFISCSI_SESSION_DEBUG(cs, "BHSTMR_FUNCTION_QUERY_TASK");
+#endif
+ io->taskio.task_action = CTL_TASK_QUERY_TASK;
+ io->taskio.tag_num = bhstmr->bhstmr_referenced_task_tag;
+ break;
+ case BHSTMR_FUNCTION_QUERY_TASK_SET:
+#if 0
+ CFISCSI_SESSION_DEBUG(cs, "BHSTMR_FUNCTION_QUERY_TASK_SET");
+#endif
+ io->taskio.task_action = CTL_TASK_QUERY_TASK_SET;
+ break;
case BHSTMR_FUNCTION_I_T_NEXUS_RESET:
#if 0
CFISCSI_SESSION_DEBUG(cs, "BHSTMR_FUNCTION_I_T_NEXUS_RESET");
#endif
io->taskio.task_action = CTL_TASK_I_T_NEXUS_RESET;
break;
+ case BHSTMR_FUNCTION_QUERY_ASYNC_EVENT:
+#if 0
+ CFISCSI_SESSION_DEBUG(cs, "BHSTMR_FUNCTION_QUERY_ASYNC_EVENT");
+#endif
+ io->taskio.task_action = CTL_TASK_QUERY_ASYNC_EVENT;
+ break;
default:
CFISCSI_SESSION_DEBUG(cs, "unsupported function 0x%x",
bhstmr->bhstmr_function & ~0x80);
@@ -2910,18 +2929,23 @@ cfiscsi_task_management_done(union ctl_io *io)
response->ip_bhs;
bhstmr2->bhstmr_opcode = ISCSI_BHS_OPCODE_TASK_RESPONSE;
bhstmr2->bhstmr_flags = 0x80;
- if (io->io_hdr.status == CTL_SUCCESS) {
+ switch (io->taskio.task_status) {
+ case CTL_TASK_FUNCTION_COMPLETE:
bhstmr2->bhstmr_response = BHSTMR_RESPONSE_FUNCTION_COMPLETE;
- } else {
- /*
- * XXX: How to figure out what exactly went wrong? iSCSI spec
- * expects us to provide detailed error, e.g. "Task does
- * not exist" or "LUN does not exist".
- */
- CFISCSI_SESSION_DEBUG(cs, "BHSTMR_RESPONSE_FUNCTION_NOT_SUPPORTED");
- bhstmr2->bhstmr_response =
- BHSTMR_RESPONSE_FUNCTION_NOT_SUPPORTED;
+ break;
+ case CTL_TASK_FUNCTION_SUCCEEDED:
+ bhstmr2->bhstmr_response = BHSTMR_RESPONSE_FUNCTION_SUCCEEDED;
+ break;
+ case CTL_TASK_LUN_DOES_NOT_EXIST:
+ bhstmr2->bhstmr_response = BHSTMR_RESPONSE_LUN_DOES_NOT_EXIST;
+ break;
+ case CTL_TASK_FUNCTION_NOT_SUPPORTED:
+ default:
+ bhstmr2->bhstmr_response = BHSTMR_RESPONSE_FUNCTION_NOT_SUPPORTED;
+ break;
}
+ memcpy(bhstmr2->bhstmr_additional_reponse_information,
+ io->taskio.task_resp, sizeof(io->taskio.task_resp));
bhstmr2->bhstmr_initiator_task_tag = bhstmr->bhstmr_initiator_task_tag;
ctl_free_io(io);