1. 03 9月, 2019 1 次提交
    • S
      usbip: Implement SG support to vhci-hcd and stub driver · ea44d190
      Suwan Kim 提交于
      There are bugs on vhci with usb 3.0 storage device. In USB, each SG
      list entry buffer should be divisible by the bulk max packet size.
      But with native SG support, this problem doesn't matter because the
      SG buffer is treated as contiguous buffer. But without native SG
      support, USB storage driver breaks SG list into several URBs and the
      error occurs because of a buffer size of URB that cannot be divided
      by the bulk max packet size. The error situation is as follows.
      
      When USB Storage driver requests 31.5 KB data and has SG list which
      has 3584 bytes buffer followed by 7 4096 bytes buffer for some
      reason. USB Storage driver splits this SG list into several URBs
      because VHCI doesn't support SG and sends them separately. So the
      first URB buffer size is 3584 bytes. When receiving data from device,
      USB 3.0 device sends data packet of 1024 bytes size because the max
      packet size of BULK pipe is 1024 bytes. So device sends 4096 bytes.
      But the first URB buffer has only 3584 bytes buffer size. So host
      controller terminates the transfer even though there is more data to
      receive. So, vhci needs to support SG transfer to prevent this error.
      
      In this patch, vhci supports SG regardless of whether the server's
      host controller supports SG or not, because stub driver splits SG
      list into several URBs if the server's host controller doesn't
      support SG.
      
      To support SG, vhci sets URB_DMA_MAP_SG flag in urb->transfer_flags
      if URB has SG list and this flag will tell stub driver to use SG
      list. After receiving urb from stub driver, vhci clear URB_DMA_MAP_SG
      flag to avoid unnecessary DMA unmapping in HCD.
      
      vhci sends each SG list entry to stub driver. Then, stub driver sees
      the total length of the buffer and allocates SG table and pages
      according to the total buffer length calling sgl_alloc(). After stub
      driver receives completed URB, it again sends each SG list entry to
      vhci.
      
      If the server's host controller doesn't support SG, stub driver
      breaks a single SG request into several URBs and submits them to
      the server's host controller. When all the split URBs are completed,
      stub driver reassembles the URBs into a single return command and
      sends it to vhci.
      
      Moreover, in the situation where vhci supports SG, but stub driver
      does not, or vice versa, usbip works normally. Because there is no
      protocol modification, there is no problem in communication between
      server and client even if the one has a kernel without SG support.
      
      In the case of vhci supports SG and stub driver doesn't, because
      vhci sends only the total length of the buffer to stub driver as
      it did before the patch applied, stub driver only needs to allocate
      the required length of buffers using only kmalloc() regardless of
      whether vhci supports SG or not. But stub driver has to allocate
      buffer with kmalloc() as much as the total length of SG buffer which
      is quite huge when vhci sends SG request, so it has overhead in
      buffer allocation in this situation.
      
      If stub driver needs to send data buffer to vhci because of IN pipe,
      stub driver also sends only total length of buffer as metadata and
      then sends real data as vhci does. Then vhci receive data from stub
      driver and store it to the corresponding buffer of SG list entry.
      
      And for the case of stub driver supports SG and vhci doesn't, since
      the USB storage driver checks that vhci doesn't support SG and sends
      the request to stub driver by splitting the SG list into multiple
      URBs, stub driver allocates a buffer for each URB with kmalloc() as
      it did before this patch.
      
      * Test environment
      
      Test uses two difference machines and two different kernel version
      to make mismatch situation between the client and the server where
      vhci supports SG, but stub driver does not, or vice versa. All tests
      are conducted in both full SG support that both vhci and stub support
      SG and half SG support that is the mismatch situation. Test kernel
      version is 5.3-rc6 with commit "usb: add a HCD_DMA flag instead of
      guestimating DMA capabilities" to avoid unnecessary DMA mapping and
      unmapping.
      
       - Test kernel version
          - 5.3-rc6 with SG support
          - 5.1.20-200.fc29.x86_64 without SG support
      
      * SG support test
      
       - Test devices
          - Super-speed storage device - SanDisk Ultra USB 3.0
          - High-speed storage device - SMI corporation USB 2.0 flash drive
      
       - Test description
      
      Test read and write operation of mass storage device that uses the
      BULK transfer. In test, the client reads and writes files whose size
      is over 1G and it works normally.
      
      * Regression test
      
       - Test devices
          - Super-speed device - Logitech Brio webcam
          - High-speed device  - Logitech C920 HD Pro webcam
          - Full-speed device  - Logitech bluetooth mouse
                               - Britz BR-Orion speaker
          - Low-speed device   - Logitech wired mouse
      
       - Test description
      
      Moving and click test for mouse. To test the webcam, use gnome-cheese.
      To test the speaker, play music and video on the client. All works
      normally.
      
      * VUDC compatibility test
      
      VUDC also works well with this patch. Tests are done with two USB
      gadget created by CONFIGFS USB gadget. Both use the BULK pipe.
      
              1. Serial gadget
              2. Mass storage gadget
      
       - Serial gadget test
      
      Serial gadget on the host sends and receives data using cat command
      on the /dev/ttyGS<N>. The client uses minicom to communicate with
      the serial gadget.
      
       - Mass storage gadget test
      
      After connecting the gadget with vhci, use "dd" to test read and
      write operation on the client side.
      
      Read  - dd if=/dev/sd<N> iflag=direct of=/dev/null bs=1G count=1
      Write - dd if=<my file path> iflag=direct of=/dev/sd<N> bs=1G count=1
      Signed-off-by: NSuwan Kim <suwan.kim027@gmail.com>
      Acked-by: NShuah khan <skhan@linuxfoundation.org>
      Link: https://lore.kernel.org/r/20190828032741.12234-1-suwan.kim027@gmail.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ea44d190
  2. 30 4月, 2019 1 次提交
    • G
      usbip: vhci_hcd: Mark expected switch fall-through · b063f04e
      Gustavo A. R. Silva 提交于
      In preparation to enabling -Wimplicit-fallthrough, mark switch
      cases where we are expecting to fall through.
      
      This patch fixes the following warning:
      
      In file included from drivers/usb/usbip/vhci_hcd.c:15:
      drivers/usb/usbip/vhci_hcd.c: In function ‘vhci_hub_control’:
      drivers/usb/usbip/usbip_common.h:63:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
         if (flag & usbip_debug_flag)  \
            ^
      drivers/usb/usbip/usbip_common.h:77:2: note: in expansion of macro ‘usbip_dbg_with_flag’
        usbip_dbg_with_flag(usbip_debug_vhci_rh, fmt , ##args)
        ^~~~~~~~~~~~~~~~~~~
      drivers/usb/usbip/vhci_hcd.c:509:4: note: in expansion of macro ‘usbip_dbg_vhci_rh’
          usbip_dbg_vhci_rh(
          ^~~~~~~~~~~~~~~~~
      drivers/usb/usbip/vhci_hcd.c:511:3: note: here
         case USB_PORT_FEAT_U2_TIMEOUT:
         ^~~~
      
      Warning level 3 was used: -Wimplicit-fallthrough=3
      
      This patch is part of the ongoing efforts to enable
      -Wimplicit-fallthrough.
      Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
      Acked-by: NShuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b063f04e
  3. 19 3月, 2019 1 次提交
  4. 25 1月, 2019 1 次提交
  5. 09 10月, 2018 1 次提交
  6. 22 4月, 2018 1 次提交
  7. 16 2月, 2018 1 次提交
  8. 19 12月, 2017 2 次提交
  9. 01 12月, 2017 1 次提交
  10. 07 11月, 2017 1 次提交
    • G
      USB: usbip: Remove redundant license text · 7f2b019c
      Greg Kroah-Hartman 提交于
      Now that the SPDX tag is in all USB files, that identifies the license
      in a specific and legally-defined manner.  So the extra GPL text wording
      can be removed as it is no longer needed at all.
      
      This is done on a quest to remove the 700+ different ways that files in
      the kernel describe the GPL license text.  And there's unneeded stuff
      like the address (sometimes incorrect) for the FSF which is never
      needed.
      
      No copyright headers or other non-license-description text was removed.
      
      Cc: Valentina Manea <valentina.manea.m@gmail.com>
      Acked-by: NShuah Khan <shuahkh@osg.samsung.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7f2b019c
  11. 04 11月, 2017 1 次提交
  12. 01 9月, 2017 1 次提交
  13. 22 7月, 2017 1 次提交
  14. 27 6月, 2017 1 次提交
  15. 13 6月, 2017 6 次提交
  16. 17 5月, 2017 1 次提交
    • J
      USB: usbip: fix nonconforming hub descriptor · ec963b41
      Johan Hovold 提交于
      Fix up the root-hub descriptor to accommodate the variable-length
      DeviceRemovable and PortPwrCtrlMask fields, while marking all ports as
      removable (and leaving the reserved bit zero unset).
      
      Also add a build-time constraint on VHCI_HC_PORTS which must never be
      greater than USB_MAXCHILDREN (but this was only enforced through a
      KConfig constant).
      
      This specifically fixes the descriptor layout whenever VHCI_HC_PORTS is
      greater than seven (default is 8).
      
      Fixes: 04679b34 ("Staging: USB/IP: add client driver")
      Cc: Takahiro Hirofuchi <hirofuchi@users.sourceforge.net>
      Cc: Valentina Manea <valentina.manea.m@gmail.com>
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Acked-by: NShuah Khan <shuahkh@osg.samsung.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ec963b41
  17. 08 4月, 2017 1 次提交
  18. 09 2月, 2017 1 次提交
  19. 07 11月, 2016 1 次提交
  20. 15 8月, 2016 1 次提交
  21. 09 8月, 2016 1 次提交
    • N
      usbip: vhci extension: modifications to vhci driver · 0775a9cb
      Nobuo Iwata 提交于
      Modification to Kconfig, vhci_hc.c, vhci.h and vhci_sysfs.c.
      
      1. kernel config
      
      Followings are added.
      
      USBIP_VHCI_HC_PORTS: Number of ports per USB/IP virtual host
      controller. The default is 8 - same as current VHCI_NPORTS.
      USBIP_VHCI_NR_HCS: Number of USB/IP virtual host controllers. The
      default is 1. This paratmeter is replaced with USBIP_VHCI_INIT_HCS and
      USBIP_VHCI_MAX_HCS included in succeeding dynamic extension patch.
      
      2. the_controller to controllers
      
      the_controller is changed to vhci_pdevs: array of struct
      platform_device.
      
      3. vhci_sysfs.c
      
      Sysfs structure is changed as following.
      
      BEFORE:
          /sys/devices/platform
              +-- vhci
                  +-- status
                  +-- attach
                  +-- detach
                  +-- usbip_debug
      
      AFTER: example for CONFIG_USBIP_NR_HCS=4
          /sys/devices/platform
              +-- vhci
              |   +-- nports
              |   +-- status
              |   +-- status.1
              |   +-- status.2
              |   +-- status.3
              |   +-- attach
              |   +-- detach
              |   +-- usbip_debug
              +-- vhci.1
              +-- vhci.2
              +-- vhci.3
      
      vhci[.N] is shown for each host controller kobj. vhch.1, vhci.2, ...
      are shown only when CONFIG_USBIP_NR_HCS is more than 1. Only 'vhci'
      (without number) has user space interfaces. 'nports' is newly added to
      give ports-per-controller and number of controlles. Before that, number
      of ports is acquired by reading status lines. Status is divided for
      each controller to avoid page size (4KB) limitation.
      
      Old userspace tool binaries work with the first status within the first
      controller.
      
      Inconsistency between status header and content is fixed.
      4th and 5th column are
      header:          "dev bus"
      content(unused): "000 000"
      content(used):   "%08x", devid
      Only 1st and 2nd column are used by program. In old version, sscanf()
      in parse_status expect no bus column. And bus_id string is shown in the
      last column. Then bus in the header is removed and unused content is
      replaced with 8 zeros. The sscanf() expects more than 5 columns and new
      has 6 columns so there's no compatibility issue in this change.
      Signed-off-by: NNobuo Iwata <nobuo.iwata@fujixerox.co.jp>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0775a9cb
  22. 18 6月, 2016 1 次提交
  23. 04 2月, 2016 1 次提交
  24. 04 10月, 2015 3 次提交
  25. 04 4月, 2015 1 次提交
  26. 25 1月, 2015 1 次提交
  27. 25 11月, 2014 1 次提交
  28. 20 10月, 2014 1 次提交
  29. 26 8月, 2014 1 次提交
  30. 31 7月, 2014 1 次提交
  31. 19 6月, 2014 1 次提交
  32. 24 5月, 2014 1 次提交