aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2013-10-16 03:12:56 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2013-10-16 18:42:52 -0400
commit8f4a1fb0d029feef385986f320c7b4c13d9fce40 (patch)
tree4a9de2474eaaba3d83510b733b130bc9c43c4653
parent969871cdc2d0f5a81d6733450b5334d14fce2b75 (diff)
tcm_loop: Implement target reset
Implement target reset by resetting the transport status. (nab: Remove unused ret in tcm_loop_target_reset) Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/target/loopback/tcm_loop.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 04811caac487..1b41e6776152 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -392,6 +392,31 @@ static int tcm_loop_device_reset(struct scsi_cmnd *sc)
392 return (ret == TMR_FUNCTION_COMPLETE) ? SUCCESS : FAILED; 392 return (ret == TMR_FUNCTION_COMPLETE) ? SUCCESS : FAILED;
393} 393}
394 394
395static int tcm_loop_target_reset(struct scsi_cmnd *sc)
396{
397 struct tcm_loop_hba *tl_hba;
398 struct tcm_loop_tpg *tl_tpg;
399
400 /*
401 * Locate the tcm_loop_hba_t pointer
402 */
403 tl_hba = *(struct tcm_loop_hba **)shost_priv(sc->device->host);
404 if (!tl_hba) {
405 pr_err("Unable to perform device reset without"
406 " active I_T Nexus\n");
407 return FAILED;
408 }
409 /*
410 * Locate the tl_tpg pointer from TargetID in sc->device->id
411 */
412 tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id];
413 if (tl_tpg) {
414 tl_tpg->tl_transport_status = TCM_TRANSPORT_ONLINE;
415 return SUCCESS;
416 }
417 return FAILED;
418}
419
395static int tcm_loop_slave_alloc(struct scsi_device *sd) 420static int tcm_loop_slave_alloc(struct scsi_device *sd)
396{ 421{
397 set_bit(QUEUE_FLAG_BIDI, &sd->request_queue->queue_flags); 422 set_bit(QUEUE_FLAG_BIDI, &sd->request_queue->queue_flags);
@@ -421,6 +446,7 @@ static struct scsi_host_template tcm_loop_driver_template = {
421 .change_queue_type = tcm_loop_change_queue_type, 446 .change_queue_type = tcm_loop_change_queue_type,
422 .eh_abort_handler = tcm_loop_abort_task, 447 .eh_abort_handler = tcm_loop_abort_task,
423 .eh_device_reset_handler = tcm_loop_device_reset, 448 .eh_device_reset_handler = tcm_loop_device_reset,
449 .eh_target_reset_handler = tcm_loop_target_reset,
424 .can_queue = 1024, 450 .can_queue = 1024,
425 .this_id = -1, 451 .this_id = -1,
426 .sg_tablesize = 256, 452 .sg_tablesize = 256,