qemu/hw/usb
Hans de Goede a552a966f1 usb: Add packet combining functions
Currently we only do pipelining for output endpoints, since to properly
support short-not-ok semantics we can only have one outstanding input
packet. Since the ehci and uhci controllers have a limited per td packet
size guests will split large input transfers to into multiple packets,
and since we don't pipeline these, this comes with a serious performance
penalty.

This patch adds helper functions to (re-)combine packets which belong to 1
transfer at the guest device-driver level into 1 large transger. This can be
used by (redirection) usb-devices to enable pipelining for input endpoints.

This patch will combine packets together until a transfer terminating packet
is encountered. A terminating packet is a packet which meets one or more of
the following conditions:
1) The packet size is *not* a multiple of the endpoint max packet size
2) The packet does *not* have its short-not-ok flag set
3) The packet has its interrupt-on-complete flag set

The short-not-ok flag of the combined packet is that of the terminating packet.
Multiple combined packets may be submitted to the device, if the combined
packets do not have their short-not-ok flag set, enabling true pipelining.

If a combined packet does have its short-not-ok flag set the queue will
wait with submitting further packets to the device until that packet has
completed.

Once enabled in the usb-redir and ehci code, this improves the speed (MB/s)
of a Linux guest reading from a USB mass storage device by a factor of
1.2 - 1.5.

And the main reason why I started working on this, when reading from a pl2303
USB<->serial converter, it combines the previous 4 packets submitted per
device-driver level read into 1 big read, reducing the number of packets / sec
by a factor 4, and it allows to have multiple reads outstanding. This allows
for much better latency tolerance without the pl2303's internal buffer
overflowing (which was happening at 115200 bps, without serial flow control).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01 15:17:58 +01:00
..
bus.c usb: Add USB_RET_ADD_TO_QUEUE packet result code 2012-10-25 09:08:09 +02:00
combined-packet.c usb: Add packet combining functions 2012-11-01 15:17:58 +01:00
core.c usb: Add packet combining functions 2012-11-01 15:17:58 +01:00
desc.c usb3: bos decriptor 2012-09-11 07:43:01 +02:00
desc.h usb3: bos decriptor 2012-09-11 07:43:01 +02:00
dev-audio.c usb-audio: fix usb version 2012-09-11 07:43:00 +02:00
dev-bluetooth.c Allow machines to configure the QEMU_VERSION that's exposed via hardware 2012-06-19 13:36:56 -05:00
dev-hid.c Allow machines to configure the QEMU_VERSION that's exposed via hardware 2012-06-19 13:36:56 -05:00
dev-hub.c Allow machines to configure the QEMU_VERSION that's exposed via hardware 2012-06-19 13:36:56 -05:00
dev-network.c net: fix usbnet_receive() packet drops 2012-09-14 08:40:32 +01:00
dev-serial.c usb-serial: only expose device in guest when the chardev is open 2012-10-22 13:26:42 -05:00
dev-smartcard-reader.c Allow machines to configure the QEMU_VERSION that's exposed via hardware 2012-06-19 13:36:56 -05:00
dev-storage.c usb-storage: usb3 support 2012-09-11 07:43:01 +02:00
dev-uas.c cleanup useless return sentence 2012-10-05 15:10:21 +02:00
dev-wacom.c Allow machines to configure the QEMU_VERSION that's exposed via hardware 2012-06-19 13:36:56 -05:00
hcd-ehci-pci.c usb/ehci-pci: add helper to create ich9 usb controllers 2012-11-01 15:17:58 +01:00
hcd-ehci-sysbus.c usb/ehci: add sysbus variant 2012-11-01 13:10:10 +01:00
hcd-ehci.c usb/ehci: split into multiple source files 2012-11-01 13:10:10 +01:00
hcd-ehci.h usb/ehci: split into multiple source files 2012-11-01 13:10:10 +01:00
hcd-musb.c usb: Add an int_req flag to USBPacket 2012-10-25 09:08:10 +02:00
hcd-ohci.c usb: Add an int_req flag to USBPacket 2012-10-25 09:08:10 +02:00
hcd-uhci.c uhci: Don't crash on device disconnect 2012-11-01 15:17:58 +01:00
hcd-xhci.c xhci: allow address slot being called multiple times 2012-11-01 13:10:09 +01:00
host-bsd.c
host-linux.c usb: Move short-not-ok handling to the core 2012-10-25 09:08:10 +02:00
host-stub.c
libhw.c usb: Fix usb_packet_map() in the presence of IOMMUs 2012-09-26 09:24:42 +02:00
Makefile.objs usb: Add packet combining functions 2012-11-01 15:17:58 +01:00
redirect.c usb: Move short-not-ok handling to the core 2012-10-25 09:08:10 +02:00