Re: tcm_usb_gadget - how to use?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/27/2012 06:15 PM, Thomas Knauth wrote:
Hi Sebastian,

Hi Thomas,

today I came across your recent work to bring USB-attached-SCSI to the
USB gadget framework; at least this is how I would interpret it.

It brings USB Attached SCSI (UAS) and Bulk Only transport (BOT). The
latter is the same protocol that is used by g_mass_storage. That means
it should also work on WinXP which does not support UAS.

I'm
interested in trying out the code. g_mass_storage has a module
parameter where I can specify the backing store. tcm_usb_gadget seems
to miss a similar option?

There are two ways: targetcli (userland package from linux-iscsi.org)
or manual. With targetcli you should be able to setup "disk" device and
add this to the gadget.

This is part of a script I use for testing (the manual way):

|modprobe dummy_hcd
|modprobe target_core_mod
|modprobe tcm_usb_gadget
|mount a -t configfs /sys/kernel/config

Load modules & mount configfs

|CONFIGFS=/sys/kernel/config/;
|TARGET=$CONFIGFS/target/core/
|FABRIC=$CONFIGFS/target/usb_gadget/
|
|# RD
|mkdir -p $TARGET/rd_mcp_0/ramdisk
|echo rd_pages=32768 > $TARGET/rd_mcp_0/ramdisk/control
|echo 1 > $TARGET/rd_mcp_0/ramdisk/enable

setups & enables ramdisk backend of around 128MiB.

|# file
|mkdir -p $TARGET/fileio_0/fileio
|echo "fd_dev_name=/root/file.bin,fd_dev_size=31457280" > |$TARGET/fileio_0/fileio/control
|echo 1 > $TARGET/fileio_0/fileio/enable

setups / enables a file backend of around 32MiB.

|mkdir -p $FABRIC/naa.6001405c3214b06a/tpgt_1
|mkdir $FABRIC/naa.6001405c3214b06a/tpgt_1/lun/lun_0
|mkdir $FABRIC/naa.6001405c3214b06a/tpgt_1/lun/lun_1
|echo naa.6001405c3214b06b > $FABRIC/naa.6001405c3214b06a/tpgt_1/nexus

create two LUNs for the USB gadget.

|ln -s $TARGET/rd_mcp_0/ramdisk $FABRIC/naa.6001405c3214b06a/tpgt_1/lun/lun_0/virtual_scsi_port |ln -s $TARGET/fileio_0/fileio $FABRIC/naa.6001405c3214b06a/tpgt_1/lun/lun_1/virtual_scsi_port

assign the two LUNs, one storage backend each.

|echo 1 > /sys/kernel/config/target/usb_gadget/naa.6001405c3214b06a/tpgt_1/enable

enable the gadget. After this step gadget should bind to the UDC and
start.

I have a PLX USB 3380 device which I want to use to export storage
There is no PLX 3380 driver in tree yet, right?

from one machine to another machine. g_mass_storage works with the
device, however, data rates are nowhere near what is achievable over
USB 3.0. As far as I know, the BOT Mass Storage Protocol has inherent
deficiencies performance-wise. Googling for UAS and USB gadget support
revealed your recent kernel patches. Could you shed some light onto
how I would use the tcm_usb_gadget to export storage over USB?

Before you start: I tested it mostly against dummy_hcd within Linux. I
had a omap4 based board and tested the BOT part against WinXP. I never
tested USB3 + streams on a real UDC. From what I know the stream
support has not been tested on dwc3 which is currently the only UDC in
tree.
There are a few things that can be optimized within the tcm gadget
itself but since I did not have anything besides emulation I tried to
make it work first.


Kind regards,
Thomas.

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux