[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 02/13] usb-linux: make iso urb count contigurable
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 02/13] usb-linux: make iso urb count contigurable |
Date: |
Fri, 24 Jun 2011 12:59:24 +0200 |
Add a qdev property for the number of iso urbs which
usb-linux keeps in flight, so it can be configured at
runtime. Make it default to four (old hardcoded value
used to be three).
Signed-off-by: Gerd Hoffmann <address@hidden>
---
usb-linux.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/usb-linux.c b/usb-linux.c
index 3c6156a..f65dcb7 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -85,7 +85,6 @@ static int usb_fs_type;
/* endpoint association data */
#define ISO_FRAME_DESC_PER_URB 32
-#define ISO_URB_COUNT 3
#define INVALID_EP_TYPE 255
/* devio.c limits single requests to 16k */
@@ -120,6 +119,7 @@ typedef struct USBHostDevice {
int configuration;
int ninterfaces;
int closing;
+ uint32_t iso_urb_count;
Notifier exit;
struct endp_data endp_table[MAX_ENDPOINTS];
@@ -505,8 +505,8 @@ static AsyncURB *usb_host_alloc_iso(USBHostDevice *s,
uint8_t ep, int in)
AsyncURB *aurb;
int i, j, len = get_max_packet_size(s, ep);
- aurb = qemu_mallocz(ISO_URB_COUNT * sizeof(*aurb));
- for (i = 0; i < ISO_URB_COUNT; i++) {
+ aurb = qemu_mallocz(s->iso_urb_count * sizeof(*aurb));
+ for (i = 0; i < s->iso_urb_count; i++) {
aurb[i].urb.endpoint = ep;
aurb[i].urb.buffer_length = ISO_FRAME_DESC_PER_URB * len;
aurb[i].urb.buffer = qemu_malloc(aurb[i].urb.buffer_length);
@@ -536,7 +536,7 @@ static void usb_host_stop_n_free_iso(USBHostDevice *s,
uint8_t ep)
return;
}
- for (i = 0; i < ISO_URB_COUNT; i++) {
+ for (i = 0; i < s->iso_urb_count; i++) {
/* in flight? */
if (aurb[i].iso_frame_idx == -1) {
ret = ioctl(s->fd, USBDEVFS_DISCARDURB, &aurb[i]);
@@ -554,7 +554,7 @@ static void usb_host_stop_n_free_iso(USBHostDevice *s,
uint8_t ep)
async_complete(s);
}
- for (i = 0; i < ISO_URB_COUNT; i++) {
+ for (i = 0; i < s->iso_urb_count; i++) {
qemu_free(aurb[i].urb.buffer);
}
@@ -639,7 +639,7 @@ static int usb_host_handle_iso_data(USBHostDevice *s,
USBPacket *p, int in)
}
aurb[i].iso_frame_idx++;
if (aurb[i].iso_frame_idx == ISO_FRAME_DESC_PER_URB) {
- i = (i + 1) % ISO_URB_COUNT;
+ i = (i + 1) % s->iso_urb_count;
set_iso_urb_idx(s, p->devep, i);
}
} else {
@@ -652,7 +652,7 @@ static int usb_host_handle_iso_data(USBHostDevice *s,
USBPacket *p, int in)
if (is_iso_started(s, p->devep)) {
/* (Re)-submit all fully consumed / filled urbs */
- for (i = 0; i < ISO_URB_COUNT; i++) {
+ for (i = 0; i < s->iso_urb_count; i++) {
if (aurb[i].iso_frame_idx == ISO_FRAME_DESC_PER_URB) {
ret = ioctl(s->fd, USBDEVFS_SUBMITURB, &aurb[i]);
if (ret < 0) {
@@ -1233,6 +1233,7 @@ static struct USBDeviceInfo usb_host_dev_info = {
DEFINE_PROP_STRING("hostport", USBHostDevice, match.port),
DEFINE_PROP_HEX32("vendorid", USBHostDevice, match.vendor_id, 0),
DEFINE_PROP_HEX32("productid", USBHostDevice, match.product_id, 0),
+ DEFINE_PROP_UINT32("isobufs", USBHostDevice, iso_urb_count, 4),
DEFINE_PROP_END_OF_LIST(),
},
};
--
1.7.1
- [Qemu-devel] [PULL] usb patch queue, Gerd Hoffmann, 2011/06/14
- [Qemu-devel] [PULL] usb patch queue, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 03/13] usb-linux: track inflight iso urb count, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 04/13] ehci: add freq + maxframes properties, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 02/13] usb-linux: make iso urb count contigurable,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 01/13] usb-linux: add get_endp(), Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 06/13] usb-bus: Don't allow attaching a device to a bus with no free ports, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 05/13] ehci: switch to nanoseconds, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 09/13] usb-linux: allow "compatible" high speed devices to connect at fullspeed, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 08/13] usb: Add a speedmask to devices, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 13/13] usb: ignore USB_DT_DEBUG, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 11/13] hw/usb-ohci.c: Fix handling of remote wakeup corner cases, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 07/13] usb: Proper error propagation for usb_device_attach errors, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 12/13] usb-storage: Turn drive serial into a qdev property usb-storage.serial, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 10/13] usb-bus: Don't allow speed mismatch while attaching devices, Gerd Hoffmann, 2011/06/24