linux/drivers/scsi/libsas
John Garry cec9771d2e scsi: libsas: Support SATA PHY connection rate unmatch fixing during discovery
+----------+             +----------+
   |          |             |          |
   |          |--- 3.0 G ---|          |--- 6.0 G --- SAS  disk
   |          |             |          |
   |          |--- 3.0 G ---|          |--- 6.0 G --- SAS  disk
   |initiator |             |          |
   | device   |--- 3.0 G ---| Expander |--- 6.0 G --- SAS  disk
   |          |             |          |
   |          |--- 3.0 G ---|          |--- 6.0 G --- SATA disk  -->failed to connect
   |          |             |          |
   |          |             |          |--- 6.0 G --- SATA disk  -->failed to connect
   |          |             |          |
   +----------+             +----------+

According to Serial Attached SCSI - 1.1 (SAS-1.1):
If an expander PHY attached to a SATA PHY is using a physical link rate
greater than the maximum connection rate supported by the pathway from an
STP initiator port, a management application client should use the SMP PHY
CONTROL function (see 10.4.3.10) to set the PROGRAMMED MAXIMUM PHYSICAL
LINK RATE field of the expander PHY to the maximum connection rate
supported by the pathway from that STP initiator port.

Currently libsas does not support checking if this condition occurs, nor
rectifying when it does.

Such a condition is not at all common, however it has been seen on some
pre-silicon environments where the initiator PHY only supports a 1.5 Gbit
maximum linkrate, mated with 12G expander PHYs and 3/6G SATA phy.

This patch adds support for checking and rectifying this condition during
initial device discovery only.

We do support checking min pathway connection rate during revalidation phase,
when new devices can be detected in the topology. However we do not
support in the case of the the user reprogramming PHY linkrates, such that
min pathway condition is not met/maintained.

A note on root port PHY rates:
The libsas root port PHY rates calculation is broken. Libsas sets the
rates (min, max, and current linkrate) of a root port to the same linkrate
of the first PHY member of that same port. In doing so, it assumes that
all other PHYs which subsequently join the port to have the same
negotiated linkrate, when they could actually be different.

In practice this doesn't happen, as initiator and expander PHYs are
normally initialised with consistent min/max linkrates.

This has not caused an issue so far, so leave alone for now.

Tested-by: Jian Luo <luojian5@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-01-11 22:14:24 -05:00
..
Kconfig scsi: scsi_transport_sas: switch to bsg-lib for SMP passthrough 2017-08-29 21:51:45 -04:00
Makefile scsi: libsas: Drop SAS_DPRINTK() and revise logs levels 2018-11-15 14:37:06 -05:00
sas_ata.c SCSI misc on 20181224 2018-12-28 14:48:06 -08:00
sas_discover.c scsi: libsas: Remove pcidev reference 2018-11-15 14:37:06 -05:00
sas_event.c scsi: libsas: Delete sas_dump.{c, h} 2018-11-15 14:37:05 -05:00
sas_expander.c scsi: libsas: Support SATA PHY connection rate unmatch fixing during discovery 2019-01-11 22:14:24 -05:00
sas_host_smp.c scsi: scsi_transport_sas: switch to bsg-lib for SMP passthrough 2017-08-29 21:51:45 -04:00
sas_init.c scsi: libsas: Drop SAS_DPRINTK() and revise logs levels 2018-11-15 14:37:06 -05:00
sas_internal.h scsi: libsas: Drop SAS_DPRINTK() and revise logs levels 2018-11-15 14:37:06 -05:00
sas_phy.c scsi: libsas: Drop sas_printk() 2018-11-15 14:37:06 -05:00
sas_port.c scsi: libsas: Drop SAS_DPRINTK() and revise logs levels 2018-11-15 14:37:06 -05:00
sas_scsi_host.c SCSI misc on 20181224 2018-12-28 14:48:06 -08:00
sas_task.c scsi: libsas: Drop SAS_DPRINTK() and revise logs levels 2018-11-15 14:37:06 -05:00