From patchwork Fri Apr 12 08:57:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 162102 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp365022jan; Fri, 12 Apr 2019 01:58:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyH/Cqqnmn4/70zY9ZbduUBKlf2l/WHKCNHQSFrZLdT30+11ECCPjAWl5iWaiPbUSKcnUxZ X-Received: by 2002:a63:5c43:: with SMTP id n3mr48529581pgm.163.1555059533395; Fri, 12 Apr 2019 01:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555059533; cv=none; d=google.com; s=arc-20160816; b=DsGgwRcw9miXbLPnHEbfu9pvR8aDDrpkdwQNL8KfBDG3lF35lHAvl7tnu27sAm0qX4 RRm7icnPy4LIGRkPlnlNZ+BEC7/lllrRP8BXHLRaFMAOQ5iEivoONTz0J0MLxpiABriY 5Ru7bXVD2qRdJ+f8v4TMOhsyMozCJ+pOPGqu7Gd6UaliWQqErQEX81Mg7Tu104ytM4ZP DU7my0/P4VUDdyAGMwNc/XEzt11ekzj2nF8+rdS1uWFRpMSMO0Djhbwi19hG47Zbw31T A+Ks2eCVzeqQv8f9s9K2lmARgaiznaOMawp626xLsX3557An5sP0mhqSwM/8twKqoEAr NP7w== 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=atcJRAecD0RIGOkCvrvNWnPiAZAKzGJD/sgrVyfzt4c=; b=gjEV8fV0K48AjIWyCMYBRcyc6qDGkbSUZ0yZfp3RZxZNpk6e7MMVItNx8aMcNeKdfY 9TrmQqVnZ4FrA8MeDofjyrxN0tVxj8IUG7bEMoU2RAJOMfBOZPSCEpIBBDwjhUs6FH7t 2ZCZodHgrBvDplJ93v3jdV/0Afgebgzpq9CXMkKWGYXQIu+39IwkpD6aCT5tu81sVYxj l6d4eiC+C9sXa9bob+QGP3eynx6w9mHP4wG1TS+Xmp/1hGlhQgEgjNtDIx+lBp/A1DU6 i9Ms9jyRqCS56tZ8RU3UEeYsFR/MIWGRD1OFqTcpKaR5p0RZFOCQbJ3jj3LWPyKUvfGo 6i9w== 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 a67si29728022pla.350.2019.04.12.01.58.52; Fri, 12 Apr 2019 01:58:53 -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 S1727934AbfDLI6v (ORCPT + 31 others); Fri, 12 Apr 2019 04:58:51 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6733 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727185AbfDLI63 (ORCPT ); Fri, 12 Apr 2019 04:58:29 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id BDD497B9900FE6028435; Fri, 12 Apr 2019 16:58:24 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Fri, 12 Apr 2019 16:58:14 +0800 From: John Garry To: , CC: , , , , , , John Garry Subject: [PATCH 1/6] scsi: libsas: Stop hardcoding SAS address length Date: Fri, 12 Apr 2019 16:57:52 +0800 Message-ID: <1555059478-36224-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1555059478-36224-1-git-send-email-john.garry@huawei.com> References: <1555059478-36224-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Many times we use 8 for SAS address length, while we already have a macro for this - SAS_ADDR_SIZE. Replace instances of this with the macro. However, don't touch the SAS address array sizes sas.h, as these are defined according to the SAS spec. Some missing whitespaces are also added, and whitespace indentation in sas_hash_addr() is also fixed (see sas_hash_addr()). Signed-off-by: John Garry --- drivers/scsi/libsas/sas_expander.c | 15 +++++------ drivers/scsi/libsas/sas_init.c | 40 ++++++++++++++++-------------- include/scsi/libsas.h | 6 ++--- 3 files changed, 32 insertions(+), 29 deletions(-) -- 2.17.1 diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 17b45a0c7bc3..93f297199d4c 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -1151,7 +1151,7 @@ static int sas_find_sub_addr(struct domain_device *dev, u8 *sub_addr) phy->attached_dev_type == SAS_FANOUT_EXPANDER_DEVICE) && phy->routing_attr == SUBTRACTIVE_ROUTING) { - memcpy(sub_addr, phy->attached_sas_addr,SAS_ADDR_SIZE); + memcpy(sub_addr, phy->attached_sas_addr, SAS_ADDR_SIZE); return 1; } @@ -1163,7 +1163,7 @@ static int sas_check_level_subtractive_boundary(struct domain_device *dev) { struct expander_device *ex = &dev->ex_dev; struct domain_device *child; - u8 sub_addr[8] = {0, }; + u8 sub_addr[SAS_ADDR_SIZE] = {0, }; list_for_each_entry(child, &ex->children, siblings) { if (child->dev_type != SAS_EDGE_EXPANDER_DEVICE && @@ -1173,7 +1173,7 @@ static int sas_check_level_subtractive_boundary(struct domain_device *dev) sas_find_sub_addr(child, sub_addr); continue; } else { - u8 s2[8]; + u8 s2[SAS_ADDR_SIZE]; if (sas_find_sub_addr(child, s2) && (SAS_ADDR(sub_addr) != SAS_ADDR(s2))) { @@ -1760,10 +1760,11 @@ static int sas_get_phy_attached_dev(struct domain_device *dev, int phy_id, res = sas_get_phy_discover(dev, phy_id, disc_resp); if (res == 0) { - memcpy(sas_addr, disc_resp->disc.attached_sas_addr, 8); + memcpy(sas_addr, disc_resp->disc.attached_sas_addr, + SAS_ADDR_SIZE); *type = to_dev_type(dr); if (*type == 0) - memset(sas_addr, 0, 8); + memset(sas_addr, 0, SAS_ADDR_SIZE); } kfree(disc_resp); return res; @@ -2027,10 +2028,10 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last) struct expander_device *ex = &dev->ex_dev; struct ex_phy *phy = &ex->ex_phy[phy_id]; enum sas_device_type type = SAS_PHY_UNUSED; - u8 sas_addr[8]; + u8 sas_addr[SAS_ADDR_SIZE]; int res; - memset(sas_addr, 0, 8); + memset(sas_addr, 0, SAS_ADDR_SIZE); res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type); switch (res) { case SMP_RESP_NO_PHY: diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c index 221340ee8651..213c85557bf9 100644 --- a/drivers/scsi/libsas/sas_init.c +++ b/drivers/scsi/libsas/sas_init.c @@ -87,25 +87,27 @@ EXPORT_SYMBOL_GPL(sas_free_task); /*------------ SAS addr hash -----------*/ void sas_hash_addr(u8 *hashed, const u8 *sas_addr) { - const u32 poly = 0x00DB2777; - u32 r = 0; - int i; - - for (i = 0; i < 8; i++) { - int b; - for (b = 7; b >= 0; b--) { - r <<= 1; - if ((1 << b) & sas_addr[i]) { - if (!(r & 0x01000000)) - r ^= poly; - } else if (r & 0x01000000) - r ^= poly; - } - } - - hashed[0] = (r >> 16) & 0xFF; - hashed[1] = (r >> 8) & 0xFF ; - hashed[2] = r & 0xFF; + const u32 poly = 0x00DB2777; + u32 r = 0; + int i; + + for (i = 0; i < SAS_ADDR_SIZE; i++) { + int b; + + for (b = (SAS_ADDR_SIZE - 1); b >= 0; b--) { + r <<= 1; + if ((1 << b) & sas_addr[i]) { + if (!(r & 0x01000000)) + r ^= poly; + } else if (r & 0x01000000) { + r ^= poly; + } + } + } + + hashed[0] = (r >> 16) & 0xFF; + hashed[1] = (r >> 8) & 0xFF; + hashed[2] = r & 0xFF; } int sas_register_ha(struct sas_ha_struct *sas_ha) diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index 56b2dba7d911..cfaaf1254211 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h @@ -245,9 +245,9 @@ static inline struct sas_discovery_event *to_sas_discovery_event(struct work_str struct sas_discovery { struct sas_discovery_event disc_work[DISC_NUM_EVENTS]; unsigned long pending; - u8 fanout_sas_addr[8]; - u8 eeds_a[8]; - u8 eeds_b[8]; + u8 fanout_sas_addr[SAS_ADDR_SIZE]; + u8 eeds_a[SAS_ADDR_SIZE]; + u8 eeds_b[SAS_ADDR_SIZE]; int max_level; }; From patchwork Fri Apr 12 08:57:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 162100 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp364800jan; Fri, 12 Apr 2019 01:58:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqouIYIHUHmsr0lzN16AwWYdkH1qmphAbA5kcIWbig1clef0zOqyqf6h0uq6LsBw6LBVAg X-Received: by 2002:a17:902:1c9:: with SMTP id b67mr34242035plb.158.1555059517389; Fri, 12 Apr 2019 01:58:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555059517; cv=none; d=google.com; s=arc-20160816; b=hKYH5DagyQQPTYP+yz9HLyN0thLoAa8YBnYols982sOTuB0XMjWkGBOvDWHolHf7i6 v/xc7UjlwOL9YBAmsx8AHRoV6pVt5Dj4JwDYs0RyNdVpM8bJJH1ANSG8qYNpqR+nS5ih JcY6rFbdVGlL2WB3Y5p6UjgIeHMJ9p/oFZzpQYmdTO1ZeqwXA+ag3toUkKzVYAHisHRJ vFQl6J2ympd34XWEPQbambQ1kyAp2sOCgVBeEWJ5mRAyEpjcr0nCCTZaCkWIyZqUknmz 0b2tSYIeOa7aDTZIYa2kLG5N2gBTGFRaB2Deu8LqVRxAAYNj69Fja4L50+705WTSOj6F 5ZOg== 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=CS8aGAg5fQ+Si49IVyEPxghsgYAwmqcBIeRi4FeMocg=; b=nsOikFLDG5SYyh75iKPGtktrADi7MQR3Uwy8uFnq5GS4MYmNrB9TaRyOtzFczhbmwn 7bUzByo/Rc8JqIJHH0dYv6D1PHyl/nnzAZyGjaKwxwwIrDW+4va7snPq8/nI1hkoITjm 6Yjy/RwJlLX1Gg4WwqWKgnJmLnAqy3XcOwUIQXR9nyRTfopY9S3ThrqjcX+7avDxvYFZ MvX0S7Hli4cm3JGpflYd9mTLTwt0mk9r3lqT7uXoE+cM9Df6uPxfB8NqD8sPmDH8QPsU dil66GqZHVjvNLJq4dj2OSL71zQ2UEo0qweTshskZhdyNgbPmVivrKD8uUleO8rY9JpB 3Gag== 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 70si7955696plc.88.2019.04.12.01.58.37; Fri, 12 Apr 2019 01:58:37 -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 S1727776AbfDLI6g (ORCPT + 31 others); Fri, 12 Apr 2019 04:58:36 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6737 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727276AbfDLI6d (ORCPT ); Fri, 12 Apr 2019 04:58:33 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id C2D68F58CF30741F09EE; Fri, 12 Apr 2019 16:58:24 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Fri, 12 Apr 2019 16:58:15 +0800 From: John Garry To: , CC: , , , , , , John Garry Subject: [PATCH 2/6] scsi: libsas: Try to retain programmed min linkrate for SATA min pathway unmatch fixing Date: Fri, 12 Apr 2019 16:57:53 +0800 Message-ID: <1555059478-36224-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1555059478-36224-1-git-send-email-john.garry@huawei.com> References: <1555059478-36224-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently for fixing the linkrate matching during discovery such that the linkrate of a SATA PHY does not exceed min pathway to initiator, we set the SATA PHY programmed min linkrate to the same value as the programmed max linkrate. This is unnecessary, and we should be able to keep the same programmed min linkrate if it is already lower than this new max programmed linkrate. This patch makes that change. In effect, this will not make much difference since we generally will negotiate a linkrate at the programmed max linkrate, and the programmed min linkrate will have no impact. Signed-off-by: John Garry --- drivers/scsi/libsas/sas_expander.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 93f297199d4c..dfdf3c94d326 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -826,9 +826,14 @@ static struct domain_device *sas_ex_discover_end_dev( #ifdef CONFIG_SCSI_SAS_ATA if ((phy->attached_tproto & SAS_PROTOCOL_STP) || phy->attached_sata_dev) { if (child->linkrate > parent->min_linkrate) { + struct sas_phy *cphy = child->phy; + enum sas_linkrate min_prate = cphy->minimum_linkrate, + parent_min_lrate = parent->min_linkrate, + min_linkrate = (min_prate > parent_min_lrate) ? + parent_min_lrate : 0; struct sas_phy_linkrates rates = { .maximum_linkrate = parent->min_linkrate, - .minimum_linkrate = parent->min_linkrate, + .minimum_linkrate = min_linkrate, }; int ret; From patchwork Fri Apr 12 08:57:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 162097 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp364741jan; Fri, 12 Apr 2019 01:58:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+n+DKRFG4ZS/Go5ReBsLfoTBr5HoKn/4jCDVZYC+7OJrNVT3FnFaPb9JlClTYAwUDKUBG X-Received: by 2002:a17:902:56e:: with SMTP id 101mr6784317plf.142.1555059512264; Fri, 12 Apr 2019 01:58:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555059512; cv=none; d=google.com; s=arc-20160816; b=xtXHIRo6ZyWjCbv+bRuLbToWWmUY59aLeBRip5veLBvIos5q2L+iouuXGqWJ0kb8Uc ssWt4OXS7MmEdI9UwUjKztpwuq4bNzO8dy37E7pUMbkPQE0Ji87D3uwj/EUUG2S+jvur XeS7Rho4aOGdYINqmRBRa6EDBZFnFfwoOjsj8p/HgOlBur7eDkJr2hA79qfcMWscu63m Ib2Wo5veAr6YTX/okMN6RY5S3Hq50Buid8zYPTQZCyi4lZIg3WATB2oieUKOgaU2uNEs jC3BAd3xYzEsby+fsjIfsM9X/cQ6kH2TQScmrLf6K/MDSqoApqhLUxEDTfsois7L5YqT v6lA== 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=zBaka+U9w2QfrrJ17+PW+qcM5J1+VIbWaaJFF9slFcc=; b=CXy7HCP0sr8KB04RDUCaaB6C2QWFLr1+UWLPAlW5dNpaITeJjPYIBPzwOnt/7buw9e aPmiOg2dtRa8IXxPDJahZ76VGJa/MAWxcDJNdL0H5/CsOxa8HvfYcvJEwnJJDdFZEvjV n1kpUuV6nBFIk4TcEaAwJlgLNXt/A1auzlf+imOg6b9k9QBBBFuwFVpV64w0SAkvNO07 cs9ufNUERV/W1zzqVyXoGDzBgJOd9m1Z9MrMLytOAvLyn2haD/Ttz3TLms9PRSeEcVr/ ntYBxFGoY3bxXtQC2duXcXPzZa+DUSvhMtcmrILPShwmrSEDsLZm+P9Rlyuq/Q6Rey6Y irzw== 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 b2si36052809pgt.494.2019.04.12.01.58.31; Fri, 12 Apr 2019 01:58:32 -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 S1727491AbfDLI6a (ORCPT + 31 others); Fri, 12 Apr 2019 04:58:30 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6735 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727278AbfDLI61 (ORCPT ); Fri, 12 Apr 2019 04:58:27 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id B481B12ED4669CC8B778; Fri, 12 Apr 2019 16:58:24 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Fri, 12 Apr 2019 16:58:16 +0800 From: John Garry To: , CC: , , , , , , John Garry Subject: [PATCH 4/6] scsi: libsas: Inject revalidate event for root port event Date: Fri, 12 Apr 2019 16:57:55 +0800 Message-ID: <1555059478-36224-5-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1555059478-36224-1-git-send-email-john.garry@huawei.com> References: <1555059478-36224-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org According to the SAS spec, an expander device shall transmit BROADCAST (CHANGE) from at least one phy in each expander port other than the expander port that is the cause for transmitting BROADCAST (CHANGE). As such, for when the link is lost for a root PHY attached to an expander PHY, we get no broadcast event. This causes an issue for libsas, in that we will not revalidate the domain for these events. As a solution, for when a root PHY is formed or deformed from a root port, insert a broadcast event to trigger a domain revalidation. Signed-off-by: John Garry --- drivers/scsi/libsas/sas_port.c | 24 +++++++++++++++++++++--- include/scsi/libsas.h | 7 +++++++ 2 files changed, 28 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c index 03fe479359b6..38a10478605c 100644 --- a/drivers/scsi/libsas/sas_port.c +++ b/drivers/scsi/libsas/sas_port.c @@ -95,6 +95,7 @@ static void sas_form_port(struct asd_sas_phy *phy) int i; struct sas_ha_struct *sas_ha = phy->ha; struct asd_sas_port *port = phy->port; + struct domain_device *port_dev; struct sas_internal *si = to_sas_internal(sas_ha->core.shost->transportt); unsigned long flags; @@ -153,8 +154,9 @@ static void sas_form_port(struct asd_sas_phy *phy) } /* add the phy to the port */ + port_dev = port->port_dev; list_add_tail(&phy->port_phy_el, &port->phy_list); - sas_phy_set_target(phy, port->port_dev); + sas_phy_set_target(phy, port_dev); phy->port = port; port->num_phys++; port->phy_mask |= (1U << phy->id); @@ -184,14 +186,21 @@ static void sas_form_port(struct asd_sas_phy *phy) port->phy_mask, SAS_ADDR(port->attached_sas_addr)); - if (port->port_dev) - port->port_dev->pathways = port->num_phys; + if (port_dev) + port_dev->pathways = port->num_phys; /* Tell the LLDD about this port formation. */ if (si->dft->lldd_port_formed) si->dft->lldd_port_formed(phy); sas_discover_event(phy->port, DISCE_DISCOVER_DOMAIN); + /* Only insert a revalidate event after initial discovery */ + if (port_dev && sas_dev_type_is_expander(port_dev->dev_type)) { + struct expander_device *ex_dev = &port_dev->ex_dev; + + ex_dev->ex_change_count = -1; + sas_discover_event(port, DISCE_REVALIDATE_DOMAIN); + } flush_workqueue(sas_ha->disco_q); } @@ -254,6 +263,15 @@ void sas_deform_port(struct asd_sas_phy *phy, int gone) spin_unlock(&port->phy_list_lock); spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags); + /* Only insert revalidate event if the port still has members */ + if (port->port && dev && sas_dev_type_is_expander(dev->dev_type)) { + struct expander_device *ex_dev = &dev->ex_dev; + + ex_dev->ex_change_count = -1; + sas_discover_event(port, DISCE_REVALIDATE_DOMAIN); + } + flush_workqueue(sas_ha->disco_q); + return; } diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index cfaaf1254211..b08febec7895 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h @@ -224,6 +224,13 @@ struct sas_work { struct work_struct work; }; +/* Lots of code duplicates this in the SCSI tree, which can be factored out */ +static inline bool sas_dev_type_is_expander(enum sas_device_type type) +{ + return type == SAS_EDGE_EXPANDER_DEVICE || + type == SAS_FANOUT_EXPANDER_DEVICE; +} + static inline void INIT_SAS_WORK(struct sas_work *sw, void (*fn)(struct work_struct *)) { INIT_WORK(&sw->work, fn); From patchwork Fri Apr 12 08:57:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 162096 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp364693jan; Fri, 12 Apr 2019 01:58:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyatsuanMiQUm/Yir+n+Zpek9FKE6A036WPj+LolNJhUMEbn/vQdRwoyw38nXfXQamd9Fzu X-Received: by 2002:a63:d713:: with SMTP id d19mr7737296pgg.145.1555059509774; Fri, 12 Apr 2019 01:58:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555059509; cv=none; d=google.com; s=arc-20160816; b=R0sao6BIJbMVYMJZ8ojFuMPNxvsy3fGploNVos71i4cBEPAf9ubvGN29z1jnCepHFJ Un6MIhfkFPy+bixfuOHojOkWKeykZDGBAr9jPHbisOhnBeZ6gDipo/OsZJfNA5oovEBQ gqBI/Bp6vALllmcQgMYmzd43D3aUKoJVIS3Km+DSHBfugFKeTDg8kLa1yB4yi0qvb1Cl 1ExvQXjGQYFbu5IwYH4pSLDw6DEYIXHouybaSqKnhLWSw2HrBIsT986JdmagIn/5Kua6 v92FZz6Sft8h5FO/T+RT9u2FPqJg1MkhMxFJqiGwGJ3miRXHY1dFV7JqRro4twcguYri W8eA== 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=2r70ILTNHMZfSrYuadec8IKhbET2cfPsrvP45I58g/s=; b=SsWiCVX9fIJg4kjFLFlq84hnoKF4qImZ4w94UA+tuMUaViPbiBuImWTg780Zyay8Kc v0tCH6jTcJbq9u+/g3g+aCmSK6OdXGfg1MhgcdLbN6qcCbs9f4Kdf/RlQqT7RI6S2n9i l8NQ/J8BCEGzqU4/Pg9oWdEEnRtPVSnEqqpBQy+xS1XZ5AXprUX9t5rnw706/vN9Ivmt VTIcRx6LtbsQeFKxUczuPuKXhQylR43+gv09yon/PUYl8FXYQ7RA4yXUUCU0IYslHwsw 1fhu5FCKvR0GZ5TcJNHDHX3i0NJV/cqOWTmQuFhFzPrcuHbpsjECB4b/k4yBwdszkY9h 6cog== 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 gn11si36505252plb.205.2019.04.12.01.58.29; Fri, 12 Apr 2019 01:58:29 -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 S1727361AbfDLI62 (ORCPT + 31 others); Fri, 12 Apr 2019 04:58:28 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6732 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726731AbfDLI61 (ORCPT ); Fri, 12 Apr 2019 04:58:27 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id AFEB922D21713472FF63; Fri, 12 Apr 2019 16:58:24 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Fri, 12 Apr 2019 16:58:16 +0800 From: John Garry To: , CC: , , , , , , John Garry Subject: [PATCH 5/6] scsi: libsas: Do discovery on empty PHY to update PHY info Date: Fri, 12 Apr 2019 16:57:56 +0800 Message-ID: <1555059478-36224-6-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1555059478-36224-1-git-send-email-john.garry@huawei.com> References: <1555059478-36224-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When we discover the PHY is empty in sas_rediscover_dev(), the PHY information (like negotiated linkrate) is not updated. As such, for a user examining sysfs for that PHY, they would see incorrect values: root@(none)$ cd /sys/class/sas_phy/phy-0:0:20 root@(none)$ more negotiated_linkrate 3.0 Gbit root@(none)$ echo 0 > enable root@(none)$ more negotiated_linkrate 3.0 Gbit So fix this, simply discover the PHY again, even though we know it's empty; in the above example, this gives us: root@(none)$ more negotiated_linkrate Phy disabled We must do this after unregistering the device associated with the PHY (in sas_unregister_devs_sas_addr()). Signed-off-by: John Garry --- drivers/scsi/libsas/sas_expander.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.17.1 diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 6f569a65d791..ad96bc843acc 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -2068,6 +2068,11 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) { phy->phy_state = PHY_EMPTY; sas_unregister_devs_sas_addr(dev, phy_id, last); + /* + * Even though the PHY is empty, for convenience we discover + * the PHY to update the PHY info, like negotiated linkrate. + */ + sas_ex_phy_discover(dev, phy_id); return res; } else if (SAS_ADDR(sas_addr) == SAS_ADDR(phy->attached_sas_addr) && dev_type_flutter(type, phy->attached_dev_type)) { From patchwork Fri Apr 12 08:57:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 162099 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp364793jan; Fri, 12 Apr 2019 01:58:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqwChp03JTbR8JSQobqe48O1GJf/+8NIZ9kI1WIBAazCU8IJJ63/XVH9uu800tuSNEEGF3he X-Received: by 2002:a17:902:9a4c:: with SMTP id x12mr8582065plv.90.1555059517048; Fri, 12 Apr 2019 01:58:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555059517; cv=none; d=google.com; s=arc-20160816; b=yYEVr9jJiVucKa4kEO7fgRcNU9Ggbz1b9o4Daea4DYe7ihN4hnF+6IeBRWEDKA2QkX +uhk//6Bt1OwW5L3S+qHEj/Wocdxwr2r/obC7wR0h+Jz0OerZaK95CJKUsSiLL6WWG/K GezTB+Tobzaw+vpk11pEjt4xAe2tMp2zk2InSWyKg/q+ElUxvEYisoKzMuh4BURHOYXg s7aIEBIPN/mZ2vJNcr4PZ1lMoHU54b6h9Hwv8CrTO0NuXl2V+KMXgFqYWc65skwWclUL wRSz1eq1oHO9tk9YHS5j3L/ViYk+3l9iwCt3ihU8EdHsXMqNp2QKLcWZDcKsz6PWgG2i S7dQ== 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=pdN5Z0W3w8gPH/++XMAue4HJtiUNBMIrP5/3RREp6sE=; b=kgPFrflQYkuUoVvC7Cyu7JbkEtMa1Qx3RDTbGM1BDUiH2YGQKrR6W4Po1QohBpeNTN L1LT43eVWFuiewxPeF3YkdkOfG2QD4BiJZJP7sUyMmUHnmPDhhufFPczmuNi1kHDqMb4 FK5Fh/0tQKOjb9/SWdLhJaYXPqZrA7HC4ZufxFFxtMkYoc2UEJ1G2gi3MxKNnd/E2PPV X0SsHSf7NhUeAOnQYbE6nPOXb2/8uzrIT9i8GkzaMZn7hSgzOVdzPKtT12ejfO5CCQMJ HC2zquydI7KmFrgHcGRxZbTZZyOKIFA4zkAsw75yxURj6LTUVx8VAGGbVvpzAzxO19vw DeNw== 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 70si7955696plc.88.2019.04.12.01.58.36; Fri, 12 Apr 2019 01:58:37 -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 S1727660AbfDLI6f (ORCPT + 31 others); Fri, 12 Apr 2019 04:58:35 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6734 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725973AbfDLI6b (ORCPT ); Fri, 12 Apr 2019 04:58:31 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id A91F2C8FF5261A2F2F78; Fri, 12 Apr 2019 16:58:24 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Fri, 12 Apr 2019 16:58:16 +0800 From: John Garry To: , CC: , , , , , , John Garry Subject: [PATCH 6/6] scsi: libsas: Print expander PHY indexes in decimal Date: Fri, 12 Apr 2019 16:57:57 +0800 Message-ID: <1555059478-36224-7-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1555059478-36224-1-git-send-email-john.garry@huawei.com> References: <1555059478-36224-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently we print expander PHY indexes in a mix of decimal and hex. It is more consistent and also more convenient to read decimal, so make this change. We use width of 2 for expander and 1 for root PHYs prints. Some lines which were needlessly spilling multiple lines are unified. Signed-off-by: John Garry --- drivers/scsi/libsas/sas_ata.c | 2 +- drivers/scsi/libsas/sas_expander.c | 44 +++++++++++++++--------------- drivers/scsi/libsas/sas_init.c | 2 +- drivers/scsi/libsas/sas_phy.c | 7 ++--- 4 files changed, 27 insertions(+), 28 deletions(-) -- 2.17.1 diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 6f93fee2b21b..1ecca71df8b5 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -281,7 +281,7 @@ int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy) res = sas_get_report_phy_sata(dev->parent, phy->phy_id, &dev->sata_dev.rps_resp); if (res) { - pr_debug("report phy sata to %016llx:0x%x returned 0x%x\n", + pr_debug("report phy sata to %016llx:%02d returned 0x%x\n", SAS_ADDR(dev->parent->sas_addr), phy->phy_id, res); return res; diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index ad96bc843acc..83f2fd70ce76 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -870,7 +870,7 @@ static struct domain_device *sas_ex_discover_end_dev( res = sas_discover_sata(child); if (res) { - pr_notice("sas_discover_sata() for device %16llx at %016llx:0x%x returned 0x%x\n", + pr_notice("sas_discover_sata() for device %16llx at %016llx:%02d returned 0x%x\n", SAS_ADDR(child->sas_addr), SAS_ADDR(parent->sas_addr), phy_id, res); goto out_list_del; @@ -895,7 +895,7 @@ static struct domain_device *sas_ex_discover_end_dev( res = sas_discover_end_dev(child); if (res) { - pr_notice("sas_discover_end_dev() for device %16llx at %016llx:0x%x returned 0x%x\n", + pr_notice("sas_discover_end_dev() for device %16llx at %016llx:%02d returned 0x%x\n", SAS_ADDR(child->sas_addr), SAS_ADDR(parent->sas_addr), phy_id, res); goto out_list_del; @@ -960,7 +960,7 @@ static struct domain_device *sas_ex_discover_expander( int res; if (phy->routing_attr == DIRECT_ROUTING) { - pr_warn("ex %016llx:0x%x:D <--> ex %016llx:0x%x is not allowed\n", + pr_warn("ex %016llx:%02d:D <--> ex %016llx:0x%x is not allowed\n", SAS_ADDR(parent->sas_addr), phy_id, SAS_ADDR(phy->attached_sas_addr), phy->attached_phy_id); @@ -1070,7 +1070,7 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id) ex_phy->attached_dev_type != SAS_FANOUT_EXPANDER_DEVICE && ex_phy->attached_dev_type != SAS_EDGE_EXPANDER_DEVICE && ex_phy->attached_dev_type != SAS_SATA_PENDING) { - pr_warn("unknown device type(0x%x) attached to ex %016llx phy 0x%x\n", + pr_warn("unknown device type(0x%x) attached to ex %016llx phy%02d\n", ex_phy->attached_dev_type, SAS_ADDR(dev->sas_addr), phy_id); @@ -1086,7 +1086,7 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id) } if (sas_ex_join_wide_port(dev, phy_id)) { - pr_debug("Attaching ex phy%d to wide port %016llx\n", + pr_debug("Attaching ex phy%02d to wide port %016llx\n", phy_id, SAS_ADDR(ex_phy->attached_sas_addr)); return res; } @@ -1098,7 +1098,7 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id) break; case SAS_FANOUT_EXPANDER_DEVICE: if (SAS_ADDR(dev->port->disc.fanout_sas_addr)) { - pr_debug("second fanout expander %016llx phy 0x%x attached to ex %016llx phy 0x%x\n", + pr_debug("second fanout expander %016llx phy%02d attached to ex %016llx phy%02d\n", SAS_ADDR(ex_phy->attached_sas_addr), ex_phy->attached_phy_id, SAS_ADDR(dev->sas_addr), @@ -1131,7 +1131,7 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id) SAS_ADDR(child->sas_addr)) { ex->ex_phy[i].phy_state= PHY_DEVICE_DISCOVERED; if (sas_ex_join_wide_port(dev, i)) - pr_debug("Attaching ex phy%d to wide port %016llx\n", + pr_debug("Attaching ex phy%02d to wide port %016llx\n", i, SAS_ADDR(ex->ex_phy[i].attached_sas_addr)); } } @@ -1266,7 +1266,7 @@ static int sas_check_ex_subtractive_boundary(struct domain_device *dev) else if (SAS_ADDR(sub_sas_addr) != SAS_ADDR(phy->attached_sas_addr)) { - pr_notice("ex %016llx phy 0x%x diverges(%016llx) on subtractive boundary(%016llx). Disabled\n", + pr_notice("ex %016llx phy%02d diverges(%016llx) on subtractive boundary(%016llx). Disabled\n", SAS_ADDR(dev->sas_addr), i, SAS_ADDR(phy->attached_sas_addr), SAS_ADDR(sub_sas_addr)); @@ -1287,7 +1287,7 @@ static void sas_print_parent_topology_bug(struct domain_device *child, }; struct domain_device *parent = child->parent; - pr_notice("%s ex %016llx phy 0x%x <--> %s ex %016llx phy 0x%x has %c:%c routing link!\n", + pr_notice("%s ex %016llx phy%02d <--> %s ex %016llx phy%02d has %c:%c routing link!\n", ex_type[parent->dev_type], SAS_ADDR(parent->sas_addr), parent_phy->phy_id, @@ -1309,7 +1309,7 @@ static int sas_check_eeds(struct domain_device *child, if (SAS_ADDR(parent->port->disc.fanout_sas_addr) != 0) { res = -ENODEV; - pr_warn("edge ex %016llx phy S:0x%x <--> edge ex %016llx phy S:0x%x, while there is a fanout ex %016llx\n", + pr_warn("edge ex %016llx phy S:%02d <--> edge ex %016llx phy S:%02d, while there is a fanout ex %016llx\n", SAS_ADDR(parent->sas_addr), parent_phy->phy_id, SAS_ADDR(child->sas_addr), @@ -1332,7 +1332,7 @@ static int sas_check_eeds(struct domain_device *child, ; else { res = -ENODEV; - pr_warn("edge ex %016llx phy 0x%x <--> edge ex %016llx phy 0x%x link forms a third EEDS!\n", + pr_warn("edge ex %016llx phy%02d <--> edge ex %016llx phy%02d link forms a third EEDS!\n", SAS_ADDR(parent->sas_addr), parent_phy->phy_id, SAS_ADDR(child->sas_addr), @@ -1450,11 +1450,11 @@ static int sas_configure_present(struct domain_device *dev, int phy_id, goto out; res = rri_resp[2]; if (res == SMP_RESP_NO_INDEX) { - pr_warn("overflow of indexes: dev %016llx phy 0x%x index 0x%x\n", + pr_warn("overflow of indexes: dev %016llx phy%02d index 0x%x\n", SAS_ADDR(dev->sas_addr), phy_id, i); goto out; } else if (res != SMP_RESP_FUNC_ACC) { - pr_notice("%s: dev %016llx phy 0x%x index 0x%x result 0x%x\n", + pr_notice("%s: dev %016llx phy%02d index 0x%x result 0x%x\n", __func__, SAS_ADDR(dev->sas_addr), phy_id, i, res); goto out; @@ -1520,7 +1520,7 @@ static int sas_configure_set(struct domain_device *dev, int phy_id, goto out; res = cri_resp[2]; if (res == SMP_RESP_NO_INDEX) { - pr_warn("overflow of indexes: dev %016llx phy 0x%x index 0x%x\n", + pr_warn("overflow of indexes: dev %016llx phy%02d index 0x%x\n", SAS_ADDR(dev->sas_addr), phy_id, index); } out: @@ -1876,7 +1876,7 @@ static int sas_find_bcast_dev(struct domain_device *dev, if (phy_id != -1) { *src_dev = dev; ex->ex_change_count = ex_change_count; - pr_info("ex %016llx phy%d change count has changed\n", + pr_info("ex %016llx phy%02d change count has changed\n", SAS_ADDR(dev->sas_addr), phy_id); return res; } else @@ -1991,7 +1991,7 @@ static int sas_discover_new(struct domain_device *dev, int phy_id) struct domain_device *child; int res; - pr_debug("ex %016llx phy%d new device attached\n", + pr_debug("ex %016llx phy%02d new device attached\n", SAS_ADDR(dev->sas_addr), phy_id); res = sas_ex_phy_discover(dev, phy_id); if (res) @@ -2041,10 +2041,10 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, int res; if (!last) - sprintf(msg, ", part of a wide port with phy%d", sibling); + sprintf(msg, ", part of a wide port with phy%02d", sibling); - pr_debug("ex %016llx rediscovering phy%d%s\n", SAS_ADDR(dev->sas_addr), - phy_id, msg); + pr_debug("ex %016llx rediscovering phy%02d%s\n", + SAS_ADDR(dev->sas_addr), phy_id, msg); memset(sas_addr, 0, SAS_ADDR_SIZE); res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type); @@ -2083,13 +2083,13 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, if (ata_dev && phy->attached_dev_type == SAS_SATA_PENDING) action = ", needs recovery"; - pr_debug("ex %016llx phy 0x%x broadcast flutter%s\n", + pr_debug("ex %016llx phy%02d broadcast flutter%s\n", SAS_ADDR(dev->sas_addr), phy_id, action); return res; } /* we always have to delete the old device when we went here */ - pr_info("ex %016llx phy 0x%x replace %016llx\n", + pr_info("ex %016llx phy%02d replace %016llx\n", SAS_ADDR(dev->sas_addr), phy_id, SAS_ADDR(phy->attached_sas_addr)); sas_unregister_devs_sas_addr(dev, phy_id, last); @@ -2119,7 +2119,7 @@ static int sas_rediscover(struct domain_device *dev, const int phy_id) int i; bool last = true; /* is this the last phy of the port */ - pr_debug("ex %016llx phy%d originated BROADCAST(CHANGE)\n", + pr_debug("ex %016llx phy%02d originated BROADCAST(CHANGE)\n", SAS_ADDR(dev->sas_addr), phy_id); if (SAS_ADDR(changed_phy->attached_sas_addr) != 0) { diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c index 213c85557bf9..28a460c36c0b 100644 --- a/drivers/scsi/libsas/sas_init.c +++ b/drivers/scsi/libsas/sas_init.c @@ -625,7 +625,7 @@ struct asd_sas_event *sas_alloc_event(struct asd_sas_phy *phy) if (atomic_read(&phy->event_nr) > phy->ha->event_thres) { if (i->dft->lldd_control_phy) { if (cmpxchg(&phy->in_shutdown, 0, 1) == 0) { - pr_notice("The phy%02d bursting events, shut it down.\n", + pr_notice("The phy%d bursting events, shut it down.\n", phy->id); sas_notify_phy_event(phy, PHYE_SHUTDOWN); } diff --git a/drivers/scsi/libsas/sas_phy.c b/drivers/scsi/libsas/sas_phy.c index 0374243c85d0..e030e1452136 100644 --- a/drivers/scsi/libsas/sas_phy.c +++ b/drivers/scsi/libsas/sas_phy.c @@ -122,11 +122,10 @@ static void sas_phye_shutdown(struct work_struct *work) phy->enabled = 0; ret = i->dft->lldd_control_phy(phy, PHY_FUNC_DISABLE, NULL); if (ret) - pr_notice("lldd disable phy%02d returned %d\n", - phy->id, ret); + pr_notice("lldd disable phy%d returned %d\n", phy->id, + ret); } else - pr_notice("phy%02d is not enabled, cannot shutdown\n", - phy->id); + pr_notice("phy%d is not enabled, cannot shutdown\n", phy->id); } /* ---------- Phy class registration ---------- */