diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-05-07 19:07:14 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 04:04:47 -0700 |
commit | 26298264a5de6d46d6e872dfd4c5d14c3011666f (patch) | |
tree | 57648e0046fdb85aaaaaa27c445a0fda2e76273a | |
parent | 0d84366fbef557f92ef82ac9a224c57ffb3318bc (diff) |
isci: move task context alignment from run-time to compile time
Remove usage of PTR_ALIGN by arranging for the task context to be aligned by
the compiler. Another step towards unifying isci_request and
scic_sds_request. Once this is complete the task context in the request can
likely be removed in favor of building the task directly to tc memory (see:
scic_sds_controller_copy_task_context). It's not clear why this needs to be
cacheline aligned if we just end up copying before submission...
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_request.c | 64 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_request.h | 1 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_smp_request.c | 37 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_stp_request.c | 24 |
4 files changed, 13 insertions, 113 deletions
diff --git a/drivers/scsi/isci/core/scic_sds_request.c b/drivers/scsi/isci/core/scic_sds_request.c index 189a7999726c..baf69edab699 100644 --- a/drivers/scsi/isci/core/scic_sds_request.c +++ b/drivers/scsi/isci/core/scic_sds_request.c @@ -125,31 +125,6 @@ )) /** - * scic_sds_ssp_request_get_task_context_buffer() - - * - * This macro returns the address of the task context buffer in the io request - * memory - */ -#define scic_sds_ssp_request_get_task_context_buffer(memory) \ - ((struct scu_task_context *)(\ - ((char *)(scic_sds_ssp_request_get_response_buffer(memory))) \ - + SSP_RESP_IU_MAX_SIZE \ - )) - -/** - * scic_sds_ssp_request_get_sgl_element_buffer() - - * - * This macro returns the address of the sgl elment pairs in the io request - * memory buffer - */ -#define scic_sds_ssp_request_get_sgl_element_buffer(memory) \ - ((struct scu_sgl_element_pair *)(\ - ((char *)(scic_sds_ssp_request_get_task_context_buffer(memory))) \ - + sizeof(struct scu_task_context) \ - )) - - -/** * scic_ssp_task_request_get_object_size() - * * This macro returns the sizeof of memory required to store an SSP Task @@ -185,24 +160,6 @@ )) /** - * scic_sds_ssp_task_request_get_task_context_buffer() - - * - * This macro returs the task context buffer for the SSP task request. - */ -#define scic_sds_ssp_task_request_get_task_context_buffer(memory) \ - ((struct scu_task_context *)(\ - ((char *)(scic_sds_ssp_task_request_get_response_buffer(memory))) \ - + SSP_RESP_IU_MAX_SIZE \ - )) - - - -/* - * **************************************************************************** - * * SCIC SDS IO REQUEST PRIVATE METHODS - * **************************************************************************** */ - -/** * * * This method returns the size required to store an SSP IO request object. u32 @@ -210,9 +167,7 @@ static u32 scic_sds_ssp_request_get_object_size(void) { return sizeof(struct scic_sds_request) - + scic_ssp_io_request_get_object_size() - + sizeof(struct scu_task_context) - + SMP_CACHE_BYTES; + + scic_ssp_io_request_get_object_size(); } /** @@ -328,13 +283,8 @@ static void scic_sds_ssp_io_request_assign_buffers( sci_req->response_buffer = scic_sds_ssp_request_get_response_buffer(sci_req); - if (sci_req->was_tag_assigned_by_user == false) { - sci_req->task_context_buffer = - scic_sds_ssp_request_get_task_context_buffer(sci_req); - sci_req->task_context_buffer = - PTR_ALIGN(sci_req->task_context_buffer, - SMP_CACHE_BYTES); - } + if (sci_req->was_tag_assigned_by_user == false) + sci_req->task_context_buffer = &sci_req->tc; } static void scic_sds_io_request_build_ssp_command_iu(struct scic_sds_request *sci_req) @@ -530,12 +480,8 @@ static void scic_sds_ssp_task_request_assign_buffers( sci_req->response_buffer = scic_sds_ssp_task_request_get_response_buffer(sci_req); - if (sci_req->was_tag_assigned_by_user == false) { - sci_req->task_context_buffer = - scic_sds_ssp_task_request_get_task_context_buffer(sci_req); - sci_req->task_context_buffer = - PTR_ALIGN(sci_req->task_context_buffer, SMP_CACHE_BYTES); - } + if (sci_req->was_tag_assigned_by_user == false) + sci_req->task_context_buffer = &sci_req->tc; } /** diff --git a/drivers/scsi/isci/core/scic_sds_request.h b/drivers/scsi/isci/core/scic_sds_request.h index 83d737adbc48..8f65814e79c8 100644 --- a/drivers/scsi/isci/core/scic_sds_request.h +++ b/drivers/scsi/isci/core/scic_sds_request.h @@ -184,6 +184,7 @@ struct scic_sds_request { void *command_buffer; void *response_buffer; struct scu_task_context *task_context_buffer; + struct scu_task_context tc ____cacheline_aligned; /* could be larger with sg chaining */ #define SCU_SGL_SIZE ((SCU_IO_REQUEST_SGE_COUNT + 1) / 2) diff --git a/drivers/scsi/isci/core/scic_sds_smp_request.c b/drivers/scsi/isci/core/scic_sds_smp_request.c index cb1adef1d559..53b1260f44bc 100644 --- a/drivers/scsi/isci/core/scic_sds_smp_request.c +++ b/drivers/scsi/isci/core/scic_sds_smp_request.c @@ -78,9 +78,7 @@ u32 scic_sds_smp_request_get_object_size(void) { return sizeof(struct scic_sds_request) + sizeof(struct smp_req) - + sizeof(struct smp_resp) - + sizeof(struct scu_task_context) - + SMP_CACHE_BYTES; + + sizeof(struct smp_resp); } /** @@ -102,29 +100,7 @@ u32 scic_sds_smp_request_get_object_size(void) (((char *)(scic_sds_smp_request_get_command_buffer(memory))) \ + sizeof(struct smp_req)) -/** - * scic_sds_smp_request_get_task_context_buffer() - - * - * This macro returs the task context buffer for the SMP request. - */ -#define scic_sds_smp_request_get_task_context_buffer(memory) \ - ((struct scu_task_context *)(\ - ((char *)(scic_sds_smp_request_get_response_buffer(memory))) \ - + sizeof(struct smp_resp) \ - )) - - - -/** - * This method build the remainder of the IO request object. - * @sci_req: This parameter specifies the request object being constructed. - * - * The scic_sds_general_request_construct() must be called before this call is - * valid. none - */ - -void scic_sds_smp_request_assign_buffers( - struct scic_sds_request *sci_req) +void scic_sds_smp_request_assign_buffers(struct scic_sds_request *sci_req) { /* Assign all of the buffer pointers */ sci_req->command_buffer = @@ -132,13 +108,8 @@ void scic_sds_smp_request_assign_buffers( sci_req->response_buffer = scic_sds_smp_request_get_response_buffer(sci_req); - if (sci_req->was_tag_assigned_by_user == false) { - sci_req->task_context_buffer = - scic_sds_smp_request_get_task_context_buffer(sci_req); - sci_req->task_context_buffer = - PTR_ALIGN(sci_req->task_context_buffer, SMP_CACHE_BYTES); - } - + if (sci_req->was_tag_assigned_by_user == false) + sci_req->task_context_buffer = &sci_req->tc; } /* diff --git a/drivers/scsi/isci/core/scic_sds_stp_request.c b/drivers/scsi/isci/core/scic_sds_stp_request.c index 013af11df62b..f21354571ff8 100644 --- a/drivers/scsi/isci/core/scic_sds_stp_request.c +++ b/drivers/scsi/isci/core/scic_sds_stp_request.c @@ -94,18 +94,6 @@ )) /** - * scic_sds_stp_request_get_task_context_buffer() - - * - * This macro returns the address of the task context buffer in the io request - * memory - */ -#define scic_sds_stp_request_get_task_context_buffer(memory) \ - ((struct scu_task_context *)(\ - ((char *)(scic_sds_stp_request_get_response_buffer(memory))) \ - + SSP_RESP_IU_MAX_SIZE \ - )) - -/** * * * This method return the memory space required for STP PIO requests. u32 @@ -114,9 +102,7 @@ u32 scic_sds_stp_request_get_object_size(void) { return sizeof(struct scic_sds_stp_request) + sizeof(struct host_to_dev_fis) - + sizeof(struct dev_to_host_fis) - + sizeof(struct scu_task_context) - + SMP_CACHE_BYTES; + + sizeof(struct dev_to_host_fis); } void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req) @@ -126,12 +112,8 @@ void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req) sci_req->command_buffer = scic_sds_stp_request_get_h2d_reg_buffer(stp_req); sci_req->response_buffer = scic_sds_stp_request_get_response_buffer(stp_req); - if (sci_req->was_tag_assigned_by_user == false) { - sci_req->task_context_buffer = - scic_sds_stp_request_get_task_context_buffer(stp_req); - sci_req->task_context_buffer = PTR_ALIGN(sci_req->task_context_buffer, - SMP_CACHE_BYTES); - } + if (sci_req->was_tag_assigned_by_user == false) + sci_req->task_context_buffer = &sci_req->tc; } /** |