From patchwork Mon Jun 7 09:29:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 455270 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp2590118jae; Mon, 7 Jun 2021 02:35:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaibIEq6hBf6+5+kgQsArkOnJWsWyrvOQc+ADtY4AQdsVCtoDEFrfZRyGvJgIQE8n5GLj5 X-Received: by 2002:a17:906:6849:: with SMTP id a9mr17230269ejs.415.1623058501250; Mon, 07 Jun 2021 02:35:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623058501; cv=none; d=google.com; s=arc-20160816; b=rf8Wp2+vwwMN0XBo9UUW4H24N5j1nJSmVRd7e32q3EKqj/jkcgAnJbYTiWfD8wrINz qTtApIGCcoAqolyzbfMhIFC5hLLDKjFOEDc25Qyb+yXCC/SmzNdvPxlMye8ZRviaAp4R 5A47OdJb9kV0DH46XIO1K4SQ50ehfk7uDML6GH9PE3MqraRvQ6lY2/MSu9WXJe2WUDrQ 4Ny65H0RbafwP/g4O1prU9HSS5WrluCWEoJJviUQnSb1vCpT77x6VeKlk57y3RgKLn2a 3NICFZ4sXFnqvRhicazDLZlVdgPVACksSBUYRa0C6gllSXU3U3UmzMnWgtwfCYRRx1xU Dlzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=zQS0Y5nI4akdaFCLjifUmi2QCUcEevb4ByDmIkrj8kE=; b=0ZY/SDggcZsSdt0lMLZU6tcXKaLbd2sn4qnIqwBt8rALzjHpdikrnSYrxgRCboir70 GxlU5Bh3yBq8q+Mb3y+6X839CY51LAdAsrgG+R0Xalutj+2wXwbEMMjlH0pHKXsj55av Ttzf23dHFelTgkp5kMOsLof552FuBBCH52v4QlJIudtD3KrlEvLQqDevwMm0cXkKyYxb f2YnWDWH7PHrAAYtf/xAggvkx8TT16zSnFTpN1ki3JDqUIO0Pw0I1dQRxl6l1cFpdDUX UvFcDAvJfIUp3EofHYtFgTStd7+GpfTJeyK9b2j3cK/OLKYvC/9DQvW+AyyKWDLH+xsX 9b4g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v12si12128395ejb.163.2021.06.07.02.35.01 for ; Mon, 07 Jun 2021 02:35:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230355AbhFGJgH (ORCPT ); Mon, 7 Jun 2021 05:36:07 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3158 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230241AbhFGJgG (ORCPT ); Mon, 7 Jun 2021 05:36:06 -0400 Received: from fraeml734-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Fz7Ht4nRTz6G7h5; Mon, 7 Jun 2021 17:24:58 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml734-chm.china.huawei.com (10.206.15.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 7 Jun 2021 11:34:14 +0200 Received: from localhost.localdomain (10.69.192.58) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 7 Jun 2021 10:34:11 +0100 From: John Garry To: , CC: , , , Luo Jiaxing , John Garry Subject: [PATCH 1/5] scsi: hisi_sas: Put a limit of link reset retries Date: Mon, 7 Jun 2021 17:29:35 +0800 Message-ID: <1623058179-80434-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1623058179-80434-1-git-send-email-john.garry@huawei.com> References: <1623058179-80434-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Luo Jiaxing If an OOB event is received but the phy still fails to come up, a link reset will be issued repeatedly at an interval of 20s until the phy comes up. Set a limit for link reset issue retries to avoid printing the timeout message endlessly. Signed-off-by: Luo Jiaxing Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 1 + drivers/scsi/hisi_sas/hisi_sas_main.c | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) -- 2.26.2 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index cf879cc59e4c..8e36ede12cf1 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -185,6 +185,7 @@ struct hisi_sas_phy { enum sas_linkrate minimum_linkrate; enum sas_linkrate maximum_linkrate; int enable; + int wait_phyup_cnt; atomic_t down_cnt; /* Trace FIFO */ diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 5a204074099c..50420741fc81 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -857,6 +857,7 @@ static void hisi_sas_phyup_work(struct work_struct *work) struct asd_sas_phy *sas_phy = &phy->sas_phy; int phy_no = sas_phy->id; + phy->wait_phyup_cnt = 0; if (phy->identify.target_port_protocols == SAS_PROTOCOL_SSP) hisi_hba->hw->sl_notify_ssp(hisi_hba, phy_no); hisi_sas_bytes_dmaed(hisi_hba, phy_no, GFP_KERNEL); @@ -899,6 +900,8 @@ static void hisi_sas_wait_phyup_timedout(struct timer_list *t) hisi_sas_notify_phy_event(phy, HISI_PHYE_LINK_RESET); } +#define HISI_SAS_WAIT_PHYUP_RETRIES 10 + void hisi_sas_phy_oob_ready(struct hisi_hba *hisi_hba, int phy_no) { struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; @@ -909,8 +912,16 @@ void hisi_sas_phy_oob_ready(struct hisi_hba *hisi_hba, int phy_no) return; if (!timer_pending(&phy->timer)) { - phy->timer.expires = jiffies + HISI_SAS_WAIT_PHYUP_TIMEOUT * HZ; - add_timer(&phy->timer); + if (phy->wait_phyup_cnt < HISI_SAS_WAIT_PHYUP_RETRIES) { + phy->wait_phyup_cnt++; + phy->timer.expires = jiffies + + HISI_SAS_WAIT_PHYUP_TIMEOUT * HZ; + add_timer(&phy->timer); + } else { + dev_warn(dev, "phy%d failed to come up %d times, giving up\n", + phy_no, phy->wait_phyup_cnt); + phy->wait_phyup_cnt = 0; + } } } EXPORT_SYMBOL_GPL(hisi_sas_phy_oob_ready);