1. 05 3月, 2014 9 次提交
  2. 26 1月, 2013 1 次提交
  3. 12 1月, 2013 6 次提交
  4. 27 9月, 2012 2 次提交
  5. 26 9月, 2012 5 次提交
  6. 26 6月, 2012 7 次提交
  7. 03 2月, 2012 3 次提交
    • S
      usb/uas: make sure data urb is gone if we receive status before that · e4d8318a
      Sebastian Andrzej Siewior 提交于
      Just run into the following:
      - new disk arrived in the system
      - udev couldn't wait to get its hands on to to run ata_id /dev/sda
      - this sent the cdb 0xa1 to the device.
      - my UAS-gadget recevied the cdb and had no idea what to do with it. It
        decided to send a status URB back with sense set to invalid opcode.
      - the host side received it status and completed the scsi command.
      - the host sent another scsi with 4kib data buffer
      - Now I was confused why the data transfer is only 512 bytes instead of
        4kib since the host is always allocating the complete transfer in one
        go.
      - Finally the system crashed while walking through the sg list.
      
      This patch adds three new flags in order to distinguish between DATA
      URB completed and outstanding. If we receive status before data, we
      cancel data and let data complete the command.
      This solves the problem for IN and OUT transfers but does not work for
      BIDI.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      e4d8318a
    • S
      usb/uas: move UAS structs / defines into a header file · 348748b0
      Sebastian Andrzej Siewior 提交于
      The protocol specific structures and defines which are used by UAS are
      moved into a header files by this patch so it can be accessed by the UAS
      gadget as well.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      348748b0
    • S
      usb/uas: only bind if the hcd supports SG · c898add5
      Sebastian Andrzej Siewior 提交于
      The UAS driver requires SG support by the HCD operating the device. This
      patch stops UAS from operating on a HCD without sg support and prints a
      message to let him know.
      
      The spec says:
      |For [USB2] backward compatibility, the device shall present [BOT] as
      |alternate interface zero (primary) and [UAS] as alternate interface one
      |(secondary). A device which does not need backward compatibility with
      |[BOT] shall present [UAS] as alternate interface zero. In [USB2]
      |systems, the [BOT] driver or an associated filter driver may need to
      |issue a SET INTERFACE request for alternate interface one and then allow
      |the [UAS] driver to load.
      
      If the user used usb_modeswitch to switch to UAS then he can go back to
      BOT or use a different HCD. In case UAS is the only interface then there
      is currently no way out.
      In future usb_sg_wait() should be extended to provide a non-blocking
      interface so it can work with the UAS driver.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      c898add5
  8. 22 12月, 2011 6 次提交
    • S
      usb/uas: one only one status URB/host on stream-less connection · ceb3f91f
      Sebastian Andrzej Siewior 提交于
      The status/sense URB is allocated on per-command basis. A read/write
      looks the following way on a stream-less connection:
      
      - send cmd tag X, queue status
      - receive status, oh it is a read for tag X. queue status & read
      - receive read
      - receive status, oh I'm done for tag X. Cool call complete and free
        status urb.
      
      This block repeats itself 1:1 for further commands and looks great so
      far. Lets take a look now what happens if we do allow multiple commands:
      
      - send cmd tag X, queue statusX (belongs to the command with the X tag)
      - send cmd tag Y, queue statusY (belongs to the command with the Y tag)
      - receive statusX, oh it is a read for tag X. queue statusX & a read
      - receive read
      - receive statusY, oh I'm done for tag X. Cool call complete and free statusY.
      - receive statusX, oh it is a read for tag Y. queue statusY & before we
        queue the read the the following message can be observed:
        |sd 0:0:0:0: [sda] sense urb submission failure
        followed by a second attempt with the same result.
      
      In order to address this problem we will use only one status URB for
      each scsi host in case we don't have stream support (as suggested by
      Matthew). This URB is requeued until the device removed. Nothing changes
      on stream based endpoints.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      ceb3f91f
    • S
      usb/uas: use scsi_host_find_tag() to find command from a tag · 22188f4a
      Sebastian Andrzej Siewior 提交于
      In "usb/uas: use unique tags for all LUNs" we make sure to create unique
      tags across all LUNs. This patch uses scsi_host_find_tag() to obtain the
      correct command which is associated with the tag.
      The following changes are required:
      - don't use sdev->current_cmnd anymore
        Since we can have devices which don't support command queueing we must
        ensure that we can tell the two commands apart. Even if a device
        supports comand queuing we send the INQUIRY command "untagged" for
        LUN1 while we can send a tagged command to LUN0 at the same time.
        devinfo->cmnd is used for stashing the one "untagged" command.
      - tag number is altered. If stream support is used then the tag number
        must match the stream number. Therefore we can't use tag 0 and must
        start at tag 1.
        In case we have untagged commands (at least the first command) we must
        be able to distinguish between command tag 0 (which becomes 1) and
        untagged command (which becomes curently also 1).
        The following tag numbers are used:
        0: never
        1: for untagged commands (devinfo->cmnd)
        2+: tagged commands.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      22188f4a
    • S
      usb/uas: use unique tags for all LUNs · dae51546
      Sebastian Andrzej Siewior 提交于
      I observed that on a device with multiple LUNs UAS was re-using the same
      tag number for requests which were issued at the same time to both LUNs.
      This patch uses scsi_init_shared_tag_map() to use unique tags for all
      LUNs. With this patch I haven't seen the same tag number during the init
      sequence anymore. Tag 1 is used for devices which do not adverise
      command queueing.
      This patch initilizes the queue before adding the scsi host like the
      other two user in tree.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      dae51546
    • S
      UAS: Free status URB when we can't find the SCSI tag. · 96c1eb98
      Sarah Sharp 提交于
      In the UAS status URB completion handler, we need to free the URB, no
      matter what happens.  Fix a bug where we would leak the URB (and its
      buffer) if we couldn't find a SCSI command that is associated with this
      status phase.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Matthew Wilcox <willy@linux.intel.com>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      96c1eb98
    • S
      UAS: Use unique tags on non-streams devices. · 9eb44541
      Sarah Sharp 提交于
      UAS can work with either USB 3.0 devices that support bulk streams, or
      USB 2.0 devices that do not support bulk streams.  When we're working
      with a non-streams device, we need to be able to uniquely identify a
      SCSI command with a tag in the IU.  Devices will barf and abort all
      queued commands if they find a duplicate tag.
      
      uas_queuecommand_lck() sets cmdinfo->stream to zero if the device
      doesn't support streams, which is later passed into uas_alloc_cmd_urb()
      as the variable stream.  This means the UAS driver was setting the tag
      in all commands to zero for non-stream devices.  So the UAS driver won't
      currently work with USB 2.0 devices.
      
      Use the SCSI command tag instead of the stream ID for the command IU
      tag.  We have to add one to the SCSI command tag because SCSI tags are
      zero-based, but stream IDs are one-based, and the command tag must match
      the stream ID that we're queueing the data IUs for.  Untagged SCSI
      commands use stream ID 1.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Matthew Wilcox <willy@linux.intel.com>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      9eb44541
    • S
      UAS: Re-add workqueue items if submission fails. · ea9da1c7
      Sarah Sharp 提交于
      If the original submission (or allocation) of the URBs for a SCSI
      command fails, the UAS driver sticks the command structure in a
      workqueue and schedules uas_do_work() to run.  That function removes the
      entire queue before walking across it and attempting to resubmit.
      
      Unfortunately, if the second submission fails, we will leak memory
      (because an allocated URB was not submitted) and possibly leave the SCSI
      command partially enqueued on some of the stream rings.  Fix this by
      checking whether the second submission failed and re-queueing the
      command to the UAS workqueue and scheduling it.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Matthew Wilcox <willy@linux.intel.com>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      ea9da1c7
  9. 19 11月, 2011 1 次提交
    • G
      USB: convert drivers/usb/* to use module_usb_driver() · 65db4305
      Greg Kroah-Hartman 提交于
      This converts the drivers in drivers/usb/* to use the
      module_usb_driver() macro which makes the code smaller and a bit
      simpler.
      
      Added bonus is that it removes some unneeded kernel log messages about
      drivers loading and/or unloading.
      
      Cc: Simon Arlott <cxacru@fire.lp0.eu>
      Cc: Duncan Sands <duncan.sands@free.fr>
      Cc: Matthieu CASTET <castet.matthieu@free.fr>
      Cc: Stanislaw Gruszka <stf_xl@wp.pl>
      Cc: Pete Zaitcev <zaitcev@redhat.com>
      Cc: Oliver Neukum <oliver@neukum.name>
      Cc: Juergen Stuber <starblue@users.sourceforge.net>
      Cc: Cesar Miquel <miquel@df.uba.ar>
      Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Cc: Matthew Wilcox <willy@linux.intel.com>
      Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Cc: Felipe Balbi <balbi@ti.com>
      Cc: Lucas De Marchi <lucas.demarchi@profusion.mobi>
      Cc: Michael Hund <mhund@ld-didactic.de>
      Cc: Zack Parsons <k3bacon@gmail.com>
      Cc: Melchior FRANZ <mfranz@aon.at>
      Cc: Tomoki Sekiyama <tomoki.sekiyama@gmail.com>
      Cc: Dan Carpenter <error27@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      65db4305