[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1352109631-3385-15-git-send-email-b.zolnierkie@samsung.com>
Date: Mon, 05 Nov 2012 11:00:25 +0100
From: Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
To: linux-kernel@...r.kernel.org
Cc: djbw@...com, dwmw2@...radead.org, hskinnemoen@...il.com,
iws@...o.caltech.edu, vinod.koul@...el.com, vipin.kumar@...com,
t.figa@...sung.com, kyungmin.park@...sung.com,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
Subject: [PATCH 14/20] async_tx: do DMA unmap in core for XOR_VAL operations
Convert core async_tx code (async_xor_val()) to do DMA unmapping
itself using the ->callback functionality.
Cc: Dan Williams <djbw@...com>
Cc: Tomasz Figa <t.figa@...sung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@...sung.com>
---
crypto/async_tx/async_xor.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/crypto/async_tx/async_xor.c b/crypto/async_tx/async_xor.c
index 59a4af3..d44da16 100644
--- a/crypto/async_tx/async_xor.c
+++ b/crypto/async_tx/async_xor.c
@@ -284,6 +284,20 @@ xor_val_chan(struct async_submit_ctl *submit, struct page *dest,
src_cnt, len);
}
+static void async_xor_val_cb(void *dma_async_param)
+{
+ struct dma_async_tx_descriptor *tx = dma_async_param;
+ struct dma_device *dev = tx->chan->device;
+ int i;
+
+ for (i = 0; i < tx->dma_src_cnt; i++)
+ dma_unmap_page(dev->dev, tx->dma_src[i], tx->dma_len,
+ DMA_TO_DEVICE);
+
+ if (tx->orig_callback)
+ tx->orig_callback(tx->orig_callback_param);
+}
+
/**
* async_xor_val - attempt a xor parity check with a dma engine.
* @dest: destination page used if the xor is performed synchronously
@@ -319,7 +333,8 @@ async_xor_val(struct page *dest, struct page **src_list, unsigned int offset,
if (dma_src && device && src_cnt <= device->max_xor &&
is_dma_xor_aligned(device, offset, 0, len)) {
- unsigned long dma_prep_flags = 0;
+ unsigned long dma_prep_flags = DMA_COMPL_SKIP_SRC_UNMAP |
+ DMA_COMPL_SKIP_DEST_UNMAP;
int i;
pr_debug("%s: (async) len: %zu\n", __func__, len);
@@ -346,7 +361,12 @@ async_xor_val(struct page *dest, struct page **src_list, unsigned int offset,
}
}
- async_tx_submit(chan, tx, submit);
+ for (i = 0; i < src_cnt; i++)
+ tx->dma_src[i] = dma_src[i];
+ tx->dma_src_cnt = src_cnt;
+ tx->dma_len = len;
+
+ __async_tx_submit(chan, tx, async_xor_val_cb, tx, submit);
} else {
enum async_tx_flags flags_orig = submit->flags;
--
1.8.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists