1USB_SG_WAIT(9) USB Core APIs USB_SG_WAIT(9)
2
3
4
6 usb_sg_wait - synchronously execute scatter/gather request
7
9 void usb_sg_wait(struct usb_sg_request * io);
10
12 io
13 request block handle, as initialized with usb_sg_init. some fields
14 become accessible when this call returns.
15
17 !in_interrupt ()
18
20 This function blocks until the specified I/O operation completes. It
21 leverages the grouping of the related I/O requests to get good transfer
22 rates, by queueing the requests. At higher speeds, such queuing can
23 significantly improve USB throughput.
24
25 There are three kinds of completion for this function.
26
27 (1) success, where io->status is zero. The number of io->bytes
28 transferred is as requested. (2) error, where io->status is a negative
29 errno value. The number of io->bytes transferred before the error is
30 usually less than requested, and can be nonzero. (3) cancellation, a
31 type of error with status -ECONNRESET that is initiated by
32 usb_sg_cancel.
33
34 When this function returns, all memory allocated through usb_sg_init or
35 this call will have been freed. The request block parameter may still
36 be passed to usb_sg_cancel, or it may be freed. It could also be
37 reinitialized and then reused.
38
40 Bulk transfers are valid for full or high speed endpoints. The best
41 full speed data rate is 19 packets of 64 bytes each per frame, or 1216
42 bytes per millisecond. The best high speed data rate is 13 packets of
43 512 bytes each per microframe, or 52 KBytes per millisecond.
44
45 The reason to use interrupt transfers through this API would most
46 likely be to reserve high speed bandwidth, where up to 24 KBytes per
47 millisecond could be transferred. That capability is less useful for
48 low or full speed interrupt endpoints, which allow at most one packet
49 per millisecond, of at most 8 or 64 bytes (respectively).
50
51 It is not necessary to call this function to reserve bandwidth for
52 devices under an xHCI host controller, as the bandwidth is reserved
53 when the configuration or interface alt setting is selected.
54
56Kernel Hackers Manual 3.10 June 2019 USB_SG_WAIT(9)