Commit 366da0da authored by Luo Jiaxing's avatar Luo Jiaxing Committed by Martin K. Petersen

scsi: hisi_sas: Put a limit of link reset retries

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.

Link: https://lore.kernel.org/r/1623058179-80434-2-git-send-email-john.garry@huawei.comSigned-off-by: default avatarLuo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent d1f2ce77
...@@ -185,6 +185,7 @@ struct hisi_sas_phy { ...@@ -185,6 +185,7 @@ struct hisi_sas_phy {
enum sas_linkrate minimum_linkrate; enum sas_linkrate minimum_linkrate;
enum sas_linkrate maximum_linkrate; enum sas_linkrate maximum_linkrate;
int enable; int enable;
int wait_phyup_cnt;
atomic_t down_cnt; atomic_t down_cnt;
/* Trace FIFO */ /* Trace FIFO */
......
...@@ -857,6 +857,7 @@ static void hisi_sas_phyup_work(struct work_struct *work) ...@@ -857,6 +857,7 @@ static void hisi_sas_phyup_work(struct work_struct *work)
struct asd_sas_phy *sas_phy = &phy->sas_phy; struct asd_sas_phy *sas_phy = &phy->sas_phy;
int phy_no = sas_phy->id; int phy_no = sas_phy->id;
phy->wait_phyup_cnt = 0;
if (phy->identify.target_port_protocols == SAS_PROTOCOL_SSP) if (phy->identify.target_port_protocols == SAS_PROTOCOL_SSP)
hisi_hba->hw->sl_notify_ssp(hisi_hba, phy_no); hisi_hba->hw->sl_notify_ssp(hisi_hba, phy_no);
hisi_sas_bytes_dmaed(hisi_hba, phy_no, GFP_KERNEL); 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) ...@@ -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); 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) void hisi_sas_phy_oob_ready(struct hisi_hba *hisi_hba, int phy_no)
{ {
struct hisi_sas_phy *phy = &hisi_hba->phy[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) ...@@ -909,8 +912,16 @@ void hisi_sas_phy_oob_ready(struct hisi_hba *hisi_hba, int phy_no)
return; return;
if (!timer_pending(&phy->timer)) { if (!timer_pending(&phy->timer)) {
phy->timer.expires = jiffies + HISI_SAS_WAIT_PHYUP_TIMEOUT * HZ; if (phy->wait_phyup_cnt < HISI_SAS_WAIT_PHYUP_RETRIES) {
add_timer(&phy->timer); 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); EXPORT_SYMBOL_GPL(hisi_sas_phy_oob_ready);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment