diff options
author | John Garry <john.garry@huawei.com> | 2019-04-12 04:57:56 -0400 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2019-04-15 18:55:01 -0400 |
commit | d8649fc1c5e40e691d589ed825998c36a947491c (patch) | |
tree | b0cbf9932a4cb53546694e63a02afb858bfb5b5d /drivers/scsi/libsas/sas_expander.c | |
parent | 085f104a83d565097644889bf1f6f1aa6d345cb5 (diff) |
scsi: libsas: Do discovery on empty PHY to update PHY info
When we discover the PHY is empty in sas_rediscover_dev(), the PHY
information (like negotiated linkrate) is not updated.
As such, for a user examining sysfs for that PHY, they would see
incorrect values:
root@(none)$ cd /sys/class/sas_phy/phy-0:0:20
root@(none)$ more negotiated_linkrate
3.0 Gbit
root@(none)$ echo 0 > enable
root@(none)$ more negotiated_linkrate
3.0 Gbit
So fix this, simply discover the PHY again, even though we know it's empty;
in the above example, this gives us:
root@(none)$ more negotiated_linkrate
Phy disabled
We must do this after unregistering the device associated with the PHY
(in sas_unregister_devs_sas_addr()).
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/libsas/sas_expander.c')
-rw-r--r-- | drivers/scsi/libsas/sas_expander.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 6f569a65d791..ad96bc843acc 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
@@ -2068,6 +2068,11 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, | |||
2068 | if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) { | 2068 | if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) { |
2069 | phy->phy_state = PHY_EMPTY; | 2069 | phy->phy_state = PHY_EMPTY; |
2070 | sas_unregister_devs_sas_addr(dev, phy_id, last); | 2070 | sas_unregister_devs_sas_addr(dev, phy_id, last); |
2071 | /* | ||
2072 | * Even though the PHY is empty, for convenience we discover | ||
2073 | * the PHY to update the PHY info, like negotiated linkrate. | ||
2074 | */ | ||
2075 | sas_ex_phy_discover(dev, phy_id); | ||
2071 | return res; | 2076 | return res; |
2072 | } else if (SAS_ADDR(sas_addr) == SAS_ADDR(phy->attached_sas_addr) && | 2077 | } else if (SAS_ADDR(sas_addr) == SAS_ADDR(phy->attached_sas_addr) && |
2073 | dev_type_flutter(type, phy->attached_dev_type)) { | 2078 | dev_type_flutter(type, phy->attached_dev_type)) { |