aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Skirvin <jeffrey.d.skirvin@intel.com>2011-10-27 18:05:22 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-10-31 05:19:47 -0400
commit3b34c169f8197e02529fa3ec703703c2ce418c57 (patch)
tree4834c97238ea0b7968de0bd9b7efd8c780175eda
parent98145cb722b51ccc3ba27166c9803545accba950 (diff)
[SCSI] isci: Remove redundant isci_request.ttype field.
Use the existing IREQ_TMF flag as a request type indicator. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--drivers/scsi/isci/remote_device.c11
-rw-r--r--drivers/scsi/isci/request.c45
-rw-r--r--drivers/scsi/isci/request.h6
-rw-r--r--drivers/scsi/isci/task.c29
4 files changed, 31 insertions, 60 deletions
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c
index 20c77edd471..9d9e33d2ed5 100644
--- a/drivers/scsi/isci/remote_device.c
+++ b/drivers/scsi/isci/remote_device.c
@@ -1463,15 +1463,12 @@ void isci_device_clear_reset_pending(struct isci_host *ihost, struct isci_remote
1463 dev_dbg(&ihost->pdev->dev, "%s: idev = %p request = %p\n", 1463 dev_dbg(&ihost->pdev->dev, "%s: idev = %p request = %p\n",
1464 __func__, idev, isci_request); 1464 __func__, idev, isci_request);
1465 1465
1466 if (isci_request->ttype == io_task) { 1466 if (!test_bit(IREQ_TMF, &isci_request->flags)) {
1467 struct sas_task *task = isci_request_access_task(isci_request);
1467 1468
1468 unsigned long flags2; 1469 spin_lock(&task->task_state_lock);
1469 struct sas_task *task = isci_request_access_task(
1470 isci_request);
1471
1472 spin_lock_irqsave(&task->task_state_lock, flags2);
1473 task->task_state_flags &= ~SAS_TASK_NEED_DEV_RESET; 1470 task->task_state_flags &= ~SAS_TASK_NEED_DEV_RESET;
1474 spin_unlock_irqrestore(&task->task_state_lock, flags2); 1471 spin_unlock(&task->task_state_lock);
1475 } 1472 }
1476 } 1473 }
1477 spin_unlock_irqrestore(&ihost->scic_lock, flags); 1474 spin_unlock_irqrestore(&ihost->scic_lock, flags);
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c
index bfc7379727b..192cb48d849 100644
--- a/drivers/scsi/isci/request.c
+++ b/drivers/scsi/isci/request.c
@@ -191,7 +191,7 @@ static void sci_task_request_build_ssp_task_iu(struct isci_request *ireq)
191 191
192 task_iu->task_func = isci_tmf->tmf_code; 192 task_iu->task_func = isci_tmf->tmf_code;
193 task_iu->task_tag = 193 task_iu->task_tag =
194 (ireq->ttype == tmf_task) ? 194 (test_bit(IREQ_TMF, &ireq->flags)) ?
195 isci_tmf->io_tag : 195 isci_tmf->io_tag :
196 SCI_CONTROLLER_INVALID_IO_TAG; 196 SCI_CONTROLLER_INVALID_IO_TAG;
197} 197}
@@ -516,7 +516,7 @@ sci_io_request_construct_sata(struct isci_request *ireq,
516 struct domain_device *dev = ireq->target_device->domain_dev; 516 struct domain_device *dev = ireq->target_device->domain_dev;
517 517
518 /* check for management protocols */ 518 /* check for management protocols */
519 if (ireq->ttype == tmf_task) { 519 if (test_bit(IREQ_TMF, &ireq->flags)) {
520 struct isci_tmf *tmf = isci_request_access_tmf(ireq); 520 struct isci_tmf *tmf = isci_request_access_tmf(ireq);
521 521
522 if (tmf->tmf_code == isci_tmf_sata_srst_high || 522 if (tmf->tmf_code == isci_tmf_sata_srst_high ||
@@ -632,7 +632,7 @@ enum sci_status sci_task_request_construct_sata(struct isci_request *ireq)
632 enum sci_status status = SCI_SUCCESS; 632 enum sci_status status = SCI_SUCCESS;
633 633
634 /* check for management protocols */ 634 /* check for management protocols */
635 if (ireq->ttype == tmf_task) { 635 if (test_bit(IREQ_TMF, &ireq->flags)) {
636 struct isci_tmf *tmf = isci_request_access_tmf(ireq); 636 struct isci_tmf *tmf = isci_request_access_tmf(ireq);
637 637
638 if (tmf->tmf_code == isci_tmf_sata_srst_high || 638 if (tmf->tmf_code == isci_tmf_sata_srst_high ||
@@ -2630,14 +2630,8 @@ static void isci_task_save_for_upper_layer_completion(
2630 switch (task_notification_selection) { 2630 switch (task_notification_selection) {
2631 2631
2632 case isci_perform_normal_io_completion: 2632 case isci_perform_normal_io_completion:
2633
2634 /* Normal notification (task_done) */ 2633 /* Normal notification (task_done) */
2635 dev_dbg(&host->pdev->dev, 2634
2636 "%s: Normal - task = %p, response=%d (%d), status=%d (%d)\n",
2637 __func__,
2638 task,
2639 task->task_status.resp, response,
2640 task->task_status.stat, status);
2641 /* Add to the completed list. */ 2635 /* Add to the completed list. */
2642 list_add(&request->completed_node, 2636 list_add(&request->completed_node,
2643 &host->requests_to_complete); 2637 &host->requests_to_complete);
@@ -2650,13 +2644,6 @@ static void isci_task_save_for_upper_layer_completion(
2650 /* No notification to libsas because this request is 2644 /* No notification to libsas because this request is
2651 * already in the abort path. 2645 * already in the abort path.
2652 */ 2646 */
2653 dev_dbg(&host->pdev->dev,
2654 "%s: Aborted - task = %p, response=%d (%d), status=%d (%d)\n",
2655 __func__,
2656 task,
2657 task->task_status.resp, response,
2658 task->task_status.stat, status);
2659
2660 /* Wake up whatever process was waiting for this 2647 /* Wake up whatever process was waiting for this
2661 * request to complete. 2648 * request to complete.
2662 */ 2649 */
@@ -2673,30 +2660,22 @@ static void isci_task_save_for_upper_layer_completion(
2673 2660
2674 case isci_perform_error_io_completion: 2661 case isci_perform_error_io_completion:
2675 /* Use sas_task_abort */ 2662 /* Use sas_task_abort */
2676 dev_dbg(&host->pdev->dev,
2677 "%s: Error - task = %p, response=%d (%d), status=%d (%d)\n",
2678 __func__,
2679 task,
2680 task->task_status.resp, response,
2681 task->task_status.stat, status);
2682 /* Add to the aborted list. */ 2663 /* Add to the aborted list. */
2683 list_add(&request->completed_node, 2664 list_add(&request->completed_node,
2684 &host->requests_to_errorback); 2665 &host->requests_to_errorback);
2685 break; 2666 break;
2686 2667
2687 default: 2668 default:
2688 dev_dbg(&host->pdev->dev,
2689 "%s: Unknown - task = %p, response=%d (%d), status=%d (%d)\n",
2690 __func__,
2691 task,
2692 task->task_status.resp, response,
2693 task->task_status.stat, status);
2694
2695 /* Add to the error to libsas list. */ 2669 /* Add to the error to libsas list. */
2696 list_add(&request->completed_node, 2670 list_add(&request->completed_node,
2697 &host->requests_to_errorback); 2671 &host->requests_to_errorback);
2698 break; 2672 break;
2699 } 2673 }
2674 dev_dbg(&host->pdev->dev,
2675 "%s: %d - task = %p, response=%d (%d), status=%d (%d)\n",
2676 __func__, task_notification_selection, task,
2677 (task) ? task->task_status.resp : 0, response,
2678 (task) ? task->task_status.stat : 0, status);
2700} 2679}
2701 2680
2702static void isci_process_stp_response(struct sas_task *task, struct dev_to_host_fis *fis) 2681static void isci_process_stp_response(struct sas_task *task, struct dev_to_host_fis *fis)
@@ -3079,7 +3058,7 @@ static void sci_request_started_state_enter(struct sci_base_state_machine *sm)
3079 /* XXX as hch said always creating an internal sas_task for tmf 3058 /* XXX as hch said always creating an internal sas_task for tmf
3080 * requests would simplify the driver 3059 * requests would simplify the driver
3081 */ 3060 */
3082 task = ireq->ttype == io_task ? isci_request_access_task(ireq) : NULL; 3061 task = (test_bit(IREQ_TMF, &ireq->flags)) ? NULL : isci_request_access_task(ireq);
3083 3062
3084 /* all unaccelerated request types (non ssp or ncq) handled with 3063 /* all unaccelerated request types (non ssp or ncq) handled with
3085 * substates 3064 * substates
@@ -3563,7 +3542,7 @@ static struct isci_request *isci_io_request_from_tag(struct isci_host *ihost,
3563 3542
3564 ireq = isci_request_from_tag(ihost, tag); 3543 ireq = isci_request_from_tag(ihost, tag);
3565 ireq->ttype_ptr.io_task_ptr = task; 3544 ireq->ttype_ptr.io_task_ptr = task;
3566 ireq->ttype = io_task; 3545 clear_bit(IREQ_TMF, &ireq->flags);
3567 task->lldd_task = ireq; 3546 task->lldd_task = ireq;
3568 3547
3569 return ireq; 3548 return ireq;
@@ -3577,7 +3556,7 @@ struct isci_request *isci_tmf_request_from_tag(struct isci_host *ihost,
3577 3556
3578 ireq = isci_request_from_tag(ihost, tag); 3557 ireq = isci_request_from_tag(ihost, tag);
3579 ireq->ttype_ptr.tmf_task_ptr = isci_tmf; 3558 ireq->ttype_ptr.tmf_task_ptr = isci_tmf;
3580 ireq->ttype = tmf_task; 3559 set_bit(IREQ_TMF, &ireq->flags);
3581 3560
3582 return ireq; 3561 return ireq;
3583} 3562}
diff --git a/drivers/scsi/isci/request.h b/drivers/scsi/isci/request.h
index f720b97b7bb..be38933dd6d 100644
--- a/drivers/scsi/isci/request.h
+++ b/drivers/scsi/isci/request.h
@@ -77,11 +77,6 @@ enum isci_request_status {
77 dead = 0x07 77 dead = 0x07
78}; 78};
79 79
80enum task_type {
81 io_task = 0,
82 tmf_task = 1
83};
84
85enum sci_request_protocol { 80enum sci_request_protocol {
86 SCIC_NO_PROTOCOL, 81 SCIC_NO_PROTOCOL,
87 SCIC_SMP_PROTOCOL, 82 SCIC_SMP_PROTOCOL,
@@ -116,7 +111,6 @@ struct isci_request {
116 #define IREQ_ACTIVE 3 111 #define IREQ_ACTIVE 3
117 unsigned long flags; 112 unsigned long flags;
118 /* XXX kill ttype and ttype_ptr, allocate full sas_task */ 113 /* XXX kill ttype and ttype_ptr, allocate full sas_task */
119 enum task_type ttype;
120 union ttype_ptr_union { 114 union ttype_ptr_union {
121 struct sas_task *io_task_ptr; /* When ttype==io_task */ 115 struct sas_task *io_task_ptr; /* When ttype==io_task */
122 struct isci_tmf *tmf_task_ptr; /* When ttype==tmf_task */ 116 struct isci_tmf *tmf_task_ptr; /* When ttype==tmf_task */
diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c
index ec85beb1f97..80e1a69ac96 100644
--- a/drivers/scsi/isci/task.c
+++ b/drivers/scsi/isci/task.c
@@ -254,7 +254,7 @@ static enum sci_status isci_sata_management_task_request_build(struct isci_reque
254 struct isci_tmf *isci_tmf; 254 struct isci_tmf *isci_tmf;
255 enum sci_status status; 255 enum sci_status status;
256 256
257 if (tmf_task != ireq->ttype) 257 if (!test_bit(IREQ_TMF, &ireq->flags))
258 return SCI_FAILURE; 258 return SCI_FAILURE;
259 259
260 isci_tmf = isci_request_access_tmf(ireq); 260 isci_tmf = isci_request_access_tmf(ireq);
@@ -352,18 +352,7 @@ static void isci_request_mark_zombie(struct isci_host *ihost, struct isci_reques
352 req_completion = ireq->io_request_completion; 352 req_completion = ireq->io_request_completion;
353 ireq->io_request_completion = NULL; 353 ireq->io_request_completion = NULL;
354 354
355 if (ireq->ttype == io_task) { 355 if (test_bit(IREQ_TMF, &ireq->flags)) {
356
357 /* Break links with the sas_task - the callback is done
358 * elsewhere.
359 */
360 struct sas_task *task = isci_request_access_task(ireq);
361
362 if (task)
363 task->lldd_task = NULL;
364
365 ireq->ttype_ptr.io_task_ptr = NULL;
366 } else {
367 /* Break links with the TMF request. */ 356 /* Break links with the TMF request. */
368 struct isci_tmf *tmf = isci_request_access_tmf(ireq); 357 struct isci_tmf *tmf = isci_request_access_tmf(ireq);
369 358
@@ -380,6 +369,16 @@ static void isci_request_mark_zombie(struct isci_host *ihost, struct isci_reques
380 ireq->ttype_ptr.tmf_task_ptr = NULL; 369 ireq->ttype_ptr.tmf_task_ptr = NULL;
381 dev_dbg(&ihost->pdev->dev, "%s: tmf_code %d, managed tag %#x\n", 370 dev_dbg(&ihost->pdev->dev, "%s: tmf_code %d, managed tag %#x\n",
382 __func__, tmf->tmf_code, tmf->io_tag); 371 __func__, tmf->tmf_code, tmf->io_tag);
372 } else {
373 /* Break links with the sas_task - the callback is done
374 * elsewhere.
375 */
376 struct sas_task *task = isci_request_access_task(ireq);
377
378 if (task)
379 task->lldd_task = NULL;
380
381 ireq->ttype_ptr.io_task_ptr = NULL;
383 } 382 }
384 383
385 dev_warn(&ihost->pdev->dev, "task context unrecoverable (tag: %#x)\n", 384 dev_warn(&ihost->pdev->dev, "task context unrecoverable (tag: %#x)\n",
@@ -803,7 +802,9 @@ void isci_terminate_pending_requests(struct isci_host *ihost,
803 dev_dbg(&ihost->pdev->dev, 802 dev_dbg(&ihost->pdev->dev,
804 "%s: idev=%p request=%p; task=%p old_state=%d\n", 803 "%s: idev=%p request=%p; task=%p old_state=%d\n",
805 __func__, idev, ireq, 804 __func__, idev, ireq,
806 ireq->ttype == io_task ? isci_request_access_task(ireq) : NULL, 805 (!test_bit(IREQ_TMF, &ireq->flags)
806 ? isci_request_access_task(ireq)
807 : NULL),
807 old_state); 808 old_state);
808 809
809 /* If the old_state is started: 810 /* If the old_state is started: