Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/ctl/ctl_frontend_iscsi.c
Show First 20 Lines • Show All 1,106 Lines • ▼ Show 20 Lines | cfiscsi_data_wait_free(struct cfiscsi_session *cs, | ||||
icl_conn_transfer_done(cs->cs_conn, cdw->cdw_icl_prv); | icl_conn_transfer_done(cs->cs_conn, cdw->cdw_icl_prv); | ||||
uma_zfree(cfiscsi_data_wait_zone, cdw); | uma_zfree(cfiscsi_data_wait_zone, cdw); | ||||
} | } | ||||
static void | static void | ||||
cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs) | cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs) | ||||
{ | { | ||||
struct cfiscsi_data_wait *cdw; | struct cfiscsi_data_wait *cdw; | ||||
union ctl_io *io; | union ctl_io *io, *cdw_io; | ||||
int error, last, wait; | int error, last, wait; | ||||
if (cs->cs_target == NULL) | if (cs->cs_target == NULL) | ||||
return; /* No target yet, so nothing to do. */ | return; /* No target yet, so nothing to do. */ | ||||
io = ctl_alloc_io(cs->cs_target->ct_port.ctl_pool_ref); | io = ctl_alloc_io(cs->cs_target->ct_port.ctl_pool_ref); | ||||
ctl_zero_io(io); | ctl_zero_io(io); | ||||
PRIV_REQUEST(io) = cs; | PRIV_REQUEST(io) = cs; | ||||
io->io_hdr.io_type = CTL_IO_TASK; | io->io_hdr.io_type = CTL_IO_TASK; | ||||
Show All 15 Lines | cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs) | ||||
while ((cdw = TAILQ_FIRST(&cs->cs_waiting_for_data_out)) != NULL) { | while ((cdw = TAILQ_FIRST(&cs->cs_waiting_for_data_out)) != NULL) { | ||||
TAILQ_REMOVE(&cs->cs_waiting_for_data_out, cdw, cdw_next); | TAILQ_REMOVE(&cs->cs_waiting_for_data_out, cdw, cdw_next); | ||||
CFISCSI_SESSION_UNLOCK(cs); | CFISCSI_SESSION_UNLOCK(cs); | ||||
/* | /* | ||||
* Set nonzero port status; this prevents backends from | * Set nonzero port status; this prevents backends from | ||||
* assuming that the data transfer actually succeeded | * assuming that the data transfer actually succeeded | ||||
* and writing uninitialized data to disk. | * and writing uninitialized data to disk. | ||||
*/ | */ | ||||
cdw->cdw_ctl_io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; | cdw_io = cdw->cdw_ctl_io; | ||||
cdw->cdw_ctl_io->scsiio.io_hdr.port_status = 42; | cdw_io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; | ||||
ctl_datamove_done(cdw->cdw_ctl_io, false); | cdw_io->scsiio.io_hdr.port_status = 42; | ||||
cfiscsi_data_wait_free(cs, cdw); | cfiscsi_data_wait_free(cs, cdw); | ||||
ctl_datamove_done(cdw_io, false); | |||||
CFISCSI_SESSION_LOCK(cs); | CFISCSI_SESSION_LOCK(cs); | ||||
} | } | ||||
CFISCSI_SESSION_UNLOCK(cs); | CFISCSI_SESSION_UNLOCK(cs); | ||||
/* | /* | ||||
* Wait for CTL to terminate all the tasks. | * Wait for CTL to terminate all the tasks. | ||||
*/ | */ | ||||
if (wait > 0) | if (wait > 0) | ||||
▲ Show 20 Lines • Show All 1,756 Lines • ▼ Show 20 Lines | |||||
cfiscsi_task_management_done(union ctl_io *io) | cfiscsi_task_management_done(union ctl_io *io) | ||||
{ | { | ||||
struct icl_pdu *request, *response; | struct icl_pdu *request, *response; | ||||
struct iscsi_bhs_task_management_request *bhstmr; | struct iscsi_bhs_task_management_request *bhstmr; | ||||
struct iscsi_bhs_task_management_response *bhstmr2; | struct iscsi_bhs_task_management_response *bhstmr2; | ||||
struct cfiscsi_data_wait *cdw, *tmpcdw; | struct cfiscsi_data_wait *cdw, *tmpcdw; | ||||
struct cfiscsi_session *cs, *tcs; | struct cfiscsi_session *cs, *tcs; | ||||
struct cfiscsi_softc *softc; | struct cfiscsi_softc *softc; | ||||
union ctl_io *cdw_io; | |||||
int cold_reset = 0; | int cold_reset = 0; | ||||
request = PRIV_REQUEST(io); | request = PRIV_REQUEST(io); | ||||
cs = PDU_SESSION(request); | cs = PDU_SESSION(request); | ||||
bhstmr = (struct iscsi_bhs_task_management_request *)request->ip_bhs; | bhstmr = (struct iscsi_bhs_task_management_request *)request->ip_bhs; | ||||
KASSERT((bhstmr->bhstmr_opcode & ~ISCSI_BHS_OPCODE_IMMEDIATE) == | KASSERT((bhstmr->bhstmr_opcode & ~ISCSI_BHS_OPCODE_IMMEDIATE) == | ||||
ISCSI_BHS_OPCODE_TASK_REQUEST, | ISCSI_BHS_OPCODE_TASK_REQUEST, | ||||
("replying to wrong opcode 0x%x", bhstmr->bhstmr_opcode)); | ("replying to wrong opcode 0x%x", bhstmr->bhstmr_opcode)); | ||||
Show All 17 Lines | TAILQ_FOREACH_SAFE(cdw, | ||||
continue; | continue; | ||||
#if 0 | #if 0 | ||||
CFISCSI_SESSION_DEBUG(cs, "removing csw for initiator task " | CFISCSI_SESSION_DEBUG(cs, "removing csw for initiator task " | ||||
"tag 0x%x", bhstmr->bhstmr_initiator_task_tag); | "tag 0x%x", bhstmr->bhstmr_initiator_task_tag); | ||||
#endif | #endif | ||||
TAILQ_REMOVE(&cs->cs_waiting_for_data_out, | TAILQ_REMOVE(&cs->cs_waiting_for_data_out, | ||||
cdw, cdw_next); | cdw, cdw_next); | ||||
io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; | cdw_io = cdw->cdw_ctl_io; | ||||
cdw->cdw_ctl_io->scsiio.io_hdr.port_status = 43; | cdw_io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; | ||||
jhb: I would appreciate some thoughts on my questions here. | |||||
Done Inline ActionsNo, cdw_io != io here. io is the abort request, while cdw_io is the original SCSI command being aborted. You've properly fixed CTL_FLAG_DMA_INPROG clear on wrong io. mav: No, cdw_io != io here. io is the abort request, while cdw_io is the original SCSI command being… | |||||
Done Inline ActionsThanks, I've axed the comment. jhb: Thanks, I've axed the comment. | |||||
ctl_datamove_done(cdw->cdw_ctl_io, false); | cdw_io->scsiio.io_hdr.port_status = 43; | ||||
cfiscsi_data_wait_free(cs, cdw); | cfiscsi_data_wait_free(cs, cdw); | ||||
ctl_datamove_done(cdw_io, false); | |||||
} | } | ||||
CFISCSI_SESSION_UNLOCK(cs); | CFISCSI_SESSION_UNLOCK(cs); | ||||
} | } | ||||
if ((bhstmr->bhstmr_function & ~0x80) == | if ((bhstmr->bhstmr_function & ~0x80) == | ||||
BHSTMR_FUNCTION_TARGET_COLD_RESET && | BHSTMR_FUNCTION_TARGET_COLD_RESET && | ||||
Not Done Inline Actionsabove we set it to 42, here 43? I'm not super familiar with the code, but is that a problem? imp: above we set it to 42, here 43? I'm not super familiar with the code, but is that a problem?
| |||||
Not Done Inline ActionsThese codes were never formalized. I've done some cleanup, but haven't completed. So anything non-zero is OK, unique values are used just to ease debugging. And since the command was aborted, this code goes nowhere really, but still it is better to indicate that the transfer was not successful. mav: These codes were never formalized. I've done some cleanup, but haven't completed. So anything… | |||||
io->io_hdr.status == CTL_SUCCESS) | io->io_hdr.status == CTL_SUCCESS) | ||||
cold_reset = 1; | cold_reset = 1; | ||||
response = cfiscsi_pdu_new_response(request, M_WAITOK); | response = cfiscsi_pdu_new_response(request, M_WAITOK); | ||||
bhstmr2 = (struct iscsi_bhs_task_management_response *) | bhstmr2 = (struct iscsi_bhs_task_management_response *) | ||||
response->ip_bhs; | response->ip_bhs; | ||||
bhstmr2->bhstmr_opcode = ISCSI_BHS_OPCODE_TASK_RESPONSE; | bhstmr2->bhstmr_opcode = ISCSI_BHS_OPCODE_TASK_RESPONSE; | ||||
bhstmr2->bhstmr_flags = 0x80; | bhstmr2->bhstmr_flags = 0x80; | ||||
▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines |
I would appreciate some thoughts on my questions here.