Commit 0d84366f authored by Dan Williams's avatar Dan Williams

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: default avatarDan Williams <dan.j.williams@intel.com>
parent 827a84d4
...@@ -212,8 +212,7 @@ static u32 scic_sds_ssp_request_get_object_size(void) ...@@ -212,8 +212,7 @@ static u32 scic_sds_ssp_request_get_object_size(void)
return sizeof(struct scic_sds_request) return sizeof(struct scic_sds_request)
+ scic_ssp_io_request_get_object_size() + scic_ssp_io_request_get_object_size()
+ sizeof(struct scu_task_context) + sizeof(struct scu_task_context)
+ SMP_CACHE_BYTES + SMP_CACHE_BYTES;
+ sizeof(struct scu_sgl_element_pair) * SCU_MAX_SGL_ELEMENT_PAIRS;
} }
/** /**
...@@ -239,7 +238,7 @@ static struct scu_sgl_element_pair *scic_sds_request_get_sgl_element_pair( ...@@ -239,7 +238,7 @@ static struct scu_sgl_element_pair *scic_sds_request_get_sgl_element_pair(
return &task_context->sgl_pair_cd; return &task_context->sgl_pair_cd;
} }
return &sci_req->sgl_element_pair_buffer[sgl_pair_index - 2]; return &sci_req->sg_table[sgl_pair_index - 2];
} }
/** /**
...@@ -328,11 +327,6 @@ static void scic_sds_ssp_io_request_assign_buffers( ...@@ -328,11 +327,6 @@ static void scic_sds_ssp_io_request_assign_buffers(
scic_sds_ssp_request_get_command_buffer(sci_req); scic_sds_ssp_request_get_command_buffer(sci_req);
sci_req->response_buffer = sci_req->response_buffer =
scic_sds_ssp_request_get_response_buffer(sci_req); scic_sds_ssp_request_get_response_buffer(sci_req);
sci_req->sgl_element_pair_buffer =
scic_sds_ssp_request_get_sgl_element_buffer(sci_req);
sci_req->sgl_element_pair_buffer =
PTR_ALIGN(sci_req->sgl_element_pair_buffer,
sizeof(struct scu_sgl_element_pair));
if (sci_req->was_tag_assigned_by_user == false) { if (sci_req->was_tag_assigned_by_user == false) {
sci_req->task_context_buffer = sci_req->task_context_buffer =
...@@ -535,7 +529,6 @@ static void scic_sds_ssp_task_request_assign_buffers( ...@@ -535,7 +529,6 @@ static void scic_sds_ssp_task_request_assign_buffers(
scic_sds_ssp_task_request_get_command_buffer(sci_req); scic_sds_ssp_task_request_get_command_buffer(sci_req);
sci_req->response_buffer = sci_req->response_buffer =
scic_sds_ssp_task_request_get_response_buffer(sci_req); scic_sds_ssp_task_request_get_response_buffer(sci_req);
sci_req->sgl_element_pair_buffer = NULL;
if (sci_req->was_tag_assigned_by_user == false) { if (sci_req->was_tag_assigned_by_user == false) {
sci_req->task_context_buffer = sci_req->task_context_buffer =
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include "sci_base_state_machine.h" #include "sci_base_state_machine.h"
#include "scu_task_context.h" #include "scu_task_context.h"
#include "scic_sds_stp_request.h" #include "scic_sds_stp_request.h"
#include "scu_constants.h"
struct scic_sds_controller; struct scic_sds_controller;
struct scic_sds_remote_device; struct scic_sds_remote_device;
...@@ -183,7 +184,10 @@ struct scic_sds_request { ...@@ -183,7 +184,10 @@ struct scic_sds_request {
void *command_buffer; void *command_buffer;
void *response_buffer; void *response_buffer;
struct scu_task_context *task_context_buffer; struct scu_task_context *task_context_buffer;
struct scu_sgl_element_pair *sgl_element_pair_buffer;
/* could be larger with sg chaining */
#define SCU_SGL_SIZE ((SCU_IO_REQUEST_SGE_COUNT + 1) / 2)
struct scu_sgl_element_pair sg_table[SCU_SGL_SIZE] __attribute__ ((aligned(32)));
/** /**
* This field indicates if this request is a task management request or * This field indicates if this request is a task management request or
...@@ -327,14 +331,6 @@ struct scic_sds_io_request_state_handler { ...@@ -327,14 +331,6 @@ struct scic_sds_io_request_state_handler {
extern const struct sci_base_state scic_sds_io_request_started_task_mgmt_substate_table[]; extern const struct sci_base_state scic_sds_io_request_started_task_mgmt_substate_table[];
/**
*
*
* This macro returns the maximum number of SGL element paris that we will
* support in a single IO request.
*/
#define SCU_MAX_SGL_ELEMENT_PAIRS ((SCU_IO_REQUEST_SGE_COUNT + 1) / 2)
/** /**
* scic_sds_request_get_controller() - * scic_sds_request_get_controller() -
* *
......
...@@ -131,7 +131,6 @@ void scic_sds_smp_request_assign_buffers( ...@@ -131,7 +131,6 @@ void scic_sds_smp_request_assign_buffers(
scic_sds_smp_request_get_command_buffer(sci_req); scic_sds_smp_request_get_command_buffer(sci_req);
sci_req->response_buffer = sci_req->response_buffer =
scic_sds_smp_request_get_response_buffer(sci_req); scic_sds_smp_request_get_response_buffer(sci_req);
sci_req->sgl_element_pair_buffer = NULL;
if (sci_req->was_tag_assigned_by_user == false) { if (sci_req->was_tag_assigned_by_user == false) {
sci_req->task_context_buffer = sci_req->task_context_buffer =
......
...@@ -105,18 +105,6 @@ ...@@ -105,18 +105,6 @@
+ SSP_RESP_IU_MAX_SIZE \ + SSP_RESP_IU_MAX_SIZE \
)) ))
/**
* scic_sds_stp_request_get_sgl_element_buffer() -
*
* This macro returns the address of the sgl elment pairs in the io request
* memory buffer
*/
#define scic_sds_stp_request_get_sgl_element_buffer(memory) \
((struct scu_sgl_element_pair *)(\
((char *)(scic_sds_stp_request_get_task_context_buffer(memory))) \
+ sizeof(struct scu_task_context) \
))
/** /**
* *
* *
...@@ -128,8 +116,7 @@ u32 scic_sds_stp_request_get_object_size(void) ...@@ -128,8 +116,7 @@ u32 scic_sds_stp_request_get_object_size(void)
+ sizeof(struct host_to_dev_fis) + sizeof(struct host_to_dev_fis)
+ sizeof(struct dev_to_host_fis) + sizeof(struct dev_to_host_fis)
+ sizeof(struct scu_task_context) + sizeof(struct scu_task_context)
+ SMP_CACHE_BYTES + SMP_CACHE_BYTES;
+ sizeof(struct scu_sgl_element_pair) * SCU_MAX_SGL_ELEMENT_PAIRS;
} }
void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req) 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,9 +125,6 @@ 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->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); sci_req->response_buffer = scic_sds_stp_request_get_response_buffer(stp_req);
sci_req->sgl_element_pair_buffer = scic_sds_stp_request_get_sgl_element_buffer(stp_req);
sci_req->sgl_element_pair_buffer = PTR_ALIGN(sci_req->sgl_element_pair_buffer,
sizeof(struct scu_sgl_element_pair));
if (sci_req->was_tag_assigned_by_user == false) { if (sci_req->was_tag_assigned_by_user == false) {
sci_req->task_context_buffer = sci_req->task_context_buffer =
......
...@@ -200,14 +200,10 @@ static enum sci_status isci_io_request_build( ...@@ -200,14 +200,10 @@ static enum sci_status isci_io_request_build(
/* build the common request object. For now, /* build the common request object. For now,
* we will let the core allocate the IO tag. * we will let the core allocate the IO tag.
*/ */
status = scic_io_request_construct( status = scic_io_request_construct(&isci_host->sci, sci_device,
&isci_host->sci, SCI_CONTROLLER_INVALID_IO_TAG,
sci_device, request, request->sci_req,
SCI_CONTROLLER_INVALID_IO_TAG, &request->sci_request_handle);
request,
request->sci_request_mem_ptr,
(struct scic_sds_request **)&request->sci_request_handle
);
if (status != SCI_SUCCESS) { if (status != SCI_SUCCESS) {
dev_warn(&isci_host->pdev->dev, dev_warn(&isci_host->pdev->dev,
...@@ -277,8 +273,6 @@ static int isci_request_alloc_core( ...@@ -277,8 +273,6 @@ static int isci_request_alloc_core(
/* initialize the request object. */ /* initialize the request object. */
spin_lock_init(&request->state_lock); spin_lock_init(&request->state_lock);
request->sci_request_mem_ptr = ((u8 *)request) +
sizeof(struct isci_request);
request->request_daddr = handle; request->request_daddr = handle;
request->isci_host = isci_host; request->isci_host = isci_host;
request->isci_device = isci_device; request->isci_device = isci_device;
......
...@@ -53,10 +53,11 @@ ...@@ -53,10 +53,11 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#if !defined(_ISCI_REQUEST_H_) #ifndef _ISCI_REQUEST_H_
#define _ISCI_REQUEST_H_ #define _ISCI_REQUEST_H_
#include "isci.h" #include "isci.h"
#include "scic_sds_request.h"
/** /**
* struct isci_request_status - This enum defines the possible states of an I/O * struct isci_request_status - This enum defines the possible states of an I/O
...@@ -80,16 +81,8 @@ enum task_type { ...@@ -80,16 +81,8 @@ enum task_type {
tmf_task = 1 tmf_task = 1
}; };
/**
* struct isci_request - This class represents the request object used to track
* IO, smp and TMF request internal. It wraps the SCIC request object.
*
*
*/
struct isci_request { struct isci_request {
struct scic_sds_request *sci_request_handle; struct scic_sds_request *sci_request_handle;
enum isci_request_status status; enum isci_request_status status;
enum task_type ttype; enum task_type ttype;
unsigned short io_tag; unsigned short io_tag;
...@@ -105,7 +98,6 @@ struct isci_request { ...@@ -105,7 +98,6 @@ struct isci_request {
struct list_head completed_node; struct list_head completed_node;
/* For use in the reqs_in_process list: */ /* For use in the reqs_in_process list: */
struct list_head dev_node; struct list_head dev_node;
void *sci_request_mem_ptr;
spinlock_t state_lock; spinlock_t state_lock;
dma_addr_t request_daddr; dma_addr_t request_daddr;
dma_addr_t zero_scatter_daddr; dma_addr_t zero_scatter_daddr;
...@@ -123,6 +115,7 @@ struct isci_request { ...@@ -123,6 +115,7 @@ struct isci_request {
* TMF was aborting is guaranteed to have completed. * TMF was aborting is guaranteed to have completed.
*/ */
struct completion *io_request_completion; struct completion *io_request_completion;
struct scic_sds_request sci_req[0] ____cacheline_aligned;
}; };
/** /**
......
...@@ -298,14 +298,10 @@ static enum sci_status isci_task_request_build( ...@@ -298,14 +298,10 @@ static enum sci_status isci_task_request_build(
goto out; goto out;
/* let the core do it's construct. */ /* let the core do it's construct. */
status = scic_task_request_construct( status = scic_task_request_construct(&isci_host->sci, sci_device,
&isci_host->sci, SCI_CONTROLLER_INVALID_IO_TAG,
sci_device, request, &request->sci_req,
SCI_CONTROLLER_INVALID_IO_TAG, &request->sci_request_handle);
request,
request->sci_request_mem_ptr,
&request->sci_request_handle
);
if (status != SCI_SUCCESS) { if (status != SCI_SUCCESS) {
dev_warn(&isci_host->pdev->dev, dev_warn(&isci_host->pdev->dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment