From patchwork Tue Feb 16 12:22:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 62007 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1622125lbl; Tue, 16 Feb 2016 04:08:01 -0800 (PST) X-Received: by 10.66.251.194 with SMTP id zm2mr30986046pac.131.1455624481143; Tue, 16 Feb 2016 04:08:01 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ej17si50830326pac.190.2016.02.16.04.08.00; Tue, 16 Feb 2016 04:08:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755243AbcBPMH7 (ORCPT + 30 others); Tue, 16 Feb 2016 07:07:59 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:24120 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754979AbcBPMGG (ORCPT ); Tue, 16 Feb 2016 07:06:06 -0500 Received: from 172.24.1.47 (EHLO szxeml431-hub.china.huawei.com) ([172.24.1.47]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BWD19033; Tue, 16 Feb 2016 20:06:00 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by szxeml431-hub.china.huawei.com (10.82.67.208) with Microsoft SMTP Server id 14.3.235.1; Tue, 16 Feb 2016 20:05:47 +0800 From: John Garry To: , CC: , , , , , , John Garry Subject: [PATCH 3/6] hisi_sas: use slot abort in v1 hw Date: Tue, 16 Feb 2016 20:22:28 +0800 Message-ID: <1455625351-165881-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1455625351-165881-1-git-send-email-john.garry@huawei.com> References: <1455625351-165881-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.56C310AA.00A9, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 6be1c092f8a1520eb3a06738f264b7fa Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When TRANS_TX_CREDIT_TIMEOUT_ERR or TRANS_TX_CLOSE_NORMAL_ERR errors occur for a command, the command should be re-attempted. Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c index ce5f65d..34f71a1c 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c @@ -1118,9 +1118,8 @@ static int prep_ssp_v1_hw(struct hisi_hba *hisi_hba, } /* by default, task resp is complete */ -static void slot_err_v1_hw(struct hisi_hba *hisi_hba, - struct sas_task *task, - struct hisi_sas_slot *slot) +static void slot_err_v1_hw(struct hisi_hba *hisi_hba, struct sas_task *task, + struct hisi_sas_slot *slot, int *abort_slot) { struct task_status_struct *ts = &task->task_status; struct hisi_sas_err_record_v1 *err_record = slot->status_buffer; @@ -1212,6 +1211,14 @@ static void slot_err_v1_hw(struct hisi_hba *hisi_hba, ts->stat = SAS_NAK_R_ERR; break; } + case TRANS_TX_CREDIT_TIMEOUT_ERR: + case TRANS_TX_CLOSE_NORMAL_ERR: + { + /* This will request a retry */ + ts->stat = SAS_QUEUE_FULL; + ++(*abort_slot); + break; + } default: { ts->stat = SAM_STAT_CHECK_CONDITION; @@ -1317,8 +1324,14 @@ static int slot_complete_v1_hw(struct hisi_hba *hisi_hba, if (cmplt_hdr_data & CMPLT_HDR_ERR_RCRD_XFRD_MSK && !(cmplt_hdr_data & CMPLT_HDR_RSPNS_XFRD_MSK)) { + int abort_slot = 0; - slot_err_v1_hw(hisi_hba, task, slot); + slot_err_v1_hw(hisi_hba, task, slot, &abort_slot); + if (unlikely(abort_slot)) { + queue_work(hisi_hba->wq, &slot->abort_slot); + sts = ts->stat; + goto out_1; + } goto out; } @@ -1375,6 +1388,7 @@ out: if (task->task_done) task->task_done(task); +out_1: return sts; }