From 3eaf814c51f85aaad0d181d27ff686ce35b31d6a Mon Sep 17 00:00:00 2001 From: Kuiying Wang Date: Tue, 29 Oct 2019 11:28:29 +0800 Subject: [PATCH] Fix NCSI driver issue caused by host shutdown due to overheated. NCSI device cannot be recovered when host shutdown due to overheated. Tested: Heat host till shutdown due to overheated and then run the ipmi command like power status Signed-off-by: Kuiying Wang --- net/ncsi/ncsi-manage.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c index 70fe02697544..4e16a0015f26 100644 --- a/net/ncsi/ncsi-manage.c +++ b/net/ncsi/ncsi-manage.c @@ -132,18 +132,15 @@ static void ncsi_channel_monitor(struct timer_list *t) netdev_err(ndp->ndev.dev, "NCSI Channel %d timed out!\n", nc->id); ncsi_report_link(ndp, true); - ndp->flags |= NCSI_DEV_RESHUFFLE; ncsi_stop_channel_monitor(nc); - ncm = &nc->modes[NCSI_MODE_LINK]; spin_lock_irqsave(&nc->lock, flags); - nc->state = NCSI_CHANNEL_INVISIBLE; - ncm->data[2] &= ~0x1; + nc->state = NCSI_CHANNEL_INACTIVE; spin_unlock_irqrestore(&nc->lock, flags); spin_lock_irqsave(&ndp->lock, flags); - nc->state = NCSI_CHANNEL_ACTIVE; + ndp->flags |= NCSI_DEV_RESHUFFLE | NCSI_DEV_RESET; list_add_tail_rcu(&nc->link, &ndp->channel_queue); spin_unlock_irqrestore(&ndp->lock, flags); ncsi_process_next_channel(ndp); @@ -424,6 +421,7 @@ static void ncsi_request_timeout(struct timer_list *t) { struct ncsi_request *nr = from_timer(nr, t, timer); struct ncsi_dev_priv *ndp = nr->ndp; + struct ncsi_dev *nd = &ndp->ndev; struct ncsi_cmd_pkt *cmd; struct ncsi_package *np; struct ncsi_channel *nc; @@ -438,6 +436,16 @@ static void ncsi_request_timeout(struct timer_list *t) spin_unlock_irqrestore(&ndp->lock, flags); return; } + if (nd->state == ncsi_dev_state_suspend || + nd->state == ncsi_dev_state_suspend_select || + nd->state == ncsi_dev_state_suspend_gls || + nd->state == ncsi_dev_state_suspend_dcnt || + nd->state == ncsi_dev_state_suspend_dc || + nd->state == ncsi_dev_state_suspend_deselect || + nd->state == ncsi_dev_state_suspend_done) { + ndp->flags |= NCSI_DEV_RESET; + nd->state = ncsi_dev_state_suspend_done; + } spin_unlock_irqrestore(&ndp->lock, flags); if (nr->flags == NCSI_REQ_FLAG_NETLINK_DRIVEN) { -- 2.7.4