Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3540037imm; Fri, 19 Oct 2018 12:19:11 -0700 (PDT) X-Google-Smtp-Source: ACcGV62NKzkxRZmUJ2B0F3vVW7PyltJWzq5OCensVL4UMZXQEHmFZNPG0ObYK8m4Mu14yF4bNXsH X-Received: by 2002:a17:902:e28a:: with SMTP id cf10-v6mr35971052plb.81.1539976751920; Fri, 19 Oct 2018 12:19:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539976751; cv=none; d=google.com; s=arc-20160816; b=lN5f3wf99mCepjHN5YHiUKg4nXYZ+v1nRj7N9brXhxRkU/OReF7gZ2bkVZgyh/H9wU EeSl//L0HhETw1qpyzosGDwd8qMWP3XDD9sTV92KrG9yLTm2Uq9WStGe3LNQwouxcKaQ HlO2De8uFB7nRqA+pulcKoruLVoHBVIN7jC/tokDxWbxMw+rR9Kj5Jr7rmq6wwGaFWUw fKJkcaDTfVi45ekEHkQABeoxGOiwr0lwM18o0fbd7St0C6X2OSZANwGEg/3Tyz37trVP D0iWT4dh/UMAdZiroZ2qdQfDgkVG8KXO6Sjv8mMqA/qEV+tlaeJtCCPx38ZyFeyQek7F F/aw== 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 w18-v6si25788305pfg.70.2018.10.19.12.18.56; Fri, 19 Oct 2018 12:19:11 -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 S1728003AbeJTDYk (ORCPT + 99 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 Content-Type: text/plain 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(+) 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); -- 2.7.4