diff options
Diffstat (limited to 'Documentation/DMA-API-HOWTO.txt')
-rw-r--r-- | Documentation/DMA-API-HOWTO.txt | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/Documentation/DMA-API-HOWTO.txt b/Documentation/DMA-API-HOWTO.txt index c3ab456422f3..bfd94e90af51 100644 --- a/Documentation/DMA-API-HOWTO.txt +++ b/Documentation/DMA-API-HOWTO.txt | |||
@@ -639,6 +639,36 @@ is planned to completely remove virt_to_bus() and bus_to_virt() as | |||
639 | they are entirely deprecated. Some ports already do not provide these | 639 | they are entirely deprecated. Some ports already do not provide these |
640 | as it is impossible to correctly support them. | 640 | as it is impossible to correctly support them. |
641 | 641 | ||
642 | Handling Errors | ||
643 | |||
644 | DMA address space is limited on some architectures and an allocation | ||
645 | failure can be determined by: | ||
646 | |||
647 | - checking if dma_alloc_coherent returns NULL or dma_map_sg returns 0 | ||
648 | |||
649 | - checking the returned dma_addr_t of dma_map_single and dma_map_page | ||
650 | by using dma_mapping_error(): | ||
651 | |||
652 | dma_addr_t dma_handle; | ||
653 | |||
654 | dma_handle = dma_map_single(dev, addr, size, direction); | ||
655 | if (dma_mapping_error(dev, dma_handle)) { | ||
656 | /* | ||
657 | * reduce current DMA mapping usage, | ||
658 | * delay and try again later or | ||
659 | * reset driver. | ||
660 | */ | ||
661 | } | ||
662 | |||
663 | Networking drivers must call dev_kfree_skb to free the socket buffer | ||
664 | and return NETDEV_TX_OK if the DMA mapping fails on the transmit hook | ||
665 | (ndo_start_xmit). This means that the socket buffer is just dropped in | ||
666 | the failure case. | ||
667 | |||
668 | SCSI drivers must return SCSI_MLQUEUE_HOST_BUSY if the DMA mapping | ||
669 | fails in the queuecommand hook. This means that the SCSI subsystem | ||
670 | passes the command to the driver again later. | ||
671 | |||
642 | Optimizing Unmap State Space Consumption | 672 | Optimizing Unmap State Space Consumption |
643 | 673 | ||
644 | On many platforms, dma_unmap_{single,page}() is simply a nop. | 674 | On many platforms, dma_unmap_{single,page}() is simply a nop. |
@@ -710,36 +740,6 @@ to "Closing". | |||
710 | 740 | ||
711 | 2) More to come... | 741 | 2) More to come... |
712 | 742 | ||
713 | Handling Errors | ||
714 | |||
715 | DMA address space is limited on some architectures and an allocation | ||
716 | failure can be determined by: | ||
717 | |||
718 | - checking if dma_alloc_coherent returns NULL or dma_map_sg returns 0 | ||
719 | |||
720 | - checking the returned dma_addr_t of dma_map_single and dma_map_page | ||
721 | by using dma_mapping_error(): | ||
722 | |||
723 | dma_addr_t dma_handle; | ||
724 | |||
725 | dma_handle = dma_map_single(dev, addr, size, direction); | ||
726 | if (dma_mapping_error(dev, dma_handle)) { | ||
727 | /* | ||
728 | * reduce current DMA mapping usage, | ||
729 | * delay and try again later or | ||
730 | * reset driver. | ||
731 | */ | ||
732 | } | ||
733 | |||
734 | Networking drivers must call dev_kfree_skb to free the socket buffer | ||
735 | and return NETDEV_TX_OK if the DMA mapping fails on the transmit hook | ||
736 | (ndo_start_xmit). This means that the socket buffer is just dropped in | ||
737 | the failure case. | ||
738 | |||
739 | SCSI drivers must return SCSI_MLQUEUE_HOST_BUSY if the DMA mapping | ||
740 | fails in the queuecommand hook. This means that the SCSI subsystem | ||
741 | passes the command to the driver again later. | ||
742 | |||
743 | Closing | 743 | Closing |
744 | 744 | ||
745 | This document, and the API itself, would not be in its current | 745 | This document, and the API itself, would not be in its current |