1. 02 9月, 2013 1 次提交
  2. 03 6月, 2013 1 次提交
  3. 19 2月, 2013 3 次提交
  4. 07 1月, 2013 1 次提交
  5. 19 12月, 2012 1 次提交
  6. 04 12月, 2012 1 次提交
    • H
      usb: Don't allow USB_RET_ASYNC for interrupt packets · be41efde
      Hans de Goede 提交于
      It is tempting to use USB_RET_ASYNC for interrupt packets, rather then the
      current NAK + polling approach, but this causes issues for migration, as
      an async completed packet will not getting written back to guest memory until
      the next poll time, and if a migration happens in between it will get lost!
      
      Make an exception for host devices, because:
      1) host-linux actually uses async completion for interrupt endpoints
      2) host devices don't migrate anyways
      
      Ideally we would convert host-linux.c to handle (input) interrupt endpoints in
      a buffered manner like it does for isoc endpoints, keeping multiple urbs
      submitted to ensure the devices timing requirements are met, as well as making
      its interrupt ep handling the same as other usb-devices.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      be41efde
  7. 09 11月, 2012 1 次提交
    • H
      usb: split packet result into actual_length + status · 9a77a0f5
      Hans de Goede 提交于
      Since with the ehci and xhci controllers a single packet can be larger
      then maxpacketsize, it is possible for the result of a single packet
      to be both having transferred some data as well as the transfer to have
      an error.
      
      An example would be an input transfer from a bulk endpoint successfully
      receiving 1 or more maxpacketsize packets from the device, followed
      by a packet signalling halt.
      
      While already touching all the devices and controllers handle_packet /
      handle_data / handle_control code, also change the return type of
      these functions to void, solely storing the status in the packet. To
      make the code paths for regular versus async packet handling more
      uniform.
      
      This patch unfortunately is somewhat invasive, since makeing the qemu
      usb core deal with this requires changes everywhere. This patch only
      prepares the usb core for this, all the hcd / device changes are done
      in such a way that there are no functional changes.
      
      This patch has been tested with uhci and ehci hcds, together with usb-audio,
      usb-hid and usb-storage devices, as well as with usb-redir redirection
      with a wide variety of real devices.
      
      Note that there is usually no need to directly set packet->actual_length
      form devices handle_data callback, as that is done by usb_packet_copy()
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      9a77a0f5
  8. 01 11月, 2012 1 次提交
    • H
      usb: Add packet combining functions · a552a966
      Hans de Goede 提交于
      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: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      a552a966
  9. 25 10月, 2012 6 次提交
  10. 11 9月, 2012 3 次提交
  11. 31 8月, 2012 2 次提交
    • G
      usb: unique packet ids · e983395d
      Gerd Hoffmann 提交于
      This patch adds IDs to usb packets.  Those IDs are (a) supposed to be
      unique for the lifecycle of a packet (from packet setup until the packet
      is either completed or canceled) and (b) stable across migration.
      
      uhci, ohci, ehci and xhci use the guest physical address of the transfer
      descriptor for this.
      
      musb needs a different approach because there is no transfer descriptor.
      But musb also doesn't support pipelining, so we have never more than one
      packet per endpoint in flight.  So we go create an ID based on endpoint
      and device address.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      e983395d
    • H
      usb: Halt ep queue en cancel pending packets on a packet error · 0132b4b6
      Hans de Goede 提交于
      For controllers which queue up more then 1 packet at a time, we must halt the
      ep queue, and inside the controller code cancel all pending packets on an
      error.
      
      There are multiple reasons for this:
      1) Guests expect the controllers to halt ep queues on error, so that they
      get the opportunity to cancel transfers which the scheduled after the failing
      one, before processing continues
      
      2) Not cancelling queued up packets after a failed transfer also messes up
      the controller state machine, in the case of EHCI causing the following
      assert to trigger: "assert(p->qtdaddr == q->qtdaddr)" at hcd-ehci.c:2075
      
      3) For bulk endpoints with pipelining enabled (redirection to a real USB
      device), we must cancel all the transfers after this a failed one so that:
      a) If they've completed already, they are not processed further causing more
         stalls to be reported, originating from the same failed transfer
      b) If still in flight, they are cancelled before the guest does
         a clear stall, otherwise the guest and device can loose sync!
      
      Note this patch only touches the ehci and uhci controller changes, since AFAIK
      no other controllers actually queue up multiple transfer. If I'm wrong on this
      other controllers need to be updated too!
      
      Also note that this patch was heavily tested with the ehci code, where I had
      a reproducer for a device causing a transfer to fail. The uhci code is not
      tested with actually failing transfers and could do with a thorough review!
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      0132b4b6
  12. 16 8月, 2012 1 次提交
  13. 09 7月, 2012 2 次提交
  14. 08 6月, 2012 1 次提交
    • M
      change iov_* function prototypes to be more appropriate · dcf6f5e1
      Michael Tokarev 提交于
      Reorder arguments to be more natural, readable and
      consistent with other iov_* functions, and change
      argument names, from:
       iov_from_buf(iov, iov_cnt, buf, iov_off, size)
      to
       iov_from_buf(iov, iov_cnt, offset, buf, bytes)
      
      The result becomes natural English:
      
       copy data to this `iov' vector with `iov_cnt'
       elements starting at byte offset `offset'
       from memory buffer `buf', processing `bytes'
       bytes max.
      
      (Try to read the original prototype this way).
      
      Also change iov_clear() to more general iov_memset()
      (it uses memset() internally anyway).
      
      While at it, add comments to the header file
      describing what the routines actually does.
      
      The patch only renames argumens in the header, but
      keeps old names in the implementation.  The next
      patch will touch actual code to match.
      
      Now, it might look wrong to pay so much attention
      to so small things.  But we've so many badly designed
      interfaces already so the whole thing becomes rather
      confusing or error prone.  One example of this is
      previous commit and small discussion which emerged
      from it, with an outcome that the utility functions
      like these aren't well-understdandable, leading to
      strange usage cases.  That's why I paid quite some
      attention to this set of functions and a few
      others in subsequent patches.
      Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
      dcf6f5e1
  15. 26 4月, 2012 1 次提交
  16. 17 4月, 2012 1 次提交
  17. 13 3月, 2012 2 次提交
  18. 07 3月, 2012 3 次提交
  19. 27 2月, 2012 1 次提交
  20. 10 2月, 2012 7 次提交