1USB_BUFFER_ALLOC(9)              USB Core APIs             USB_BUFFER_ALLOC(9)
2
3
4

NAME

6       usb_buffer_alloc - allocate dma-consistent buffer for
7       URB_NO_xxx_DMA_MAP
8

SYNOPSIS

10       void * usb_buffer_alloc(struct usb_device * dev, size_t size,
11                               gfp_t mem_flags, dma_addr_t * dma);
12

ARGUMENTS

14       dev
15           device the buffer will be used with
16
17       size
18           requested buffer size
19
20       mem_flags
21           affect whether allocation may block
22
23       dma
24           used to return DMA address of buffer
25

DESCRIPTION

27       Return value is either null (indicating no buffer could be allocated),
28       or the cpu-space pointer to a buffer that may be used to perform DMA to
29       the specified device. Such cpu-space buffers are returned along with
30       the DMA address (through the pointer provided).
31
32       These buffers are used with URB_NO_xxx_DMA_MAP set in
33       urb->transfer_flags to avoid behaviors like using “DMA bounce buffers”,
34       or thrashing IOMMU hardware during URB completion/resubmit. The
35       implementation varies between platforms, depending on details of how
36       DMA will work to this device. Using these buffers also eliminates
37       cacheline sharing problems on architectures where CPU caches are not
38       DMA-coherent. On systems without bus-snooping caches, these buffers are
39       uncached.
40
41       When the buffer is no longer used, free it with usb_buffer_free.
42
44Kernel Hackers Manual 2.6.         June 2019               USB_BUFFER_ALLOC(9)
Impressum