Linux USB module uas

最後更新: 2020-06-27

介紹

 

UAS

UAS = USB Attached SCSI (亦有人叫 UASP)[P for Protocol]

Use of UAS:

provides faster transfers compared to the older USB Mass Storage Bulk-Only Transport (BOT) drivers(usb_storage)

當 USB 升級到 USB 3.0 時, 將原來的半雙工傳輸模式, 改為全雙工模式

 * uas depends usb-storage

USB/SATA Bridge(Hardware)

"Bridge" refers to the actual USB/SATA IC within the USB SATA enclosure you're using.

i.e.

ASM1051E SATA 6Gb/s bridge

It's referred to as a "bridge" because it bridges two completely unrelated/incompatible protocols (USB and ATA)

USB/SATA bridge is saving power and going into a mode that essentially knocks the USB storage layer offline

目錄

  • 常見 IC 廠
  • Check 是否行 USB 3.0
  • power-cycling
  • 遇上有 bug 的盒子
     

常見 IC 廠

 

  • ASMedia
  • JMicron

 


Check 是否行 USB 3.0

 

查看Port上Device的資訊

# USB Version

lsusb -v -d 174c:55aa | grep bcdUSB

  bcdUSB               3.00
  bcdUSB               3.00

lsusb -v -d '152d:9561' | grep bInterfaceProtocol

bInterfaceProtocol     80 Bulk-Only       # 支援 BOT (Driver=usb-storage)
bInterfaceProtocol     98                 # 支援 UASP

查看 load 了什麼 driver

lsusb -t

正確載入 USB 3.0 driver 時

/:  Bus 09.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=uas, 5000M

當是 2.0 時

/:  Bus 09.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 5000M
    |__ Port 1: Dev 7, If 0, Class=Mass Storage, Driver=usb-storage, 5000M

Remark

UAS was introduced as part of the USB 3.0 standard,

but can also be used with devices complying to the slower USB 2.0 standard,

assuming use of compatible hardware, firmware and drivers.

=> 所以有 uas 都未必是在行 USB 3.0

Module 的依賴

lsmod | grep uas

uas                    24576  2
usb_storage            69632  1 uas

 


power-cycling

 

power-cycling the bridge would cause USB reenumeration within the Linux USB layer,

followed by SCSI device bus rescanning within the Linux SCSI/SATA translation layer

 


遇上有 bug 的盒子

 

dmesg

[57755.387588] sd 6:0:0:0: [sde] tag#6 uas_eh_abort_handler 0 uas-tag 7 inflight: CMD OUT
[57755.387593] sd 6:0:0:0: [sde] tag#6 CDB: Write(16) 8a 00 00 00 00 02 97 c2 df ff 00 00 04 00 00 00
[57755.387803] sd 6:0:0:0: [sde] tag#2 uas_eh_abort_handler 0 uas-tag 3 inflight: CMD OUT
[57755.387806] sd 6:0:0:0: [sde] tag#2 CDB: Write(16) 8a 00 00 00 00 02 97 c2 db ff 00 00 04 00 00 00
...
[57755.424986] scsi host6: uas_eh_device_reset_handler start
[57755.588811] usb 9-2: reset SuperSpeed USB device number 2 using xhci_hcd
[57755.613940] scsi host6: uas_eh_device_reset_handler success

解決方法:

# Force USB 2.0 Commands on a USB 3.0 Port

lsusb

Bus 009 Device 002: ID 174c:55aa ASMedia Technology Inc. 
 Name: ASM1051E SATA 6Gb/s bridge,
  ASM1053E SATA 6Gb/s bridge,
  ASM1153 SATA 3Gb/s bridge, 
  ASM1153E SATA 6Gb/s bridge

建立 /etc/modprobe.d/usbdisk.conf

# disable usb 3.0 disk
blacklist uas

# 當 device 沒有 load usb_storage 時
alias usb:v174cp55aad*dc*dsc*dp*ic*isc*ip*in* usb_storage

# quirks
options usb-storage quirks=174c:55aa:u

rmmod uas

# unload uas 的原因

lsmod | grep usb_storage

usb_storage            73728  1 uas

rmmod usb_storage

modprobe usb_storage        # 不 reboot 的方法, 重載入 kernel module

update-initramfs -u             # 使 reboot 之後仍然有效

log

[284480.770742] usb 4-1: UAS is ignored for this device, using usb-storage instead

quirks 解釋:

Flag:

  • 'u' is defined as being equivalent to the flag US_FL_IGNORE_UAS,
  • 't' to the flag US_FL_NO_ATA_1X.

usb.c (source code)

case 't':
    f |= US_FL_NO_ATA_1X;
    break;
case 'u':
    f |= US_FL_IGNORE_UAS;
    break;

Other flag

US_FL_NO_ATA_1X             /* All Seagate disk enclosures have broken ATA pass-through support */

 


 

 

 

 

 

Creative Commons license icon Creative Commons license icon