Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 254499
b: refs/heads/master
c: f4636a7
h: refs/heads/master
i:
  254497: 3eb2a3c
  254495: a3a755b
v: v3
  • Loading branch information
Piotr Sawicki authored and Dan Williams committed Jul 3, 2011
1 parent 783e203 commit 3edd417
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 95 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f00e6ba4996a34f098fe50c78077f0568fd838ec
refs/heads/master: f4636a7b2ab8288466b83a8459d47c43143a70dc
6 changes: 3 additions & 3 deletions trunk/drivers/scsi/isci/remote_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic
if (status != SCI_SUCCESS)
break;

status = sci_req->state_handlers->start_handler(sci_req);
status = scic_sds_request_start(sci_req);
if (status != SCI_SUCCESS)
break;

Expand All @@ -540,7 +540,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic
if (status != SCI_SUCCESS)
break;

status = sci_req->state_handlers->start_handler(sci_req);
status = scic_sds_request_start(sci_req);
} else
return SCI_FAILURE_INVALID_STATE;
break;
Expand Down Expand Up @@ -709,7 +709,7 @@ enum sci_status scic_sds_remote_device_start_task(struct scic_sds_controller *sc
if (status != SCI_SUCCESS)
goto out;

status = sci_req->state_handlers->start_handler(sci_req);
status = scic_sds_request_start(sci_req);
if (status != SCI_SUCCESS)
goto out;

Expand Down
156 changes: 71 additions & 85 deletions trunk/drivers/scsi/isci/request.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,23 +757,80 @@ static u32 sci_req_tx_bytes(struct scic_sds_request *sci_req)
return ret_val;
}

enum sci_status
scic_sds_request_start(struct scic_sds_request *request)
enum sci_status scic_sds_request_start(struct scic_sds_request *sci_req)
{
if (request->device_sequence !=
scic_sds_remote_device_get_sequence(request->target_device))
struct scic_sds_controller *scic = sci_req->owning_controller;
struct scu_task_context *task_context;
enum sci_base_request_states state;

if (sci_req->device_sequence !=
scic_sds_remote_device_get_sequence(sci_req->target_device))
return SCI_FAILURE;

if (request->state_handlers->start_handler)
return request->state_handlers->start_handler(request);
state = sci_req->state_machine.current_state_id;
if (state != SCI_BASE_REQUEST_STATE_CONSTRUCTED) {
dev_warn(scic_to_dev(scic),
"%s: SCIC IO Request requested to start while in wrong "
"state %d\n", __func__, state);
return SCI_FAILURE_INVALID_STATE;
}

dev_warn(scic_to_dev(request->owning_controller),
"%s: SCIC IO Request requested to start while in wrong "
"state %d\n",
__func__,
sci_base_state_machine_get_state(&request->state_machine));
/* if necessary, allocate a TCi for the io request object and then will,
* if necessary, copy the constructed TC data into the actual TC buffer.
* If everything is successful the post context field is updated with
* the TCi so the controller can post the request to the hardware.
*/
if (sci_req->io_tag == SCI_CONTROLLER_INVALID_IO_TAG)
sci_req->io_tag = scic_controller_allocate_io_tag(scic);

return SCI_FAILURE_INVALID_STATE;
/* Record the IO Tag in the request */
if (sci_req->io_tag != SCI_CONTROLLER_INVALID_IO_TAG) {
task_context = sci_req->task_context_buffer;

task_context->task_index = scic_sds_io_tag_get_index(sci_req->io_tag);

switch (task_context->protocol_type) {
case SCU_TASK_CONTEXT_PROTOCOL_SMP:
case SCU_TASK_CONTEXT_PROTOCOL_SSP:
/* SSP/SMP Frame */
task_context->type.ssp.tag = sci_req->io_tag;
task_context->type.ssp.target_port_transfer_tag =
0xFFFF;
break;

case SCU_TASK_CONTEXT_PROTOCOL_STP:
/* STP/SATA Frame
* task_context->type.stp.ncq_tag = sci_req->ncq_tag;
*/
break;

case SCU_TASK_CONTEXT_PROTOCOL_NONE:
/* / @todo When do we set no protocol type? */
break;

default:
/* This should never happen since we build the IO
* requests */
break;
}

/*
* Check to see if we need to copy the task context buffer
* or have been building into the task context buffer */
if (sci_req->was_tag_assigned_by_user == false)
scic_sds_controller_copy_task_context(scic, sci_req);

/* Add to the post_context the io tag value */
sci_req->post_context |= scic_sds_io_tag_get_index(sci_req->io_tag);

/* Everything is good go ahead and change state */
sci_base_state_machine_change_state(&sci_req->state_machine,
SCI_BASE_REQUEST_STATE_STARTED);

return SCI_SUCCESS;
}

return SCI_FAILURE_INSUFFICIENT_RESOURCES;
}

enum sci_status
Expand Down Expand Up @@ -903,75 +960,6 @@ static void scic_sds_io_request_copy_response(struct scic_sds_request *sci_req)
memcpy(resp_buf, ssp_response->resp_data, len);
}

/*
* This method implements the action taken when a constructed
* SCIC_SDS_IO_REQUEST_T object receives a scic_sds_request_start() request.
* This method will, if necessary, allocate a TCi for the io request object and
* then will, if necessary, copy the constructed TC data into the actual TC
* buffer. If everything is successful the post context field is updated with
* the TCi so the controller can post the request to the hardware. enum sci_status
* SCI_SUCCESS SCI_FAILURE_INSUFFICIENT_RESOURCES
*/
static enum sci_status scic_sds_request_constructed_state_start_handler(
struct scic_sds_request *request)
{
struct scu_task_context *task_context;

if (request->io_tag == SCI_CONTROLLER_INVALID_IO_TAG) {
request->io_tag =
scic_controller_allocate_io_tag(request->owning_controller);
}

/* Record the IO Tag in the request */
if (request->io_tag != SCI_CONTROLLER_INVALID_IO_TAG) {
task_context = request->task_context_buffer;

task_context->task_index = scic_sds_io_tag_get_index(request->io_tag);

switch (task_context->protocol_type) {
case SCU_TASK_CONTEXT_PROTOCOL_SMP:
case SCU_TASK_CONTEXT_PROTOCOL_SSP:
/* SSP/SMP Frame */
task_context->type.ssp.tag = request->io_tag;
task_context->type.ssp.target_port_transfer_tag = 0xFFFF;
break;

case SCU_TASK_CONTEXT_PROTOCOL_STP:
/*
* STP/SATA Frame
* task_context->type.stp.ncq_tag = request->ncq_tag; */
break;

case SCU_TASK_CONTEXT_PROTOCOL_NONE:
/* / @todo When do we set no protocol type? */
break;

default:
/* This should never happen since we build the IO requests */
break;
}

/*
* Check to see if we need to copy the task context buffer
* or have been building into the task context buffer */
if (request->was_tag_assigned_by_user == false) {
scic_sds_controller_copy_task_context(
request->owning_controller, request);
}

/* Add to the post_context the io tag value */
request->post_context |= scic_sds_io_tag_get_index(request->io_tag);

/* Everything is good go ahead and change state */
sci_base_state_machine_change_state(&request->state_machine,
SCI_BASE_REQUEST_STATE_STARTED);

return SCI_SUCCESS;
}

return SCI_FAILURE_INSUFFICIENT_RESOURCES;
}

/*
* scic_sds_request_started_state_tc_completion_handler() - This method process
* TC (task context) completions for normal IO request (i.e. Task/Abort
Expand Down Expand Up @@ -2529,10 +2517,8 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_d2h_frame_handler(
}

static const struct scic_sds_io_request_state_handler scic_sds_request_state_handler_table[] = {
[SCI_BASE_REQUEST_STATE_INITIAL] = { },
[SCI_BASE_REQUEST_STATE_CONSTRUCTED] = {
.start_handler = scic_sds_request_constructed_state_start_handler,
},
[SCI_BASE_REQUEST_STATE_INITIAL] = {},
[SCI_BASE_REQUEST_STATE_CONSTRUCTED] = {},
[SCI_BASE_REQUEST_STATE_STARTED] = {
.tc_completion_handler = scic_sds_request_started_state_tc_completion_handler,
.frame_handler = scic_sds_request_started_state_frame_handler,
Expand Down
6 changes: 0 additions & 6 deletions trunk/drivers/scsi/isci/request.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,12 +438,6 @@ typedef enum sci_status (*scic_sds_io_request_task_completion_handler_t)
*
*/
struct scic_sds_io_request_state_handler {
/**
* The start_handler specifies the method invoked when a user attempts to
* start a request.
*/
scic_sds_io_request_handler_t start_handler;

/**
* The complete_handler specifies the method invoked when a user attempts to
* complete a request.
Expand Down

0 comments on commit 3edd417

Please sign in to comment.