Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2962932imm; Mon, 28 May 2018 21:04:13 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJBAsuIChlZgmg8NbamONbZttISLntjqs+00JAVlBuVn4FDyyL3uWpJCIosTNpkBLhns6Ye X-Received: by 2002:a62:48cd:: with SMTP id q74-v6mr4489269pfi.153.1527566653123; Mon, 28 May 2018 21:04:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527566653; cv=none; d=google.com; s=arc-20160816; b=M3Ge7bQvRwNBFyygMTbDrjt6htmRceBBOdy9ywO6NA/vMxgU8YCupmhKfSMT03xu7l 2VRpu3u0bQL+1M3Y0+V+2P2dpvfgSUmnWWhjhU2kDu68Z0wPV41bKZHJWR0gnludvzoc qSB3Edo5LiVzVtRrUj/ss9q9HNIrZQwshKzGbypW+5TqODTJ1JNTqy9rW/w+Jge5dvOv 1UmfMzFuS6xhMdr5nPc0FB3bO9yp7+xeZN0AIbk7muJ8OcM/ZsBoJx65osZTsdgA/vf6 8JAnQdroxyYkE6hO/IsCwO4vBSWZDLkjmQtI9zFZ8+SUFk/Nwrh/R47q+FSsBtOO0X6j 2lKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=4jJAkF2C62cA34+YMccyFnBtOa0tOUAgbkKDJyI5LlI=; b=xj9y2l6roRo9Uy4nbBQblieCHHA4JhlN/McAvflW+PYV8cgMjoI/nsdF4ffX9vmwNH AF2lGHnE+4vrYnG9TNQ+Ay0xPs/8JNpyUh812h0SZPCl8eVFIc5pGXgwGDwqLt0PKKJ/ UHq5ZrEM1ynLc/SeEdjxkujWLJk0NBCxDuIWdcThGdV++0Zdr3NvLPuJ8sXvWJPsbR/l JHeXVvz8UJXVyKTBxvbHvulYBEgqCfGxVTHjg2RlFtoAzaDyLrcfp9Hd6CEdZO3WqFkb dVdt4JOHN185wgJqC9TUo2QbLRUDPowEInkyQs+6/m2ulJoo5WpzU8s9gdvzDS2l7qvt QUCA== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r4-v6si24894617pgp.103.2018.05.28.21.03.58; Mon, 28 May 2018 21:04:13 -0700 (PDT) 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 S1756084AbeE2COq (ORCPT + 99 others); Mon, 28 May 2018 22:14:46 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8200 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756022AbeE2COU (ORCPT ); Mon, 28 May 2018 22:14:20 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 17BC69C79EE89; Tue, 29 May 2018 10:14:07 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.382.0; Tue, 29 May 2018 10:13:58 +0800 From: Jason Yan To: , CC: , , , , , , , , , , , , , Jason Yan Subject: [PATCH 0/8] libsas: Support swapping disks and SATA phy link rate matching the pathway Date: Tue, 29 May 2018 10:23:01 +0800 Message-ID: <20180529022309.21071-1-yanaijie@huawei.com> X-Mailer: git-send-email 2.13.6 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.124.28] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The work flow of revalidation now is scanning expander phy by the sequence of the phy and check if the phy have changed. This will leads to some issues of swapping disks or replacing a disk with a new one. And when an expander phy attached to a SATA phy is using a physical link rate greater than the expander host phys's linkrate, the disk will failed to be discovered(ATA commands all failed). This is described in sas protocal spec as: "If an expander phy attached to a SATA phy is using a physical link rate greater than the maximum connection rate supported by the pathway from an STP initiator port, a management application client should use the SMP PHY CONTROL function (see 10.4.3.10) to set the PROGRAMMED MAXIMUM PHYSICAL LINK RATE field of the expander phy to the maximum connection rate supported by the pathway from that STP initiator port." This patchset addresses the issues above by these main changes: 1. Let the revalidation first scan all phys, mark all changed phys, then revalidate in two steps. First check if we need to unregister some devices. if we need to unregister some devices, raise a new bcast and return. Second, if no devices need to be unregistered, discover new devices. 2. Check the SATA phy's linkrate to see if it is greater than any phy's linkrate it may pass through. Remember the minimum linkrate of the pathway and set the SATA phy linkrate to it using the SMP PHY CONTROL function. 3. Other changes such as checking the ata devices class and id to ensure the same device after flutter and so on. Jason Yan (8): scsi: libsas: delete dead code in scsi_transport_sas.c scsi: libsas: check the lldd callback correctly scsi: libsas: always unregister the old device if going to discover new scsi: libsas: trigger a new revalidation to discover the device scsi: libsas: check if the same sata device when flutter scsi: libsas: reset the phy state and address if discover failed scsi: libsas: fix issue of swapping two sas disks scsi: libsas: support SATA phy link rate unmatch the pathway drivers/ata/libata-core.c | 3 +- drivers/scsi/libsas/sas_ata.c | 131 ++++++++++++++++++++++++ drivers/scsi/libsas/sas_discover.c | 4 +- drivers/scsi/libsas/sas_expander.c | 198 +++++++++++++++++++++++++++++-------- drivers/scsi/libsas/sas_port.c | 2 + drivers/scsi/scsi_transport_sas.c | 2 - include/linux/libata.h | 2 + include/scsi/libsas.h | 1 + include/scsi/sas_ata.h | 6 ++ 9 files changed, 305 insertions(+), 44 deletions(-) -- 2.13.6