Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1552015rdh; Fri, 27 Oct 2023 20:03:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG3Chz+RTeaClM3m9pGurDjsAw2Gy/tMmbzs2aQeCo+kXiVzGfdUO8raGF4KoCigURbR2y3 X-Received: by 2002:a17:90a:be0e:b0:27d:2ce9:d6d5 with SMTP id a14-20020a17090abe0e00b0027d2ce9d6d5mr5610742pjs.12.1698462214918; Fri, 27 Oct 2023 20:03:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698462214; cv=none; d=google.com; s=arc-20160816; b=Hq8cHf92/dOQLGsrEpLdVSE4P/XG+rGmH86TBdY4b29MA+jXhzDrMnQUigh+ckDnBC p0fTVSAb1uaSzH3Jts8EZO1A8EKgf+XqT5dAyTQZYQ5U/AKBJ1QErJZPQoAhOvCrJvr6 IcLemAW/OPL8aEM4xtBVLXwyk04a5Brdfc4jsnm102D0LQNFfiANmszCOd+pDV9eB5// nTKX8YN5AAkgTiT31ENAmnLQdUk/OacNPWZsFkd7NX8nYwBpghxSZYx96gxEvlNgGk1F k2TM4rFoH2pjmPtKX3OU14BX+D7FgBvvWFpfYZS5xknuFdjbEDPsvG93alhZCffqGK4G LsEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=LaGujkp12D1PpXpAAudV6cE/2VZy+tkqMm13uwMNyWU=; fh=28Gsh8p/Rrgoh0ZJgxMb30MiNZzzGa/AucmCEg5DMJI=; b=etyetxAdG3RX9G9lSqI1/KDtsCBnD76k7cGSituKqIUEWIuSLQi7BSDRV5nBpS6jYB 1sHpqPpVI1RJbBR9ifldn7lk7c/3PMyR3/Av6iy4xwKalZfJVrhJgx6vc3WOZIbbvAgx hT2gtQCLxjc4jxuw4bpgH4BJ02Q7L1y/E5F/pYfVlbuHEKbk1h2RDmJryowgRbjzdyF9 mlnaQkgA4uJs8Kwhv/t5kB19WkAOL39CRAlfEVS9kzi0+6J3SqElz0R/powZcuTxyLDn d24vFf3gJlAnHdKNOsYXAkxdpNAMDwqUtw0sOfs0RXBy4mg6zywozSI0yFqDQOfJaPcT ygrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id g13-20020a17090ace8d00b0027d22503b9esi503627pju.84.2023.10.27.20.03.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 20:03:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id C026081F8537; Fri, 27 Oct 2023 20:03:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233135AbjJ1DDF (ORCPT + 99 others); Fri, 27 Oct 2023 23:03:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233155AbjJ1DCm (ORCPT ); Fri, 27 Oct 2023 23:02:42 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADB4211F; Fri, 27 Oct 2023 20:02:40 -0700 (PDT) Received: from kwepemm000007.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SHPN75JP2zpWWt; Sat, 28 Oct 2023 10:57:43 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) by kwepemm000007.china.huawei.com (7.193.23.189) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 28 Oct 2023 11:02:38 +0800 From: Jijie Shao To: , , , , , CC: , , , , , Subject: [PATCH net 6/7] net: hns3: fix VF reset fail issue Date: Sat, 28 Oct 2023 10:59:16 +0800 Message-ID: <20231028025917.314305-7-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20231028025917.314305-1-shaojijie@huawei.com> References: <20231028025917.314305-1-shaojijie@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm000007.china.huawei.com (7.193.23.189) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 27 Oct 2023 20:03:31 -0700 (PDT) Currently the reset process in hns3 and firmware watchdog init process is asynchronous. We think firmware watchdog initialization is completed before VF clear the interrupt source. However, firmware initialization may not complete early. So VF will receive multiple reset interrupts and fail to reset. So we add delay before VF interrupt source and 5 ms delay is enough to avoid second reset interrupt. Fixes: 427900d27d86 ("net: hns3: fix the timing issue of VF clearing interrupt sources") Signed-off-by: Jijie Shao --- .../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 1c62e58ff6d8..7b87da031be6 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -1924,8 +1924,14 @@ static void hclgevf_service_task(struct work_struct *work) hclgevf_mailbox_service_task(hdev); } -static void hclgevf_clear_event_cause(struct hclgevf_dev *hdev, u32 regclr) +static void hclgevf_clear_event_cause(struct hclgevf_dev *hdev, u32 regclr, + bool need_dalay) { +#define HCLGEVF_RESET_DELAY 5 + + if (need_dalay) + mdelay(HCLGEVF_RESET_DELAY); + hclgevf_write_dev(&hdev->hw, HCLGE_COMM_VECTOR0_CMDQ_SRC_REG, regclr); } @@ -1990,7 +1996,8 @@ static irqreturn_t hclgevf_misc_irq_handle(int irq, void *data) hclgevf_enable_vector(&hdev->misc_vector, false); event_cause = hclgevf_check_evt_cause(hdev, &clearval); if (event_cause != HCLGEVF_VECTOR0_EVENT_OTHER) - hclgevf_clear_event_cause(hdev, clearval); + hclgevf_clear_event_cause(hdev, clearval, + event_cause == HCLGEVF_VECTOR0_EVENT_RST); switch (event_cause) { case HCLGEVF_VECTOR0_EVENT_RST: @@ -2340,7 +2347,7 @@ static int hclgevf_misc_irq_init(struct hclgevf_dev *hdev) return ret; } - hclgevf_clear_event_cause(hdev, 0); + hclgevf_clear_event_cause(hdev, 0, false); /* enable misc. vector(vector 0) */ hclgevf_enable_vector(&hdev->misc_vector, true); -- 2.30.0