Skip to content

Commit

Permalink
IB/iser: DMA unmap TX bufs used for iSCSI/iSER headers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Or Gerlitz authored and Roland Dreier committed Nov 4, 2011
1 parent 2c4ce60 commit 5243954
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 8 additions & 3 deletions drivers/infiniband/ulp/iser/iscsi_iser.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ int iser_initialize_task_headers(struct iscsi_task *task,
tx_desc->tx_sg[0].length = ISER_HEADERS_LEN;
tx_desc->tx_sg[0].lkey = device->mr->lkey;

iser_task->headers_initialized = 1;
iser_task->iser_conn = iser_conn;
return 0;
}
Expand All @@ -166,8 +165,7 @@ iscsi_iser_task_init(struct iscsi_task *task)
{
struct iscsi_iser_task *iser_task = task->dd_data;

if (!iser_task->headers_initialized)
if (iser_initialize_task_headers(task, &iser_task->desc))
if (iser_initialize_task_headers(task, &iser_task->desc))
return -ENOMEM;

/* mgmt task */
Expand Down Expand Up @@ -278,6 +276,13 @@ iscsi_iser_task_xmit(struct iscsi_task *task)
static void iscsi_iser_cleanup_task(struct iscsi_task *task)
{
struct iscsi_iser_task *iser_task = task->dd_data;
struct iser_tx_desc *tx_desc = &iser_task->desc;

struct iscsi_iser_conn *iser_conn = task->conn->dd_data;
struct iser_device *device = iser_conn->ib_conn->device;

ib_dma_unmap_single(device->ib_device,
tx_desc->dma_addr, ISER_HEADERS_LEN, DMA_TO_DEVICE);

/* mgmt tasks do not need special cleanup */
if (!task->sc)
Expand Down
1 change: 0 additions & 1 deletion drivers/infiniband/ulp/iser/iscsi_iser.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ struct iscsi_iser_task {
struct iser_regd_buf rdma_regd[ISER_DIRS_NUM];/* regd rdma buf */
struct iser_data_buf data[ISER_DIRS_NUM]; /* orig. data des*/
struct iser_data_buf data_copy[ISER_DIRS_NUM];/* contig. copy */
int headers_initialized;
};

struct iser_page_vec {
Expand Down

0 comments on commit 5243954

Please sign in to comment.