提交 3b34c169 编写于 作者: J Jeff Skirvin 提交者: James Bottomley

[SCSI] isci: Remove redundant isci_request.ttype field.

Use the existing IREQ_TMF flag as a request type indicator.
Signed-off-by: NJeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: NDan Williams <dan.j.williams@intel.com>
Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
上级 98145cb7
...@@ -1463,15 +1463,12 @@ void isci_device_clear_reset_pending(struct isci_host *ihost, struct isci_remote ...@@ -1463,15 +1463,12 @@ void isci_device_clear_reset_pending(struct isci_host *ihost, struct isci_remote
dev_dbg(&ihost->pdev->dev, "%s: idev = %p request = %p\n", dev_dbg(&ihost->pdev->dev, "%s: idev = %p request = %p\n",
__func__, idev, isci_request); __func__, idev, isci_request);
if (isci_request->ttype == io_task) { if (!test_bit(IREQ_TMF, &isci_request->flags)) {
struct sas_task *task = isci_request_access_task(isci_request);
unsigned long flags2; spin_lock(&task->task_state_lock);
struct sas_task *task = isci_request_access_task(
isci_request);
spin_lock_irqsave(&task->task_state_lock, flags2);
task->task_state_flags &= ~SAS_TASK_NEED_DEV_RESET; task->task_state_flags &= ~SAS_TASK_NEED_DEV_RESET;
spin_unlock_irqrestore(&task->task_state_lock, flags2); spin_unlock(&task->task_state_lock);
} }
} }
spin_unlock_irqrestore(&ihost->scic_lock, flags); spin_unlock_irqrestore(&ihost->scic_lock, flags);
......
...@@ -191,7 +191,7 @@ static void sci_task_request_build_ssp_task_iu(struct isci_request *ireq) ...@@ -191,7 +191,7 @@ static void sci_task_request_build_ssp_task_iu(struct isci_request *ireq)
task_iu->task_func = isci_tmf->tmf_code; task_iu->task_func = isci_tmf->tmf_code;
task_iu->task_tag = task_iu->task_tag =
(ireq->ttype == tmf_task) ? (test_bit(IREQ_TMF, &ireq->flags)) ?
isci_tmf->io_tag : isci_tmf->io_tag :
SCI_CONTROLLER_INVALID_IO_TAG; SCI_CONTROLLER_INVALID_IO_TAG;
} }
...@@ -516,7 +516,7 @@ sci_io_request_construct_sata(struct isci_request *ireq, ...@@ -516,7 +516,7 @@ sci_io_request_construct_sata(struct isci_request *ireq,
struct domain_device *dev = ireq->target_device->domain_dev; struct domain_device *dev = ireq->target_device->domain_dev;
/* check for management protocols */ /* check for management protocols */
if (ireq->ttype == tmf_task) { if (test_bit(IREQ_TMF, &ireq->flags)) {
struct isci_tmf *tmf = isci_request_access_tmf(ireq); struct isci_tmf *tmf = isci_request_access_tmf(ireq);
if (tmf->tmf_code == isci_tmf_sata_srst_high || 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,7 +632,7 @@ enum sci_status sci_task_request_construct_sata(struct isci_request *ireq)
enum sci_status status = SCI_SUCCESS; enum sci_status status = SCI_SUCCESS;
/* check for management protocols */ /* check for management protocols */
if (ireq->ttype == tmf_task) { if (test_bit(IREQ_TMF, &ireq->flags)) {
struct isci_tmf *tmf = isci_request_access_tmf(ireq); struct isci_tmf *tmf = isci_request_access_tmf(ireq);
if (tmf->tmf_code == isci_tmf_sata_srst_high || if (tmf->tmf_code == isci_tmf_sata_srst_high ||
...@@ -2630,14 +2630,8 @@ static void isci_task_save_for_upper_layer_completion( ...@@ -2630,14 +2630,8 @@ static void isci_task_save_for_upper_layer_completion(
switch (task_notification_selection) { switch (task_notification_selection) {
case isci_perform_normal_io_completion: case isci_perform_normal_io_completion:
/* Normal notification (task_done) */ /* Normal notification (task_done) */
dev_dbg(&host->pdev->dev,
"%s: Normal - task = %p, response=%d (%d), status=%d (%d)\n",
__func__,
task,
task->task_status.resp, response,
task->task_status.stat, status);
/* Add to the completed list. */ /* Add to the completed list. */
list_add(&request->completed_node, list_add(&request->completed_node,
&host->requests_to_complete); &host->requests_to_complete);
...@@ -2650,13 +2644,6 @@ static void isci_task_save_for_upper_layer_completion( ...@@ -2650,13 +2644,6 @@ static void isci_task_save_for_upper_layer_completion(
/* No notification to libsas because this request is /* No notification to libsas because this request is
* already in the abort path. * already in the abort path.
*/ */
dev_dbg(&host->pdev->dev,
"%s: Aborted - task = %p, response=%d (%d), status=%d (%d)\n",
__func__,
task,
task->task_status.resp, response,
task->task_status.stat, status);
/* Wake up whatever process was waiting for this /* Wake up whatever process was waiting for this
* request to complete. * request to complete.
*/ */
...@@ -2673,30 +2660,22 @@ static void isci_task_save_for_upper_layer_completion( ...@@ -2673,30 +2660,22 @@ static void isci_task_save_for_upper_layer_completion(
case isci_perform_error_io_completion: case isci_perform_error_io_completion:
/* Use sas_task_abort */ /* Use sas_task_abort */
dev_dbg(&host->pdev->dev,
"%s: Error - task = %p, response=%d (%d), status=%d (%d)\n",
__func__,
task,
task->task_status.resp, response,
task->task_status.stat, status);
/* Add to the aborted list. */ /* Add to the aborted list. */
list_add(&request->completed_node, list_add(&request->completed_node,
&host->requests_to_errorback); &host->requests_to_errorback);
break; break;
default: default:
dev_dbg(&host->pdev->dev,
"%s: Unknown - task = %p, response=%d (%d), status=%d (%d)\n",
__func__,
task,
task->task_status.resp, response,
task->task_status.stat, status);
/* Add to the error to libsas list. */ /* Add to the error to libsas list. */
list_add(&request->completed_node, list_add(&request->completed_node,
&host->requests_to_errorback); &host->requests_to_errorback);
break; break;
} }
dev_dbg(&host->pdev->dev,
"%s: %d - task = %p, response=%d (%d), status=%d (%d)\n",
__func__, task_notification_selection, task,
(task) ? task->task_status.resp : 0, response,
(task) ? task->task_status.stat : 0, status);
} }
static void isci_process_stp_response(struct sas_task *task, struct dev_to_host_fis *fis) static 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,7 +3058,7 @@ static void sci_request_started_state_enter(struct sci_base_state_machine *sm)
/* XXX as hch said always creating an internal sas_task for tmf /* XXX as hch said always creating an internal sas_task for tmf
* requests would simplify the driver * requests would simplify the driver
*/ */
task = ireq->ttype == io_task ? isci_request_access_task(ireq) : NULL; task = (test_bit(IREQ_TMF, &ireq->flags)) ? NULL : isci_request_access_task(ireq);
/* all unaccelerated request types (non ssp or ncq) handled with /* all unaccelerated request types (non ssp or ncq) handled with
* substates * substates
...@@ -3563,7 +3542,7 @@ static struct isci_request *isci_io_request_from_tag(struct isci_host *ihost, ...@@ -3563,7 +3542,7 @@ static struct isci_request *isci_io_request_from_tag(struct isci_host *ihost,
ireq = isci_request_from_tag(ihost, tag); ireq = isci_request_from_tag(ihost, tag);
ireq->ttype_ptr.io_task_ptr = task; ireq->ttype_ptr.io_task_ptr = task;
ireq->ttype = io_task; clear_bit(IREQ_TMF, &ireq->flags);
task->lldd_task = ireq; task->lldd_task = ireq;
return ireq; return ireq;
...@@ -3577,7 +3556,7 @@ struct isci_request *isci_tmf_request_from_tag(struct isci_host *ihost, ...@@ -3577,7 +3556,7 @@ struct isci_request *isci_tmf_request_from_tag(struct isci_host *ihost,
ireq = isci_request_from_tag(ihost, tag); ireq = isci_request_from_tag(ihost, tag);
ireq->ttype_ptr.tmf_task_ptr = isci_tmf; ireq->ttype_ptr.tmf_task_ptr = isci_tmf;
ireq->ttype = tmf_task; set_bit(IREQ_TMF, &ireq->flags);
return ireq; return ireq;
} }
......
...@@ -77,11 +77,6 @@ enum isci_request_status { ...@@ -77,11 +77,6 @@ enum isci_request_status {
dead = 0x07 dead = 0x07
}; };
enum task_type {
io_task = 0,
tmf_task = 1
};
enum sci_request_protocol { enum sci_request_protocol {
SCIC_NO_PROTOCOL, SCIC_NO_PROTOCOL,
SCIC_SMP_PROTOCOL, SCIC_SMP_PROTOCOL,
...@@ -116,7 +111,6 @@ struct isci_request { ...@@ -116,7 +111,6 @@ struct isci_request {
#define IREQ_ACTIVE 3 #define IREQ_ACTIVE 3
unsigned long flags; unsigned long flags;
/* XXX kill ttype and ttype_ptr, allocate full sas_task */ /* XXX kill ttype and ttype_ptr, allocate full sas_task */
enum task_type ttype;
union ttype_ptr_union { union ttype_ptr_union {
struct sas_task *io_task_ptr; /* When ttype==io_task */ struct sas_task *io_task_ptr; /* When ttype==io_task */
struct isci_tmf *tmf_task_ptr; /* When ttype==tmf_task */ struct isci_tmf *tmf_task_ptr; /* When ttype==tmf_task */
......
...@@ -254,7 +254,7 @@ static enum sci_status isci_sata_management_task_request_build(struct isci_reque ...@@ -254,7 +254,7 @@ static enum sci_status isci_sata_management_task_request_build(struct isci_reque
struct isci_tmf *isci_tmf; struct isci_tmf *isci_tmf;
enum sci_status status; enum sci_status status;
if (tmf_task != ireq->ttype) if (!test_bit(IREQ_TMF, &ireq->flags))
return SCI_FAILURE; return SCI_FAILURE;
isci_tmf = isci_request_access_tmf(ireq); 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,18 +352,7 @@ static void isci_request_mark_zombie(struct isci_host *ihost, struct isci_reques
req_completion = ireq->io_request_completion; req_completion = ireq->io_request_completion;
ireq->io_request_completion = NULL; ireq->io_request_completion = NULL;
if (ireq->ttype == io_task) { if (test_bit(IREQ_TMF, &ireq->flags)) {
/* Break links with the sas_task - the callback is done
* elsewhere.
*/
struct sas_task *task = isci_request_access_task(ireq);
if (task)
task->lldd_task = NULL;
ireq->ttype_ptr.io_task_ptr = NULL;
} else {
/* Break links with the TMF request. */ /* Break links with the TMF request. */
struct isci_tmf *tmf = isci_request_access_tmf(ireq); struct isci_tmf *tmf = isci_request_access_tmf(ireq);
...@@ -380,6 +369,16 @@ static void isci_request_mark_zombie(struct isci_host *ihost, struct isci_reques ...@@ -380,6 +369,16 @@ static void isci_request_mark_zombie(struct isci_host *ihost, struct isci_reques
ireq->ttype_ptr.tmf_task_ptr = NULL; ireq->ttype_ptr.tmf_task_ptr = NULL;
dev_dbg(&ihost->pdev->dev, "%s: tmf_code %d, managed tag %#x\n", dev_dbg(&ihost->pdev->dev, "%s: tmf_code %d, managed tag %#x\n",
__func__, tmf->tmf_code, tmf->io_tag); __func__, tmf->tmf_code, tmf->io_tag);
} else {
/* Break links with the sas_task - the callback is done
* elsewhere.
*/
struct sas_task *task = isci_request_access_task(ireq);
if (task)
task->lldd_task = NULL;
ireq->ttype_ptr.io_task_ptr = NULL;
} }
dev_warn(&ihost->pdev->dev, "task context unrecoverable (tag: %#x)\n", 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,7 +802,9 @@ void isci_terminate_pending_requests(struct isci_host *ihost,
dev_dbg(&ihost->pdev->dev, dev_dbg(&ihost->pdev->dev,
"%s: idev=%p request=%p; task=%p old_state=%d\n", "%s: idev=%p request=%p; task=%p old_state=%d\n",
__func__, idev, ireq, __func__, idev, ireq,
ireq->ttype == io_task ? isci_request_access_task(ireq) : NULL, (!test_bit(IREQ_TMF, &ireq->flags)
? isci_request_access_task(ireq)
: NULL),
old_state); old_state);
/* If the old_state is started: /* If the old_state is started:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册