1USB_BUFFER_MAP_SG(9) USB Core APIs USB_BUFFER_MAP_SG(9)
2
3
4
6 usb_buffer_map_sg - create scatterlist DMA mapping(s) for an endpoint
7
9 int usb_buffer_map_sg(const struct usb_device * dev, int is_in,
10 struct scatterlist * sg, int nents);
11
13 dev
14 device to which the scatterlist will be mapped
15
16 is_in
17 mapping transfer direction
18
19 sg
20 the scatterlist to map
21
22 nents
23 the number of entries in the scatterlist
24
26 Either < 0 (indicating no buffers could be mapped), or the number of
27 DMA mapping array entries in the scatterlist.
28
30 The caller is responsible for placing the resulting DMA addresses from
31 the scatterlist into URB transfer buffer pointers, and for setting the
32 URB_NO_TRANSFER_DMA_MAP transfer flag in each of those URBs.
33
34 Top I/O rates come from queuing URBs, instead of waiting for each one
35 to complete before starting the next I/O. This is particularly easy to
36 do with scatterlists. Just allocate and submit one URB for each DMA
37 mapping entry returned, stopping on the first error or when all
38 succeed. Better yet, use the usb_sg_*() calls, which do that (and more)
39 for you.
40
41 This call would normally be used when translating scatterlist requests,
42 rather than usb_buffer_map, since on some hardware (with IOMMUs) it may
43 be able to coalesce mappings for improved I/O efficiency.
44
45 Reverse the effect of this call with usb_buffer_unmap_sg.
46
48Kernel Hackers Manual 3.10 June 2019 USB_BUFFER_MAP_SG(9)