From patchwork Fri Jan 4 16:01:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 154784 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp762321ljp; Fri, 4 Jan 2019 08:01:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN7W0TmWB2kS1Pi62dDrBzUfmBrCwgGD3oKicu4BEpHJFLVP1um+ti0lzpvpLwU8VZ5oEiXE X-Received: by 2002:a17:902:820d:: with SMTP id x13mr52818609pln.229.1546617692755; Fri, 04 Jan 2019 08:01:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546617692; cv=none; d=google.com; s=arc-20160816; b=omuWl+AA2TinoPH8P1XfcSy27hxzwAQu/vz41xmrvmGH3i58LmQLlj+i+WPyX582T+ JJRTQHH9qv0+3ta/7ujeYAPJfzDRCw1YzI0UUF/L7ZNB4sNXR9ZGGaCP8Zf6aXDt1Acp rew0i3RX7pgcFvXWRaaFtwm/nX1ScR0AzHwi48503lVmGfric+KZ05MQo87XsTc23ipQ SzwXinxVYtZ6C+8eu7/74hK2aP2RbTWky/c2hDVXFwx+ntkKFzTugmTXyE0bx6bDwgUu foSNvpVZocX7ih2iZJqAB9tRXpjRvlEzVxP8ik+TvWNA6EBvsI16BVSU3ZfHt5HFdje5 Gb2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=ol5Izgpwq4/5SkZ0+ZUJRNtxGSXFQzNwkzMKvAF+gbU=; b=xo6i6Swqtji14AWbjD18LVt2y+24eEbqPyQ6sQFEtCxvrh8KAIjGpRmHRYGjvY/aQd AZfZHkGiR5Zd3nj4+0kXrTSbryaJ5/h1CsSpleFucqMKhuqyidpIOgVEsnY4QaUmC5By wnRZ3e3JX+1fVXzhZxZeIyPBmDHTuzs8Z5Hu6zbTE6ig1DnPUpshdNzzSewVlCPQyK5r l7lxRbQ4UFJJLbZFEyuGSUOOqYdKhLNDrkxWgbo3snScc7naa13mD1aNteDzq6K3F9Mz TUoqwXbFzCoJcrkIuHZMwCFAr9JYsWX6F+r72x7ST0Gs1tKv2PbdFQv1KMU2rn5FaY4n fCGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o3si54652078pgm.441.2019.01.04.08.01.32; Fri, 04 Jan 2019 08:01:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-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-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728382AbfADQBc (ORCPT + 1 other); Fri, 4 Jan 2019 11:01:32 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:35486 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727022AbfADQBc (ORCPT ); Fri, 4 Jan 2019 11:01:32 -0500 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 6490D36796A41; Sat, 5 Jan 2019 00:01:28 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.408.0; Sat, 5 Jan 2019 00:00:25 +0800 From: John Garry To: , CC: , , , , John Garry Subject: [PATCH 2/3] scsi: libsas: Check SMP PHY control function result Date: Sat, 5 Jan 2019 00:01:27 +0800 Message-ID: <1546617688-240623-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1546617688-240623-1-git-send-email-john.garry@huawei.com> References: <1546617688-240623-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Currently the SMP PHY control execution result is checked, however the function result for the command is not. As such, we may be missing all potential errors, like SMP FUNCTION FAILED, INVALID REQUEST FRAME LENGTH, etc., meaning the PHY control request has failed. In some scenarios we need to ensure the function result is accepted, so add a check for this. Tested-by: Jian Luo Signed-off-by: John Garry --- drivers/scsi/libsas/sas_expander.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- 1.9.1 diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 17eb418..8817b8e 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -614,7 +614,14 @@ int sas_smp_phy_control(struct domain_device *dev, int phy_id, } res = smp_execute_task(dev, pc_req, PC_REQ_SIZE, pc_resp,PC_RESP_SIZE); - + if (res) { + pr_err("ex %016llx phy%02d PHY control failed: %d\n", + SAS_ADDR(dev->sas_addr), phy_id, res); + } else if (pc_resp[2] != SMP_RESP_FUNC_ACC) { + pr_err("ex %016llx phy%02d PHY control failed: function result 0x%x\n", + SAS_ADDR(dev->sas_addr), phy_id, pc_resp[2]); + res = pc_resp[2]; + } kfree(pc_resp); kfree(pc_req); return res;