aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas/sas_expander.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-03-09 19:53:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-09 19:53:47 -0500
commit92fff53b7191cae566be9ca6752069426c7f8241 (patch)
tree019396be4719ad3969d0395cfa0a90860be75f4a /drivers/scsi/libsas/sas_expander.c
parenta50243b1ddcdd766d0d17fbfeeb1a22e62fdc461 (diff)
parent26af1a368e40618d67956b1f883fbcfec292c5d8 (diff)
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI updates from James Bottomley: "This is mostly update of the usual drivers: arcmsr, qla2xxx, lpfc, hisi_sas, target/iscsi and target/core. Additionally Christoph refactored gdth as part of the dma changes. The major mid-layer change this time is the removal of bidi commands and with them the whole of the osd/exofs driver and filesystem. This is a major simplification for block and mq in particular" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (240 commits) scsi: cxgb4i: validate tcp sequence number only if chip version <= T5 scsi: cxgb4i: get pf number from lldi->pf scsi: core: replace GFP_ATOMIC with GFP_KERNEL in scsi_scan.c scsi: mpt3sas: Add missing breaks in switch statements scsi: aacraid: Fix missing break in switch statement scsi: kill command serial number scsi: csiostor: drop serial_number usage scsi: mvumi: use request tag instead of serial_number scsi: dpt_i2o: remove serial number usage scsi: st: osst: Remove negative constant left-shifts scsi: ufs-bsg: Allow reading descriptors scsi: ufs: Allow reading descriptor via raw upiu scsi: ufs-bsg: Change the calling convention for write descriptor scsi: ufs: Remove unused device quirks Revert "scsi: ufs: disable vccq if it's not needed by UFS device" scsi: megaraid_sas: Remove a bunch of set but not used variables scsi: clean obsolete return values of eh_timed_out scsi: sd: Optimal I/O size should be a multiple of physical block size scsi: MAINTAINERS: SCSI initiator and target tweaks scsi: fcoe: make use of fip_mode enum complete ...
Diffstat (limited to 'drivers/scsi/libsas/sas_expander.c')
-rw-r--r--drivers/scsi/libsas/sas_expander.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index f21c93bbb35c..17b45a0c7bc3 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -25,6 +25,7 @@
25#include <linux/scatterlist.h> 25#include <linux/scatterlist.h>
26#include <linux/blkdev.h> 26#include <linux/blkdev.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <asm/unaligned.h>
28 29
29#include "sas_internal.h" 30#include "sas_internal.h"
30 31
@@ -614,7 +615,14 @@ int sas_smp_phy_control(struct domain_device *dev, int phy_id,
614 } 615 }
615 616
616 res = smp_execute_task(dev, pc_req, PC_REQ_SIZE, pc_resp,PC_RESP_SIZE); 617 res = smp_execute_task(dev, pc_req, PC_REQ_SIZE, pc_resp,PC_RESP_SIZE);
617 618 if (res) {
619 pr_err("ex %016llx phy%02d PHY control failed: %d\n",
620 SAS_ADDR(dev->sas_addr), phy_id, res);
621 } else if (pc_resp[2] != SMP_RESP_FUNC_ACC) {
622 pr_err("ex %016llx phy%02d PHY control failed: function result 0x%x\n",
623 SAS_ADDR(dev->sas_addr), phy_id, pc_resp[2]);
624 res = pc_resp[2];
625 }
618 kfree(pc_resp); 626 kfree(pc_resp);
619 kfree(pc_req); 627 kfree(pc_req);
620 return res; 628 return res;
@@ -689,10 +697,10 @@ int sas_smp_get_phy_events(struct sas_phy *phy)
689 if (res) 697 if (res)
690 goto out; 698 goto out;
691 699
692 phy->invalid_dword_count = scsi_to_u32(&resp[12]); 700 phy->invalid_dword_count = get_unaligned_be32(&resp[12]);
693 phy->running_disparity_error_count = scsi_to_u32(&resp[16]); 701 phy->running_disparity_error_count = get_unaligned_be32(&resp[16]);
694 phy->loss_of_dword_sync_count = scsi_to_u32(&resp[20]); 702 phy->loss_of_dword_sync_count = get_unaligned_be32(&resp[20]);
695 phy->phy_reset_problem_count = scsi_to_u32(&resp[24]); 703 phy->phy_reset_problem_count = get_unaligned_be32(&resp[24]);
696 704
697 out: 705 out:
698 kfree(req); 706 kfree(req);
@@ -817,6 +825,26 @@ static struct domain_device *sas_ex_discover_end_dev(
817 825
818#ifdef CONFIG_SCSI_SAS_ATA 826#ifdef CONFIG_SCSI_SAS_ATA
819 if ((phy->attached_tproto & SAS_PROTOCOL_STP) || phy->attached_sata_dev) { 827 if ((phy->attached_tproto & SAS_PROTOCOL_STP) || phy->attached_sata_dev) {
828 if (child->linkrate > parent->min_linkrate) {
829 struct sas_phy_linkrates rates = {
830 .maximum_linkrate = parent->min_linkrate,
831 .minimum_linkrate = parent->min_linkrate,
832 };
833 int ret;
834
835 pr_notice("ex %016llx phy%02d SATA device linkrate > min pathway connection rate, attempting to lower device linkrate\n",
836 SAS_ADDR(child->sas_addr), phy_id);
837 ret = sas_smp_phy_control(parent, phy_id,
838 PHY_FUNC_LINK_RESET, &rates);
839 if (ret) {
840 pr_err("ex %016llx phy%02d SATA device could not set linkrate (%d)\n",
841 SAS_ADDR(child->sas_addr), phy_id, ret);
842 goto out_free;
843 }
844 pr_notice("ex %016llx phy%02d SATA device set linkrate successfully\n",
845 SAS_ADDR(child->sas_addr), phy_id);
846 child->linkrate = child->min_linkrate;
847 }
820 res = sas_get_ata_info(child, phy); 848 res = sas_get_ata_info(child, phy);
821 if (res) 849 if (res)
822 goto out_free; 850 goto out_free;