From patchwork Fri Oct 19 19:15:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 149347 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp3688147lji; Fri, 19 Oct 2018 12:17:18 -0700 (PDT) X-Google-Smtp-Source: ACcGV61O2M/gdPhQ1kdwRNgnGFclfhdxdimqczRWjqLNeaSO5iBU7oxwLA84/jFZF2+mIPz8fLb/ X-Received: by 2002:a17:902:5a0c:: with SMTP id q12-v6mr20345467pli.253.1539976638594; Fri, 19 Oct 2018 12:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539976638; cv=none; d=google.com; s=arc-20160816; b=tRn/jziVLlT0EQJlPD46bPjyqr3GQz25O6ar+GrFDgH0eFLbafA1ehbf+xG7+Fha9M /r6XNaQ1J/B9+hEoPTfnOHdNK02p3xTCSDUOP2my39Y0BCl2NExvg2aTODzW3+kMwYgY 0k05gUeZwmv5XPqiXThNt3DtX8mHU7JN8m8own0IoYqvycrcxpsQhltaP/PP6haLks+B tK3qQQF5EuXp6E5HIp/GtQrdyzm5mPVG0mTI1nXaosfT7CjG5UGUXGWkV5jKkhtAZBwv ZcRNWXlwaFUFKLNUAZV6ocFw0qn3Is9q43+VKpvqy0u5mNvMI0ys7D122uHrzVsIv7ta V2HQ== 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=Z2LFVhoac3G+m5Z0CbYOgDcoqum2E7dPEzNvyQtK4/c=; b=azhFxSzrwy520eDF6fROvfa2cTc0KR+4+nhltSAf2d7HKiEcwBBdW0SWS6yPqEOxIl /MYapoGW5DTDoWB/T1DdDVoulSkpjN9xaTHfbhgR8thf+sEQLh8yhCJ9ZxLcfMYnpnq+ Z9+7+ygp+c1NBaM+Zsz5Q5Hvjm76nGoQCrSO88X5n0eODoAO0VdGwYn0C7BPAPSuoWFw 8xzDAqgs4usJq5SpkKc3/6tieqHEJJnvh1htE8xW17RDmUDGHsDFnhJU1djzTQgC8Bkg CbCawJIG0MyAU4uL+O3/NfD83XFZF84OIUXXHnPYB6Sw6s9iOofnIHqkArVCpclEkDPO OERw== 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 n25-v6si25149669pgl.508.2018.10.19.12.17.18; Fri, 19 Oct 2018 12:17:18 -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 S1728007AbeJTDYk (ORCPT + 32 others); Fri, 19 Oct 2018 23:24:40 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:45804 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727680AbeJTDYj (ORCPT ); Fri, 19 Oct 2018 23:24:39 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 329A578EB2AF8; Sat, 20 Oct 2018 03:17:12 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Sat, 20 Oct 2018 03:17:03 +0800 From: Salil Mehta To: CC: , , , , , , , Shiju Jose Subject: [PATCH net-next 3/7] net: hns3: Add support to enable and disable hw errors Date: Fri, 19 Oct 2018 20:15:28 +0100 Message-ID: <20181019191532.10088-4-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20181019191532.10088-1-salil.mehta@huawei.com> References: <20181019191532.10088-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shiju Jose This patch adds functions to enable and disable hw errors. Signed-off-by: Shiju Jose Signed-off-by: Salil Mehta --- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c | 22 ++++++++++++++++++++++ .../net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h | 2 ++ .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 8 ++++++++ 3 files changed, 32 insertions(+) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c index 83aca6f..d2640d1 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c @@ -7,6 +7,28 @@ static const struct hclge_hw_blk hw_blk[] = { { /* sentinel */ } }; +int hclge_hw_error_set_state(struct hclge_dev *hdev, bool state) +{ + struct device *dev = &hdev->pdev->dev; + int ret = 0; + int i = 0; + + while (hw_blk[i].name) { + if (!hw_blk[i].enable_error) { + i++; + continue; + } + ret = hw_blk[i].enable_error(hdev, state); + if (ret) { + dev_err(dev, "fail(%d) to en/disable err int\n", ret); + return ret; + } + i++; + } + + return ret; +} + pci_ers_result_t hclge_process_ras_hw_error(struct hnae3_ae_dev *ae_dev) { struct hclge_dev *hdev = ae_dev->priv; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h index ea1637c..373e9bf 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h @@ -21,9 +21,11 @@ enum hclge_err_int_type { struct hclge_hw_blk { u32 msk; const char *name; + int (*enable_error)(struct hclge_dev *hdev, bool en); void (*process_error)(struct hclge_dev *hdev, enum hclge_err_int_type type); }; +int hclge_hw_error_set_state(struct hclge_dev *hdev, bool state); pci_ers_result_t hclge_process_ras_hw_error(struct hnae3_ae_dev *ae_dev); #endif diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 5075365..082ea97 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -6759,6 +6759,13 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev) goto err_mdiobus_unreg; } + ret = hclge_hw_error_set_state(hdev, true); + if (ret) { + dev_err(&pdev->dev, + "hw error interrupts enable failed, ret =%d\n", ret); + goto err_mdiobus_unreg; + } + hclge_dcb_ops_set(hdev); timer_setup(&hdev->service_timer, hclge_service_timer, 0); @@ -6896,6 +6903,7 @@ static void hclge_uninit_ae_dev(struct hnae3_ae_dev *ae_dev) hclge_enable_vector(&hdev->misc_vector, false); synchronize_irq(hdev->misc_vector.vector_irq); + hclge_hw_error_set_state(hdev, false); hclge_destroy_cmd_queue(&hdev->hw); hclge_misc_irq_uninit(hdev); hclge_pci_uninit(hdev);