Re: [RFC v2 0/5] dmaengine: Slave DMA interface and example users
From: Haavard Skinnemoen
Date: Mon Feb 04 2008 - 10:32:28 EST
On Wed, 30 Jan 2008 10:39:47 -0700
"Dan Williams" <dan.j.williams@xxxxxxxxx> wrote:
> Agreed, the issue is how to do this without requiring an
> interrupt+callback sequence for each transaction or requiring the
> client to carry per transaction unmap-data. For example NET_DMA never
> sees a dma_addr_t and assumes that all it needs to care about is the
> last transaction in a sequence. Since it is alive for the duration of
> a transaction, we could put unmap data in dma_async_tx_descriptor
> along with an unmap function pointer since dma_unmap* routines have an
> equal number of parameters. But I just got through making this
> structure smaller so maybe there is a better way.
I have to say I'm not crazy about the idea of adding more callbacks to
the descriptor...
The client must somehow know when the transfer is complete -- after
all, it has to call async_tx_ack() at some point. So additional
callbacks shouldn't be needed.
How about adding more variants of the "ack" function -- one for each
kind of transfer? For example, after an async_memcpy() transaction is
complete, the client must call async_memcpy_ack(), which could be an
inline function containing something along the lines of
static inline void async_memcpy_ack(struct dma_async_tx_descriptor *tx)
{
struct dma_device *dma = tx->chan->device;
dma_unmap_page(dma->dev, tx->src_phys, tx->len, DMA_TO_DEVICE);
dma_unmap_page(dma->dev, tx->dst_phys, tx->len, DMA_FROM_DEVICE);
async_tx_ack(tx);
}
which would evaluate to just async_tx_ack(tx) in most cases, since
dma_unmap_page() usually doesn't actually do anything.
This requires three additional fields in the dma_async_tx_descriptor
structure, but in many cases the driver needs these fields in its own
private descriptor wrapper anyway.
Haavard
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/