aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/request.h
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2011-06-28 16:47:09 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:04:51 -0400
commit312e0c2455c18716cf640d4336dcb1e9e5053818 (patch)
treebe2dbc9a3e5ba39783448f0029231ea43e6e0428 /drivers/scsi/isci/request.h
parent9274f45ea551421cd3bf329de9dd8d1e6208285a (diff)
isci: unify can_queue tracking on the tci_pool, uplevel tag assignment
The tci_pool tracks our outstanding command slots which are also the 'index' portion of our tags. Grabbing the tag early in ->lldd_execute_task let's us drop the isci_host_can_queue() and ->was_tag_assigned_by_user infrastructure. ->was_tag_assigned_by_user required the task context to be duplicated in request-local buffer. With the tci established early we can build the task_context directly into its final location and skip a memcpy. With the task context buffer at a known address at request construction we have the opportunity/obligation to also fix sgl handling. This rework feels like it belongs in another patch but the sgl handling and task_context are too intertwined. 1/ fix the 'ab' pair embedded in the task context to point to the 'cd' pair in the task context (previously we were prematurely linking to the staging buffer). 2/ fix the broken iteration of pio sgls that assumes all sgls are relative to the request, and does a dangerous looking reverse lookup of physical address to virtual address. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/request.h')
-rw-r--r--drivers/scsi/isci/request.h58
1 files changed, 3 insertions, 55 deletions
diff --git a/drivers/scsi/isci/request.h b/drivers/scsi/isci/request.h
index 9130f22a63b8..8c77c4cbe04a 100644
--- a/drivers/scsi/isci/request.h
+++ b/drivers/scsi/isci/request.h
@@ -136,7 +136,7 @@ struct scic_sds_stp_request {
136 u8 ending_error; 136 u8 ending_error;
137 137
138 struct scic_sds_request_pio_sgl { 138 struct scic_sds_request_pio_sgl {
139 struct scu_sgl_element_pair *sgl_pair; 139 int sgl_index;
140 u8 sgl_set; 140 u8 sgl_set;
141 u32 sgl_offset; 141 u32 sgl_offset;
142 } request_current; 142 } request_current;
@@ -172,12 +172,6 @@ struct scic_sds_request {
172 struct scic_sds_remote_device *target_device; 172 struct scic_sds_remote_device *target_device;
173 173
174 /* 174 /*
175 * This field is utilized to determine if the SCI user is managing
176 * the IO tag for this request or if the core is managing it.
177 */
178 bool was_tag_assigned_by_user;
179
180 /*
181 * This field indicates the IO tag for this request. The IO tag is 175 * This field indicates the IO tag for this request. The IO tag is
182 * comprised of the task_index and a sequence count. The sequence count 176 * comprised of the task_index and a sequence count. The sequence count
183 * is utilized to help identify tasks from one life to another. 177 * is utilized to help identify tasks from one life to another.
@@ -209,8 +203,7 @@ struct scic_sds_request {
209 */ 203 */
210 u32 post_context; 204 u32 post_context;
211 205
212 struct scu_task_context *task_context_buffer; 206 struct scu_task_context *tc;
213 struct scu_task_context tc ____cacheline_aligned;
214 207
215 /* could be larger with sg chaining */ 208 /* could be larger with sg chaining */
216 #define SCU_SGL_SIZE ((SCI_MAX_SCATTER_GATHER_ELEMENTS + 1) / 2) 209 #define SCU_SGL_SIZE ((SCI_MAX_SCATTER_GATHER_ELEMENTS + 1) / 2)
@@ -465,35 +458,6 @@ enum sci_base_request_states {
465 (request)->sci_status = (sci_status_code); \ 458 (request)->sci_status = (sci_status_code); \
466 } 459 }
467 460
468/**
469 * SCU_SGL_ZERO() -
470 *
471 * This macro zeros the hardware SGL element data
472 */
473#define SCU_SGL_ZERO(scu_sge) \
474 { \
475 (scu_sge).length = 0; \
476 (scu_sge).address_lower = 0; \
477 (scu_sge).address_upper = 0; \
478 (scu_sge).address_modifier = 0; \
479 }
480
481/**
482 * SCU_SGL_COPY() -
483 *
484 * This macro copys the SGL Element data from the host os to the hardware SGL
485 * elment data
486 */
487#define SCU_SGL_COPY(scu_sge, os_sge) \
488 { \
489 (scu_sge).length = sg_dma_len(sg); \
490 (scu_sge).address_upper = \
491 upper_32_bits(sg_dma_address(sg)); \
492 (scu_sge).address_lower = \
493 lower_32_bits(sg_dma_address(sg)); \
494 (scu_sge).address_modifier = 0; \
495 }
496
497enum sci_status scic_sds_request_start(struct scic_sds_request *sci_req); 461enum sci_status scic_sds_request_start(struct scic_sds_request *sci_req);
498enum sci_status scic_sds_io_request_terminate(struct scic_sds_request *sci_req); 462enum sci_status scic_sds_io_request_terminate(struct scic_sds_request *sci_req);
499enum sci_status 463enum sci_status
@@ -510,22 +474,6 @@ extern enum sci_status
510scic_sds_io_request_tc_completion(struct scic_sds_request *sci_req, u32 code); 474scic_sds_io_request_tc_completion(struct scic_sds_request *sci_req, u32 code);
511 475
512/* XXX open code in caller */ 476/* XXX open code in caller */
513static inline void *scic_request_get_virt_addr(struct scic_sds_request *sci_req,
514 dma_addr_t phys_addr)
515{
516 struct isci_request *ireq = sci_req_to_ireq(sci_req);
517 dma_addr_t offset;
518
519 BUG_ON(phys_addr < ireq->request_daddr);
520
521 offset = phys_addr - ireq->request_daddr;
522
523 BUG_ON(offset >= sizeof(*ireq));
524
525 return (char *)ireq + offset;
526}
527
528/* XXX open code in caller */
529static inline dma_addr_t 477static inline dma_addr_t
530scic_io_request_get_dma_addr(struct scic_sds_request *sci_req, void *virt_addr) 478scic_io_request_get_dma_addr(struct scic_sds_request *sci_req, void *virt_addr)
531{ 479{
@@ -672,7 +620,7 @@ struct isci_request *isci_request_alloc_tmf(struct isci_host *ihost,
672 struct isci_tmf *isci_tmf, 620 struct isci_tmf *isci_tmf,
673 gfp_t gfp_flags); 621 gfp_t gfp_flags);
674int isci_request_execute(struct isci_host *ihost, struct isci_remote_device *idev, 622int isci_request_execute(struct isci_host *ihost, struct isci_remote_device *idev,
675 struct sas_task *task, gfp_t gfp_flags); 623 struct sas_task *task, u16 tag, gfp_t gfp_flags);
676void isci_terminate_pending_requests(struct isci_host *ihost, 624void isci_terminate_pending_requests(struct isci_host *ihost,
677 struct isci_remote_device *idev); 625 struct isci_remote_device *idev);
678enum sci_status 626enum sci_status