SATA/SAS link speed negotiation

Mirco Tischler mt-ml at gmx.de
Thu Jul 14 16:46:21 EDT 2011


2011/7/14 Peter Hamilton <peterghamilton at gmail.com>:
> I'm trying to find out what the negotiated speed is on a SATA port.  dmesg
> reports the negotiated speed, but I'm hoping to find it somewhere in /sys or
> /proc (or some other tool).  Scraping dmesg is a messy process as I'm
> starting with a block device.  I would have to trace the block device to the
> scsi address and translate that to an ata address.
> Here's the scsi and block device info from dmesg:
>
> scsi 7:0:0:0: Direct-Access     ATA      WDC WD1600AAJS-2 01.0 PQ: 0 ANSI: 5
> sd 7:0:0:0: [sdd] 312581808 512-byte logical blocks: (160 GB/149 GiB)
> sd 7:0:0:0: [sdd] Write Protect is off
> sd 7:0:0:0: [sdd] Mode Sense: 00 3a 00 00
> sd 7:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support
> DPO or FUA
> sd 7:0:0:0: [sdd] Attached SCSI disk
> sd 7:0:0:0: Attached scsi generic sg3 type 0
> Here's the corresponding ata info from dmesg:
> ata7: SATA link up 3.0 Gbps (SStatus 123 SControl 370)
> ata7.00: ATA-8: WDC WD1600AAJS-22L7A0, 01.03E01, max UDMA/133
> ata7.00: 312581808 sectors, multi 0: LBA48 NCQ (depth 31/32), AA
> ata7.00: configured for UDMA/133
>
>
>
> Finding the SATA link speed in dmesg would be much cleaner than scraping
> dmesg.  Does anyone know where I might find that?
> Also, for a SAS HBA, the link speed is not reported to dmesg.  Does anyone
> know how to find the link speed for a SAS drive?
> Thanks,
> Peter
Take a look at /sys/class/ata_link/linkX/sata_spd
Where X should be the number of your SATA port. There probabably
exists something equivalent for SAS but I don't have a controller so I
can't tell for sure.

Mirco



More information about the Kernelnewbies mailing list