aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp/iser
diff options
context:
space:
mode:
authorOr Gerlitz <ogerlitz@mellanox.com>2011-11-03 18:21:27 -0400
committerRoland Dreier <roland@purestorage.com>2011-11-04 12:32:44 -0400
commit52439540ea30396982b69662dd21aede6b336288 (patch)
tree2604bc377ec689ce1a23fa45e1a317196bd96a82 /drivers/infiniband/ulp/iser
parent2c4ce609347f2a45792c8d9ebb5af11217766cb6 (diff)
IB/iser: DMA unmap TX bufs used for iSCSI/iSER headers
The current driver never does DMA unmapping on these buffers. Fix that by adding DMA unmapping to the task cleanup callback, and DMA mapping to the task init function (drop the headers_initialized micro-optimization). Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/ulp/iser')
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.c11
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.h1
2 files changed, 8 insertions, 4 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 84e8c293a715..c42b8f390c0b 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -151,7 +151,6 @@ int iser_initialize_task_headers(struct iscsi_task *task,
151 tx_desc->tx_sg[0].length = ISER_HEADERS_LEN; 151 tx_desc->tx_sg[0].length = ISER_HEADERS_LEN;
152 tx_desc->tx_sg[0].lkey = device->mr->lkey; 152 tx_desc->tx_sg[0].lkey = device->mr->lkey;
153 153
154 iser_task->headers_initialized = 1;
155 iser_task->iser_conn = iser_conn; 154 iser_task->iser_conn = iser_conn;
156 return 0; 155 return 0;
157} 156}
@@ -166,8 +165,7 @@ iscsi_iser_task_init(struct iscsi_task *task)
166{ 165{
167 struct iscsi_iser_task *iser_task = task->dd_data; 166 struct iscsi_iser_task *iser_task = task->dd_data;
168 167
169 if (!iser_task->headers_initialized) 168 if (iser_initialize_task_headers(task, &iser_task->desc))
170 if (iser_initialize_task_headers(task, &iser_task->desc))
171 return -ENOMEM; 169 return -ENOMEM;
172 170
173 /* mgmt task */ 171 /* mgmt task */
@@ -278,6 +276,13 @@ iscsi_iser_task_xmit(struct iscsi_task *task)
278static void iscsi_iser_cleanup_task(struct iscsi_task *task) 276static void iscsi_iser_cleanup_task(struct iscsi_task *task)
279{ 277{
280 struct iscsi_iser_task *iser_task = task->dd_data; 278 struct iscsi_iser_task *iser_task = task->dd_data;
279 struct iser_tx_desc *tx_desc = &iser_task->desc;
280
281 struct iscsi_iser_conn *iser_conn = task->conn->dd_data;
282 struct iser_device *device = iser_conn->ib_conn->device;
283
284 ib_dma_unmap_single(device->ib_device,
285 tx_desc->dma_addr, ISER_HEADERS_LEN, DMA_TO_DEVICE);
281 286
282 /* mgmt tasks do not need special cleanup */ 287 /* mgmt tasks do not need special cleanup */
283 if (!task->sc) 288 if (!task->sc)
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h
index 2982a14a0557..db7ea3704da7 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.h
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.h
@@ -278,7 +278,6 @@ struct iscsi_iser_task {
278 struct iser_regd_buf rdma_regd[ISER_DIRS_NUM];/* regd rdma buf */ 278 struct iser_regd_buf rdma_regd[ISER_DIRS_NUM];/* regd rdma buf */
279 struct iser_data_buf data[ISER_DIRS_NUM]; /* orig. data des*/ 279 struct iser_data_buf data[ISER_DIRS_NUM]; /* orig. data des*/
280 struct iser_data_buf data_copy[ISER_DIRS_NUM];/* contig. copy */ 280 struct iser_data_buf data_copy[ISER_DIRS_NUM];/* contig. copy */
281 int headers_initialized;
282}; 281};
283 282
284struct iser_page_vec { 283struct iser_page_vec {