Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1606758

[PATCH 10/23] scsi: hisi_sas: hardreset for SATA disk in LU reset

From John Garry <john.garry@huawei.com>
Newsgroups linux.kernel
Subject [PATCH 10/23] scsi: hisi_sas: hardreset for SATA disk in LU reset
Date 2017-03-22 18:10 +0100
Message-ID <tnRVM-5RD-13@gated-at.bofh.it> (permalink)
References <tnRM5-5ys-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


When issuing an LU reset for a SATA target, issue an
internal abort and a hard reset.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
---
 drivers/scsi/hisi_sas/hisi_sas_main.c | 38 ++++++++++++++++++++++++++---------
 1 file changed, 29 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 36d4e5a..19f2892 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -1037,23 +1037,43 @@ static int hisi_sas_I_T_nexus_reset(struct domain_device *device)
 
 static int hisi_sas_lu_reset(struct domain_device *device, u8 *lun)
 {
-	struct hisi_sas_tmf_task tmf_task;
 	struct hisi_sas_device *sas_dev = device->lldd_dev;
 	struct hisi_hba *hisi_hba = dev_to_hisi_hba(device);
 	struct device *dev = &hisi_hba->pdev->dev;
 	unsigned long flags;
 	int rc = TMF_RESP_FUNC_FAILED;
 
-	tmf_task.tmf = TMF_LU_RESET;
 	sas_dev->dev_status = HISI_SAS_DEV_EH;
-	rc = hisi_sas_debug_issue_ssp_tmf(device, lun, &tmf_task);
-	if (rc == TMF_RESP_FUNC_COMPLETE) {
-		spin_lock_irqsave(&hisi_hba->lock, flags);
-		hisi_sas_release_task(hisi_hba, device);
-		spin_unlock_irqrestore(&hisi_hba->lock, flags);
-	}
+	if (dev_is_sata(device)) {
+		struct sas_phy *phy;
+
+		/* Clear internal IO and then hardreset */
+		rc = hisi_sas_internal_task_abort(hisi_hba, device,
+						  HISI_SAS_INT_ABT_DEV, 0);
+		if (rc == TMF_RESP_FUNC_FAILED)
+			goto out;
 
-	/* If failed, fall-through I_T_Nexus reset */
+		phy = sas_get_local_phy(device);
+
+		rc = sas_phy_reset(phy, 1);
+
+		if (rc == 0) {
+			spin_lock_irqsave(&hisi_hba->lock, flags);
+			hisi_sas_release_task(hisi_hba, device);
+			spin_unlock_irqrestore(&hisi_hba->lock, flags);
+		}
+		sas_put_local_phy(phy);
+	} else {
+		struct hisi_sas_tmf_task tmf_task = { .tmf =  TMF_LU_RESET };
+
+		rc = hisi_sas_debug_issue_ssp_tmf(device, lun, &tmf_task);
+		if (rc == TMF_RESP_FUNC_COMPLETE) {
+			spin_lock_irqsave(&hisi_hba->lock, flags);
+			hisi_sas_release_task(hisi_hba, device);
+			spin_unlock_irqrestore(&hisi_hba->lock, flags);
+		}
+	}
+out:
 	dev_err(dev, "lu_reset: for device[%llx]:rc= %d\n",
 		sas_dev->device_id, rc);
 	return rc;
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/23] hisi_sas: error handling and other misc fixes and improvements John Garry <john.garry@huawei.com> - 2017-03-22 18:00 +0100
  [PATCH 13/23] scsi: hisi_sas: fix some sas_task.task_state_lock locking John Garry <john.garry@huawei.com> - 2017-03-22 18:00 +0100
  [PATCH 12/23] scsi: hisi_sas: free slots after hardreset John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100
  [PATCH 10/23] scsi: hisi_sas: hardreset for SATA disk in LU reset John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100
  [PATCH 09/23] scsi: hisi_sas: modify hisi_sas_abort_task() for SSP John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100
  [PATCH 14/23] scsi: hisi_sas: remove task free'ing for timeouts John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100
  [PATCH 06/23] scsi: hisi_sas: error hisi_sas_task_prep() when port down John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100
  [PATCH 15/23] scsi: hisi_sas: process error codes according to their priority John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100
  [PATCH 02/23] scsi: hisi_sas: add controller reset John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100
  [PATCH 19/23] scsi: hisi_sas: add hisi_sas_clear_nexus_ha() John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100
  [PATCH 22/23] scsi: hisi_sas: use dev_is_sata to identify SATA or SAS disk John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100
  [PATCH 17/23] scsi: hisi_sas: handle PHY UP+DOWN simultaneous irq John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100
  [PATCH 05/23] scsi: hisi_sas: remove hisi_sas_port_deformed() John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100
  [PATCH 16/23] scsi: hisi_sas: some modifications to v2 hw reg init values John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100
  [PATCH 04/23] scsi: hisi_sas: add softreset function for SATA disk John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100
  [PATCH 20/23] scsi: hisi_sas: release SMP slot in lldd_abort_task John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100
  [PATCH 03/23] scsi: hisi_sas: move PHY init to hisi_sas_scan_start() John Garry <john.garry@huawei.com> - 2017-03-22 18:10 +0100
  Re: [PATCH 00/23] hisi_sas: error handling and other misc fixes and improvements "Martin K. Petersen" <martin.petersen@oracle.com> - 2017-03-23 16:20 +0100

csiph-web