aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2011-05-07 22:07:14 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:04:47 -0400
commit26298264a5de6d46d6e872dfd4c5d14c3011666f (patch)
tree57648e0046fdb85aaaaaa27c445a0fda2e76273a /drivers
parent0d84366fbef557f92ef82ac9a224c57ffb3318bc (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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/isci/core/scic_sds_request.c64
-rw-r--r--drivers/scsi/isci/core/scic_sds_request.h1
-rw-r--r--drivers/scsi/isci/core/scic_sds_smp_request.c37
-rw-r--r--drivers/scsi/isci/core/scic_sds_stp_request.c24
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 @@
125 )) 125 ))
126 126
127/** 127/**
128 * scic_sds_ssp_request_get_task_context_buffer() -
129 *
130 * This macro returns the address of the task context buffer in the io request
131 * memory
132 */
133#define scic_sds_ssp_request_get_task_context_buffer(memory) \
134 ((struct scu_task_context *)(\
135 ((char *)(scic_sds_ssp_request_get_response_buffer(memory))) \
136 + SSP_RESP_IU_MAX_SIZE \
137 ))
138
139/**
140 * scic_sds_ssp_request_get_sgl_element_buffer() -
141 *
142 * This macro returns the address of the sgl elment pairs in the io request
143 * memory buffer
144 */
145#define scic_sds_ssp_request_get_sgl_element_buffer(memory) \
146 ((struct scu_sgl_element_pair *)(\
147 ((char *)(scic_sds_ssp_request_get_task_context_buffer(memory))) \
148 + sizeof(struct scu_task_context) \
149 ))
150
151
152/**
153 * scic_ssp_task_request_get_object_size() - 128 * scic_ssp_task_request_get_object_size() -
154 * 129 *
155 * This macro returns the sizeof of memory required to store an SSP Task 130 * This macro returns the sizeof of memory required to store an SSP Task
@@ -185,24 +160,6 @@
185 )) 160 ))
186 161
187/** 162/**
188 * scic_sds_ssp_task_request_get_task_context_buffer() -
189 *
190 * This macro returs the task context buffer for the SSP task request.
191 */
192#define scic_sds_ssp_task_request_get_task_context_buffer(memory) \
193 ((struct scu_task_context *)(\
194 ((char *)(scic_sds_ssp_task_request_get_response_buffer(memory))) \
195 + SSP_RESP_IU_MAX_SIZE \
196 ))
197
198
199
200/*
201 * ****************************************************************************
202 * * SCIC SDS IO REQUEST PRIVATE METHODS
203 * **************************************************************************** */
204
205/**
206 * 163 *
207 * 164 *
208 * This method returns the size required to store an SSP IO request object. u32 165 * This method returns the size required to store an SSP IO request object. u32
@@ -210,9 +167,7 @@
210static u32 scic_sds_ssp_request_get_object_size(void) 167static u32 scic_sds_ssp_request_get_object_size(void)
211{ 168{
212 return sizeof(struct scic_sds_request) 169 return sizeof(struct scic_sds_request)
213 + scic_ssp_io_request_get_object_size() 170 + scic_ssp_io_request_get_object_size();
214 + sizeof(struct scu_task_context)
215 + SMP_CACHE_BYTES;
216} 171}
217 172
218/** 173/**
@@ -328,13 +283,8 @@ static void scic_sds_ssp_io_request_assign_buffers(
328 sci_req->response_buffer = 283 sci_req->response_buffer =
329 scic_sds_ssp_request_get_response_buffer(sci_req); 284 scic_sds_ssp_request_get_response_buffer(sci_req);
330 285
331 if (sci_req->was_tag_assigned_by_user == false) { 286 if (sci_req->was_tag_assigned_by_user == false)
332 sci_req->task_context_buffer = 287 sci_req->task_context_buffer = &sci_req->tc;
333 scic_sds_ssp_request_get_task_context_buffer(sci_req);
334 sci_req->task_context_buffer =
335 PTR_ALIGN(sci_req->task_context_buffer,
336 SMP_CACHE_BYTES);
337 }
338} 288}
339 289
340static void scic_sds_io_request_build_ssp_command_iu(struct scic_sds_request *sci_req) 290static 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(
530 sci_req->response_buffer = 480 sci_req->response_buffer =
531 scic_sds_ssp_task_request_get_response_buffer(sci_req); 481 scic_sds_ssp_task_request_get_response_buffer(sci_req);
532 482
533 if (sci_req->was_tag_assigned_by_user == false) { 483 if (sci_req->was_tag_assigned_by_user == false)
534 sci_req->task_context_buffer = 484 sci_req->task_context_buffer = &sci_req->tc;
535 scic_sds_ssp_task_request_get_task_context_buffer(sci_req);
536 sci_req->task_context_buffer =
537 PTR_ALIGN(sci_req->task_context_buffer, SMP_CACHE_BYTES);
538 }
539} 485}
540 486
541/** 487/**
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 {
184 void *command_buffer; 184 void *command_buffer;
185 void *response_buffer; 185 void *response_buffer;
186 struct scu_task_context *task_context_buffer; 186 struct scu_task_context *task_context_buffer;
187 struct scu_task_context tc ____cacheline_aligned;
187 188
188 /* could be larger with sg chaining */ 189 /* could be larger with sg chaining */
189 #define SCU_SGL_SIZE ((SCU_IO_REQUEST_SGE_COUNT + 1) / 2) 190 #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)
78{ 78{
79 return sizeof(struct scic_sds_request) 79 return sizeof(struct scic_sds_request)
80 + sizeof(struct smp_req) 80 + sizeof(struct smp_req)
81 + sizeof(struct smp_resp) 81 + sizeof(struct smp_resp);
82 + sizeof(struct scu_task_context)
83 + SMP_CACHE_BYTES;
84} 82}
85 83
86/** 84/**
@@ -102,29 +100,7 @@ u32 scic_sds_smp_request_get_object_size(void)
102 (((char *)(scic_sds_smp_request_get_command_buffer(memory))) \ 100 (((char *)(scic_sds_smp_request_get_command_buffer(memory))) \
103 + sizeof(struct smp_req)) 101 + sizeof(struct smp_req))
104 102
105/** 103void scic_sds_smp_request_assign_buffers(struct scic_sds_request *sci_req)
106 * scic_sds_smp_request_get_task_context_buffer() -
107 *
108 * This macro returs the task context buffer for the SMP request.
109 */
110#define scic_sds_smp_request_get_task_context_buffer(memory) \
111 ((struct scu_task_context *)(\
112 ((char *)(scic_sds_smp_request_get_response_buffer(memory))) \
113 + sizeof(struct smp_resp) \
114 ))
115
116
117
118/**
119 * This method build the remainder of the IO request object.
120 * @sci_req: This parameter specifies the request object being constructed.
121 *
122 * The scic_sds_general_request_construct() must be called before this call is
123 * valid. none
124 */
125
126void scic_sds_smp_request_assign_buffers(
127 struct scic_sds_request *sci_req)
128{ 104{
129 /* Assign all of the buffer pointers */ 105 /* Assign all of the buffer pointers */
130 sci_req->command_buffer = 106 sci_req->command_buffer =
@@ -132,13 +108,8 @@ void scic_sds_smp_request_assign_buffers(
132 sci_req->response_buffer = 108 sci_req->response_buffer =
133 scic_sds_smp_request_get_response_buffer(sci_req); 109 scic_sds_smp_request_get_response_buffer(sci_req);
134 110
135 if (sci_req->was_tag_assigned_by_user == false) { 111 if (sci_req->was_tag_assigned_by_user == false)
136 sci_req->task_context_buffer = 112 sci_req->task_context_buffer = &sci_req->tc;
137 scic_sds_smp_request_get_task_context_buffer(sci_req);
138 sci_req->task_context_buffer =
139 PTR_ALIGN(sci_req->task_context_buffer, SMP_CACHE_BYTES);
140 }
141
142} 113}
143 114
144/* 115/*
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 @@
94 )) 94 ))
95 95
96/** 96/**
97 * scic_sds_stp_request_get_task_context_buffer() -
98 *
99 * This macro returns the address of the task context buffer in the io request
100 * memory
101 */
102#define scic_sds_stp_request_get_task_context_buffer(memory) \
103 ((struct scu_task_context *)(\
104 ((char *)(scic_sds_stp_request_get_response_buffer(memory))) \
105 + SSP_RESP_IU_MAX_SIZE \
106 ))
107
108/**
109 * 97 *
110 * 98 *
111 * This method return the memory space required for STP PIO requests. u32 99 * 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)
114{ 102{
115 return sizeof(struct scic_sds_stp_request) 103 return sizeof(struct scic_sds_stp_request)
116 + sizeof(struct host_to_dev_fis) 104 + sizeof(struct host_to_dev_fis)
117 + sizeof(struct dev_to_host_fis) 105 + sizeof(struct dev_to_host_fis);
118 + sizeof(struct scu_task_context)
119 + SMP_CACHE_BYTES;
120} 106}
121 107
122void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req) 108void 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)
126 sci_req->command_buffer = scic_sds_stp_request_get_h2d_reg_buffer(stp_req); 112 sci_req->command_buffer = scic_sds_stp_request_get_h2d_reg_buffer(stp_req);
127 sci_req->response_buffer = scic_sds_stp_request_get_response_buffer(stp_req); 113 sci_req->response_buffer = scic_sds_stp_request_get_response_buffer(stp_req);
128 114
129 if (sci_req->was_tag_assigned_by_user == false) { 115 if (sci_req->was_tag_assigned_by_user == false)
130 sci_req->task_context_buffer = 116 sci_req->task_context_buffer = &sci_req->tc;
131 scic_sds_stp_request_get_task_context_buffer(stp_req);
132 sci_req->task_context_buffer = PTR_ALIGN(sci_req->task_context_buffer,
133 SMP_CACHE_BYTES);
134 }
135} 117}
136 118
137/** 119/**