diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-05-08 04:56:57 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:04:47 -0400 |
commit | 0d84366fbef557f92ef82ac9a224c57ffb3318bc (patch) | |
tree | 05f0b1ed0896550ee5182d18ea938338b3a99df2 | |
parent | 827a84d4e036b342b31abc2bcc3893505c2c7daa (diff) |
isci: make sgl explicit/aligned request object member
Towards unifying request objects we need all members to be defined in the
object and not carved out of anonymous buffer space.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_request.c | 11 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_request.h | 14 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_smp_request.c | 1 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_stp_request.c | 18 | ||||
-rw-r--r-- | drivers/scsi/isci/request.c | 14 | ||||
-rw-r--r-- | drivers/scsi/isci/request.h | 13 | ||||
-rw-r--r-- | drivers/scsi/isci/task.c | 12 |
7 files changed, 19 insertions, 64 deletions
diff --git a/drivers/scsi/isci/core/scic_sds_request.c b/drivers/scsi/isci/core/scic_sds_request.c index fd7bd334fa4b..189a7999726c 100644 --- a/drivers/scsi/isci/core/scic_sds_request.c +++ b/drivers/scsi/isci/core/scic_sds_request.c | |||
@@ -212,8 +212,7 @@ static u32 scic_sds_ssp_request_get_object_size(void) | |||
212 | return sizeof(struct scic_sds_request) | 212 | return sizeof(struct scic_sds_request) |
213 | + scic_ssp_io_request_get_object_size() | 213 | + scic_ssp_io_request_get_object_size() |
214 | + sizeof(struct scu_task_context) | 214 | + sizeof(struct scu_task_context) |
215 | + SMP_CACHE_BYTES | 215 | + SMP_CACHE_BYTES; |
216 | + sizeof(struct scu_sgl_element_pair) * SCU_MAX_SGL_ELEMENT_PAIRS; | ||
217 | } | 216 | } |
218 | 217 | ||
219 | /** | 218 | /** |
@@ -239,7 +238,7 @@ static struct scu_sgl_element_pair *scic_sds_request_get_sgl_element_pair( | |||
239 | return &task_context->sgl_pair_cd; | 238 | return &task_context->sgl_pair_cd; |
240 | } | 239 | } |
241 | 240 | ||
242 | return &sci_req->sgl_element_pair_buffer[sgl_pair_index - 2]; | 241 | return &sci_req->sg_table[sgl_pair_index - 2]; |
243 | } | 242 | } |
244 | 243 | ||
245 | /** | 244 | /** |
@@ -328,11 +327,6 @@ static void scic_sds_ssp_io_request_assign_buffers( | |||
328 | scic_sds_ssp_request_get_command_buffer(sci_req); | 327 | scic_sds_ssp_request_get_command_buffer(sci_req); |
329 | sci_req->response_buffer = | 328 | sci_req->response_buffer = |
330 | scic_sds_ssp_request_get_response_buffer(sci_req); | 329 | scic_sds_ssp_request_get_response_buffer(sci_req); |
331 | sci_req->sgl_element_pair_buffer = | ||
332 | scic_sds_ssp_request_get_sgl_element_buffer(sci_req); | ||
333 | sci_req->sgl_element_pair_buffer = | ||
334 | PTR_ALIGN(sci_req->sgl_element_pair_buffer, | ||
335 | sizeof(struct scu_sgl_element_pair)); | ||
336 | 330 | ||
337 | if (sci_req->was_tag_assigned_by_user == false) { | 331 | if (sci_req->was_tag_assigned_by_user == false) { |
338 | sci_req->task_context_buffer = | 332 | sci_req->task_context_buffer = |
@@ -535,7 +529,6 @@ static void scic_sds_ssp_task_request_assign_buffers( | |||
535 | scic_sds_ssp_task_request_get_command_buffer(sci_req); | 529 | scic_sds_ssp_task_request_get_command_buffer(sci_req); |
536 | sci_req->response_buffer = | 530 | sci_req->response_buffer = |
537 | scic_sds_ssp_task_request_get_response_buffer(sci_req); | 531 | scic_sds_ssp_task_request_get_response_buffer(sci_req); |
538 | sci_req->sgl_element_pair_buffer = NULL; | ||
539 | 532 | ||
540 | if (sci_req->was_tag_assigned_by_user == false) { | 533 | if (sci_req->was_tag_assigned_by_user == false) { |
541 | sci_req->task_context_buffer = | 534 | sci_req->task_context_buffer = |
diff --git a/drivers/scsi/isci/core/scic_sds_request.h b/drivers/scsi/isci/core/scic_sds_request.h index c93f3ed8946d..83d737adbc48 100644 --- a/drivers/scsi/isci/core/scic_sds_request.h +++ b/drivers/scsi/isci/core/scic_sds_request.h | |||
@@ -60,6 +60,7 @@ | |||
60 | #include "sci_base_state_machine.h" | 60 | #include "sci_base_state_machine.h" |
61 | #include "scu_task_context.h" | 61 | #include "scu_task_context.h" |
62 | #include "scic_sds_stp_request.h" | 62 | #include "scic_sds_stp_request.h" |
63 | #include "scu_constants.h" | ||
63 | 64 | ||
64 | struct scic_sds_controller; | 65 | struct scic_sds_controller; |
65 | struct scic_sds_remote_device; | 66 | struct scic_sds_remote_device; |
@@ -183,7 +184,10 @@ struct scic_sds_request { | |||
183 | void *command_buffer; | 184 | void *command_buffer; |
184 | void *response_buffer; | 185 | void *response_buffer; |
185 | struct scu_task_context *task_context_buffer; | 186 | struct scu_task_context *task_context_buffer; |
186 | struct scu_sgl_element_pair *sgl_element_pair_buffer; | 187 | |
188 | /* could be larger with sg chaining */ | ||
189 | #define SCU_SGL_SIZE ((SCU_IO_REQUEST_SGE_COUNT + 1) / 2) | ||
190 | struct scu_sgl_element_pair sg_table[SCU_SGL_SIZE] __attribute__ ((aligned(32))); | ||
187 | 191 | ||
188 | /** | 192 | /** |
189 | * This field indicates if this request is a task management request or | 193 | * This field indicates if this request is a task management request or |
@@ -328,14 +332,6 @@ struct scic_sds_io_request_state_handler { | |||
328 | extern const struct sci_base_state scic_sds_io_request_started_task_mgmt_substate_table[]; | 332 | extern const struct sci_base_state scic_sds_io_request_started_task_mgmt_substate_table[]; |
329 | 333 | ||
330 | /** | 334 | /** |
331 | * | ||
332 | * | ||
333 | * This macro returns the maximum number of SGL element paris that we will | ||
334 | * support in a single IO request. | ||
335 | */ | ||
336 | #define SCU_MAX_SGL_ELEMENT_PAIRS ((SCU_IO_REQUEST_SGE_COUNT + 1) / 2) | ||
337 | |||
338 | /** | ||
339 | * scic_sds_request_get_controller() - | 335 | * scic_sds_request_get_controller() - |
340 | * | 336 | * |
341 | * This macro will return the controller for this io request object | 337 | * This macro will return the controller for this io request object |
diff --git a/drivers/scsi/isci/core/scic_sds_smp_request.c b/drivers/scsi/isci/core/scic_sds_smp_request.c index 1f8773d3b793..cb1adef1d559 100644 --- a/drivers/scsi/isci/core/scic_sds_smp_request.c +++ b/drivers/scsi/isci/core/scic_sds_smp_request.c | |||
@@ -131,7 +131,6 @@ void scic_sds_smp_request_assign_buffers( | |||
131 | scic_sds_smp_request_get_command_buffer(sci_req); | 131 | scic_sds_smp_request_get_command_buffer(sci_req); |
132 | sci_req->response_buffer = | 132 | sci_req->response_buffer = |
133 | scic_sds_smp_request_get_response_buffer(sci_req); | 133 | scic_sds_smp_request_get_response_buffer(sci_req); |
134 | sci_req->sgl_element_pair_buffer = NULL; | ||
135 | 134 | ||
136 | if (sci_req->was_tag_assigned_by_user == false) { | 135 | if (sci_req->was_tag_assigned_by_user == false) { |
137 | sci_req->task_context_buffer = | 136 | sci_req->task_context_buffer = |
diff --git a/drivers/scsi/isci/core/scic_sds_stp_request.c b/drivers/scsi/isci/core/scic_sds_stp_request.c index 7dba40fc2585..013af11df62b 100644 --- a/drivers/scsi/isci/core/scic_sds_stp_request.c +++ b/drivers/scsi/isci/core/scic_sds_stp_request.c | |||
@@ -106,18 +106,6 @@ | |||
106 | )) | 106 | )) |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * scic_sds_stp_request_get_sgl_element_buffer() - | ||
110 | * | ||
111 | * This macro returns the address of the sgl elment pairs in the io request | ||
112 | * memory buffer | ||
113 | */ | ||
114 | #define scic_sds_stp_request_get_sgl_element_buffer(memory) \ | ||
115 | ((struct scu_sgl_element_pair *)(\ | ||
116 | ((char *)(scic_sds_stp_request_get_task_context_buffer(memory))) \ | ||
117 | + sizeof(struct scu_task_context) \ | ||
118 | )) | ||
119 | |||
120 | /** | ||
121 | * | 109 | * |
122 | * | 110 | * |
123 | * This method return the memory space required for STP PIO requests. u32 | 111 | * This method return the memory space required for STP PIO requests. u32 |
@@ -128,8 +116,7 @@ u32 scic_sds_stp_request_get_object_size(void) | |||
128 | + sizeof(struct host_to_dev_fis) | 116 | + sizeof(struct host_to_dev_fis) |
129 | + sizeof(struct dev_to_host_fis) | 117 | + sizeof(struct dev_to_host_fis) |
130 | + sizeof(struct scu_task_context) | 118 | + sizeof(struct scu_task_context) |
131 | + SMP_CACHE_BYTES | 119 | + SMP_CACHE_BYTES; |
132 | + sizeof(struct scu_sgl_element_pair) * SCU_MAX_SGL_ELEMENT_PAIRS; | ||
133 | } | 120 | } |
134 | 121 | ||
135 | void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req) | 122 | void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req) |
@@ -138,9 +125,6 @@ void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req) | |||
138 | 125 | ||
139 | sci_req->command_buffer = scic_sds_stp_request_get_h2d_reg_buffer(stp_req); | 126 | sci_req->command_buffer = scic_sds_stp_request_get_h2d_reg_buffer(stp_req); |
140 | sci_req->response_buffer = scic_sds_stp_request_get_response_buffer(stp_req); | 127 | sci_req->response_buffer = scic_sds_stp_request_get_response_buffer(stp_req); |
141 | sci_req->sgl_element_pair_buffer = scic_sds_stp_request_get_sgl_element_buffer(stp_req); | ||
142 | sci_req->sgl_element_pair_buffer = PTR_ALIGN(sci_req->sgl_element_pair_buffer, | ||
143 | sizeof(struct scu_sgl_element_pair)); | ||
144 | 128 | ||
145 | if (sci_req->was_tag_assigned_by_user == false) { | 129 | if (sci_req->was_tag_assigned_by_user == false) { |
146 | sci_req->task_context_buffer = | 130 | sci_req->task_context_buffer = |
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c index e01c2c98f4e9..9dd971a3fbb2 100644 --- a/drivers/scsi/isci/request.c +++ b/drivers/scsi/isci/request.c | |||
@@ -200,14 +200,10 @@ static enum sci_status isci_io_request_build( | |||
200 | /* build the common request object. For now, | 200 | /* build the common request object. For now, |
201 | * we will let the core allocate the IO tag. | 201 | * we will let the core allocate the IO tag. |
202 | */ | 202 | */ |
203 | status = scic_io_request_construct( | 203 | status = scic_io_request_construct(&isci_host->sci, sci_device, |
204 | &isci_host->sci, | 204 | SCI_CONTROLLER_INVALID_IO_TAG, |
205 | sci_device, | 205 | request, request->sci_req, |
206 | SCI_CONTROLLER_INVALID_IO_TAG, | 206 | &request->sci_request_handle); |
207 | request, | ||
208 | request->sci_request_mem_ptr, | ||
209 | (struct scic_sds_request **)&request->sci_request_handle | ||
210 | ); | ||
211 | 207 | ||
212 | if (status != SCI_SUCCESS) { | 208 | if (status != SCI_SUCCESS) { |
213 | dev_warn(&isci_host->pdev->dev, | 209 | dev_warn(&isci_host->pdev->dev, |
@@ -277,8 +273,6 @@ static int isci_request_alloc_core( | |||
277 | 273 | ||
278 | /* initialize the request object. */ | 274 | /* initialize the request object. */ |
279 | spin_lock_init(&request->state_lock); | 275 | spin_lock_init(&request->state_lock); |
280 | request->sci_request_mem_ptr = ((u8 *)request) + | ||
281 | sizeof(struct isci_request); | ||
282 | request->request_daddr = handle; | 276 | request->request_daddr = handle; |
283 | request->isci_host = isci_host; | 277 | request->isci_host = isci_host; |
284 | request->isci_device = isci_device; | 278 | request->isci_device = isci_device; |
diff --git a/drivers/scsi/isci/request.h b/drivers/scsi/isci/request.h index 9c97715e54d8..ddfbf71c97e5 100644 --- a/drivers/scsi/isci/request.h +++ b/drivers/scsi/isci/request.h | |||
@@ -53,10 +53,11 @@ | |||
53 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 53 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
54 | */ | 54 | */ |
55 | 55 | ||
56 | #if !defined(_ISCI_REQUEST_H_) | 56 | #ifndef _ISCI_REQUEST_H_ |
57 | #define _ISCI_REQUEST_H_ | 57 | #define _ISCI_REQUEST_H_ |
58 | 58 | ||
59 | #include "isci.h" | 59 | #include "isci.h" |
60 | #include "scic_sds_request.h" | ||
60 | 61 | ||
61 | /** | 62 | /** |
62 | * struct isci_request_status - This enum defines the possible states of an I/O | 63 | * struct isci_request_status - This enum defines the possible states of an I/O |
@@ -80,16 +81,8 @@ enum task_type { | |||
80 | tmf_task = 1 | 81 | tmf_task = 1 |
81 | }; | 82 | }; |
82 | 83 | ||
83 | /** | ||
84 | * struct isci_request - This class represents the request object used to track | ||
85 | * IO, smp and TMF request internal. It wraps the SCIC request object. | ||
86 | * | ||
87 | * | ||
88 | */ | ||
89 | struct isci_request { | 84 | struct isci_request { |
90 | |||
91 | struct scic_sds_request *sci_request_handle; | 85 | struct scic_sds_request *sci_request_handle; |
92 | |||
93 | enum isci_request_status status; | 86 | enum isci_request_status status; |
94 | enum task_type ttype; | 87 | enum task_type ttype; |
95 | unsigned short io_tag; | 88 | unsigned short io_tag; |
@@ -105,7 +98,6 @@ struct isci_request { | |||
105 | struct list_head completed_node; | 98 | struct list_head completed_node; |
106 | /* For use in the reqs_in_process list: */ | 99 | /* For use in the reqs_in_process list: */ |
107 | struct list_head dev_node; | 100 | struct list_head dev_node; |
108 | void *sci_request_mem_ptr; | ||
109 | spinlock_t state_lock; | 101 | spinlock_t state_lock; |
110 | dma_addr_t request_daddr; | 102 | dma_addr_t request_daddr; |
111 | dma_addr_t zero_scatter_daddr; | 103 | dma_addr_t zero_scatter_daddr; |
@@ -123,6 +115,7 @@ struct isci_request { | |||
123 | * TMF was aborting is guaranteed to have completed. | 115 | * TMF was aborting is guaranteed to have completed. |
124 | */ | 116 | */ |
125 | struct completion *io_request_completion; | 117 | struct completion *io_request_completion; |
118 | struct scic_sds_request sci_req[0] ____cacheline_aligned; | ||
126 | }; | 119 | }; |
127 | 120 | ||
128 | /** | 121 | /** |
diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c index 12f2df947362..7d5f79378452 100644 --- a/drivers/scsi/isci/task.c +++ b/drivers/scsi/isci/task.c | |||
@@ -298,14 +298,10 @@ static enum sci_status isci_task_request_build( | |||
298 | goto out; | 298 | goto out; |
299 | 299 | ||
300 | /* let the core do it's construct. */ | 300 | /* let the core do it's construct. */ |
301 | status = scic_task_request_construct( | 301 | status = scic_task_request_construct(&isci_host->sci, sci_device, |
302 | &isci_host->sci, | 302 | SCI_CONTROLLER_INVALID_IO_TAG, |
303 | sci_device, | 303 | request, &request->sci_req, |
304 | SCI_CONTROLLER_INVALID_IO_TAG, | 304 | &request->sci_request_handle); |
305 | request, | ||
306 | request->sci_request_mem_ptr, | ||
307 | &request->sci_request_handle | ||
308 | ); | ||
309 | 305 | ||
310 | if (status != SCI_SUCCESS) { | 306 | if (status != SCI_SUCCESS) { |
311 | dev_warn(&isci_host->pdev->dev, | 307 | dev_warn(&isci_host->pdev->dev, |