[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/14] usb-redir: simplify packet copy
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 10/14] usb-redir: simplify packet copy |
Date: |
Thu, 21 Feb 2013 10:59:09 +0100 |
usb_packet_copy can handle combined packets now,
so it isn't needed to special-case them any more.
Also use the new usb_packet_size() function.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb/redirect.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 8c0ead0..7078403 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -737,7 +737,7 @@ static void usbredir_handle_bulk_data(USBRedirDevice *dev,
USBPacket *p,
uint8_t ep)
{
struct usb_redir_bulk_packet_header bulk_packet;
- size_t size = (p->combined) ? p->combined->iov.size : p->iov.size;
+ size_t size = usb_packet_size(p);
const int maxp = dev->endpoint[EP2I(ep)].max_packet_size;
if (usbredir_already_in_flight(dev, p->id)) {
@@ -771,12 +771,7 @@ static void usbredir_handle_bulk_data(USBRedirDevice *dev,
USBPacket *p,
&bulk_packet, NULL, 0);
} else {
uint8_t buf[size];
- if (p->combined) {
- iov_to_buf(p->combined->iov.iov, p->combined->iov.niov,
- 0, buf, size);
- } else {
- usb_packet_copy(p, buf, size);
- }
+ usb_packet_copy(p, buf, size);
usbredir_log_data(dev, "bulk data out:", buf, size);
usbredirparser_send_bulk_packet(dev->parser, p->id,
&bulk_packet, buf, size);
@@ -1830,7 +1825,7 @@ static void usbredir_bulk_packet(void *priv, uint64_t id,
p = usbredir_find_packet_by_id(dev, ep, id);
if (p) {
- size_t size = (p->combined) ? p->combined->iov.size : p->iov.size;
+ size_t size = usb_packet_size(p);
usbredir_handle_status(dev, p, bulk_packet->status);
if (data_len > 0) {
usbredir_log_data(dev, "bulk data in:", data, data_len);
@@ -1840,12 +1835,7 @@ static void usbredir_bulk_packet(void *priv, uint64_t id,
p->status = USB_RET_BABBLE;
data_len = len = size;
}
- if (p->combined) {
- iov_from_buf(p->combined->iov.iov, p->combined->iov.niov,
- 0, data, data_len);
- } else {
- usb_packet_copy(p, data, data_len);
- }
+ usb_packet_copy(p, data, data_len);
}
p->actual_length = len;
if (p->pid == USB_TOKEN_IN && p->ep->pipeline) {
--
1.7.9.7
- [Qemu-devel] [PULL 00/14] usb patch queue, Gerd Hoffmann, 2013/02/21
- [Qemu-devel] [PATCH 03/14] make usb devices configurable, Gerd Hoffmann, 2013/02/21
- [Qemu-devel] [PATCH 02/14] fix scripts/make_device_config.sh, Gerd Hoffmann, 2013/02/21
- [Qemu-devel] [PATCH 10/14] usb-redir: simplify packet copy,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 07/14] usb-host: remove usb_host_device_close, Gerd Hoffmann, 2013/02/21
- [Qemu-devel] [PATCH 08/14] usb: add usb_ep_set_halted, Gerd Hoffmann, 2013/02/21
- [Qemu-devel] [PATCH 05/14] usb-storage: use scsi_req_enqueue return value, Gerd Hoffmann, 2013/02/21
- [Qemu-devel] [PATCH 11/14] usb: fix endpoint descriptor ordering, Gerd Hoffmann, 2013/02/21
- [Qemu-devel] [PATCH 09/14] usb: make usb_packet_copy operate on combined packets, Gerd Hoffmann, 2013/02/21
- [Qemu-devel] [PATCH 04/14] allow disabling usb smartcard support, Gerd Hoffmann, 2013/02/21
- [Qemu-devel] [PATCH 01/14] usb: Makefile cleanup, Gerd Hoffmann, 2013/02/21
- [Qemu-devel] [PATCH 12/14] usb-core: usb3 streams, Gerd Hoffmann, 2013/02/21