diff options
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r-- | drivers/infiniband/ulp/srp/ib_srp.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index e7fa8b680cb6..4e22afef7206 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -471,14 +471,26 @@ static void srp_unmap_data(struct scsi_cmnd *scmnd, | |||
471 | scmnd->sc_data_direction); | 471 | scmnd->sc_data_direction); |
472 | } | 472 | } |
473 | 473 | ||
474 | static void srp_remove_req(struct srp_target_port *target, struct srp_request *req) | ||
475 | { | ||
476 | srp_unmap_data(req->scmnd, target, req); | ||
477 | list_move_tail(&req->list, &target->free_reqs); | ||
478 | } | ||
479 | |||
480 | static void srp_reset_req(struct srp_target_port *target, struct srp_request *req) | ||
481 | { | ||
482 | req->scmnd->result = DID_RESET << 16; | ||
483 | req->scmnd->scsi_done(req->scmnd); | ||
484 | srp_remove_req(target, req); | ||
485 | } | ||
486 | |||
474 | static int srp_reconnect_target(struct srp_target_port *target) | 487 | static int srp_reconnect_target(struct srp_target_port *target) |
475 | { | 488 | { |
476 | struct ib_cm_id *new_cm_id; | 489 | struct ib_cm_id *new_cm_id; |
477 | struct ib_qp_attr qp_attr; | 490 | struct ib_qp_attr qp_attr; |
478 | struct srp_request *req; | 491 | struct srp_request *req, *tmp; |
479 | struct ib_wc wc; | 492 | struct ib_wc wc; |
480 | int ret; | 493 | int ret; |
481 | int i; | ||
482 | 494 | ||
483 | spin_lock_irq(target->scsi_host->host_lock); | 495 | spin_lock_irq(target->scsi_host->host_lock); |
484 | if (target->state != SRP_TARGET_LIVE) { | 496 | if (target->state != SRP_TARGET_LIVE) { |
@@ -514,19 +526,12 @@ static int srp_reconnect_target(struct srp_target_port *target) | |||
514 | while (ib_poll_cq(target->cq, 1, &wc) > 0) | 526 | while (ib_poll_cq(target->cq, 1, &wc) > 0) |
515 | ; /* nothing */ | 527 | ; /* nothing */ |
516 | 528 | ||
517 | list_for_each_entry(req, &target->req_queue, list) { | 529 | list_for_each_entry_safe(req, tmp, &target->req_queue, list) |
518 | req->scmnd->result = DID_RESET << 16; | 530 | srp_reset_req(target, req); |
519 | req->scmnd->scsi_done(req->scmnd); | ||
520 | srp_unmap_data(req->scmnd, target, req); | ||
521 | } | ||
522 | 531 | ||
523 | target->rx_head = 0; | 532 | target->rx_head = 0; |
524 | target->tx_head = 0; | 533 | target->tx_head = 0; |
525 | target->tx_tail = 0; | 534 | target->tx_tail = 0; |
526 | INIT_LIST_HEAD(&target->free_reqs); | ||
527 | INIT_LIST_HEAD(&target->req_queue); | ||
528 | for (i = 0; i < SRP_SQ_SIZE; ++i) | ||
529 | list_add_tail(&target->req_ring[i].list, &target->free_reqs); | ||
530 | 535 | ||
531 | ret = srp_connect_target(target); | 536 | ret = srp_connect_target(target); |
532 | if (ret) | 537 | if (ret) |
@@ -726,12 +731,6 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target, | |||
726 | return len; | 731 | return len; |
727 | } | 732 | } |
728 | 733 | ||
729 | static void srp_remove_req(struct srp_target_port *target, struct srp_request *req) | ||
730 | { | ||
731 | srp_unmap_data(req->scmnd, target, req); | ||
732 | list_move_tail(&req->list, &target->free_reqs); | ||
733 | } | ||
734 | |||
735 | static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp) | 734 | static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp) |
736 | { | 735 | { |
737 | struct srp_request *req; | 736 | struct srp_request *req; |
@@ -1348,11 +1347,8 @@ static int srp_reset_device(struct scsi_cmnd *scmnd) | |||
1348 | spin_lock_irq(target->scsi_host->host_lock); | 1347 | spin_lock_irq(target->scsi_host->host_lock); |
1349 | 1348 | ||
1350 | list_for_each_entry_safe(req, tmp, &target->req_queue, list) | 1349 | list_for_each_entry_safe(req, tmp, &target->req_queue, list) |
1351 | if (req->scmnd->device == scmnd->device) { | 1350 | if (req->scmnd->device == scmnd->device) |
1352 | req->scmnd->result = DID_RESET << 16; | 1351 | srp_reset_req(target, req); |
1353 | req->scmnd->scsi_done(req->scmnd); | ||
1354 | srp_remove_req(target, req); | ||
1355 | } | ||
1356 | 1352 | ||
1357 | spin_unlock_irq(target->scsi_host->host_lock); | 1353 | spin_unlock_irq(target->scsi_host->host_lock); |
1358 | 1354 | ||