mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-04-01 03:44:08 +00:00
Documentation: move the error handling to the better place in DMA-API-HOWTO
Handing DMA mapping errors is essential. Let's put it in the more appropriate place rather than the end of the doc. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
b02de87161
commit
4ae9ca825e
1 changed files with 30 additions and 30 deletions
|
@ -639,6 +639,36 @@ is planned to completely remove virt_to_bus() and bus_to_virt() as
|
||||||
they are entirely deprecated. Some ports already do not provide these
|
they are entirely deprecated. Some ports already do not provide these
|
||||||
as it is impossible to correctly support them.
|
as it is impossible to correctly support them.
|
||||||
|
|
||||||
|
Handling Errors
|
||||||
|
|
||||||
|
DMA address space is limited on some architectures and an allocation
|
||||||
|
failure can be determined by:
|
||||||
|
|
||||||
|
- checking if dma_alloc_coherent returns NULL or dma_map_sg returns 0
|
||||||
|
|
||||||
|
- checking the returned dma_addr_t of dma_map_single and dma_map_page
|
||||||
|
by using dma_mapping_error():
|
||||||
|
|
||||||
|
dma_addr_t dma_handle;
|
||||||
|
|
||||||
|
dma_handle = dma_map_single(dev, addr, size, direction);
|
||||||
|
if (dma_mapping_error(dev, dma_handle)) {
|
||||||
|
/*
|
||||||
|
* reduce current DMA mapping usage,
|
||||||
|
* delay and try again later or
|
||||||
|
* reset driver.
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
Networking drivers must call dev_kfree_skb to free the socket buffer
|
||||||
|
and return NETDEV_TX_OK if the DMA mapping fails on the transmit hook
|
||||||
|
(ndo_start_xmit). This means that the socket buffer is just dropped in
|
||||||
|
the failure case.
|
||||||
|
|
||||||
|
SCSI drivers must return SCSI_MLQUEUE_HOST_BUSY if the DMA mapping
|
||||||
|
fails in the queuecommand hook. This means that the SCSI subsystem
|
||||||
|
passes the command to the driver again later.
|
||||||
|
|
||||||
Optimizing Unmap State Space Consumption
|
Optimizing Unmap State Space Consumption
|
||||||
|
|
||||||
On many platforms, dma_unmap_{single,page}() is simply a nop.
|
On many platforms, dma_unmap_{single,page}() is simply a nop.
|
||||||
|
@ -710,36 +740,6 @@ to "Closing".
|
||||||
|
|
||||||
2) More to come...
|
2) More to come...
|
||||||
|
|
||||||
Handling Errors
|
|
||||||
|
|
||||||
DMA address space is limited on some architectures and an allocation
|
|
||||||
failure can be determined by:
|
|
||||||
|
|
||||||
- checking if dma_alloc_coherent returns NULL or dma_map_sg returns 0
|
|
||||||
|
|
||||||
- checking the returned dma_addr_t of dma_map_single and dma_map_page
|
|
||||||
by using dma_mapping_error():
|
|
||||||
|
|
||||||
dma_addr_t dma_handle;
|
|
||||||
|
|
||||||
dma_handle = dma_map_single(dev, addr, size, direction);
|
|
||||||
if (dma_mapping_error(dev, dma_handle)) {
|
|
||||||
/*
|
|
||||||
* reduce current DMA mapping usage,
|
|
||||||
* delay and try again later or
|
|
||||||
* reset driver.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
Networking drivers must call dev_kfree_skb to free the socket buffer
|
|
||||||
and return NETDEV_TX_OK if the DMA mapping fails on the transmit hook
|
|
||||||
(ndo_start_xmit). This means that the socket buffer is just dropped in
|
|
||||||
the failure case.
|
|
||||||
|
|
||||||
SCSI drivers must return SCSI_MLQUEUE_HOST_BUSY if the DMA mapping
|
|
||||||
fails in the queuecommand hook. This means that the SCSI subsystem
|
|
||||||
passes the command to the driver again later.
|
|
||||||
|
|
||||||
Closing
|
Closing
|
||||||
|
|
||||||
This document, and the API itself, would not be in its current
|
This document, and the API itself, would not be in its current
|
||||||
|
|
Loading…
Add table
Reference in a new issue