The current code never did DMA unmapping on these buffers. Fix that
by adding unmapping to the task cleanup callback, and mapping each
time the task init function is called (drop the headers_initialized
micro-optimization). What we really want here is dma_sync on task init
and dma_unsync on task fini.

But currently it seems there's no flow for the iser transport to call
dma_unmap when the session goes down, TBD.

Signed-off-by: Or Gerlitz <ogerl...@mellanox.com>
---

Mike, any idea? do I miss something and the transport can find a slot in
the session teardown flow to go  and issue an operation (e.g dma unmapping
in the iser case), on the per transport task portion?

 drivers/infiniband/ulp/iser/iscsi_iser.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)


diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c 
b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 9c61b9c..49cf30f 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -151,7 +151,9 @@ 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;
+       /* don't set that bit such that dma mapping would take
+       place on each usage of the descriptor */
+       /* iser_task->headers_initialized       = 1; */
        iser_task->iser_conn            = iser_conn;
        return 0;
 }
@@ -278,6 +280,15 @@ 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;
+
+       iser_dbg("task %p itt 0x%x sc %p\n",task, task->itt, task->sc);
+
+       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)

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.

Reply via email to