isci: move task context alignment from run-time to compile time
authorDan Williams <dan.j.williams@intel.com>
Sun, 8 May 2011 02:07:14 +0000 (19:07 -0700)
committerDan Williams <dan.j.williams@intel.com>
Sun, 3 Jul 2011 11:04:47 +0000 (04:04 -0700)
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>
drivers/scsi/isci/core/scic_sds_request.c
drivers/scsi/isci/core/scic_sds_request.h
drivers/scsi/isci/core/scic_sds_smp_request.c
drivers/scsi/isci/core/scic_sds_stp_request.c

index 189a799..baf69ed 100644 (file)
                 ))
 
 /**
- * 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
                 ))
 
 /**
- * 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
 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;
 }
 
 /**
index 83d737a..8f65814 100644 (file)
@@ -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)
index cb1adef..53b1260 100644 (file)
@@ -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;
 }
 
 /*
index 013af11..f213545 100644 (file)
                 ))
 
 /**
- * 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;
 }
 
 /**