USB Transfer and Packet Sizes

This topic describes USB transfer sizes allowed in various versions of the Windows operating system.

Maximum transfer size

The maximum transfer size specifies hard-coded limits in the USB driver stack. It is possible that transfer sizes below these limits will fail because of system resource limitations. To avoid these types of failures and to ensure compatibility across all versions of Windows, avoid using large transfer sizes for USB transfers.

Note  

In Windows XP, Windows Server 2003, and later versions, MaximumTransferSize member of the USBD_PIPE_INFORMATION structure is obsolete. The USB driver stack ignores the value in MaximumTransferSize for both composite and non-composite devices.

In Windows 2000, the USB driver stack initializes MaximumTransferSize to USBD_DEFAULT_MAXIMUM_TRANSFER_SIZE. A client driver can set a smaller value while configuring the device. For a composite device, the client driver for each function can only change MaximumTransferSize for pipes in the non-default interface setting.

USB transfer sizes are subject to the following limits:

Transfer pipeWindows 8.1, Windows 8Windows 7, Windows VistaWindows XP, Windows Server 2003Windows 2000
Control

64K for SuperSpeed and high speed (xHCI)

4K for full and low speed (xHCI, EHCI, UHCI, OHCI)

For UHCI, 4K on the default endpoint; 64K on non-default control pipes

64K for high speed (EHCI)

4K for full and low speed (EHCI, UHCI, OHCI)

For UHCI, 4K on the default endpoint; 64K on non-default control pipes (UHCI)

64K for high speed (EHCI)

4K for full and low speed (EHCI, UHCI, OHCI)

For UHCI, 4K on the default endpoint; 64K on non-default control pipes (UHCI)

4K on the default endpoint; 64K on non-default control pipes (OHCI)

Interrupt

4MB for SuperSpeed, high, full, and low speed (xHCI, EHCI, UHCI, OHCI)

4MB for high, full, and low speed (EHCI, UHCI, OHCI)

Unlimited

Undetermined(OHCI)

Bulk

32MB for SuperSpeed (xHCI)

4MB for high and full speed (xHCI)

4MB for high and full speed (EHCI and UHCI)

256K full speed (OHCI)

4MB for high and full speed (EHCI, UHCI)

256K for full speed (OHCI)

3MB for high and full speed (EHCI)

Undetermined (UHCI)

256K for full speed (OHCI)

Undetermined(OHCI)

Isochronous

1024*wBytesPerInterval (see USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR) for SuperSpeed (xHCI)

1024* MaximumPacketSize for high speed (xHCI, EHCI)

256 * MaximumPacketSize for full speed (xHCI, EHCI)

64K for full speed (UHCI, OHCI)

1024* MaximumPacketSize for high speed (EHCI)

256 * MaximumPacketSize for full-speed (EHCI)

64K for full speed (UHCI, OHCI)

1024* MaximumPacketSize for high-speed (EHCI)

256 * MaximumPacketSize for full speed (EHCI)

64K for full speed (UHCI, OHCI)

64K for full speed (OHCI)

 

Restricting the transfer size with MaximumTransferSize does not directly affect how much bandwidth a device consumes. The client driver must either change the interface setting or restrict the maximum packet size set in the MaximumPacketSize member of USBD_PIPE_INFORMATION.

Maximum packet size

The maximum packet size is defined by the wMaxPacketSize field of the endpoint descriptor. A client driver can regulate the USB packet size in a select-interface request to the device. Changing this value does not change the wMaxPacketSize on the device.

In the URB for the request is a USBD_PIPE_INFORMATION structure for the pipe. In that structure,

  • Modify the MaximumPacketSize member of the USBD_PIPE_INFORMATION structure. Set it to a value less than or equal to the value of wMaxPacketSize defined in device firmware for the current interface setting.
  • Set the USBD_PF_CHANGE_MAX_PACKET flag in the PipeFlags member USBD_PIPE_INFORMATION structure.

For information about selecting an interface setting, see How to Select a Configuration for a USB Device.

Maximum packet size restriction on read transfer buffers

When a client driver makes a read request, the transfer buffer must be a multiple of the maximum packet size. Even when the driver expects data less than the maximum packet size, it must still request the entire packet. When the device sends a packet less than the maximum size (a short packet), it's an indication that the transfer is complete.

Note  

On older controllers, the client driver can override the behavior. In the TransferFlags member of the data transfer URB, the client driver must set the USBD_SHORT_TRANSFER_OK flag. That flag permits the device to send packets smaller than wMaxPacketSize.

On xHCI host controllers, USBD_SHORT_TRANSFER_OK ignored for bulk and interrupt endpoints. Transfer of short packets on EHCI controllers does not result in an error condition.

On EHCI host controllers, USBD_SHORT_TRANSFER_OK is ignored for bulk and interrupt endpoints.

On UHCI and OHCI host controllers, if USBD_SHORT_TRANSFER_OK is not set for a bulk or interrupt transfer, a short packet transfer halts the endpoint and an error code is returned for the transfer.

Delimiting write transfers with short packets

The USB driver stack driver does not impose the same restrictions on packet size, when writing to the device, that it imposes when reading from the device. Some client drivers must make frequent transmissions of small quantities of control data to manage their devices. It is impractical to restrict data transmissions to packets of uniform size in such cases. Therefore, the driver stack does not assign any special significance to packets of size less than the endpoint's maximum size during data writes. This allows a client driver to break a large transfer to the device into multiple URBs of any size less than or equal to the maximum.

The driver must either end the transmission by means of a packet of less than maximum size, or delimit the end of the transmission by means of a zero-length packet. The transmission is not complete until the driver sends a packet smaller than wMaxPacketSize. If the transfer size is an exact multiple of the maximum, the driver must send a zero-length delimiting packet to explicitly terminate the transfer

Delimiting the data transmission with zero-length packets, as required by the USB specification, is the responsibility of the client driver. The USB driver stack does not generate these packets automatically.

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft. All rights reserved.