Re: tcm_usb_gadget - how to use?

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

 



> 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.

Thanks for the info. By the time I received your mail, I've already
stumbled upon this code in some earlier mailing list entry. It works
perfectly. Using the usb3380 and tcm_usb_gadget I was able to transfer
data over USB. Admittedly, only zeros with dd if=/dev/zero
of=/dev/sdb, but no errors showed up whatsoever.

>
>> 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?
>

No, there is not. I have a the driver as a kernel patch from the
company directly. They are planing on putting it on their web site.
Don't know if that already happened.

>> 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.

Now I'm looking for a switch to enable UAS. As far as I understand the
code in tcm_usb_gadget.c, BOT is the hard-coded default, right? In
usbg_setup you test for USBG_IS_BOT and bail out with an error if the
flag is not set. Would this be the place to add another if-then-else
branch and call usbg_uas_setup? Although that particular function is
missing right now.

Anyway, good work. I am really excited to see the usb3380 be able to
transfer data at a rate closer to the advertised 350 MB/s. So far,
I've only achieved about 35 MB/s. Let me know, if I can help you test
the tcm_usb_gadget with a real UDC.

Kind regards,
Thomas.
--
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